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/mes/pd/ctc/data.ts |  262 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 262 insertions(+), 0 deletions(-)

diff --git a/src/views/mes/pd/ctc/data.ts b/src/views/mes/pd/ctc/data.ts
new file mode 100644
index 0000000..324297c
--- /dev/null
+++ b/src/views/mes/pd/ctc/data.ts
@@ -0,0 +1,262 @@
+import type { VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { MesPdCtcApi } from '#/api/mes/pd/ctc';
+
+import { markRaw } from 'vue';
+
+import { DICT_TYPE } from '@vben/constants';
+import { getDictOptions } from '@vben/hooks';
+
+import { MdItemSelect } from '#/views/mes/md/item/components';
+
+/** 琛ㄥ崟绫诲瀷 */
+export type FormType = 'create' | 'detail' | 'update';
+
+/** 鏂板/淇敼鎹綅瀵肩嚎浜у搧鎶�鏈弬鏁� */
+export function useFormSchema(): VbenFormSchema[] {
+  return [
+    {
+      fieldName: 'id',
+      component: 'Input',
+      dependencies: {
+        triggerFields: [''],
+        show: () => false,
+      },
+    },
+    {
+      fieldName: 'itemId',
+      label: '鐗╂枡',
+      component: markRaw(MdItemSelect),
+      componentProps: {
+        placeholder: '璇烽�夋嫨鎹綅瀵肩嚎鐗╂枡',
+      },
+      rules: 'selectRequired',
+    },
+    {
+      fieldName: 'orderSpec',
+      label: '璁㈣揣瑙勬牸',
+      component: 'Input',
+      componentProps: {
+        placeholder: '璇疯緭鍏ヨ璐ц鏍�',
+      },
+    },
+    {
+      fieldName: 'bareConductorSpec',
+      label: '瑁稿绾胯鏍�',
+      component: 'Input',
+      componentProps: {
+        placeholder: '璇疯緭鍏ヨ8瀵肩嚎瑙勬牸',
+      },
+    },
+    {
+      fieldName: 'enameledSpec',
+      label: '婕嗗寘绾胯鏍�',
+      component: 'Input',
+      componentProps: {
+        placeholder: '璇疯緭鍏ユ紗鍖呯嚎瑙勬牸',
+      },
+    },
+    {
+      fieldName: 'transpositionSpec',
+      label: '鎹綅瑙勬牸',
+      component: 'Input',
+      componentProps: {
+        placeholder: '璇疯緭鍏ユ崲浣嶈鏍�',
+      },
+    },
+    {
+      fieldName: 'conductorType',
+      label: '瀵间綋绫诲瀷',
+      component: 'Select',
+      componentProps: {
+        allowClear: true,
+        options: getDictOptions(DICT_TYPE.PRODUCT_CONDUCTOR_TYPE, 'string'),
+        placeholder: '璇烽�夋嫨瀵间綋绫诲瀷',
+      },
+    },
+    {
+      fieldName: 'crossSection',
+      label: '鎴潰绉�(mm虏)',
+      component: 'InputNumber',
+      componentProps: {
+        class: '!w-full',
+        min: 0,
+        precision: 2,
+        placeholder: '璇疯緭鍏ユ埅闈㈢Н',
+      },
+    },
+    {
+      fieldName: 'outerDiameter',
+      label: '澶栧緞(mm)',
+      component: 'InputNumber',
+      componentProps: {
+        class: '!w-full',
+        min: 0,
+        precision: 2,
+        placeholder: '璇疯緭鍏ュ寰�',
+      },
+    },
+    {
+      fieldName: 'resistance20c',
+      label: '20鈩冪洿娴佺數闃�(惟/km)',
+      component: 'InputNumber',
+      componentProps: {
+        class: '!w-full',
+        min: 0,
+        precision: 6,
+        placeholder: '璇疯緭鍏�20鈩冪洿娴佺數闃�',
+      },
+    },
+    {
+      fieldName: 'wrappingAngle',
+      label: '缁曞寘瑙掑害(掳)',
+      component: 'InputNumber',
+      componentProps: {
+        class: '!w-full',
+        min: 0,
+        precision: 2,
+        placeholder: '璇疯緭鍏ョ粫鍖呰搴�',
+      },
+    },
+    {
+      fieldName: 'insulationThickness',
+      label: '缁濈紭鍘氬害(mm)',
+      component: 'InputNumber',
+      componentProps: {
+        class: '!w-full',
+        min: 0,
+        precision: 2,
+        placeholder: '璇疯緭鍏ョ粷缂樺帤搴�',
+      },
+    },
+    {
+      fieldName: 'ratedVoltage',
+      label: '棰濆畾鐢靛帇(kV)',
+      component: 'Input',
+      componentProps: {
+        placeholder: '璇疯緭鍏ラ瀹氱數鍘�',
+      },
+    },
+    {
+      fieldName: 'testVoltage',
+      label: '璇曢獙鐢靛帇(kV)',
+      component: 'Input',
+      componentProps: {
+        placeholder: '璇疯緭鍏ヨ瘯楠岀數鍘�',
+      },
+    },
+    {
+      fieldName: 'minBendingRadius',
+      label: '鏈�灏忓集鏇插崐寰�(mm)',
+      component: 'InputNumber',
+      componentProps: {
+        class: '!w-full',
+        min: 0,
+        precision: 2,
+        placeholder: '璇疯緭鍏ユ渶灏忓集鏇插崐寰�',
+      },
+    },
+    {
+      fieldName: 'weightPerKm',
+      label: '姣忓叕閲岄噸閲�(kg/km)',
+      component: 'InputNumber',
+      componentProps: {
+        class: '!w-full',
+        min: 0,
+        precision: 2,
+        placeholder: '璇疯緭鍏ユ瘡鍏噷閲嶉噺',
+      },
+    },
+    {
+      fieldName: 'standardCode',
+      label: '鎵ц鏍囧噯',
+      component: 'Input',
+      componentProps: {
+        placeholder: '璇疯緭鍏ユ墽琛屾爣鍑嗕唬鍙�',
+      },
+    },
+    {
+      fieldName: 'remark',
+      label: '澶囨敞',
+      component: 'Textarea',
+      formItemClass: 'col-span-3',
+      componentProps: {
+        placeholder: '璇疯緭鍏ュ娉�',
+        rows: 2,
+      },
+    },
+  ];
+}
+
+/** 鍒楄〃鐨勬悳绱㈣〃鍗� */
+export function useGridFormSchema(): VbenFormSchema[] {
+  return [
+    {
+      fieldName: 'itemId',
+      label: '鐗╂枡',
+      component: markRaw(MdItemSelect),
+      componentProps: {
+        allowClear: true,
+        placeholder: '璇烽�夋嫨鎹綅瀵肩嚎鐗╂枡',
+      },
+    },
+    {
+      fieldName: 'orderSpec',
+      label: '璁㈣揣瑙勬牸',
+      component: 'Input',
+      componentProps: {
+        allowClear: true,
+        placeholder: '璇疯緭鍏ヨ璐ц鏍�',
+      },
+    },
+    {
+      fieldName: 'conductorType',
+      label: '瀵间綋绫诲瀷',
+      component: 'Select',
+      componentProps: {
+        allowClear: true,
+        options: getDictOptions(DICT_TYPE.PRODUCT_CONDUCTOR_TYPE, 'string'),
+        placeholder: '璇烽�夋嫨瀵间綋绫诲瀷',
+      },
+    },
+  ];
+}
+
+/** 鍒楄〃鐨勫瓧娈� */
+export function useGridColumns(): VxeTableGridOptions<MesPdCtcApi.Ctc>['columns'] {
+  return [
+    { field: 'itemName', title: '鐗╂枡鍚嶇О', minWidth: 140 },
+    { field: 'itemCode', title: '鐗╂枡缂栫爜', minWidth: 120 },
+    { field: 'orderSpec', title: '璁㈣揣瑙勬牸', minWidth: 140 },
+    { field: 'transpositionSpec', title: '鎹綅瑙勬牸', minWidth: 120 },
+    {
+      field: 'conductorType',
+      title: '瀵间綋绫诲瀷',
+      width: 100,
+      cellRender: {
+        name: 'CellDict',
+        props: { type: DICT_TYPE.PRODUCT_CONDUCTOR_TYPE },
+      },
+    },
+    { field: 'crossSection', title: '鎴潰绉�(mm虏)', width: 110 },
+    { field: 'outerDiameter', title: '澶栧緞(mm)', width: 100 },
+    { field: 'resistance20c', title: '20鈩冪數闃�(惟/km)', width: 140 },
+    { field: 'wrappingAngle', title: '缁曞寘瑙掑害(掳)', width: 110 },
+    { field: 'ratedVoltage', title: '棰濆畾鐢靛帇(kV)', width: 110 },
+    { field: 'standardCode', title: '鎵ц鏍囧噯', minWidth: 140 },
+    {
+      field: 'createTime',
+      title: '鍒涘缓鏃堕棿',
+      width: 170,
+      formatter: 'formatDateTime',
+    },
+    {
+      title: '鎿嶄綔',
+      width: 220,
+      fixed: 'right',
+      slots: {
+        default: 'actions',
+      },
+    },
+  ];
+}

--
Gitblit v1.9.3