update:上传控件移到cid顶部
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user