From b64a0deae5b5d33f9e20671a68936b27f0b9b00b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 21 七月 2026 18:03:03 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro2.0' into dev_pro2.0

---
 src/views/crm/contract/data.ts |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/src/views/crm/contract/data.ts b/src/views/crm/contract/data.ts
index 1efd63c..5ea024f 100644
--- a/src/views/crm/contract/data.ts
+++ b/src/views/crm/contract/data.ts
@@ -1,14 +1,16 @@
 import type { VbenFormSchema } from '#/adapter/form';
 import type { VxeTableGridOptions } from '#/adapter/vxe-table';
 
-import { useUserStore } from '../../../packages/stores/src';
-import { erpPriceInputFormatter, erpPriceMultiply } from '../../../packages/utils/src';
+import { useUserStore } from '@vben/stores';
+import { erpPriceInputFormatter, erpPriceMultiply } from '@vben/utils';
 
 import { z } from '#/adapter/form';
 import { getSimpleBusinessList } from '#/api/crm/business';
 import { getSimpleContactList } from '#/api/crm/contact';
-import { getCustomerSimpleList } from '#/api/crm/customer';
 import { getSimpleUserList } from '#/api/system/user';
+import CrmCustomerSelect from '#/components/crm-customer-select.vue';
+
+import { markRaw } from 'vue';
 
 /** 鏂板/淇敼鐨勮〃鍗� */
 export function useFormSchema(): VbenFormSchema[] {
@@ -59,13 +61,14 @@
     {
       fieldName: 'customerId',
       label: '瀹㈡埛鍚嶇О',
-      component: 'ApiSelect',
+      component: markRaw(CrmCustomerSelect),
       rules: 'required',
       componentProps: {
-        api: getCustomerSimpleList,
-        labelField: 'name',
-        valueField: 'id',
         placeholder: '璇烽�夋嫨瀹㈡埛',
+      },
+      dependencies: {
+        triggerFields: ['customerId'],
+        disabled: (values) => !!values.customerId,
       },
     },
     {
@@ -89,9 +92,15 @@
         placeholder: '璇烽�夋嫨鍟嗘満',
       },
       dependencies: {
-        triggerFields: ['customerId'],
-        disabled: (values) => !values.customerId,
+        triggerFields: ['customerId', 'businessId'],
+        disabled: (values) => !!values.businessId || !values.customerId,
         async componentProps(values) {
+          if (values.businessId && values.businessName) {
+            return {
+              options: [{ label: values.businessName, value: values.businessId }],
+              placeholder: '璇烽�夋嫨鍟嗘満',
+            };
+          }
           if (!values.customerId) {
             return {
               options: [],
@@ -280,11 +289,8 @@
     {
       fieldName: 'customerId',
       label: '瀹㈡埛',
-      component: 'ApiSelect',
+      component: markRaw(CrmCustomerSelect),
       componentProps: {
-        api: getCustomerSimpleList,
-        labelField: 'name',
-        valueField: 'id',
         placeholder: '璇烽�夋嫨瀹㈡埛',
         allowClear: true,
       },

--
Gitblit v1.9.3