From da4d175e9115eb1ad6c9871da264d081bd25351e Mon Sep 17 00:00:00 2001 From: zy Date: Sun, 27 Apr 2025 17:18:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.local | 2 +- src/views/crm/contact/ContactForm.vue | 4 ++- src/views/crm/customer/CustomerForm.vue | 2 +- .../customer/detail/CustomerDetailsInfo.vue | 12 +++++-- src/views/crm/customer/detail/index.vue | 4 +-- .../ReturnVisitRecordForm.vue | 35 +++++++++++++------ .../detail/returnvisitrecord/index.vue | 1 - src/views/crm/followup/FollowUpRecordForm.vue | 6 +++- .../components/FollowUpRecordContactForm.vue | 6 ++-- src/views/crm/product/ProductForm.vue | 4 +-- 10 files changed, 51 insertions(+), 25 deletions(-) diff --git a/.env.local b/.env.local index 49d3c9089..925808d83 100644 --- a/.env.local +++ b/.env.local @@ -4,7 +4,7 @@ NODE_ENV=development VITE_DEV=true # 请求路径 -VITE_BASE_URL='http://192.168.251.60:48080' +VITE_BASE_URL='http://172.22.3.6:48080' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务 VITE_UPLOAD_TYPE=server diff --git a/src/views/crm/contact/ContactForm.vue b/src/views/crm/contact/ContactForm.vue index 81813e6a2..8b81a8a24 100644 --- a/src/views/crm/contact/ContactForm.vue +++ b/src/views/crm/contact/ContactForm.vue @@ -18,6 +18,7 @@ @@ -113,7 +115,7 @@ - + - + - {{ customer.cooperationType }} - {{ customer.cooperationArea }} + {{ getName(getIntDictOptions(DICT_TYPE.CRM_COOPERATION_TYPE),customer.cooperationType) }} + {{ getName(getIntDictOptions(DICT_TYPE.CRM_COOPERATION_AREA),customer.cooperationArea) }} @@ -66,7 +66,7 @@ diff --git a/src/views/crm/customer/detail/index.vue b/src/views/crm/customer/detail/index.vue index 413355b9c..05c2d48b0 100644 --- a/src/views/crm/customer/detail/index.vue +++ b/src/views/crm/customer/detail/index.vue @@ -51,7 +51,7 @@ - + diff --git a/src/views/crm/customer/detail/returnvisitrecord/ReturnVisitRecordForm.vue b/src/views/crm/customer/detail/returnvisitrecord/ReturnVisitRecordForm.vue index aa060e55b..d3103677c 100644 --- a/src/views/crm/customer/detail/returnvisitrecord/ReturnVisitRecordForm.vue +++ b/src/views/crm/customer/detail/returnvisitrecord/ReturnVisitRecordForm.vue @@ -4,7 +4,7 @@ ref="formRef" :model="formData" :rules="formRules" - label-width="100px" + label-width="110px" v-loading="formLoading" > @@ -69,7 +69,7 @@ 添加联系人 - + @@ -111,7 +111,9 @@ const formData = ref({ nextTime: undefined, picUrls: undefined, fileUrls: undefined, - contactIds: undefined + contactIds: undefined, + contacts: [] + }) const formRef = ref() // 表单 Ref const formRules = reactive({ @@ -126,6 +128,18 @@ const contactTableSelectRef = ref>() const handleOpenContact = () => { contactTableSelectRef.value?.open() } +const handleAddContact = (contactId: [], newContacts: ContactApi.ContactVO[]) => { + newContacts.forEach((contact) => { + if (!formData.value.contacts.some((item) => item.id === contact.id)) { + formData.value.contacts.push(contact) + } + }) +} + +const del = (index: number) => { + formData.value.contacts.splice(index, 1) + +} /** 打开弹窗 */ const open = async (bizType: number, bizId: number) => { dialogVisible.value = true @@ -145,14 +159,12 @@ const submitForm = async () => { // 提交请求 formLoading.value = true try { - const data = formData.value as unknown as ReturnVisitRecordVO - if (formType.value === 'create') { - await ReturnVisitRecordApi.createReturnVisitRecord(data) - message.success(t('common.createSuccess')) - } else { - await ReturnVisitRecordApi.updateReturnVisitRecord(data) - message.success(t('common.updateSuccess')) - } + const data = { + ...formData.value, + contactIds: formData.value.contacts.map((item) => item.id), + } as unknown as ReturnVisitRecordVO + await ReturnVisitRecordApi.createReturnVisitRecord(data) + message.success(t('common.createSuccess')) dialogVisible.value = false // 发送操作成功的事件 emit('success') @@ -172,6 +184,7 @@ const resetForm = () => { nextTime: undefined, picUrls: undefined, fileUrls: undefined, + contacts: [] , contactIds: undefined } formRef.value?.resetFields() diff --git a/src/views/crm/customer/detail/returnvisitrecord/index.vue b/src/views/crm/customer/detail/returnvisitrecord/index.vue index fdc67db4d..1a0b41e43 100644 --- a/src/views/crm/customer/detail/returnvisitrecord/index.vue +++ b/src/views/crm/customer/detail/returnvisitrecord/index.vue @@ -50,7 +50,6 @@ link type="danger" @click="handleDelete(scope.row.id)" - v-hasPermi="['crm:return-visit-record:delete']" > 删除 diff --git a/src/views/crm/followup/FollowUpRecordForm.vue b/src/views/crm/followup/FollowUpRecordForm.vue index eb626f01c..cf0976592 100644 --- a/src/views/crm/followup/FollowUpRecordForm.vue +++ b/src/views/crm/followup/FollowUpRecordForm.vue @@ -52,7 +52,7 @@ 添加联系人 - + @@ -162,6 +162,10 @@ const handleAddContact = (contactId: [], newContacts: ContactApi.ContactVO[]) => }) } +const del = (index: number) => { + formData.value.contacts.splice(index, 1) + +} /** 关联商机 */ const businessTableSelectRef = ref>() const handleOpenBusiness = () => { diff --git a/src/views/crm/followup/components/FollowUpRecordContactForm.vue b/src/views/crm/followup/components/FollowUpRecordContactForm.vue index b3b5d3a29..cdae80f7d 100644 --- a/src/views/crm/followup/components/FollowUpRecordContactForm.vue +++ b/src/views/crm/followup/components/FollowUpRecordContactForm.vue @@ -17,7 +17,7 @@ @@ -40,8 +40,10 @@ watch( { immediate: true } ) + const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 /** 删除按钮操作 */ const handleDelete = (index: number) => { - formData.value.splice(index, 1) + emit('success', index) + } diff --git a/src/views/crm/product/ProductForm.vue b/src/views/crm/product/ProductForm.vue index 98a7fa112..636ebf39b 100644 --- a/src/views/crm/product/ProductForm.vue +++ b/src/views/crm/product/ProductForm.vue @@ -1,10 +1,10 @@