From 6c0b0dd81a98a3163e45f1b5b5417e02af165fd8 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期六, 29 八月 2026 10:04:13 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro2.0' into dev_pro2.0

---
 src/views/mes/pro/feedback/data.ts |  232 +++++++++++++++++----------------------------------------
 1 files changed, 70 insertions(+), 162 deletions(-)

diff --git a/src/views/mes/pro/feedback/data.ts b/src/views/mes/pro/feedback/data.ts
index 80c013d..32056e7 100644
--- a/src/views/mes/pro/feedback/data.ts
+++ b/src/views/mes/pro/feedback/data.ts
@@ -2,6 +2,7 @@
 import type { VxeTableGridOptions } from '#/adapter/vxe-table';
 import type { MesProFeedbackApi } from '#/api/mes/pro/feedback';
 import type { MesProTaskApi } from '#/api/mes/pro/task';
+import type { DescriptionItemSchema } from '#/components/description';
 
 import { h, markRaw } from 'vue';
 
@@ -10,19 +11,21 @@
   MesAutoCodeRuleCode,
   MesProTaskStatusEnum,
   MesProWorkOrderStatusEnum,
-} from '../../../../packages/constants/src';
-import { getDictOptions } from '../../../../packages/effects/hooks/src';
+} from '@vben/constants';
+import { getDictOptions } from '@vben/hooks';
 
 import { Button } from 'ant-design-vue';
 
 import { generateAutoCode } from '#/api/mes/md/autocode/record';
 import { getRouteProcessByRouteAndProcess } from '#/api/mes/pro/route/process';
 import { getSimpleUserList } from '#/api/system/user';
+import { loadParamDetails } from './param-state';
 import { getRangePickerDefaultProps } from '#/utils';
 import { MdItemSelect } from '#/views/mes/md/item/components';
 import { MdWorkstationSelect } from '#/views/mes/md/workstation/components';
 import { ProTaskSelect } from '#/views/mes/pro/task/components';
 import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components';
+import { DictTag } from '#/components/dict-tag';
 
 /** 鐢熶骇鎶ュ伐琛ㄥ崟绫诲瀷 */
 export type FormType = 'approve' | 'create' | 'detail' | 'submit' | 'update';
@@ -32,11 +35,11 @@
   return [
     {
       fieldName: 'code',
-      label: '鎶ュ伐鍗曞彿',
+      label: '鎶ヨ鍗曞彿',
       component: 'Input',
       componentProps: {
         allowClear: true,
-        placeholder: '璇疯緭鍏ユ姤宸ュ崟鍙�',
+        placeholder: '璇疯緭鍏ユ姤璁㈠崟鍙�',
       },
     },
     {
@@ -51,11 +54,11 @@
     },
     {
       fieldName: 'workOrderId',
-      label: '鐢熶骇宸ュ崟',
+      label: '鐢熶骇璁㈠崟',
       component: markRaw(ProWorkOrderSelect),
       componentProps: {
         allowClear: true,
-        placeholder: '璇烽�夋嫨宸ュ崟',
+        placeholder: '璇烽�夋嫨璁㈠崟',
       },
     },
     {
@@ -118,7 +121,7 @@
   return [
     {
       field: 'code',
-      title: '鎶ュ伐鍗曞彿',
+      title: '鎶ヨ鍗曞彿',
       width: 160,
       slots: { default: 'code' },
     },
@@ -133,7 +136,7 @@
     },
     { field: 'workstationName', title: '宸ヤ綔绔�', width: 120 },
     { field: 'processName', title: '宸ュ簭', width: 100 },
-    { field: 'workOrderCode', title: '鐢熶骇宸ュ崟缂栫爜', width: 160 },
+    { field: 'workOrderCode', title: '鐢熶骇璁㈠崟缂栫爜', width: 160 },
     { field: 'itemCode', title: '浜у搧鐗╂枡缂栫爜', width: 120 },
     { field: 'itemName', title: '浜у搧鐗╂枡鍚嶇О', minWidth: 140 },
     { field: 'itemSpecification', title: '瑙勬牸鍨嬪彿', width: 120 },
@@ -171,9 +174,8 @@
  * - create / update锛氬綍鍏ユ姤宸ヤ富浣撲俊鎭拰鏁伴噺
  * - submit / approve / detail锛氫富浣撳瓧娈靛彧璇�
  *
- * 鏁伴噺鍖哄煙鏍规嵁 `checkFlag` 鍜� `unqualifiedQuantity` 鍔ㄦ�佹樉绀猴細
- * - 闈炶川妫�宸ュ簭锛氭姤宸ユ暟閲� = 鍚堟牸 + 涓嶈壇锛涗笉鑹� > 0 鏃跺啀灞曞紑宸ュ簾/鏂欏簾/鍏朵粬搴熷搧
- * - 璐ㄦ宸ュ簭锛氬彧濉姤宸ユ暟閲忥紙瑙嗕负寰呮鏁伴噺锛�
+ * 鎶ュ伐鍙~鍐�"鎶ュ伐鏁伴噺"锛涘悎鏍煎搧/涓嶈壇鍝佹暟閲忕敱璐ㄦ纭畾锛屾姤宸ョ幆鑺備笉閲囬泦銆�
+ * 璐ㄦ宸ュ簭鎶ュ伐鍚庤繘鍏ュ緟妫�楠岋紙uncheckQuantity = 鎶ュ伐鏁伴噺锛夛紝闈炶川妫�宸ュ簭鐩存帴瀹岀粨銆�
  */
 export function useFormSchema(
   formType: FormType,
@@ -209,11 +211,11 @@
     },
     {
       fieldName: 'code',
-      label: '鎶ュ伐鍗曞彿',
+      label: '鎶ヨ鍗曞彿',
       component: 'Input',
       componentProps: {
         disabled: isHeaderReadonly,
-        placeholder: '璇疯緭鍏ユ姤宸ュ崟鍙�',
+        placeholder: '璇疯緭鍏ユ姤璁㈠崟鍙�',
       },
       rules: 'required',
       suffix: () =>
@@ -245,13 +247,13 @@
     },
     {
       fieldName: 'workOrderId',
-      label: '鐢熶骇宸ュ崟',
+      label: '鐢熶骇璁㈠崟',
       component: markRaw(ProWorkOrderSelect),
       componentProps: {
         disabled: isHeaderReadonly,
-        placeholder: '璇烽�夋嫨宸ュ崟',
+        placeholder: '璇烽�夋嫨璁㈠崟',
         status: MesProWorkOrderStatusEnum.CONFIRMED,
-        // 宸ュ崟鍙樻洿锛氭竻绌轰换鍔″強浠诲姟甯﹀嚭鐨勪骇鍝佷俊鎭�佹暟閲忓尯鍩熸帶鍒朵綅
+        // 璁㈠崟鍙樻洿锛氭竻绌轰换鍔″強浠诲姟甯﹀嚭鐨勪骇鍝佷俊鎭�佹暟閲忓尯鍩熸帶鍒朵綅
         onChange: async () => {
           await formApi?.setValues({
             checkFlag: true,
@@ -264,6 +266,7 @@
             taskId: undefined,
             unitMeasureName: undefined,
             workstationId: undefined,
+            reportableQuantity: undefined,
           });
         },
       },
@@ -277,15 +280,16 @@
         triggerFields: ['workOrderId', 'workstationId'],
         componentProps: (values) => ({
           disabled: isHeaderReadonly || !values.workOrderId,
-          placeholder: values.workOrderId ? '璇烽�夋嫨浠诲姟' : '璇峰厛閫夋嫨宸ュ崟',
+          placeholder: values.workOrderId ? '璇烽�夋嫨浠诲姟' : '璇峰厛閫夋嫨璁㈠崟',
           statuses: [MesProTaskStatusEnum.PREPARE],
           workOrderId: values.workOrderId,
           workstationId: values.workstationId,
         }),
       },
-      // 浠诲姟鍙樻洿锛氳嚜鍔ㄥ~鍏呭叧鑱斿瓧娈点�佷骇鍝佷俊鎭�乧heckFlag
+      // 浠诲姟鍙樻洿锛氳嚜鍔ㄥ~鍏呭叧鑱斿瓧娈点�佷骇鍝佷俊鎭�乧heckFlag锛屽苟鍔犺浇浠诲姟缁戝畾鐨勫伐鑹哄弬鏁�
       componentProps: {
         onChange: async (task?: MesProTaskApi.Task) => {
+          await loadParamDetails(task?.id);
           if (!task) {
             return;
           }
@@ -298,6 +302,7 @@
             routeId: task.routeId,
             unitMeasureName: task.unitMeasureName,
             workstationId: task.workstationId,
+            reportableQuantity: task.reportableQuantity,
           });
           // 宸ヨ壓璺嚎宸ュ簭鐨� checkFlag 鍐冲畾鏁伴噺鍖哄煙灞曠ず
           if (task.routeId && task.processId) {
@@ -377,6 +382,20 @@
       },
     },
     {
+      fieldName: 'reportableQuantity',
+      label: '鍙姤宸ユ暟閲�',
+      component: 'InputNumber',
+      componentProps: {
+        class: 'w-full',
+        disabled: true,
+        precision: 2,
+      },
+      dependencies: {
+        triggerFields: ['taskId'],
+        show: (values) => !!values.taskId && ['create', 'update'].includes(formType),
+      },
+    },
+    {
       fieldName: 'feedbackQuantity',
       label: '鎶ュ伐鏁伴噺',
       component: 'InputNumber',
@@ -384,151 +403,9 @@
         class: 'w-full',
         min: 0,
         precision: 2,
-      },
-      dependencies: {
-        triggerFields: ['checkFlag'],
-        // 闈炶川妫�宸ュ簭鏃讹紝鎶ュ伐鏁伴噺 = 鍚堟牸 + 涓嶈壇锛岀鐢ㄧ洿鎺ョ紪杈�
-        componentProps: (values) => ({
-          class: 'w-full',
-          disabled: !values.checkFlag,
-          min: 0,
-          placeholder: '璇疯緭鍏ユ姤宸ユ暟閲�',
-          precision: 2,
-        }),
+        placeholder: '璇疯緭鍏ユ姤宸ユ暟閲�',
       },
       rules: 'required',
-    },
-    {
-      fieldName: 'qualifiedQuantity',
-      label: '鍚堟牸鍝佹暟閲�',
-      component: 'InputNumber',
-      componentProps: {
-        class: 'w-full',
-        min: 0,
-        precision: 2,
-        // 鍚堟牸/涓嶈壇鍙樻洿锛岃嚜鍔ㄧ疮璁′负鎶ュ伐鏁伴噺
-        onChange: async () => {
-          const values = await formApi?.getValues();
-          await formApi?.setFieldValue(
-            'feedbackQuantity',
-            (values?.qualifiedQuantity || 0) +
-              (values?.unqualifiedQuantity || 0),
-          );
-        },
-      },
-      defaultValue: 0,
-      dependencies: {
-        triggerFields: ['checkFlag'],
-        show: (values) => !values.checkFlag,
-      },
-    },
-    {
-      fieldName: 'unqualifiedQuantity',
-      label: '涓嶈壇鍝佹暟閲�',
-      component: 'InputNumber',
-      componentProps: {
-        class: 'w-full',
-        min: 0,
-        precision: 2,
-        // 鍚堟牸/涓嶈壇鍙樻洿锛岃嚜鍔ㄧ疮璁′负鎶ュ伐鏁伴噺
-        onChange: async () => {
-          const values = await formApi?.getValues();
-          await formApi?.setFieldValue(
-            'feedbackQuantity',
-            (values?.qualifiedQuantity || 0) +
-              (values?.unqualifiedQuantity || 0),
-          );
-        },
-      },
-      defaultValue: 0,
-      dependencies: {
-        triggerFields: ['checkFlag'],
-        show: (values) => !values.checkFlag,
-      },
-    },
-    {
-      fieldName: 'laborScrapQuantity',
-      label: '宸ュ簾鏁伴噺',
-      component: 'InputNumber',
-      componentProps: {
-        class: 'w-full',
-        min: 0,
-        precision: 2,
-        // 搴熷搧鍒嗙被鍙樻洿锛岃嚜鍔ㄧ疮璁′负涓嶈壇鍝佹暟閲忓強鎶ュ伐鏁伴噺
-        onChange: async () => {
-          const values = await formApi?.getValues();
-          const unqualified =
-            (values?.laborScrapQuantity || 0) +
-            (values?.materialScrapQuantity || 0) +
-            (values?.otherScrapQuantity || 0);
-          await formApi?.setValues({
-            feedbackQuantity: (values?.qualifiedQuantity || 0) + unqualified,
-            unqualifiedQuantity: unqualified,
-          });
-        },
-      },
-      defaultValue: 0,
-      dependencies: {
-        triggerFields: ['checkFlag', 'unqualifiedQuantity'],
-        show: (values) =>
-          !values.checkFlag && (values.unqualifiedQuantity || 0) > 0,
-      },
-    },
-    {
-      fieldName: 'materialScrapQuantity',
-      label: '鏂欏簾鏁伴噺',
-      component: 'InputNumber',
-      componentProps: {
-        class: 'w-full',
-        min: 0,
-        precision: 2,
-        // 搴熷搧鍒嗙被鍙樻洿锛岃嚜鍔ㄧ疮璁′负涓嶈壇鍝佹暟閲忓強鎶ュ伐鏁伴噺
-        onChange: async () => {
-          const values = await formApi?.getValues();
-          const unqualified =
-            (values?.laborScrapQuantity || 0) +
-            (values?.materialScrapQuantity || 0) +
-            (values?.otherScrapQuantity || 0);
-          await formApi?.setValues({
-            feedbackQuantity: (values?.qualifiedQuantity || 0) + unqualified,
-            unqualifiedQuantity: unqualified,
-          });
-        },
-      },
-      defaultValue: 0,
-      dependencies: {
-        triggerFields: ['checkFlag', 'unqualifiedQuantity'],
-        show: (values) =>
-          !values.checkFlag && (values.unqualifiedQuantity || 0) > 0,
-      },
-    },
-    {
-      fieldName: 'otherScrapQuantity',
-      label: '鍏朵粬搴熷搧',
-      component: 'InputNumber',
-      componentProps: {
-        class: 'w-full',
-        min: 0,
-        precision: 2,
-        // 搴熷搧鍒嗙被鍙樻洿锛岃嚜鍔ㄧ疮璁′负涓嶈壇鍝佹暟閲忓強鎶ュ伐鏁伴噺
-        onChange: async () => {
-          const values = await formApi?.getValues();
-          const unqualified =
-            (values?.laborScrapQuantity || 0) +
-            (values?.materialScrapQuantity || 0) +
-            (values?.otherScrapQuantity || 0);
-          await formApi?.setValues({
-            feedbackQuantity: (values?.qualifiedQuantity || 0) + unqualified,
-            unqualifiedQuantity: unqualified,
-          });
-        },
-      },
-      defaultValue: 0,
-      dependencies: {
-        triggerFields: ['checkFlag', 'unqualifiedQuantity'],
-        show: (values) =>
-          !values.checkFlag && (values.unqualifiedQuantity || 0) > 0,
-      },
     },
     {
       fieldName: 'feedbackUserId',
@@ -554,7 +431,7 @@
         format: 'YYYY-MM-DD HH:mm:ss',
         placeholder: '璇烽�夋嫨鎶ュ伐鏃堕棿',
         showTime: true,
-        valueFormat: 'x',
+        valueFormat: 'YYYY-MM-DD HH:mm:ss',
       },
       rules: 'required',
     },
@@ -585,3 +462,34 @@
     },
   ];
 }
+
+/** 鐢熶骇鎶ュ伐璇︽儏鎽樿 */
+export function useDetailSchema(): DescriptionItemSchema[] {
+  return [
+    { field: 'code', label: '鎶ヨ鍗曞彿' },
+    {
+      field: 'type',
+      label: '鎶ュ伐绫诲瀷',
+      render: (val) =>
+        h(DictTag, { type: DICT_TYPE.MES_PRO_FEEDBACK_TYPE, value: val }),
+    },
+    { field: 'workOrderId', label: '鐢熶骇璁㈠崟', render: (_val, data) => data?.workOrderCode },
+    { field: 'taskId', label: '鐢熶骇浠诲姟', render: (_val, data) => data?.taskCode },
+    { field: 'workstationName', label: '宸ヤ綔绔�' },
+    { field: 'itemCode', label: '浜у搧缂栫爜' },
+    { field: 'itemName', label: '浜у搧鍚嶇О' },
+    { field: 'unitMeasureName', label: '鍗曚綅' },
+    { field: 'itemSpecification', label: '瑙勬牸' },
+    { field: 'reportableQuantity', label: '鍙姤宸ユ暟閲�' },
+    { field: 'feedbackQuantity', label: '鎶ュ伐鏁伴噺' },
+    { field: 'qualifiedQuantity', label: '鍚堟牸鍝佹暟閲�' },
+    { field: 'unqualifiedQuantity', label: '涓嶈壇鍝佹暟閲�' },
+    { field: 'laborScrapQuantity', label: '宸ュ簾鏁伴噺' },
+    { field: 'materialScrapQuantity', label: '鏂欏簾鏁伴噺' },
+    { field: 'otherScrapQuantity', label: '鍏朵粬搴熷搧' },
+    { field: 'feedbackUserNickname', label: '鎶ュ伐浜�' },
+    { field: 'feedbackTime', label: '鎶ュ伐鏃堕棿' },
+    { field: 'approveUserNickname', label: '瀹℃牳浜�' },
+    { field: 'remark', label: '澶囨敞' },
+  ];
+}

--
Gitblit v1.9.3