From 510d91cb66047c365d894ed50e34d5919385eb5c Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Wed, 25 Jun 2025 15:43:15 +0800 Subject: [PATCH] fix: crm plan --- .../src/views/crm/receivable/plan/data.ts | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/apps/web-antd/src/views/crm/receivable/plan/data.ts b/apps/web-antd/src/views/crm/receivable/plan/data.ts index 2ae3fe87e..138afa219 100644 --- a/apps/web-antd/src/views/crm/receivable/plan/data.ts +++ b/apps/web-antd/src/views/crm/receivable/plan/data.ts @@ -3,6 +3,7 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import { floatToFixed2 } from '@vben/utils'; +import { getContractSimpleList } from '#/api/crm/contract'; import { getCustomerSimpleList } from '#/api/crm/customer'; import { DICT_TYPE, getDictOptions } from '#/utils'; @@ -24,14 +25,32 @@ export function useFormSchema(): VbenFormSchema[] { { fieldName: 'contractId', label: '合同', - component: 'ApiSelect', + component: 'Select', rules: 'required', componentProps: { - api: getCustomerSimpleList, - labelField: 'name', - valueField: 'id', + options: [], placeholder: '请选择合同', }, + dependencies: { + triggerFields: ['customerId'], + disabled: (values) => !values.customerId, + async componentProps(values) { + if (!values.customerId) { + return { + options: [], + placeholder: '请选择客户', + }; + } + const res = await getContractSimpleList(values.customerId); + return { + options: res.map((item) => ({ + label: item.name, + value: item.id, + })), + placeholder: '请选择合同', + }; + }, + }, }, { fieldName: 'period',