From 27c8277d717b34b55f3ea967027b53b067f77df3 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期四, 20 八月 2026 16:58:49 +0800
Subject: [PATCH] feat 功能变更

---
 src/views/crm/contract/data.ts |  152 +++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 136 insertions(+), 16 deletions(-)

diff --git a/src/views/crm/contract/data.ts b/src/views/crm/contract/data.ts
index 1efd63c..87bfcf2 100644
--- a/src/views/crm/contract/data.ts
+++ b/src/views/crm/contract/data.ts
@@ -1,14 +1,18 @@
 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 { DICT_TYPE } from '@vben/constants';
+import { getDictOptions } from '@vben/hooks';
+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 +63,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 +81,7 @@
       componentProps: {
         showTime: false,
         format: 'YYYY-MM-DD',
-        valueFormat: 'x',
+        valueFormat: 'YYYY-MM-DD',
         placeholder: '璇烽�夋嫨涓嬪崟鏃ユ湡',
       },
     },
@@ -89,9 +94,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 +130,7 @@
       componentProps: {
         showTime: false,
         format: 'YYYY-MM-DD',
-        valueFormat: 'x',
+        valueFormat: 'YYYY-MM-DD',
         placeholder: '璇烽�夋嫨鍚堝悓寮�濮嬫椂闂�',
       },
     },
@@ -130,7 +141,7 @@
       componentProps: {
         showTime: false,
         format: 'YYYY-MM-DD',
-        valueFormat: 'x',
+        valueFormat: 'YYYY-MM-DD',
         placeholder: '璇烽�夋嫨鍚堝悓缁撴潫鏃堕棿',
       },
     },
@@ -187,6 +198,78 @@
             placeholder: '璇烽�夋嫨瀹㈡埛绛剧害浜�',
           };
         },
+      },
+    },
+    {
+      fieldName: 'contractType',
+      label: '鍚堝悓绫诲瀷',
+      component: 'Select',
+      componentProps: {
+        options: getDictOptions(DICT_TYPE.CRM_CONTRACT_TYPE),
+        placeholder: '璇烽�夋嫨鍚堝悓绫诲瀷',
+        allowClear: true,
+      },
+    },
+    {
+      fieldName: 'voltageLevel',
+      label: '鐢靛帇绛夌骇',
+      component: 'Select',
+      componentProps: {
+        options: getDictOptions(DICT_TYPE.CRM_VOLTAGE_LEVEL),
+        placeholder: '璇烽�夋嫨鐢靛帇绛夌骇',
+        allowClear: true,
+      },
+    },
+    {
+      fieldName: 'electricityType',
+      label: '鐢ㄧ數绫诲瀷',
+      component: 'Select',
+      componentProps: {
+        options: getDictOptions(DICT_TYPE.CRM_ELECTRICITY_TYPE),
+        placeholder: '璇烽�夋嫨鐢ㄧ數绫诲瀷',
+        allowClear: true,
+      },
+    },
+    {
+      fieldName: 'contractCapacity',
+      label: '鍚堝悓瀹归噺锛坘VA锛�',
+      component: 'InputNumber',
+      componentProps: {
+        class: '!w-full',
+        min: 0,
+        precision: 2,
+        placeholder: '璇疯緭鍏ュ悎鍚屽閲�',
+      },
+    },
+    {
+      fieldName: 'tariffMode',
+      label: '鐢典环妯″紡',
+      component: 'Select',
+      componentProps: {
+        options: getDictOptions(DICT_TYPE.CRM_TARIFF_MODE),
+        placeholder: '璇烽�夋嫨鐢典环妯″紡',
+        allowClear: true,
+      },
+    },
+    {
+      fieldName: 'meterMode',
+      label: '璁¢噺鏂瑰紡',
+      component: 'Select',
+      componentProps: {
+        options: getDictOptions(DICT_TYPE.CRM_METER_MODE),
+        placeholder: '璇烽�夋嫨璁¢噺鏂瑰紡',
+        allowClear: true,
+      },
+    },
+    {
+      fieldName: 'payCycle',
+      label: '缂磋垂鍛ㄦ湡锛堟湀锛�',
+      component: 'InputNumber',
+      componentProps: {
+        class: '!w-full',
+        min: 1,
+        precision: 0,
+        placeholder: '璇疯緭鍏ョ即璐瑰懆鏈�',
       },
     },
     {
@@ -280,11 +363,8 @@
     {
       fieldName: 'customerId',
       label: '瀹㈡埛',
-      component: 'ApiSelect',
+      component: markRaw(CrmCustomerSelect),
       componentProps: {
-        api: getCustomerSimpleList,
-        labelField: 'name',
-        valueField: 'id',
         placeholder: '璇烽�夋嫨瀹㈡埛',
         allowClear: true,
       },
@@ -347,6 +427,34 @@
       slots: { default: 'businessName' },
     },
     {
+      title: '鍚堝悓绫诲瀷',
+      field: 'contractType',
+      minWidth: 110,
+      cellRender: {
+        name: 'CellDict',
+        props: { type: DICT_TYPE.CRM_CONTRACT_TYPE },
+      },
+    },
+    {
+      title: '鐢靛帇绛夌骇',
+      field: 'voltageLevel',
+      minWidth: 90,
+      cellRender: {
+        name: 'CellDict',
+        props: { type: DICT_TYPE.CRM_VOLTAGE_LEVEL },
+      },
+    },
+    {
+      title: '鍚堝悓瀹归噺',
+      field: 'contractCapacity',
+      minWidth: 100,
+    },
+    {
+      title: '鎸囦护鏁�',
+      field: 'commandCount',
+      minWidth: 80,
+    },
+    {
       title: '鍚堝悓閲戦锛堝厓锛�',
       field: 'totalPrice',
       minWidth: 140,
@@ -409,6 +517,18 @@
       },
     },
     {
+      title: '宸插紑绁ㄩ噾棰濓紙鍏冿級',
+      field: 'totalInvoicePrice',
+      minWidth: 150,
+      formatter: 'formatAmount2',
+    },
+    {
+      title: '鏈紑绁ㄩ噾棰濓紙鍏冿級',
+      field: 'unInvoicePrice',
+      minWidth: 140,
+      formatter: 'formatAmount2',
+    },
+    {
       title: '鏈�鍚庤窡杩涙椂闂�',
       field: 'contactLastTime',
       minWidth: 180,

--
Gitblit v1.9.3