上传组件优化
This commit is contained in:
@ -225,7 +225,8 @@ import { methodOf } from 'lodash-es';
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@ -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({
|
||||
|
||||
@ -284,7 +284,7 @@
|
||||
<span style="font-size: 12px;font-weight: normal;">(上传公司财报等附件)</span>
|
||||
</div>
|
||||
</template>
|
||||
<UploadList ref="uploadFile" :disabled="isDisable" :file-list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName"/>
|
||||
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
|
||||
</a-card>
|
||||
</a-form>
|
||||
</div>
|
||||
@ -455,6 +455,9 @@
|
||||
}
|
||||
|
||||
});
|
||||
const uploadListChange = (val) => {
|
||||
dataFile.value = val
|
||||
}
|
||||
async function getList(id) {
|
||||
spinning.value = true
|
||||
try {
|
||||
@ -617,13 +620,12 @@
|
||||
v.dateFrom = v.dateFrom ? dayjs(v.dateFrom ).format('YYYY-MM-DD HH:mm:ss') : '';
|
||||
v.dateTo = v.dateTo ? dayjs(v.dateTo ).format('YYYY-MM-DD HH:mm:ss'): '';
|
||||
})
|
||||
let file = await uploadFile.value.getFileList()
|
||||
let obj = {
|
||||
...formState,
|
||||
lngCustomerBankList: dataBank,
|
||||
lngCustomerDocList: arrCertificate,
|
||||
lngCustomerContactList: dataContact,
|
||||
lngFileUploadList: file
|
||||
lngFileUploadList: dataFile.value
|
||||
|
||||
}
|
||||
spinning.value = true;
|
||||
|
||||
Reference in New Issue
Block a user