From 889d8ddf4c13c1b1bdbabd04c2d80b904020151e Mon Sep 17 00:00:00 2001
From: hsy <1029150275@qq.com>
Date: 星期三, 19 八月 2026 12:49:24 +0800
Subject: [PATCH] 生产订单与报工模块改造汇总 (Git Commit 文档) feat(mes-pro): 生产订单及报工模块审批流与批次填报改造 1. 生产订单功能增强 (Work Order)

---
 src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue |   76 ++++++++++++++++++++++++++++++++------
 1 files changed, 64 insertions(+), 12 deletions(-)

diff --git a/src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue b/src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue
index 7ec016e..0372990 100644
--- a/src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue
+++ b/src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue
@@ -3,12 +3,14 @@
 import type { MesProFeedbackApi } from '#/api/mes/pro/feedback';
 
 import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
+import { useRouter } from 'vue-router';
 
 import {
   DICT_TYPE,
   MesProFeedbackStatusEnum,
 } from '@vben/constants';
 import { useVbenModal } from '@vben/common-ui';
+import { useAccess } from '@vben/access';
 
 import { Button, message, Popconfirm, Space } from 'ant-design-vue';
 
@@ -16,6 +18,7 @@
 import {
   approveFeedback,
   deleteFeedback,
+  getBatchRequirements,
   getFeedbackPage,
   rejectFeedback,
   submitFeedback,
@@ -23,6 +26,7 @@
 import { $t } from '#/locales';
 
 import FeedbackForm from '../../../pro/feedback/modules/form.vue';
+import BatchInputDialog from '../../../pro/feedback/modules/batch-input-dialog.vue';
 
 defineOptions({ name: 'WorkbenchFeedbackHistoryTab' });
 
@@ -39,6 +43,22 @@
   destroyOnClose: true,
 });
 
+const { hasAccessByCodes } = useAccess();
+const router = useRouter();
+
+const batchDialogRef = ref<InstanceType<typeof BatchInputDialog>>();
+const approvingRow = ref<MesProFeedbackApi.Feedback>();
+
+/** 鎵ц瀹℃壒锛堝惈鎵规灞炴�э級 */
+async function doApprove(row: MesProFeedbackApi.Feedback, batchFields?: Record<string, unknown>) {
+  const finished = await approveFeedback({ id: row.id!, ...batchFields });
+  message.success(
+    finished ? '鎶ュ伐鍗曞凡瀹℃壒瀹屾垚' : '鎶ュ伐鎴愬姛锛岃绛夊緟璐ㄩ噺妫�楠屽畬鎴愶紒',
+  );
+  refreshGrid();
+  emit('reported');
+}
+
 /** 鏌ョ湅璇︽儏 */
 function handleDetail(row: MesProFeedbackApi.Feedback) {
   formModalApi.setData({ formType: 'detail', id: row.id }).open();
@@ -46,7 +66,7 @@
 
 /** 缂栬緫锛堜粎鑽夌锛� */
 function handleEdit(row: MesProFeedbackApi.Feedback) {
-  formModalApi.setData({ formType: 'update', id: row.id }).open();
+  formModalApi.setData({ formType: 'update', id: row.id, showSubmitButton: false }).open();
 }
 
 /** 鍒犻櫎锛堜粎鑽夌锛� */
@@ -59,7 +79,7 @@
 
 /** 鎻愪氦锛堜粎鑽夌锛� */
 async function handleSubmit(row: MesProFeedbackApi.Feedback) {
-  await submitFeedback(row.id!);
+  await submitFeedback({ id: row.id! });
   message.success('鎶ュ伐鍗曞凡鎻愪氦');
   refreshGrid();
   emit('reported');
@@ -67,12 +87,24 @@
 
 /** 瀹℃壒閫氳繃锛堜粎瀹℃壒涓級 */
 async function handleApprove(row: MesProFeedbackApi.Feedback) {
-  const finished = await approveFeedback(row.id!);
-  message.success(
-    finished ? '鎶ュ伐鍗曞凡瀹℃壒瀹屾垚' : '鎶ュ伐鎴愬姛锛岃绛夊緟璐ㄩ噺妫�楠屽畬鎴愶紒',
-  );
-  refreshGrid();
-  emit('reported');
+  try {
+    const checkResult = await getBatchRequirements(row.id!);
+    if (checkResult?.needBatchInput) {
+      approvingRow.value = row;
+      batchDialogRef.value?.open({ checkResult });
+    } else {
+      await doApprove(row);
+    }
+  } catch {
+    await doApprove(row);
+  }
+}
+
+/** 鎵规寮圭獥纭鍥炶皟 */
+function handleBatchConfirm(batchData: Record<string, unknown>) {
+  if (approvingRow.value) {
+    doApprove(approvingRow.value, batchData);
+  }
 }
 
 /** 椹冲洖锛堜粎瀹℃壒涓級 */
@@ -81,6 +113,15 @@
   message.success('鎶ュ伐鍗曞凡椹冲洖');
   refreshGrid();
   emit('reported');
+}
+
+/** 鏌ョ湅瀹℃壒璇︽儏 */
+function handleViewProcess(row: MesProFeedbackApi.Feedback) {
+  if (!row.processInstanceId) {
+    message.warning('璇ユ姤宸ュ皻鏈彁浜ゅ鎵�');
+    return;
+  }
+  router.push({ path: '/bpm/process-instance/detail', query: { id: row.processInstanceId } });
 }
 
 /** 鐘舵�佸父閲忎緵妯℃澘浣跨敤 */
@@ -100,7 +141,7 @@
         width: 160,
         slots: { default: 'code' },
       },
-      { field: 'workOrderCode', title: '宸ュ崟缂栫爜', width: 140 },
+      { field: 'taskCode', title: '浠诲姟缂栫爜', width: 140 },
       { field: 'processName', title: '宸ュ簭', width: 100 },
       { field: 'itemName', title: '浜у搧', minWidth: 120 },
       { field: 'feedbackQuantity', title: '鎶ュ伐鏁伴噺', width: 100 },
@@ -202,6 +243,7 @@
 <template>
   <div class="feedback-history-tab">
     <FormModal @success="refreshGrid" />
+    <BatchInputDialog ref="batchDialogRef" @confirm="handleBatchConfirm" />
 
     <div v-if="!taskId" class="feedback-history-tab__empty">
       璇蜂粠宸︿晶宸ュ崟鍒楄〃閫夋嫨涓�鏉′换鍔℃煡鐪嬫姤宸ヨ褰�
@@ -246,9 +288,18 @@
                 鍒犻櫎
               </Button>
             </Popconfirm>
-            <!-- 瀹℃壒涓細瀹℃壒閫氳繃銆侀┏鍥� -->
-            <Popconfirm
+            <!-- 瀹℃壒涓細鏌ョ湅瀹℃壒 -->
+            <Button
               v-if="row.status === STATUS_APPROVING"
+              type="link"
+              size="small"
+              @click="handleViewProcess(row)"
+            >
+              鏌ョ湅瀹℃壒
+            </Button>
+            <!-- 
+            <Popconfirm
+              v-if="row.status === STATUS_APPROVING && hasAccessByCodes(['mes:pro-feedback:approve'])"
               title="纭瀹℃壒閫氳繃璇ユ姤宸ュ崟锛�"
               @confirm="handleApprove(row)"
             >
@@ -257,7 +308,7 @@
               </Button>
             </Popconfirm>
             <Popconfirm
-              v-if="row.status === STATUS_APPROVING"
+              v-if="row.status === STATUS_APPROVING && hasAccessByCodes(['mes:pro-feedback:approve'])"
               title="纭椹冲洖璇ユ姤宸ュ崟锛�"
               @confirm="handleReject(row)"
             >
@@ -265,6 +316,7 @@
                 椹冲洖
               </Button>
             </Popconfirm>
+            -->
           </Space>
         </template>
       </Grid>

--
Gitblit v1.9.3