From c069a398226e8c6489b9c5c0036bf0553cc66495 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 16 十月 2026 10:28:21 +0800
Subject: [PATCH] feat(crm): 添加业务模块客户选择功能

---
 src/components/crm-customer-select.vue |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/components/crm-customer-select.vue b/src/components/crm-customer-select.vue
index 64dcc12..b55e90e 100644
--- a/src/components/crm-customer-select.vue
+++ b/src/components/crm-customer-select.vue
@@ -2,12 +2,13 @@
 import type { CrmCustomerApi } from '#/api/crm/customer';
 
 import { computed, ref, useAttrs, watch } from 'vue';
+import { useRoute } from 'vue-router';
 
 import { IconifyIcon } from '@vben/icons';
 
 import { Input, Tooltip } from 'ant-design-vue';
 
-import { getCustomer } from '#/api/crm/customer';
+import { getBusinessCustomer, getCustomer } from '#/api/crm/customer';
 
 import CrmCustomerSelectDialog from './crm-customer-select-dialog.vue';
 
@@ -16,6 +17,7 @@
 const props = withDefaults(
   defineProps<{
     allowClear?: boolean;
+    allCustomers?: boolean;
     disabled?: boolean;
     modelValue?: number;
     placeholder?: string;
@@ -26,6 +28,10 @@
     modelValue: undefined,
     placeholder: '璇烽�夋嫨瀹㈡埛',
   },
+);
+const route = useRoute();
+const useAllCustomers = computed(
+  () => props.allCustomers ?? !String(route.path).startsWith('/crm/'),
 );
 const emit = defineEmits<{
   change: [item: CrmCustomerApi.Customer | undefined];
@@ -53,7 +59,9 @@
   if (selectedItem.value?.id === id) {
     return;
   }
-  selectedItem.value = await getCustomer(id);
+  selectedItem.value = useAllCustomers.value
+    ? await getBusinessCustomer(id)
+    : await getCustomer(id);
 }
 
 watch(
@@ -129,5 +137,9 @@
       </Input>
     </Tooltip>
   </div>
-  <CrmCustomerSelectDialog ref="dialogRef" @selected="handleSelected" />
+  <CrmCustomerSelectDialog
+    ref="dialogRef"
+    :all-customers="useAllCustomers"
+    @selected="handleSelected"
+  />
 </template>

--
Gitblit v1.9.3