mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-14 19:52:48 +00:00
Update attachment.vue
This commit is contained in:
parent
93d0a89a20
commit
899f6243ef
@ -126,7 +126,7 @@
|
||||
</div>
|
||||
<div class="flex absolute top-0 left-0 right-0 bottom-0 items-center justify-center" v-else>
|
||||
<div class="flex flex-col items-center" v-if="!attachment.loading">
|
||||
<img src="@/app/assets/images/no_attachment.png" class="max-w-[130px] max-h-[130px] mb-[15px]">
|
||||
<img src="@/app/assets/images/no_attachment.png" class="max-w-[160px] max-h-[120px] mb-[15px]">
|
||||
<span class="text-[var(--el-text-color-secondary)] text-[14px]">{{type == 'icon' ? t('upload.iconEmpty') : t('upload.attachmentEmpty')}}</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -198,9 +198,13 @@ import {
|
||||
} from '@/app/api/sys'
|
||||
import { debounce, img, getToken } from '@/utils/common'
|
||||
import { ElMessage, UploadFile, UploadFiles, ElMessageBox, MessageParams } from 'element-plus'
|
||||
import storage from '@/utils/storage'
|
||||
|
||||
const attachmentCategoryName = ref('')
|
||||
const operate = ref(false)
|
||||
|
||||
const repeat = ref(false)
|
||||
|
||||
const prop = defineProps({
|
||||
// 选择数量限制
|
||||
limit: {
|
||||
@ -260,7 +264,6 @@ const attachmentParam = reactive({
|
||||
* 查询分组
|
||||
*/
|
||||
const getAttachmentCategoryList = debounce(() => {
|
||||
|
||||
const getFn = prop.type == 'icon' ? getIconCategoryList : attachmentCategoryList
|
||||
getFn({
|
||||
type: prop.type,
|
||||
@ -303,6 +306,7 @@ const getAttachmentList = debounce((page: number = 1) => {
|
||||
attachment.loading = false
|
||||
})
|
||||
})
|
||||
|
||||
getAttachmentList()
|
||||
|
||||
watch(() => attachmentParam.cate_id, () => {
|
||||
@ -313,14 +317,18 @@ watch(() => attachmentParam.cate_id, () => {
|
||||
* 添加分组
|
||||
*/
|
||||
const addAttachmentCategory = (name: string) => {
|
||||
if (repeat.value) return
|
||||
repeat.value = true
|
||||
|
||||
addCategory({
|
||||
type: prop.type,
|
||||
name
|
||||
}).then(res => {
|
||||
repeat.value = false
|
||||
attachmentCategoryName.value = ''
|
||||
getAttachmentCategoryList(1)
|
||||
}).catch(() => {
|
||||
|
||||
repeat.value = false
|
||||
})
|
||||
}
|
||||
|
||||
@ -330,13 +338,16 @@ const addAttachmentCategory = (name: string) => {
|
||||
* @param index
|
||||
*/
|
||||
const updateAttachmentCategory = (name: string, index: number) => {
|
||||
if (repeat.value) return
|
||||
repeat.value = true
|
||||
updateCategory({
|
||||
id: attachmentCategory.data[index].id,
|
||||
name
|
||||
}).then(res => {
|
||||
repeat.value = false
|
||||
attachmentCategory.data[index].name = name
|
||||
}).catch(() => {
|
||||
|
||||
repeat.value = false
|
||||
})
|
||||
}
|
||||
|
||||
@ -344,6 +355,8 @@ const updateAttachmentCategory = (name: string, index: number) => {
|
||||
* 删除分组
|
||||
*/
|
||||
const deleteAttachmentCategory = (index: number) => {
|
||||
if (repeat.value) return
|
||||
repeat.value = true
|
||||
ElMessageBox.confirm(t('upload.deleteCategoryTips'), t('warning'),
|
||||
{
|
||||
confirmButtonText: t('confirm'),
|
||||
@ -353,7 +366,9 @@ const deleteAttachmentCategory = (index: number) => {
|
||||
).then(() => {
|
||||
deleteCategory(attachmentCategory.data[index].id).then(() => {
|
||||
attachmentCategory.data.splice(index, 1)
|
||||
repeat.value = false
|
||||
}).catch(() => {
|
||||
repeat.value = false
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -384,7 +399,7 @@ const upload = computed(() => {
|
||||
clearTimeout(time.value)
|
||||
time.value=null
|
||||
},500)
|
||||
|
||||
|
||||
}else{
|
||||
clearTimeout(time.value)
|
||||
time.value=null
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user