客户表单附件
This commit is contained in:
@ -69,9 +69,9 @@
|
|||||||
<upload-outlined />
|
<upload-outlined />
|
||||||
点击上传
|
点击上传
|
||||||
</a-button>
|
</a-button>
|
||||||
<div v-if="VITE_GLOB_UPLOAD_ALERT_TIP?.trim()" style="color: red; margin-top: 8px">
|
<!-- <div v-if="VITE_GLOB_UPLOAD_ALERT_TIP?.trim()" style="color: red; margin-top: 8px">
|
||||||
{{ VITE_GLOB_UPLOAD_ALERT_TIP }}
|
{{ VITE_GLOB_UPLOAD_ALERT_TIP }}
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template #itemRender="{ file, actions }">
|
<template #itemRender="{ file, actions }">
|
||||||
@ -213,10 +213,11 @@
|
|||||||
x.status = 'done'; //没有则不会展示下载按钮
|
x.status = 'done'; //没有则不会展示下载按钮
|
||||||
x.url = x.fileUrl;
|
x.url = x.fileUrl;
|
||||||
x.thumbUrl = x.thUrl;
|
x.thumbUrl = x.thUrl;
|
||||||
|
x.fileSize = x.fileSize
|
||||||
});
|
});
|
||||||
|
|
||||||
emit('update:value', folderId.value);
|
emit('update:value', folderId.value);
|
||||||
emit('change');
|
emit('change', fileList.value);
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -379,6 +380,12 @@
|
|||||||
downloadByUrl({ url: res.url, fileName: res.name || 'files.zip' });
|
downloadByUrl({ url: res.url, fileName: res.name || 'files.zip' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function getValue () {
|
||||||
|
return fileList.value
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
getValue
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.list-upload {
|
.list-upload {
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item label="上传附件" name="fileList" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }">
|
<a-form-item label="上传附件" name="fileList" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }">
|
||||||
<Upload v-model:value="formState.filePath" @change="changeUplod" :multiple="true" :maxSize="200" :accept="accept"></Upload>
|
<Upload v-model:value="formState.filePath" @change="changeUplod" ref="uploadRef" :multiple="true" :maxSize="200" :accept="accept"></Upload>
|
||||||
<div style="color: #ccc; font-size: 12px">{{ fileTip }}</div>
|
<div style="color: #ccc; font-size: 12px">{{ fileTip }}</div>
|
||||||
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@ -49,12 +49,12 @@ import Upload from '/@/components/Form/src/components/Upload.vue';
|
|||||||
import { getDocCpList } from '/@/api/sales/Customer';
|
import { getDocCpList } from '/@/api/sales/Customer';
|
||||||
import type { FormInstance } from 'ant-design-vue';
|
import type { FormInstance } from 'ant-design-vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { object } from 'vue-types';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const isUpdate = ref(true);
|
const isUpdate = ref(true);
|
||||||
const isDisable = ref(false);
|
const isDisable = ref(false);
|
||||||
let optionList = reactive([])
|
let optionList = reactive([])
|
||||||
|
const uploadRef = ref()
|
||||||
const fileTip = '支持格式.rar .zip .doc .docx .pdf ,单个文件不能超过20MB';
|
const fileTip = '支持格式.rar .zip .doc .docx .pdf ,单个文件不能超过20MB';
|
||||||
const accept ='.rar,.zip, .doc, .docx, .pdf, .RAR, .ZIP, .DOC, .DOCX, .PDF'
|
const accept ='.rar,.zip, .doc, .docx, .pdf, .RAR, .ZIP, .DOC, .DOCX, .PDF'
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
@ -98,12 +98,9 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
|
|||||||
}
|
}
|
||||||
return endValue.valueOf() <= startValue.valueOf();
|
return endValue.valueOf() <= startValue.valueOf();
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleChangeFile = (val) => {
|
|
||||||
|
|
||||||
}
|
|
||||||
function changeUplod (val) {
|
function changeUplod (val) {
|
||||||
console.log(val, 532)
|
formState.fileList = val
|
||||||
|
console.log(val, 532, formState.filePath)
|
||||||
}
|
}
|
||||||
async function getOption() {
|
async function getOption() {
|
||||||
optionList = await getDocCpList({'valid': 'Y'})
|
optionList = await getDocCpList({'valid': 'Y'})
|
||||||
@ -115,13 +112,21 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
|
|||||||
try {
|
try {
|
||||||
await formRef.value.validate();
|
await formRef.value.validate();
|
||||||
// 验证通过,提交表单
|
// 验证通过,提交表单
|
||||||
|
let arr = uploadRef.value.getValue() || []
|
||||||
let obj = {
|
let obj = {
|
||||||
...formState,
|
...formState,
|
||||||
dateFrom: formState.dateFrom ? dayjs(formState.dateFrom).format('YYYY-MM-DD') : '',
|
dateFrom: formState.dateFrom ? dayjs(formState.dateFrom).format('YYYY-MM-DD') : '',
|
||||||
dateTo: formState.dateTo ? dayjs(formState.dateTo).format('YYYY-MM-DD') : '',
|
dateTo: formState.dateTo ? dayjs(formState.dateTo).format('YYYY-MM-DD') : '',
|
||||||
|
fileList: arr.map(v => {
|
||||||
|
return {
|
||||||
|
fileOrg: v.name,
|
||||||
|
filePath: v.url,
|
||||||
|
filesize: v.fileSize
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
console.log(obj,543)
|
console.log(obj,543, uploadRef.value.getValue())
|
||||||
|
formState.filePath = ''
|
||||||
emit('success', obj);
|
emit('success', obj);
|
||||||
notification.success({
|
notification.success({
|
||||||
message: t('操作'),
|
message: t('操作'),
|
||||||
|
|||||||
@ -1,25 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-spin :spinning="spinning" tip="加载中...">
|
<a-spin :spinning="spinning" tip="加载中...">
|
||||||
<div class="page-bg-wrap">
|
<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-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
|
||||||
<a-card title="客户基本信息" :bordered="false" >
|
<a-card title="客户基本信息" :bordered="false" >
|
||||||
<div>
|
<div>
|
||||||
@ -314,7 +295,7 @@
|
|||||||
<a-table :columns="columnsFile" :data-source="dataFile" >
|
<a-table :columns="columnsFile" :data-source="dataFile" >
|
||||||
<template #bodyCell="{ column,record,index, text }">
|
<template #bodyCell="{ column,record,index, text }">
|
||||||
<template v-if="column.dataIndex === 'fileOrg'">
|
<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>
|
||||||
<template v-if="column.dataIndex === 'docDesc' && !isDisable">
|
<template v-if="column.dataIndex === 'docDesc' && !isDisable">
|
||||||
<a-input :placeholder="t('请输入附件说明')" :disabled="isDisable" v-model:value="record.docDesc" />
|
<a-input :placeholder="t('请输入附件说明')" :disabled="isDisable" v-model:value="record.docDesc" />
|
||||||
@ -653,7 +634,6 @@
|
|||||||
if (info.file.status === 'done') {
|
if (info.file.status === 'done') {
|
||||||
if (info.file && info.file.response && info.file.response.code == 0) {
|
if (info.file && info.file.response && info.file.response.code == 0) {
|
||||||
message.success(t(`{name}上传成功!`, { name: info.file.name }));
|
message.success(t(`{name}上传成功!`, { name: info.file.name }));
|
||||||
console.log(info, t('上传成功'));
|
|
||||||
// 存储原始URL到info.fileUrl(用于提交)(改了)
|
// 存储原始URL到info.fileUrl(用于提交)(改了)
|
||||||
data.info.fileUrl = info.file.response.data.fileUrl;
|
data.info.fileUrl = info.file.response.data.fileUrl;
|
||||||
data.fileName = info.file.response.data.fileName;
|
data.fileName = info.file.response.data.fileName;
|
||||||
@ -664,6 +644,7 @@
|
|||||||
let obj = {
|
let obj = {
|
||||||
fileOrg: data.fileName,
|
fileOrg: data.fileName,
|
||||||
filePath: data.photoUrl,
|
filePath: data.photoUrl,
|
||||||
|
filesize: info?.file?.response?.data?.fileSize
|
||||||
}
|
}
|
||||||
dataFile.push(obj)
|
dataFile.push(obj)
|
||||||
|
|
||||||
@ -709,26 +690,30 @@
|
|||||||
let obj = {
|
let obj = {
|
||||||
...formState,
|
...formState,
|
||||||
lngCustomerBankList: dataBank,
|
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,
|
lngCustomerContactList: dataContact,
|
||||||
lngFileUploadList: dataFile
|
lngFileUploadList: dataFile
|
||||||
|
|
||||||
}
|
}
|
||||||
spinning.value = true;
|
spinning.value = true;
|
||||||
let request = pageType.value === 'add' ? addLngCustomer :updateLngCustomer
|
let request = !formState.id ? addLngCustomer :updateLngCustomer
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
obj.lngCustomerDocList.forEach(v => {
|
const data = await request(obj);
|
||||||
v.dateFrom = dayjs(v.dateFrom ).valueOf()
|
if (type) {
|
||||||
v.dateTo = dayjs(v.dateTo ).valueOf()
|
data?.id && (formState.id = data.id)
|
||||||
})
|
data?.cuCode && (formState.cuCode = data.cuCode)
|
||||||
const data = await addLngCustomer(obj);
|
notification.success({
|
||||||
|
message: 'Tip',
|
||||||
// notification.success({
|
description: !data?.id ? t('新增成功!') : t('修改成功!')
|
||||||
// message: 'Tip',
|
}); //提示消息
|
||||||
// description: pageType.value === 'add' ? t('新增成功!') : t('修改成功!')
|
}
|
||||||
// }); //提示消息
|
|
||||||
// formRef.value.resetFields();
|
// formRef.value.resetFields();
|
||||||
return data
|
return data
|
||||||
// setTimeout(() => {
|
// 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({
|
defineExpose({
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
getFormValue
|
getFormValue
|
||||||
|
|||||||
@ -326,7 +326,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
async function onSave() {
|
async function onSave() {
|
||||||
let value = await formInformation.value.handleSubmit();
|
let value = await formInformation.value.handleSubmit(true);
|
||||||
}
|
}
|
||||||
async function saveLaunchNew() {
|
async function saveLaunchNew() {
|
||||||
if (!taskId.value && rDraftsId.value != '0') {
|
if (!taskId.value && rDraftsId.value != '0') {
|
||||||
|
|||||||
@ -134,6 +134,7 @@
|
|||||||
import { useI18n } from '/@/hooks/web/useI18n';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
import { notification } from 'ant-design-vue';
|
import { notification } from 'ant-design-vue';
|
||||||
import { ColorPicker } from '/@/components/ColorPicker';
|
import { ColorPicker } from '/@/components/ColorPicker';
|
||||||
|
import {customFormConfig} from '/@/views/secondDev/customFormConfig'
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const ApproveUser = defineAsyncComponent(() => import('./flow/ApproveUser.vue'));
|
const ApproveUser = defineAsyncComponent(() => import('./flow/ApproveUser.vue'));
|
||||||
const AddOrSubtract = defineAsyncComponent(() => import('./flow/AddOrSubtract.vue'));
|
const AddOrSubtract = defineAsyncComponent(() => import('./flow/AddOrSubtract.vue'));
|
||||||
@ -228,11 +229,6 @@
|
|||||||
initProcessData(res);
|
initProcessData(res);
|
||||||
if (res.buttonConfigs) {
|
if (res.buttonConfigs) {
|
||||||
approvalData.buttonConfigs = res.buttonConfigs || [];
|
approvalData.buttonConfigs = res.buttonConfigs || [];
|
||||||
// 不显示保存按钮
|
|
||||||
let idx = approvalData.buttonConfigs.findIndex(v => v.buttonCode == 'draft')
|
|
||||||
if (idx >-1) {
|
|
||||||
approvalData.buttonConfigs.splice(idx, 1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (res.relationTasks) {
|
if (res.relationTasks) {
|
||||||
data.predecessorTasks = res.relationTasks;
|
data.predecessorTasks = res.relationTasks;
|
||||||
@ -302,12 +298,27 @@
|
|||||||
return fileFolderIds;
|
return fileFolderIds;
|
||||||
}
|
}
|
||||||
const onFinish = async (values: any) => {
|
const onFinish = async (values: any) => {
|
||||||
await submit();
|
if (!customFormConfig.codeList.includes(curPageCode.value)) {
|
||||||
|
await submit();
|
||||||
|
} else {
|
||||||
|
validateSuccess.value = true
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (validateSuccess.value) {
|
if (validateSuccess.value) {
|
||||||
let formModels = await formInformation.value.getFormModels();
|
let formModels = {}
|
||||||
let system = formInformation.value.getSystemType();
|
let system = {}
|
||||||
let fileFolderIds: Array<string> = getUploadFileFolderIds(formModels);
|
let fileFolderIds = []
|
||||||
|
if (!customFormConfig.codeList.includes(curPageCode.value)) {
|
||||||
|
let formModels = await formInformation.value.getFormModels();
|
||||||
|
let system = formInformation.value.getSystemType();
|
||||||
|
let fileFolderIds: Array<string> = getUploadFileFolderIds(formModels);
|
||||||
|
} else {
|
||||||
|
let value = await formInformation.value.getCustomFormValue()
|
||||||
|
let key = data.formInfos[0]?.formConfig?.key
|
||||||
|
formModels[key] = value
|
||||||
|
system[key] = false
|
||||||
|
fileFolderIds = []
|
||||||
|
}
|
||||||
let params: PostApprovalData = {
|
let params: PostApprovalData = {
|
||||||
approvedType: approvalData.approvedType,
|
approvedType: approvalData.approvedType,
|
||||||
approvedResult: approvalData.approvedResult, // approvalData.approvedType 审批结果 如果为 4 就需要传buttonCode
|
approvedResult: approvalData.approvedResult, // approvalData.approvedType 审批结果 如果为 4 就需要传buttonCode
|
||||||
@ -375,6 +386,8 @@
|
|||||||
data.submitLoading = false;
|
data.submitLoading = false;
|
||||||
notificationError(t('审批流程'), t('表单校验未通过'));
|
notificationError(t('审批流程'), t('表单校验未通过'));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
data.submitLoading = false;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
data.submitLoading = false;
|
data.submitLoading = false;
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
<div id="approveRightButton"></div>
|
<div id="approveRightButton"></div>
|
||||||
</div>
|
</div>
|
||||||
<div style="height: 500px;" v-if="customFormConfig.codeList.includes(props.curPageCode)">
|
<div style="height: 500px;" v-if="customFormConfig.codeList.includes(props.curPageCode)">
|
||||||
<component :id="props.id" :is="componentName" :disabled="true" />
|
<component :id="props.id" :is="componentName" :disabled="true" ref="customerFormRef"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<SystemForm class="form-box" v-if="item.formType == FormType.SYSTEM" :systemComponent="item.systemComponent" :isViewProcess="props.disabled" :formModel="item.formModel" :workflowConfig="item" :ref="setItemRef" />
|
<SystemForm class="form-box" v-if="item.formType == FormType.SYSTEM" :systemComponent="item.systemComponent" :isViewProcess="props.disabled" :formModel="item.formModel" :workflowConfig="item" :ref="setItemRef" />
|
||||||
@ -68,6 +68,7 @@
|
|||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import { updateWorkflow } from '/@/api/workflow/adminOperation';
|
import { updateWorkflow } from '/@/api/workflow/adminOperation';
|
||||||
import {customFormConfig} from '/@/views/secondDev/customFormConfig'
|
import {customFormConfig} from '/@/views/secondDev/customFormConfig'
|
||||||
|
const customerFormRef = ref(null)
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
@ -409,7 +410,21 @@
|
|||||||
itemRefs.value[activeIndex.value].setDisabledForm(false);
|
itemRefs.value[activeIndex.value].setDisabledForm(false);
|
||||||
forms.modes[activeIndex.value] = 'edit';
|
forms.modes[activeIndex.value] = 'edit';
|
||||||
}
|
}
|
||||||
|
const getCustomFormValue = async () => {
|
||||||
|
await nextTick()
|
||||||
|
if (!customerFormRef.value) {
|
||||||
|
message.error('表单组件正在加载,请稍后')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let value = {}
|
||||||
|
if (Array.isArray(customerFormRef.value)) {
|
||||||
|
value = customerFormRef.value[0].getFormValue()
|
||||||
|
} else {
|
||||||
|
value = customerFormRef.value.getFormValue()
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
|
||||||
|
}
|
||||||
defineExpose({
|
defineExpose({
|
||||||
validateForm,
|
validateForm,
|
||||||
getFormModels,
|
getFormModels,
|
||||||
@ -420,7 +435,8 @@
|
|||||||
handleEdit,
|
handleEdit,
|
||||||
handleSave,
|
handleSave,
|
||||||
handleCancel,
|
handleCancel,
|
||||||
handleDelete
|
handleDelete,
|
||||||
|
getCustomFormValue
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user