客户表单附件

This commit is contained in:
‘huanghaiixia’
2025-12-01 16:55:28 +08:00
parent b1cd0a5168
commit 3232319675
6 changed files with 85 additions and 86 deletions

View File

@ -1,25 +1,6 @@
<template>
<a-spin :spinning="spinning" tip="加载中...">
<div class="page-bg-wrap">
<!-- <div class="top-toolbar" id="formViewPage">
<a-space :size="10" wrap style="gap: 0">
<a-button style="margin-right: 10px" @click="close">
<slot name="icon"><close-outlined /></slot>取消
</a-button>
<a-button style="margin-right: 10px" @click="handleSubmit('save')">
<slot name="icon"><save-outlined /></slot>保存
</a-button>
<a-button style="margin-right: 10px" type="primary" @click="handleSubmit('submit')">
<slot name="icon"><check-circle-outlined /></slot>保存并提交
</a-button>
<a-button style="margin-right: 10px" >
<slot name="icon"><download-outlined /></slot>下载模板
</a-button>
<a-button >
<slot name="icon"><upload-outlined /></slot>导入
</a-button>
</a-space>
</div> -->
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
<a-card title="客户基本信息" :bordered="false" >
<div>
@ -314,7 +295,7 @@
<a-table :columns="columnsFile" :data-source="dataFile" >
<template #bodyCell="{ column,record,index, text }">
<template v-if="column.dataIndex === 'fileOrg'">
<a :href="record.filePath" :download="record.fileOrg" target="_blank">{{record.fileOrg}}</a>
<a :href="record.presignedUrl||record.filePath" :download="record.fileOrg" target="_blank">{{record.fileOrg}}</a>
</template>
<template v-if="column.dataIndex === 'docDesc' && !isDisable">
<a-input :placeholder="t('请输入附件说明')" :disabled="isDisable" v-model:value="record.docDesc" />
@ -653,7 +634,6 @@
if (info.file.status === 'done') {
if (info.file && info.file.response && info.file.response.code == 0) {
message.success(t(`{name}上传成功!`, { name: info.file.name }));
console.log(info, t('上传成功'));
// 存储原始URL到info.fileUrl用于提交改了
data.info.fileUrl = info.file.response.data.fileUrl;
data.fileName = info.file.response.data.fileName;
@ -664,6 +644,7 @@
let obj = {
fileOrg: data.fileName,
filePath: data.photoUrl,
filesize: info?.file?.response?.data?.fileSize
}
dataFile.push(obj)
@ -709,26 +690,30 @@
let obj = {
...formState,
lngCustomerBankList: dataBank,
lngCustomerDocList: dataCertificate,
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'): ''
}
}),
lngCustomerContactList: dataContact,
lngFileUploadList: dataFile
}
spinning.value = true;
let request = pageType.value === 'add' ? addLngCustomer :updateLngCustomer
let request = !formState.id ? addLngCustomer :updateLngCustomer
try {
obj.lngCustomerDocList.forEach(v => {
v.dateFrom = dayjs(v.dateFrom ).valueOf()
v.dateTo = dayjs(v.dateTo ).valueOf()
})
const data = await addLngCustomer(obj);
// notification.success({
// message: 'Tip',
// description: pageType.value === 'add' ? t('新增成功!') : t('修改成功!')
// }); //提示消息
const data = await request(obj);
if (type) {
data?.id && (formState.id = data.id)
data?.cuCode && (formState.cuCode = data.cuCode)
notification.success({
message: 'Tip',
description: !data?.id ? t('新增成功!') : t('修改成功!')
}); //提示消息
}
// formRef.value.resetFields();
return data
// setTimeout(() => {
@ -751,33 +736,6 @@
}
}
async function saveModal() {
let saveSuccess = false;
const _mode = mode.value;
try {
await formRef.value?.validate();
const values = (formRef.value?.getFormModal && formRef.value.getFormModal()) || (await formRef.value?.validate());
//添加隐藏组件
if (formProps.hiddenComponent?.length) {
formProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
if (values !== false) {
try {
if (_mode === 'create') {
saveSuccess = await formRef.value.add(values);
} else {
saveSuccess = await formRef.value.update({ values, rowId: formId.value });
}
return saveSuccess;
} catch (error) {}
}
} catch (error) {
console.error('saveModal Error: ', error);
}
}
defineExpose({
handleSubmit,
getFormValue