From efd3c8d3f1ec60fe4115c309088776b3ad9e0874 Mon Sep 17 00:00:00 2001 From: zy Date: Tue, 6 May 2025 17:16:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/BusinessProductForm.vue | 23 ++-- src/views/crm/contract/ContractForm.vue | 109 ++++++++++-------- .../ContractAAuthorizedCompanyForm.vue | 49 +++++--- .../ContractAAuthorizedPersonForm.vue | 63 +++++++--- .../ContractBAuthorizedPersonForm.vue | 73 +++++++++--- .../components/ContractProductForm.vue | 59 ++++++---- .../crm/contract/detail/ContractDetail.vue | 67 ++++++----- src/views/crm/quotation/QuotationDetail.vue | 1 + src/views/crm/quotation/QuotationForm.vue | 7 +- .../components/QuotationProductDetail.vue | 106 +++++------------ .../components/QuotationProductForm.vue | 29 ++--- .../organizations/OrganizationsForm.vue | 96 +++++++++------ 12 files changed, 396 insertions(+), 286 deletions(-) diff --git a/src/views/crm/business/components/BusinessProductForm.vue b/src/views/crm/business/components/BusinessProductForm.vue index 7164123c2..e27deca15 100644 --- a/src/views/crm/business/components/BusinessProductForm.vue +++ b/src/views/crm/business/components/BusinessProductForm.vue @@ -19,7 +19,7 @@ @@ -38,34 +39,32 @@ diff --git a/src/views/crm/contract/ContractForm.vue b/src/views/crm/contract/ContractForm.vue index e9b91373a..2eca40401 100644 --- a/src/views/crm/contract/ContractForm.vue +++ b/src/views/crm/contract/ContractForm.vue @@ -5,7 +5,7 @@ v-loading="formLoading" :model="formData" :rules="formRules" - label-width="120px" + label-width="151px" > 基础信息 @@ -21,6 +21,22 @@ + + + + + + + - - - - - - - + - - - - - - - + @@ -161,6 +150,18 @@ /> + + + + + + + @@ -170,14 +171,19 @@ - - - + + + - + + --> @@ -215,11 +221,11 @@ - - - + + --> @@ -367,13 +373,13 @@ - - + + - - + + @@ -92,9 +110,25 @@ const formLoading = ref(false) // 表单的加载中 const formData = ref([]) const formRules = reactive({ contractId: [{ required: true, message: '合同ID不能为空', trigger: 'blur' }], - customerContactId: [{ required: true, message: '客户联系人ID不能为空', trigger: 'blur' }], + authPersonType: [{ required: true, message: '授权人类型不能为空', trigger: 'blur' }], customerName: [{ required: true, message: '姓名不能为空', trigger: 'blur' }], - phoneNumber: [{ required: true, message: '手机号不能为空', trigger: 'blur' }] + phoneNumber: [{ required: true, message: '手机号不能为空', trigger: 'blur' } , + {pattern: /^(1[3-9][0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/, message: '请输入正确手机号'} + ], + idNumber: [{ required: true, message: '身份证号不能为空', trigger: 'blur' } , + { + pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/, + message: "身份证号格式不正确", + trigger: "blur", + }, + ], + email: [{ required: true, message: '电子邮箱不能为空', trigger: 'blur' } , + { + pattern: + /^(([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})$/, + message: "请输入正确的电子邮箱", + } + ] }) const formRef = ref() // 表单 Ref @@ -138,7 +172,6 @@ watch( const message = useMessage() // 消息弹窗 const contactRef = ref() // 表单 Ref const handleAdd = () => { - console.log('%csrc/views/crm/contract/components/ContractAAuthorizedPersonForm.vue:140 props.customerId', 'color: #007acc;', props.customerId); if(!props.customerId) { return message.warning('请先选择报价单') } @@ -154,11 +187,8 @@ const getList = (val: []) => { if(!formData.value.some(v => v.id === item.id)) { val.forEach(item => { formData.value.push({ - "name": item.name, - "postId": item.post, - "userRank": item.userRank, + "customerName": item.name, "phoneNumber": item.mobile, - "authDesc": item.authDesc, "wechat":item. wechat, "email":item. email, "id": item.id @@ -186,4 +216,9 @@ const getData = () => { } defineExpose({ validate, getData }) + +const getName = (opt, val) => { + const arr = opt.filter(v => v.value == val) + return arr.length ? arr[0]['label'] : '' +} \ No newline at end of file diff --git a/src/views/crm/contract/components/ContractBAuthorizedPersonForm.vue b/src/views/crm/contract/components/ContractBAuthorizedPersonForm.vue index 07ed1312a..6c99a9ba5 100644 --- a/src/views/crm/contract/components/ContractBAuthorizedPersonForm.vue +++ b/src/views/crm/contract/components/ContractBAuthorizedPersonForm.vue @@ -18,7 +18,7 @@ --> - @@ -116,7 +139,15 @@ const formRules = reactive({ contractId: [{ required: true, message: '合同ID不能为空', trigger: 'blur' }], userId: [{ required: true, message: '用户ID不能为空', trigger: 'blur' }], name: [{ required: true, message: '姓名不能为空', trigger: 'blur' }], - phoneNumber: [{ required: true, message: '手机号不能为空', trigger: 'blur' }] + phoneNumber: [{ required: true, message: '手机号不能为空', trigger: 'blur' } , + {pattern: /^(1[3-9][0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/, message: '请输入正确手机号'}], + email: [{ required: true, message: '电子邮箱不能为空', trigger: 'blur' } , + { + pattern: + /^(([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})$/, + message: "请输入正确的电子邮箱", + } + ] }) const formRef = ref() // 表单 Ref @@ -132,7 +163,13 @@ watch( } try { formLoading.value = true - formData.value = await ContractApi.getContractBAuthorizedPersonListByContractId(val) + let data = await ContractApi.getContractBAuthorizedPersonListByContractId(val) + // console.log('%csrc/views/crm/contract/components/ContractBAuthorizedPersonForm.vue:159 props.userOptions', 'color: #007acc;', props.userOptions); + // data.forEach( item => { + // item.userName = getName(props.userOptions, item.userId, 'id', 'nickname') + + // }) + formData.value = data } finally { formLoading.value = false } @@ -148,7 +185,7 @@ const handleAdd = () => { userId: undefined, name: undefined, authType: undefined, - postId: undefined, + deptName: undefined, userRank: undefined, authDesc: undefined, phoneNumber: undefined, @@ -167,11 +204,11 @@ const contactRef = ref() // 表单 Ref // contactRef.value.open(formData.value, props.customerId) // } const changeUser = (i, val) => { - console.log('%csrc/views/crm/contract/components/ContractBAuthorizedPersonForm.vue:170 i,val', 'color: #007acc;',props.userOptions.filter(v => v.id === val), i,val); let arr = props.userOptions.filter(v => v.id === val) if(arr.length) { formData.value[i].name = arr[0].nickname - formData.value[i].postId = arr[0].deptName + formData.value[i].deptName = arr[0].deptName + formData.value[i].postId = arr[0].deptId } } const getList = (val: []) => { @@ -186,6 +223,7 @@ const getList = (val: []) => { "name": item.name, "authType": item.post, "postId": item.userRank, + "deptName": item.deptName, "userRank": item.mobile, "authDesc": item.authDesc, "wechat":item. wechat, @@ -217,4 +255,9 @@ const getData = () => { } defineExpose({ validate, getData }) + +const getName = (opt, val, id, name) => { + const arr = opt.filter(v => v[id] == val) + return arr.length ? arr[0][name] : '' +} \ No newline at end of file diff --git a/src/views/crm/contract/components/ContractProductForm.vue b/src/views/crm/contract/components/ContractProductForm.vue index 0e4cfd09e..08b0687b5 100644 --- a/src/views/crm/contract/components/ContractProductForm.vue +++ b/src/views/crm/contract/components/ContractProductForm.vue @@ -19,28 +19,31 @@ --> - + - + - + - + - + - -