客户表单附件
This commit is contained in:
@ -69,9 +69,9 @@
|
||||
<upload-outlined />
|
||||
点击上传
|
||||
</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 }}
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<template #itemRender="{ file, actions }">
|
||||
@ -213,10 +213,11 @@
|
||||
x.status = 'done'; //没有则不会展示下载按钮
|
||||
x.url = x.fileUrl;
|
||||
x.thumbUrl = x.thUrl;
|
||||
x.fileSize = x.fileSize
|
||||
});
|
||||
|
||||
emit('update:value', folderId.value);
|
||||
emit('change');
|
||||
emit('change', fileList.value);
|
||||
loading.value = false;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@ -379,6 +380,12 @@
|
||||
downloadByUrl({ url: res.url, fileName: res.name || 'files.zip' });
|
||||
}
|
||||
}
|
||||
function getValue () {
|
||||
return fileList.value
|
||||
}
|
||||
defineExpose({
|
||||
getValue
|
||||
});
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.list-upload {
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
</a-col>
|
||||
<a-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>
|
||||
|
||||
</a-form-item>
|
||||
@ -49,12 +49,12 @@ import Upload from '/@/components/Form/src/components/Upload.vue';
|
||||
import { getDocCpList } from '/@/api/sales/Customer';
|
||||
import type { FormInstance } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { object } from 'vue-types';
|
||||
|
||||
const { t } = useI18n();
|
||||
const isUpdate = ref(true);
|
||||
const isDisable = ref(false);
|
||||
let optionList = reactive([])
|
||||
const uploadRef = ref()
|
||||
const fileTip = '支持格式.rar .zip .doc .docx .pdf ,单个文件不能超过20MB';
|
||||
const accept ='.rar,.zip, .doc, .docx, .pdf, .RAR, .ZIP, .DOC, .DOCX, .PDF'
|
||||
const formRef = ref()
|
||||
@ -98,12 +98,9 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
|
||||
}
|
||||
return endValue.valueOf() <= startValue.valueOf();
|
||||
}
|
||||
|
||||
const handleChangeFile = (val) => {
|
||||
|
||||
}
|
||||
function changeUplod (val) {
|
||||
console.log(val, 532)
|
||||
formState.fileList = val
|
||||
console.log(val, 532, formState.filePath)
|
||||
}
|
||||
async function getOption() {
|
||||
optionList = await getDocCpList({'valid': 'Y'})
|
||||
@ -115,13 +112,21 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
|
||||
try {
|
||||
await formRef.value.validate();
|
||||
// 验证通过,提交表单
|
||||
let arr = uploadRef.value.getValue() || []
|
||||
let obj = {
|
||||
...formState,
|
||||
dateFrom: formState.dateFrom ? dayjs(formState.dateFrom).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);
|
||||
notification.success({
|
||||
message: t('操作'),
|
||||
|
||||
@ -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
|
||||
|
||||
@ -326,7 +326,7 @@
|
||||
};
|
||||
}
|
||||
async function onSave() {
|
||||
let value = await formInformation.value.handleSubmit();
|
||||
let value = await formInformation.value.handleSubmit(true);
|
||||
}
|
||||
async function saveLaunchNew() {
|
||||
if (!taskId.value && rDraftsId.value != '0') {
|
||||
|
||||
@ -134,6 +134,7 @@
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { notification } from 'ant-design-vue';
|
||||
import { ColorPicker } from '/@/components/ColorPicker';
|
||||
import {customFormConfig} from '/@/views/secondDev/customFormConfig'
|
||||
const { t } = useI18n();
|
||||
const ApproveUser = defineAsyncComponent(() => import('./flow/ApproveUser.vue'));
|
||||
const AddOrSubtract = defineAsyncComponent(() => import('./flow/AddOrSubtract.vue'));
|
||||
@ -228,11 +229,6 @@
|
||||
initProcessData(res);
|
||||
if (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) {
|
||||
data.predecessorTasks = res.relationTasks;
|
||||
@ -302,12 +298,27 @@
|
||||
return fileFolderIds;
|
||||
}
|
||||
const onFinish = async (values: any) => {
|
||||
if (!customFormConfig.codeList.includes(curPageCode.value)) {
|
||||
await submit();
|
||||
} else {
|
||||
validateSuccess.value = true
|
||||
}
|
||||
try {
|
||||
if (validateSuccess.value) {
|
||||
let formModels = {}
|
||||
let system = {}
|
||||
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 = {
|
||||
approvedType: approvalData.approvedType,
|
||||
approvedResult: approvalData.approvedResult, // approvalData.approvedType 审批结果 如果为 4 就需要传buttonCode
|
||||
@ -375,6 +386,8 @@
|
||||
data.submitLoading = false;
|
||||
notificationError(t('审批流程'), t('表单校验未通过'));
|
||||
}
|
||||
} else {
|
||||
data.submitLoading = false;
|
||||
}
|
||||
} catch (error) {
|
||||
data.submitLoading = false;
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
<div id="approveRightButton"></div>
|
||||
</div>
|
||||
<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 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" />
|
||||
@ -68,6 +68,7 @@
|
||||
import { message } from 'ant-design-vue';
|
||||
import { updateWorkflow } from '/@/api/workflow/adminOperation';
|
||||
import {customFormConfig} from '/@/views/secondDev/customFormConfig'
|
||||
const customerFormRef = ref(null)
|
||||
const { t } = useI18n();
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@ -409,7 +410,21 @@
|
||||
itemRefs.value[activeIndex.value].setDisabledForm(false);
|
||||
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({
|
||||
validateForm,
|
||||
getFormModels,
|
||||
@ -420,7 +435,8 @@
|
||||
handleEdit,
|
||||
handleSave,
|
||||
handleCancel,
|
||||
handleDelete
|
||||
handleDelete,
|
||||
getCustomFormValue
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user