diff --git a/src/views/crm/contract/ContractForm.vue b/src/views/crm/contract/ContractForm.vue index e962d525..3dac598c 100644 --- a/src/views/crm/contract/ContractForm.vue +++ b/src/views/crm/contract/ContractForm.vue @@ -38,7 +38,12 @@ - + - + { formRef.value?.resetFields() } -// TODO 芋艿:切换客户时,需要 reset 关联的几个字段 -// TODO 芋艿:选择商机时,需要自动设置 +/** 处理切换客户 */ +const handleCustomerChange = () => { + formData.value.businessId = undefined + formData.value.signContactId = undefined + formData.value.products = [] +} + +/** 处理商机变化 */ +const handleBusinessChange = async (businessId: number) => { + const business = await BusinessApi.getBusiness(businessId) + business.products.forEach((item) => { + item.contractPrice = item.businessPrice + }) + formData.value.products = business.products +} /** 动态获取客户联系人 */ const getContactOptions = computed(() => - contactList.value.filter((item) => item.customerId === formData.value.customerId) + contactList.value.filter((item) => item.customerId == formData.value.customerId) ) /** 动态获取商机 */ const getBusinessOptions = computed(() => - businessList.value.filter((item) => item.customerId === formData.value.customerId) + businessList.value.filter((item) => item.customerId == formData.value.customerId) )