CRM:完善商机和联系人之间的关联

This commit is contained in:
YunaiV
2024-02-22 09:35:35 +08:00
parent 01684aa6e8
commit 8512fe6b43
8 changed files with 86 additions and 37 deletions

View File

@@ -33,7 +33,12 @@
<el-row>
<el-col :span="12">
<el-form-item label="客户名称" prop="customerId">
<el-select v-model="formData.customerId" placeholder="请选择客户" class="w-1/1">
<el-select
:disabled="formData.customerDefault"
v-model="formData.customerId"
placeholder="请选择客户"
class="w-1/1"
>
<el-option
v-for="item in customerList"
:key="item.id"
@@ -198,7 +203,9 @@ const formData = ref({
master: false,
post: undefined,
parentId: undefined,
remark: undefined
remark: undefined,
businessId: undefined,
customerDefault: false
})
const formRules = reactive({
name: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],
@@ -212,7 +219,7 @@ const customerList = ref<CustomerApi.CustomerVO[]>([]) // 客户列表
const contactList = ref<ContactApi.ContactVO[]>([]) // 联系人列表
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
const open = async (type: string, id?: number, customerId?: number, businessId?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
@@ -225,8 +232,19 @@ const open = async (type: string, id?: number) => {
} finally {
formLoading.value = false
}
} else {
if (customerId) {
formData.value.customerId = customerId
formData.value.customerDefault = true // 默认客户的选择,不允许变
}
// 自动关联 businessId 商机编号
if (businessId) {
formData.value.businessId = businessId
}
}
// 获得联系人列表
contactList.value = await ContactApi.getSimpleContactList()
// 获得客户列表
customerList.value = await CustomerApi.getCustomerSimpleList()
// 获得地区列表
areaList.value = await AreaApi.getAreaTree()
@@ -284,7 +302,9 @@ const resetForm = () => {
master: false,
post: undefined,
parentId: undefined,
remark: undefined
remark: undefined,
businessId: undefined,
customerDefault: false
}
formRef.value?.resetFields()
}

View File

@@ -25,7 +25,6 @@
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.master" />
</template>
</el-table-column>
<!-- TODO 芋艿操作设为首要联系人 -->
</el-table>
<!-- 分页 -->
<Pagination
@@ -49,6 +48,8 @@ defineOptions({ name: 'CrmContactList' })
const props = defineProps<{
bizType: number // 业务类型
bizId: number // 业务编号
customerId: number // 特殊:客户编号;在【商机】详情中,可以传递客户编号,默认新建的联系人关联到该客户
businessId: number // 特殊:商机编号;在【商机】详情中,可以传递商机编号,默认新建的联系人关联到该商机
}>()
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)
}
/** 打开联系人详情 */

View File

@@ -32,6 +32,7 @@
:biz-id="contact.id!"
:biz-type="BizTypeEnum.CRM_CONTACT"
:customer-id="contact.customerId"
:contact-id="contact.id"
/>
</el-tab-pane>
</el-tabs>