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

---
 src/views/crm/contract/data.ts |  219 ++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 192 insertions(+), 27 deletions(-)

diff --git a/src/views/crm/contract/data.ts b/src/views/crm/contract/data.ts
index e9ac060..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,26 @@
     {
       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,
+      },
+    },
+    {
+      fieldName: 'orderDate',
+      label: '涓嬪崟鏃ユ湡',
+      component: 'DatePicker',
+      rules: 'required',
+      componentProps: {
+        showTime: false,
+        format: 'YYYY-MM-DD',
+        valueFormat: 'YYYY-MM-DD',
+        placeholder: '璇烽�夋嫨涓嬪崟鏃ユ湡',
       },
     },
     {
@@ -77,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: [],
@@ -101,25 +124,13 @@
       },
     },
     {
-      fieldName: 'orderDate',
-      label: '涓嬪崟鏃ユ湡',
-      component: 'DatePicker',
-      rules: 'required',
-      componentProps: {
-        showTime: false,
-        format: 'YYYY-MM-DD',
-        valueFormat: 'x',
-        placeholder: '璇烽�夋嫨涓嬪崟鏃ユ湡',
-      },
-    },
-    {
       fieldName: 'startTime',
       label: '鍚堝悓寮�濮嬫椂闂�',
       component: 'DatePicker',
       componentProps: {
         showTime: false,
         format: 'YYYY-MM-DD',
-        valueFormat: 'x',
+        valueFormat: 'YYYY-MM-DD',
         placeholder: '璇烽�夋嫨鍚堝悓寮�濮嬫椂闂�',
       },
     },
@@ -130,9 +141,21 @@
       componentProps: {
         showTime: false,
         format: 'YYYY-MM-DD',
-        valueFormat: 'x',
+        valueFormat: 'YYYY-MM-DD',
         placeholder: '璇烽�夋嫨鍚堝悓缁撴潫鏃堕棿',
       },
+    },
+    {
+      fieldName: 'depositPrice',
+      label: '瀹氶噾閲戦锛堝厓锛�',
+      component: 'InputNumber',
+      componentProps: {
+        class: '!w-full',
+        min: 0,
+        precision: 2,
+        placeholder: '璇疯緭鍏ュ畾閲戦噾棰�',
+      },
+      rules: z.number().min(0).optional(),
     },
     {
       fieldName: 'signUserId',
@@ -175,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: '璇疯緭鍏ョ即璐瑰懆鏈�',
       },
     },
     {
@@ -268,12 +363,35 @@
     {
       fieldName: 'customerId',
       label: '瀹㈡埛',
-      component: 'ApiSelect',
+      component: markRaw(CrmCustomerSelect),
       componentProps: {
-        api: getCustomerSimpleList,
-        labelField: 'name',
-        valueField: 'id',
         placeholder: '璇烽�夋嫨瀹㈡埛',
+        allowClear: true,
+      },
+    },
+    {
+      fieldName: 'auditStatus',
+      label: '鍚堝悓鐘舵��',
+      component: 'Select',
+      componentProps: {
+        options: [
+          { label: '鏈彁浜�', value: 0 },
+          { label: '瀹℃壒涓�', value: 10 },
+          { label: '瀹℃牳閫氳繃', value: 20 },
+          { label: '瀹℃牳涓嶉�氳繃', value: 30 },
+          { label: '宸插彇娑�', value: 40 },
+          { label: '宸蹭綔搴�', value: 50 },
+        ],
+        placeholder: '璇烽�夋嫨鍚堝悓鐘舵��',
+        allowClear: true,
+      },
+    },
+    {
+      fieldName: 'orderNo',
+      label: '鍏宠仈璁㈠崟',
+      component: 'Input',
+      componentProps: {
+        placeholder: '璇疯緭鍏ヨ鍗曞彿',
         allowClear: true,
       },
     },
@@ -287,6 +405,7 @@
       field: 'no',
       minWidth: 180,
       fixed: 'left',
+      slots: { default: 'no' },
     },
     {
       title: '鍚堝悓鍚嶇О',
@@ -308,8 +427,42 @@
       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,
+      formatter: 'formatAmount2',
+    },
+    {
+      title: '瀹氶噾閲戦锛堝厓锛�',
+      field: 'depositPrice',
       minWidth: 140,
       formatter: 'formatAmount2',
     },
@@ -364,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