update:上传控件移到cid顶部

This commit is contained in:
2026-03-31 14:50:55 +08:00
parent 5d6efe15e2
commit 87b5cc1291
2 changed files with 51 additions and 6 deletions

View File

@@ -33,7 +33,7 @@ import MachineIcon from '@/assets/imgs/fileIcon/machine-s.png';
interface Props {
fileName: string;
fileType?: string;
dataType?: string;
dataType?: any;
size?: number;
folderOpen?: boolean;
}

View File

@@ -1,6 +1,6 @@
<template>
<div class="comp-upload-list">
<div ref="dragRef" class="btn" @click="openFun" @mousedown="startDragFun">
<div v-show="false" ref="dragRef" class="btn" @click="openFun" @mousedown="startDragFun">
<el-icon :class="{ 'icon-animation': uploading }" :size="22"><Upload /></el-icon>
</div>
<el-drawer
@@ -99,19 +99,39 @@ emitter.on('ADD_UPLOAD_FILE', (addData: any) => {
taskStatusObj[data.uploadTaskId][data.businessId] = data.status;
initFun(addData);
if (!userCloseFlag.value) {
listVisible.value = true;
$wujie.bus.$emit('OPEN_UPLOAD_LIST');
// listVisible.value = true;
}
}
});
$wujie.bus.$on('UPLOAD_LIST_DATA_EMPTY', () => {
emptyFun();
});
$wujie.bus.$on('UPLOAD_LIST_DATA_REMOVE', (index: any) => {
removeFun(index);
});
onMounted(() => {
initDragFun();
});
watch(
() => listData.value,
() => {
$wujie.bus.$emit('UPLOAD_LIST_DATA_CHANGE', listData.value);
(val: any) => {
const fileListData = val.map((item: any) => {
return {
data: {
...item.data,
},
file: {
name: item.file.name,
size: item.file.size,
},
};
});
$wujie.bus.$emit('UPLOAD_LIST_DATA_CHANGE', fileListData);
},
{ deep: true }
);
@@ -238,11 +258,36 @@ const openFun = () => {
};
const emptyFun = () => {
const removeIds: any = [];
listData.value.forEach((item: any) => {
if (item.data.status !== '2') {
removeIds.push(item.data.businessId);
}
});
stopUploadFun(removeIds);
listData.value = [];
};
const removeFun = (index: any) => {
listData.value.splice(index, 1);
const removeList = listData.value.splice(index, 1) || [];
const removeData = removeList[0];
if (removeData.data.status !== '2') {
stopUploadFun([removeData.data.businessId]);
}
};
const stopUploadFun = (ids: any) => {
if (ids.length === 0) {
return;
}
const params = {
failBusinessIds: ids,
};
chunkUploadCallbackApi(params).then((res: any) => {
if (res.code === 200) {
ElMessage.success('取消上传');
}
});
};
const startDragFun = (e: any) => {