From 7164ae5d49b43e932b9c99428a7821783b04f7f6 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 24 Feb 2024 15:46:36 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20CRM=EF=BC=9A=E5=AE=8C=E5=96=84=20CR?= =?UTF-8?q?M=20=E8=B7=9F=E8=BF=9B=E8=AE=B0=E5=BD=95=EF=BC=88=E8=81=94?= =?UTF-8?q?=E7=B3=BB=E4=BA=BA=E7=9A=84=E5=B1=95=E7=A4=BA=E3=80=81=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/crm/contact/index.ts | 5 - .../business/components/BusinessListModal.vue | 2 +- .../crm/contact/components/ContactList.vue | 2 +- .../contact/components/ContactListModal.vue | 154 ++++++++++++++++++ src/views/crm/followup/FollowUpRecordForm.vue | 31 +++- .../crm/followup/components/ContactList.vue | 97 ----------- .../components/ContactTableSelect.vue | 87 ---------- .../components/FollowUpRecordContactForm.vue | 47 ++++++ src/views/crm/followup/components/index.ts | 4 - src/views/crm/followup/index.vue | 9 +- 10 files changed, 228 insertions(+), 210 deletions(-) create mode 100644 src/views/crm/contact/components/ContactListModal.vue delete mode 100644 src/views/crm/followup/components/ContactList.vue delete mode 100644 src/views/crm/followup/components/ContactTableSelect.vue create mode 100644 src/views/crm/followup/components/FollowUpRecordContactForm.vue delete mode 100644 src/views/crm/followup/components/index.ts diff --git a/src/api/crm/contact/index.ts b/src/api/crm/contact/index.ts index 8bf0b1fe..e16646cc 100644 --- a/src/api/crm/contact/index.ts +++ b/src/api/crm/contact/index.ts @@ -82,11 +82,6 @@ export const getSimpleContactList = async () => { return await request.get({ url: `/crm/contact/simple-all-list` }) } -// 获得 CRM 联系人列表 -export const getContactListByIds = async (val: number[]) => { - return await request.get({ url: '/crm/contact/list-by-ids', params: { ids: val.join(',') } }) -} - // 批量新增联系人商机关联 export const createContactBusinessList = async (data: ContactBusinessReqVO) => { return await request.post({ url: `/crm/contact/create-business-list`, data }) diff --git a/src/views/crm/business/components/BusinessListModal.vue b/src/views/crm/business/components/BusinessListModal.vue index 2832b6ee..3c21f061 100644 --- a/src/views/crm/business/components/BusinessListModal.vue +++ b/src/views/crm/business/components/BusinessListModal.vue @@ -148,7 +148,7 @@ const submitForm = async () => { emit('success', businessIds, businessRef.value.getSelectionRows()) } -/** 打开联系人详情 */ +/** 打开商机详情 */ const { push } = useRouter() const openDetail = (id: number) => { push({ name: 'CrmBusinessDetail', params: { id } }) diff --git a/src/views/crm/contact/components/ContactList.vue b/src/views/crm/contact/components/ContactList.vue index b5974e3d..7de9a3cd 100644 --- a/src/views/crm/contact/components/ContactList.vue +++ b/src/views/crm/contact/components/ContactList.vue @@ -20,7 +20,7 @@ - + diff --git a/src/views/crm/contact/components/ContactListModal.vue b/src/views/crm/contact/components/ContactListModal.vue new file mode 100644 index 00000000..82071896 --- /dev/null +++ b/src/views/crm/contact/components/ContactListModal.vue @@ -0,0 +1,154 @@ + + diff --git a/src/views/crm/followup/FollowUpRecordForm.vue b/src/views/crm/followup/FollowUpRecordForm.vue index 34b7ef8d..eb626f01 100644 --- a/src/views/crm/followup/FollowUpRecordForm.vue +++ b/src/views/crm/followup/FollowUpRecordForm.vue @@ -48,11 +48,11 @@ - + 添加联系人 - + @@ -73,7 +73,11 @@ - + import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { FollowUpRecordApi, FollowUpRecordVO } from '@/api/crm/followup' -import { ContactList, ContactTableSelect } from './components' import { BizTypeEnum } from '@/api/crm/permission' import FollowUpRecordBusinessForm from './components/FollowUpRecordBusinessForm.vue' +import FollowUpRecordContactForm from './components/FollowUpRecordContactForm.vue' import BusinessListModal from '@/views/crm/business/components/BusinessListModal.vue' import * as BusinessApi from '@/api/crm/business' +import ContactListModal from '@/views/crm/contact/components/ContactListModal.vue' +import * as ContactApi from '@/api/crm/contact' defineOptions({ name: 'FollowUpRecordForm' }) @@ -128,7 +134,11 @@ const submitForm = async () => { // 提交请求 formLoading.value = true try { - const data = formData.value as unknown as FollowUpRecordVO + const data = { + ...formData.value, + contactIds: formData.value.contacts.map((item) => item.id), + businessIds: formData.value.businesses.map((item) => item.id) + } as unknown as FollowUpRecordVO await FollowUpRecordApi.createFollowUpRecord(data) message.success(t('common.createSuccess')) dialogVisible.value = false @@ -140,10 +150,17 @@ const submitForm = async () => { } /** 关联联系人 */ -const contactTableSelectRef = ref>() -const handleAddContact = () => { +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 businessTableSelectRef = ref>() diff --git a/src/views/crm/followup/components/ContactList.vue b/src/views/crm/followup/components/ContactList.vue deleted file mode 100644 index 5e31718a..00000000 --- a/src/views/crm/followup/components/ContactList.vue +++ /dev/null @@ -1,97 +0,0 @@ - - - diff --git a/src/views/crm/followup/components/ContactTableSelect.vue b/src/views/crm/followup/components/ContactTableSelect.vue deleted file mode 100644 index ded9a6d4..00000000 --- a/src/views/crm/followup/components/ContactTableSelect.vue +++ /dev/null @@ -1,87 +0,0 @@ - - - - diff --git a/src/views/crm/followup/components/FollowUpRecordContactForm.vue b/src/views/crm/followup/components/FollowUpRecordContactForm.vue new file mode 100644 index 00000000..b3b5d3a2 --- /dev/null +++ b/src/views/crm/followup/components/FollowUpRecordContactForm.vue @@ -0,0 +1,47 @@ + + + diff --git a/src/views/crm/followup/components/index.ts b/src/views/crm/followup/components/index.ts deleted file mode 100644 index 6c669fc3..00000000 --- a/src/views/crm/followup/components/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import ContactList from './ContactList.vue' -import ContactTableSelect from './ContactTableSelect.vue' - -export { ContactList, ContactTableSelect } diff --git a/src/views/crm/followup/index.vue b/src/views/crm/followup/index.vue index f4372627..d0b22716 100644 --- a/src/views/crm/followup/index.vue +++ b/src/views/crm/followup/index.vue @@ -71,14 +71,7 @@