From 08bb5d242135e2c1f0fc17d2b5f7ae548275a3a2 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 28 八月 2026 17:15:33 +0800
Subject: [PATCH] feat(mes): 实现临时码预生成和补录功能

---
 src/views/mes/pro/bagCode/index.vue |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/views/mes/pro/bagCode/index.vue b/src/views/mes/pro/bagCode/index.vue
index 910602c..58621ab 100644
--- a/src/views/mes/pro/bagCode/index.vue
+++ b/src/views/mes/pro/bagCode/index.vue
@@ -14,11 +14,13 @@
     exportBagCodeExcel,
     exportBagQr,
     getBagCodePage,
+    bindBagCodeBatch,
     unbindBagCodePallet,
   } from "#/api/mes/pro/bagCode";
   import { $t } from "#/locales";
 
   import { useGridColumns, useGridFormSchema } from "./data";
+  import BindBatchModal from "./modules/bind-batch.vue";
   import BindPalletModal from "./modules/bind-pallet.vue";
   import GenerateModal from "./modules/generate-form.vue";
   import ReplaceModal from "./modules/replace-form.vue";
@@ -28,6 +30,11 @@
 
   const [GenerateFormModal, generateFormModalApi] = useVbenModal({
     connectedComponent: GenerateModal,
+    destroyOnClose: true,
+  });
+
+  const [BindBatchFormModal, bindBatchFormModalApi] = useVbenModal({
+    connectedComponent: BindBatchModal,
     destroyOnClose: true,
   });
 
@@ -178,10 +185,25 @@
       .open();
   }
 
+  /** 鎵归噺褰曞叆鐢熶骇鎵规 */
+  function handleBindBatch() {
+    const records = getSelectedRecords();
+    if (!records) return;
+    if (records.some((record) => record.status !== MesProBagCodeStatusEnum.GENERATED || record.batchId)) {
+      message.warning("璇烽�夋嫨鏈綍鍏ユ壒娆′笖鐘舵�佷负宸茬敓鎴愮殑琚嬬爜");
+      return;
+    }
+    bindBatchFormModalApi.setData({ ids: records.map((record) => record.id!) }).open();
+  }
+
   /** 鎵归噺缁戝畾鎵樼洏 */
   function handleBindPallet() {
     const records = getSelectedRecords();
     if (!records) return;
+    if (records.some((record) => !record.batchId)) {
+      message.warning("璇峰厛褰曞叆鐢熶骇鎵规锛屽啀缁戝畾鎵樼洏");
+      return;
+    }
     const batchIds = new Set(records.map((record) => record.batchId));
     if (batchIds.size > 1) {
       message.warning("璇烽�夋嫨鍚屼竴鎵规涓嬬殑琚嬬爜杩涜缁戝畾");
@@ -281,6 +303,7 @@
 <template>
   <Page auto-content-height>
     <GenerateFormModal @success="handleRefresh" />
+    <BindBatchFormModal @success="handleRefresh" />
     <BindPalletFormModal @success="handleRefresh" />
     <ReplaceFormModal @success="handleReplaceSuccess" />
     <QrTraceQueryModal />
@@ -295,6 +318,12 @@
               onClick: handleGenerate,
             },
             {
+              label: '褰曞叆鎵规',
+              type: 'primary',
+              auth: ['mes:pro-bag-code:update'],
+              onClick: handleBindBatch,
+            },
+            {
               label: '缁戝畾鎵樼洏',
               type: 'primary',
               auth: ['mes:pro-bag-code:update'],

--
Gitblit v1.9.3