上传组件优化

This commit is contained in:
‘huanghaiixia’
2025-12-18 10:03:25 +08:00
parent 21a8fae538
commit fa88795dbd
3 changed files with 17 additions and 10 deletions

View File

@ -225,7 +225,8 @@ import { methodOf } from 'lodash-es';
}
},
{
immediate: true
immediate: true,
deep: true,
}
);

View File

@ -2,7 +2,7 @@
<div>
<Upload v-if="!disabled" style="margin-bottom: 10px;" :file-list="dataFile" :showUploadList="false"
v-model:value="tableId" v-model:tableName="tableName" v-model:columnName="columnName"
:btnTip="btnTip" @change="changeUplod" :multiple="true" :dataDelete="true"
:btnTip="btnTip" @change="changeUpload" :multiple="true" :dataDelete="true"
:showDownloadIcon="false"/>
<a-table :columns="columns" :data-source="dataFile" >
<template #bodyCell="{ column,record,index, text }">
@ -62,10 +62,10 @@
default: '上传'
},
tip: String,
fileList: Array,
list: Array,
});
const emit = defineEmits(['update:value', 'change', 'click', 'update:tableName', 'update:columnName']);
function changeUplod (val) {
function changeUpload (val) {
dataFile.value = []
val.forEach(v => {
v.fileOrg = v.fileOrg || v.fileName,
@ -73,6 +73,7 @@
v.fileSize = v.fileSize
dataFile.value.push(v)
})
emit('change', dataFile.value);
console.log(val, 532, dataFile.value)
}
const handleDownload = (info) => {
@ -96,6 +97,7 @@
}
dataFile.value[index] = dataFile.value.splice(index+1, 1, dataFile.value[index])[0];
}
emit('change', dataFile.value);
}
const getFileList = () => {
@ -110,11 +112,12 @@
}
},
{
immediate: true
immediate: true,
deep: true,
}
);
watch(
() => props.fileList,
() => props.list,
async (val) => {
dataFile.value = val || []
tableId.value = props.value
@ -122,7 +125,8 @@
columnName.value = props.columnName
},
{
immediate: true
immediate: true,
deep: true,
}
);
defineExpose({