diff --git a/src/api/crm/contact/index.ts b/src/api/crm/contact/index.ts index a4150bec..8bf0b1fe 100644 --- a/src/api/crm/contact/index.ts +++ b/src/api/crm/contact/index.ts @@ -47,6 +47,11 @@ export const getContactPageByCustomer = async (params: any) => { return await request.get({ url: `/crm/contact/page-by-customer`, params }) } +// 查询 CRM 联系人列表,基于指定商机 +export const getContactPageByBusiness = async (params: any) => { + return await request.get({ url: `/crm/contact/page-by-business`, params }) +} + // 查询 CRM 联系人详情 export const getContact = async (id: number) => { return await request.get({ url: `/crm/contact/get?id=` + id }) diff --git a/src/views/crm/business/BusinessForm.vue b/src/views/crm/business/BusinessForm.vue index d78cf935..07139f75 100644 --- a/src/views/crm/business/BusinessForm.vue +++ b/src/views/crm/business/BusinessForm.vue @@ -31,7 +31,12 @@ - + { +const open = async (type: string, id?: number, customerId?: number, contactId?: number) => { dialogVisible.value = true dialogTitle.value = t('action.' + type) formType.value = type @@ -210,7 +217,17 @@ const open = async (type: string, id?: number) => { } finally { formLoading.value = false } + } else { + if (customerId) { + formData.value.customerId = customerId + formData.value.customerDefault = true // 默认客户的选择,不允许变 + } + // 自动关联 contactId 联系人编号 + if (contactId) { + formData.value.contactId = contactId + } } + // 获得客户列表 customerList.value = await CustomerApi.getCustomerSimpleList() // 加载商机状态类型列表 statusTypeList.value = await BusinessStatusApi.getBusinessStatusTypeSimpleList() @@ -264,7 +281,9 @@ const resetForm = () => { totalProductPrice: undefined, totalPrice: undefined, remark: undefined, - products: [] + products: [], + contactId: undefined, + customerDefault: false } formRef.value?.resetFields() } diff --git a/src/views/crm/business/components/BusinessList.vue b/src/views/crm/business/components/BusinessList.vue index 65398480..b01781a4 100644 --- a/src/views/crm/business/components/BusinessList.vue +++ b/src/views/crm/business/components/BusinessList.vue @@ -76,6 +76,7 @@ const props = defineProps<{ bizType: number // 业务类型 bizId: number // 业务编号 customerId?: number // 关联联系人与商机时,需要传入 customerId 进行筛选 + contactId?: number // 特殊:联系人编号;在【联系人】详情中,可以传递联系人编号,默认新建的商机关联到该联系人 }>() const loading = ref(true) // 列表的加载中 @@ -125,7 +126,7 @@ const handleQuery = () => { /** 添加操作 */ const formRef = ref() const openForm = () => { - formRef.value.open('create') + formRef.value.open('create', null, props.customerId, props.contactId) } /** 打开联系人详情 */ diff --git a/src/views/crm/business/detail/index.vue b/src/views/crm/business/detail/index.vue index a0aa89ee..dd8787c2 100644 --- a/src/views/crm/business/detail/index.vue +++ b/src/views/crm/business/detail/index.vue @@ -15,6 +15,14 @@ + + + @@ -27,13 +35,6 @@ @quit-team="close" /> - - - @@ -46,7 +47,6 @@ import * as ContactApi from '@/api/crm/contact' import * as BusinessApi from '@/api/crm/business' import BusinessDetailsHeader from './BusinessDetailsHeader.vue' import BusinessDetailsInfo from './BusinessDetailsInfo.vue' -import BusinessList from '@/views/crm/business/components/BusinessList.vue' // 商机列表 import PermissionList from '@/views/crm/permission/components/PermissionList.vue' // 团队成员列表(权限) import { BizTypeEnum } from '@/api/crm/permission' import { OperateLogV2VO } from '@/api/system/operatelog' @@ -54,6 +54,7 @@ import { getOperateLogPage } from '@/api/crm/operateLog' import ContactForm from '@/views/crm/contact/ContactForm.vue' import CrmTransferForm from '@/views/crm/permission/components/TransferForm.vue' import FollowUpList from '@/views/crm/followup/index.vue' +import ContactList from '@/views/crm/contact/components/ContactList.vue' defineOptions({ name: 'CrmBusinessDetail' }) diff --git a/src/views/crm/business/index.vue b/src/views/crm/business/index.vue index 66566917..64445fb7 100644 --- a/src/views/crm/business/index.vue +++ b/src/views/crm/business/index.vue @@ -38,6 +38,11 @@ + + + + + - () const loading = ref(true) // 列表的加载中 @@ -73,6 +74,10 @@ const getList = async () => { queryParams.customerId = props.bizId data = await ContactApi.getContactPageByCustomer(queryParams) break + case BizTypeEnum.CRM_BUSINESS: + queryParams.businessId = props.bizId + data = await ContactApi.getContactPageByBusiness(queryParams) + break default: return } @@ -92,7 +97,7 @@ const handleQuery = () => { /** 添加操作 */ const formRef = ref() const openForm = () => { - formRef.value.open('create') + formRef.value.open('create', undefined, props.customerId, props.businessId) } /** 打开联系人详情 */ diff --git a/src/views/crm/contact/detail/index.vue b/src/views/crm/contact/detail/index.vue index bf27246b..21967e8c 100644 --- a/src/views/crm/contact/detail/index.vue +++ b/src/views/crm/contact/detail/index.vue @@ -32,6 +32,7 @@ :biz-id="contact.id!" :biz-type="BizTypeEnum.CRM_CONTACT" :customer-id="contact.customerId" + :contact-id="contact.id" />