客户新增

This commit is contained in:
‘huanghaiixia’
2025-11-25 12:12:15 +08:00
parent 65575b40ad
commit c8c20d5b52
6 changed files with 556 additions and 78 deletions

View File

@ -1,5 +1,5 @@
<template>
<BasicModal v-bind="$attrs" destroyOnClose @register="registerModal" showFooter :title="getTitle" width="40%" @ok="handleSubmit">
<BasicModal v-bind="$attrs" destroyOnClose @register="registerModal" showFooter :title="getTitle" width="40%" @ok="handleSubmit" @cancel="handleCancel">
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="{labelCol: { span: 8 },wrapperCol: { span: 16 },}">
<a-row>
<a-col :span="24">
@ -52,6 +52,7 @@ import dayjs from 'dayjs';
const { t } = useI18n();
const isUpdate = ref(true);
const disable = ref(false);
let optionList = reactive([])
const fileTip = '支持格式.rar .zip .doc .docx .pdf 单个文件不能超过20MB';
const accept ='.rar,.zip, .doc, .docx, .pdf, .RAR, .ZIP, .DOC, .DOCX, .PDF'
@ -64,17 +65,13 @@ let formState = reactive({
});
const rules = {
docTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
// email: [
// { required: true, message: '请输入邮箱', trigger: 'blur' },
// { type: 'email', message: '请输入正确的邮箱格式', trigger: 'blur' },
// ],
};
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
getOption()
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
disable.value = data?.btnType == 'view' ? true : false
if (unref(isUpdate)) {
formState=data.record || {}
}
@ -104,11 +101,13 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
async function getOption() {
optionList = await getDocCpList({'valid': 'Y'})
}
const handleCancel = () => {
formRef.value.resetFields();
}
const handleSubmit = async () => {
try {
await formRef.value.validate();
// 验证通过,提交表单
console.log('表单数据:', formState);
let docNo = (optionList.find(v=>v.code === formState.docTypeCode) || {}).fullName
let obj = {
...formState,