上传组件

This commit is contained in:
‘huanghaiixia’
2025-12-09 17:13:57 +08:00
parent c44db962c3
commit 9b43f5ed55
8 changed files with 142 additions and 43 deletions

View File

@ -284,11 +284,15 @@
<span style="font-size: 12px;font-weight: normal;">上传公司财报等附件</span>
</div>
</template>
<UploadNew v-if="!isDisable" style="margin-bottom: 10px;" :file-list="dataFile" :showUploadList="false" :btnTip="btnTip" @change="changeUplod" :multiple="true"/>
<Upload v-if="!isDisable" style="margin-bottom: 10px;" :file-list="dataFile" :showUploadList="false"
v-model:value="formState.filePath" v-model:tableName="tableName" v-model:columnName="columnName"
:btnTip="btnTip" @change="changeUplod" :multiple="true" :dataDelete="true"
:showDownloadIcon="false"
/>
<a-table :columns="columnsFile" :data-source="dataFile" >
<template #bodyCell="{ column,record,index, text }">
<template v-if="column.dataIndex === 'fileOrg'">
<a :href="record.presignedUrl||record.filePath" :download="record.fileOrg" target="_blank">{{record.fileOrg}}</a>
<a @click="handleDownload(record)">{{record.fileOrg}}</a>
</template>
<template v-if="column.dataIndex === 'docDesc' && !isDisable">
<a-input :placeholder="t('请输入附件说明')" :disabled="isDisable" v-model:value="record.docDesc" />
@ -328,7 +332,12 @@
import dayjs from 'dayjs';
import { getAppEnvConfig } from '/@/utils/env';
import { message } from 'ant-design-vue';
import UploadNew from '/@/components/Form/src/components/UploadNew.vue';
import Upload from '/@/components/Form/src/components/Upload.vue';
import { parseDownloadUrl} from '/@/api/system/file';
import { downloadByUrl } from '/@/utils/file/download';
const tableName = '1';
const columnName = '1'
const formType = ref('2'); // 0 新建 1 修改 2 查看
const formRef = ref();
@ -474,6 +483,11 @@
}
});
const handleDownload = (info) => {
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
downloadByUrl({ url, fileName: fileName});
};
async function getList(id) {
spinning.value = true
try {
@ -535,6 +549,7 @@
if (type == 'certificate') {
if (btn == 'edit' || btn == 'view') {
openModalCertificate(true, {record: record,isUpdate: true, btnType: btn, list: dataCertificate});
console.log(record, 'record', dataCertificate)
}
if (btn == 'delete') {
dataCertificate.splice(index, 1)
@ -602,6 +617,7 @@
if (idx <0) {
dataCertificate.push(val)
}
console.log(dataCertificate, 'dataCertificate')
}
const handleSuccessContact = (val)=> {
if (curIdx.value != null) {
@ -657,20 +673,27 @@
})
return
}
let arrCertificate = JSON.parse(JSON.stringify(dataCertificate))
arrCertificate.forEach(v => {
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'): '';
(v.fileList || []).forEach(i => {
i.id = ''
})
})
let arrUploadList = JSON.parse(JSON.stringify(dataFile.value))
arrUploadList.forEach(v => {
v.id= ''
})
let obj = {
...formState,
lngCustomerBankList: dataBank,
lngCustomerDocList: dataCertificate.map(v =>{
return {
...v,
dateFrom: v.dateFrom ? dayjs(v.dateFrom ).format('YYYY-MM-DD HH:mm:ss') : '',
dateTo: v.dateTo ? dayjs(v.dateTo ).format('YYYY-MM-DD HH:mm:ss'): ''
}
}),
lngCustomerDocList: arrCertificate,
lngCustomerContactList: dataContact,
lngFileUploadList: dataFile.value
lngFileUploadList: arrUploadList
}
console.log(arrCertificate, 'arrCertificate')
spinning.value = true;
let request = !formState.id ? addLngCustomer :updateLngCustomer