From a241b66efcc41e973290a6722fb7a4d79b833ea1 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 13 十月 2026 09:54:32 +0800
Subject: [PATCH] feat(bi): 为图表配置接口添加名称字段

---
 src/views/crm/contract/data.ts |   63 ++++++++++++++++++++-----------
 1 files changed, 41 insertions(+), 22 deletions(-)

diff --git a/src/views/crm/contract/data.ts b/src/views/crm/contract/data.ts
index 1efd63c..d87c188 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,
       },
     },
     {
@@ -76,7 +79,7 @@
       componentProps: {
         showTime: false,
         format: 'YYYY-MM-DD',
-        valueFormat: 'x',
+        valueFormat: 'YYYY-MM-DD',
         placeholder: '璇烽�夋嫨涓嬪崟鏃ユ湡',
       },
     },
@@ -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: [],
@@ -119,7 +128,7 @@
       componentProps: {
         showTime: false,
         format: 'YYYY-MM-DD',
-        valueFormat: 'x',
+        valueFormat: 'YYYY-MM-DD',
         placeholder: '璇烽�夋嫨鍚堝悓寮�濮嬫椂闂�',
       },
     },
@@ -130,7 +139,7 @@
       componentProps: {
         showTime: false,
         format: 'YYYY-MM-DD',
-        valueFormat: 'x',
+        valueFormat: 'YYYY-MM-DD',
         placeholder: '璇烽�夋嫨鍚堝悓缁撴潫鏃堕棿',
       },
     },
@@ -280,11 +289,8 @@
     {
       fieldName: 'customerId',
       label: '瀹㈡埛',
-      component: 'ApiSelect',
+      component: markRaw(CrmCustomerSelect),
       componentProps: {
-        api: getCustomerSimpleList,
-        labelField: 'name',
-        valueField: 'id',
         placeholder: '璇烽�夋嫨瀹㈡埛',
         allowClear: true,
       },
@@ -320,6 +326,7 @@
 
 export function useGridColumns(): VxeTableGridOptions['columns'] {
   return [
+    { type: 'checkbox', width: 50, fixed: 'left' },
     {
       title: '鍚堝悓缂栧彿',
       field: 'no',
@@ -362,19 +369,19 @@
       title: '涓嬪崟鏃堕棿',
       field: 'orderDate',
       minWidth: 120,
-      formatter: 'formatDateTime',
+      formatter: 'formatDate',
     },
     {
       title: '鍚堝悓寮�濮嬫椂闂�',
       field: 'startTime',
       minWidth: 120,
-      formatter: 'formatDateTime',
+      formatter: 'formatDate',
     },
     {
       title: '鍚堝悓缁撴潫鏃堕棿',
       field: 'endTime',
       minWidth: 120,
-      formatter: 'formatDateTime',
+      formatter: 'formatDate',
     },
     {
       title: '瀹㈡埛绛剧害浜�',
@@ -409,10 +416,22 @@
       },
     },
     {
+      title: '宸插紑绁ㄩ噾棰濓紙鍏冿級',
+      field: 'totalInvoicePrice',
+      minWidth: 150,
+      formatter: 'formatAmount2',
+    },
+    {
+      title: '鏈紑绁ㄩ噾棰濓紙鍏冿級',
+      field: 'unInvoicePrice',
+      minWidth: 140,
+      formatter: 'formatAmount2',
+    },
+    {
       title: '鏈�鍚庤窡杩涙椂闂�',
       field: 'contactLastTime',
       minWidth: 180,
-      formatter: 'formatDateTime',
+      formatter: 'formatDate',
     },
     {
       title: '璐熻矗浜�',
@@ -428,13 +447,13 @@
       title: '鏇存柊鏃堕棿',
       field: 'updateTime',
       minWidth: 180,
-      formatter: 'formatDateTime',
+      formatter: 'formatDate',
     },
     {
       title: '鍒涘缓鏃堕棿',
       field: 'createTime',
       minWidth: 180,
-      formatter: 'formatDateTime',
+      formatter: 'formatDate',
     },
     {
       title: '鍒涘缓浜�',

--
Gitblit v1.9.3