From bf0ef9e148f2f438b5630c9fc9f6b8943592eeff Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期一, 07 九月 2026 16:55:15 +0800
Subject: [PATCH] fix(排产): 生产状态为已完成的单不再显示0%进度,已完成类型隐藏排产维护按钮

---
 src/views/mes/pro/workorder/data.ts |  242 +++++++++++++++++++-----------------------------
 1 files changed, 96 insertions(+), 146 deletions(-)

diff --git a/src/views/mes/pro/workorder/data.ts b/src/views/mes/pro/workorder/data.ts
index fcac639..de3d920 100644
--- a/src/views/mes/pro/workorder/data.ts
+++ b/src/views/mes/pro/workorder/data.ts
@@ -1,7 +1,7 @@
-锘縤mport type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
+import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
 import type { VxeTableGridOptions } from '#/adapter/vxe-table';
-import type { MesMdProductBomApi } from '#/api/mes/md/item/productBom';
-import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder';
+import { type MesProWorkOrderApi, getWorkOrderApproveProcessList } from '#/api/mes/pro/workorder';
+import { getSimpleRoleList } from '#/api/system/role';
 import type { MesProWorkOrderBomApi } from '#/api/mes/pro/workorder/bom';
 import type { MesProWorkOrderProcessApi } from '#/api/mes/pro/workorder/process';
 
@@ -22,7 +22,6 @@
 import { getRangePickerDefaultProps } from '#/utils';
 import {
   MdItemSelect,
-  MdProductBomSelect,
 } from '#/views/mes/md/item/components';
 import { MdVendorSelect } from '#/views/mes/md/vendor/components';
 
@@ -128,6 +127,10 @@
           }
         },
       },
+      help: (values: { orderSourceType?: number }) =>
+        values.orderSourceType === MesProWorkOrderSourceTypeEnum.ORDER
+          ? '宸查�夊鎴疯鍗曪細闇�琛ュ厖鏉ユ簮鍗曟嵁缂栧彿涓庡鎴凤紝渚夸簬杩芥函璁㈠崟鏉ユ簮銆�'
+          : '鐢ㄤ簬鍖哄垎璁㈠崟涓氬姟褰掑睘锛涢�夈�屽鎴疯鍗曘�嶆椂鎵嶉渶鍏宠仈鏉ユ簮鍗曟嵁涓庡鎴枫��',
       rules: 'selectRequired',
     },
     {
@@ -143,6 +146,7 @@
         show: (values) =>
           values.orderSourceType === MesProWorkOrderSourceTypeEnum.ORDER,
       },
+      help: '濉啓涓婃父鍗曟嵁锛堝閿�鍞鍗曪級鐨勭紪鍙凤紝鐢ㄤ簬杩芥函璇ヨ鍗曠殑鏉ユ簮銆�',
     },
     {
       fieldName: 'type',
@@ -162,6 +166,11 @@
           }
         },
       },
+      help: (values: { type?: number }) =>
+        values.type === MesProWorkOrderTypeEnum.OUTSOURCE ||
+        values.type === MesProWorkOrderTypeEnum.PURCHASE
+          ? '宸查�夊澶�/閲囪喘鐢熶骇锛氶渶鎸囧畾渚涘簲鍟嗭紝濮斿鎶ュ伐涓庡叆搴撳皢鎸夎渚涘簲鍟嗙粨绠椼��'
+          : '鑷惀鐢熶骇鎸夋湰鍗曞伐搴忔帓浜э紱閫夈�屽澶栧姞宸ャ�嶆垨銆岄噰璐敓浜с�嶆椂闇�棰濆鎸囧畾渚涘簲鍟嗐��',
       rules: 'selectRequired',
     },
     {
@@ -172,6 +181,7 @@
         disabled: headerReadonly,
         placeholder: '璇烽�夋嫨浜у搧',
       },
+      help: '閫夋嫨浜у搧鍚庯紝宸ュ簭灏嗚嚜鍔ㄤ粠鍏跺伐鑹鸿矾绾垮甫鍑哄苟鎸夐渶璋冩暣锛涗骇鍝侀渶鍏堝湪銆屽伐鑹烘祦绋嬨�嶄腑閰嶇疆璺嚎涓庢姇鏂� BOM銆�',
       rules: 'selectRequired',
     },
     {
@@ -200,6 +210,7 @@
         show: (values) =>
           values.orderSourceType === MesProWorkOrderSourceTypeEnum.ORDER,
       },
+      help: '鍏宠仈瀹㈡埛鍚庯紝璁㈠崟鍙湪瀹㈡埛缁村害杩芥函骞跺鎺ュ悗缁粨绠椼��',
     },
     {
       fieldName: 'vendorId',
@@ -215,6 +226,7 @@
           values.type === MesProWorkOrderTypeEnum.OUTSOURCE ||
           values.type === MesProWorkOrderTypeEnum.PURCHASE,
       },
+      help: '濮斿/閲囪喘璁㈠崟闇�鎸囧畾渚涘簲鍟嗭紝濮斿鎶ュ伐涓庡叆搴撳潎浠ヨ渚涘簲鍟嗕负鍑嗐��',
     },
     {
       fieldName: 'batchCode',
@@ -234,10 +246,63 @@
         disabled: headerReadonly,
         format: 'YYYY-MM-DD',
         placeholder: '璇烽�夋嫨闇�姹傛棩鏈�',
-        valueFormat: 'x',
+        valueFormat: 'YYYY-MM-DD',
       },
+      help: '棰勮浜や粯/瀹屾垚鏃ユ湡锛岀敤浜庢帓浜с�佽繘搴﹁窡韪笌浜ゆ湡棰勮銆�',
       rules: 'required',
     },
+    // {
+    //   fieldName: 'feedbackRole',
+    //   label: '鎶ュ伐瑙掕壊',
+    //   component: 'ApiSelect',
+    //   componentProps: {
+    //     api: getSimpleRoleList,
+    //     disabled: headerReadonly,
+    //     labelField: 'name',
+    //     valueField: 'code',
+    //     mode: 'multiple',
+    //     placeholder: '璇烽�夋嫨鎶ュ伐瑙掕壊',
+    //   },
+    //   rules: 'selectRequired',
+    // },
+    {
+      fieldName: 'feedbackApprove',
+      label: '鏄惁鎶ュ伐瀹℃壒',
+      component: 'Switch',
+      componentProps: {
+        class: '!w-auto',
+        checkedChildren: '鏄�',
+        unCheckedChildren: '鍚�',
+        disabled: headerReadonly,
+      },
+      defaultValue: false,
+      help: '寮�鍚悗锛岀敓浜ф姤宸ユ彁浜ら渶缁忓鎵归�氳繃鎵嶈鍏ヤ骇閲忥紱鍏抽棴鍒欐姤宸ョ洿鎺ョ敓鏁堛��',
+      rules: 'required',
+    },
+    {
+      fieldName: 'processDefinitionKey',
+      label: '瀹℃壒娴佺▼',
+      component: 'ApiSelect',
+      componentProps: {
+        api: getWorkOrderApproveProcessList,
+        disabled: headerReadonly,
+        labelField: 'name',
+        valueField: 'key',
+        placeholder: '璇烽�夋嫨瀹℃壒娴佺▼',
+      },
+      dependencies: {
+        triggerFields: ['feedbackApprove'],
+        show: (values) => !!values.feedbackApprove,
+        rules(values) {
+          if (values.feedbackApprove) {
+            return 'selectRequired';
+          }
+          return undefined;
+        },
+      },
+      help: '閫夋嫨鎶ュ伐鎻愪氦鍚庤蛋鐨勫鎵规祦绋嬶紱娴佺▼闇�鍏堝湪绯荤粺銆屾祦绋嬬鐞嗐�嶄腑閮ㄧ讲锛屼粎銆屾姤宸ュ鎵广�嶇被娴佺▼鍙�夈��',
+    },
+
     {
       fieldName: 'remark',
       label: '澶囨敞',
@@ -415,6 +480,27 @@
       },
     },
     {
+      field: 'productionStatus',
+      title: '鐢熶骇鐘舵��',
+      width: 100,
+      cellRender: {
+        name: 'CellDict',
+        props: { type: DICT_TYPE.ORDER_PRODUCTION_STATUS },
+      },
+    },
+    {
+      field: 'processProgressList',
+      title: '宸ュ簭鐢熶骇杩涘害',
+      width: 350,
+      slots: { default: 'processProgressList' },
+    },
+    {
+      field: 'completionProgress',
+      title: '瀹屾垚杩涘害',
+      width: 200,
+      slots: { default: 'completionProgress' },
+    },
+    {
       field: 'createTime',
       title: '鍒涘缓鏃堕棿',
       width: 180,
@@ -425,137 +511,6 @@
       width: 240,
       fixed: 'right',
       slots: { default: 'actions' },
-    },
-  ];
-}
-
-/** 璁㈠崟 BOM 瀛愯〃鐨勫瓧娈� */
-export function useBomGridColumns(
-  editable: boolean,
-  generatable: boolean,
-): VxeTableGridOptions<MesProWorkOrderBomApi.WorkOrderBom>['columns'] {
-  return [
-    {
-      field: 'itemCode',
-      title: 'BOM 鐗╂枡缂栫爜',
-      width: 120,
-    },
-    {
-      field: 'itemName',
-      title: 'BOM 鐗╂枡鍚嶇О',
-      minWidth: 150,
-    },
-    {
-      field: 'itemSpecification',
-      title: '瑙勬牸鍨嬪彿',
-      width: 120,
-    },
-    {
-      field: 'unitMeasureName',
-      title: '鍗曚綅',
-      width: 80,
-    },
-    {
-      field: 'itemOrProduct',
-      title: '鐗╂枡/浜у搧',
-      width: 100,
-      cellRender: {
-        name: 'CellDict',
-        props: { type: DICT_TYPE.MES_MD_ITEM_OR_PRODUCT },
-      },
-    },
-    {
-      field: 'quantity',
-      title: '棰勮浣跨敤閲�',
-      width: 120,
-    },
-    {
-      field: 'remark',
-      title: '澶囨敞',
-      minWidth: 120,
-    },
-    ...(editable || generatable
-      ? [
-          {
-            title: '鎿嶄綔',
-            width: 160,
-            fixed: 'right',
-            slots: { default: 'actions' },
-          } as const,
-        ]
-      : []),
-  ];
-}
-
-/** 璁㈠崟 BOM 鏂板/淇敼鐨勮〃鍗� */
-export function useBomFormSchema(
-  isCreate: boolean,
-  productId?: number,
-  formApi?: VbenFormApi,
-): VbenFormSchema[] {
-  return [
-    {
-      fieldName: 'itemId',
-      label: '鐗╂枡',
-      component: markRaw(MdProductBomSelect),
-      componentProps: {
-        itemId: productId,
-        placeholder: '璇烽�夋嫨鐗╂枡',
-        // BOM 鐗╂枡閫変腑鍚庤嚜鍔ㄥ洖濉璁′娇鐢ㄩ噺
-        onChange: async (bom?: MesMdProductBomApi.ProductBom) => {
-          await formApi?.setFieldValue('quantity', bom?.quantity ?? undefined);
-        },
-      },
-      rules: 'selectRequired',
-      dependencies: {
-        triggerFields: [''],
-        show: () => isCreate,
-      },
-    },
-    {
-      fieldName: 'itemName',
-      label: '鐗╂枡',
-      component: 'Input',
-      componentProps: {
-        disabled: true,
-      },
-      dependencies: {
-        triggerFields: [''],
-        show: () => !isCreate,
-      },
-    },
-    {
-      fieldName: 'unitMeasureName',
-      label: '鍗曚綅',
-      component: 'Input',
-      componentProps: {
-        disabled: true,
-      },
-      dependencies: {
-        triggerFields: [''],
-        show: () => !isCreate,
-      },
-    },
-    {
-      fieldName: 'quantity',
-      label: '棰勮浣跨敤閲�',
-      component: 'InputNumber',
-      componentProps: {
-        class: '!w-full',
-        min: 0,
-        placeholder: '璇疯緭鍏ラ璁′娇鐢ㄩ噺',
-        precision: 2,
-      },
-      rules: 'required',
-    },
-    {
-      fieldName: 'remark',
-      label: '澶囨敞',
-      component: 'Textarea',
-      componentProps: {
-        placeholder: '璇疯緭鍏ュ娉�',
-        rows: 3,
-      },
     },
   ];
 }
@@ -747,7 +702,6 @@
             field: 'drag',
             title: '',
             width: 40,
-            fixed: 'left',
             slots: { default: 'dragHandle' },
           } as const,
         ]
@@ -755,6 +709,7 @@
     {
       type: 'expand',
       width: 50,
+      slots: { content: 'expand_content' },
     } as const,
     {
       field: 'sort',
@@ -819,14 +774,9 @@
       slots: { default: 'backflushFlag' },
     },
     {
-      field: 'outputItemCode',
-      title: '浜у嚭鐗╂枡缂栫爜',
-      width: 120,
-    },
-    {
-      field: 'outputItemName',
-      title: '浜у嚭鐗╂枡鍚嶇О',
-      width: 120,
+      field: 'outputItemNames',
+      title: '浜у嚭鐗╂枡',
+      width: 160,
     },
     {
       field: 'remark',
@@ -835,7 +785,7 @@
     },
     {
       title: '鎿嶄綔',
-      width: 120,
+      width: 200,
       fixed: 'right',
       slots: { default: 'actions' },
     },

--
Gitblit v1.9.3