From ee7ac8df8bce38add1f75baf876b49de94b9e00a Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期五, 16 十月 2026 17:58:33 +0800
Subject: [PATCH] feat(mes): 赋码管理绑定托盘支持未录入批次的袋码

---
 src/components/table-action/table-action.vue |   84 +++++++++++++++++++++++------------------
 1 files changed, 47 insertions(+), 37 deletions(-)

diff --git a/src/components/table-action/table-action.vue b/src/components/table-action/table-action.vue
index f813c12..724e62c 100644
--- a/src/components/table-action/table-action.vue
+++ b/src/components/table-action/table-action.vue
@@ -6,15 +6,16 @@
 
 import { computed, unref, watch } from 'vue';
 
-import { useAccess } from '..\..\packages\effects\access\src';
-import { IconifyIcon } from '..\..\packages\icons\src';
-import { $t } from '..\..\packages\locales\src';
-import { isBoolean, isFunction } from '..\..\packages\utils\src';
+import { useAccess } from '@vben/access';
+import { IconifyIcon } from '@vben/icons';
+import { $t } from '@vben/locales';
+import { isBoolean, isFunction } from '@vben/utils';
 
 import {
   Button,
   Dropdown,
   Menu,
+  Modal,
   Popconfirm,
   Space,
   Tooltip,
@@ -36,6 +37,10 @@
   divider: {
     type: Boolean,
     default: true,
+  },
+  dropdownTrigger: {
+    type: Array as PropType<('click' | 'hover' | 'contextmenu')[]>,
+    default: () => ['hover'],
   },
 });
 
@@ -97,6 +102,8 @@
     attrs.onCancel = popConfirm.cancel;
   }
 
+  // 涓嶈缃� getPopupContainer锛岃瀹冮粯璁ゆ寕杞藉埌 body锛岄伩鍏嶈閬尅
+
   return attrs;
 }
 
@@ -120,7 +127,23 @@
 /** 澶勭悊鑿滃崟鐐瑰嚮 */
 function handleMenuClick(e: any) {
   const action = getDropdownList.value[e.key];
-  if (action && action.onClick && isFunction(action.onClick)) {
+  if (!action) {
+    return;
+  }
+  const popConfirm = action.popConfirm;
+  if (popConfirm) {
+    // 涓嬫媺鑿滃崟椤逛細琚� Dropdown 鑷姩鍏抽棴閿�姣侊紝宓屽 Popconfirm 鏃犳硶寮瑰嚭锛�
+    // 鏁呮敼鐢ㄥ懡浠ゅ紡 Modal.confirm 瀹屾垚纭
+    Modal.confirm({
+      title: popConfirm.title,
+      okText: popConfirm.okText,
+      cancelText: popConfirm.cancelText,
+      onOk: popConfirm.confirm ? () => popConfirm.confirm!() : undefined,
+      onCancel: popConfirm.cancel ? () => popConfirm.cancel!() : undefined,
+    });
+    return;
+  }
+  if (action.onClick && isFunction(action.onClick)) {
     action.onClick();
   }
 }
@@ -184,7 +207,7 @@
       </template>
     </Space>
 
-    <Dropdown v-if="getDropdownList.length > 0" :trigger="['hover']">
+    <Dropdown v-if="getDropdownList.length > 0" :trigger="dropdownTrigger">
       <slot name="more">
         <Button type="link">
           <template #icon>
@@ -199,39 +222,20 @@
             v-for="(action, index) in getDropdownList"
             :key="index"
             :disabled="action.disabled"
-            @click="!action.popConfirm && handleMenuClick({ key: index })"
+            @click="handleMenuClick({ key: index })"
           >
-            <template v-if="action.popConfirm">
-              <Popconfirm v-bind="getPopConfirmProps(action.popConfirm)">
-                <template v-if="action.popConfirm.icon" #icon>
-                  <IconifyIcon :icon="action.popConfirm.icon" />
-                </template>
-                <div
-                  :class="
-                    action.disabled === true
-                      ? 'cursor-not-allowed text-gray-300'
-                      : ''
-                  "
-                >
-                  <IconifyIcon v-if="action.icon" :icon="action.icon" />
-                  <span :class="action.icon ? 'ml-1' : ''">
-                    {{ action.label }}
-                  </span>
-                </div>
-              </Popconfirm>
-            </template>
-            <template v-else>
-              <div
-                :class="
-                  action.disabled === true
-                    ? 'cursor-not-allowed text-gray-300'
-                    : ''
-                "
-              >
-                <IconifyIcon v-if="action.icon" :icon="action.icon" />
+            <div
+              :class="
+                action.disabled === true
+                  ? 'cursor-not-allowed text-gray-300'
+                  : ''
+              "
+            >
+              <IconifyIcon v-if="action.icon" :icon="action.icon" />
+              <span :class="action.icon ? 'ml-1' : ''">
                 {{ action.label }}
-              </div>
-            </template>
+              </span>
+            </div>
           </Menu.Item>
         </Menu>
       </template>
@@ -269,6 +273,12 @@
 }
 
 .ant-popconfirm {
+  width: 210px;
+
+  //.ant-popconfirm-message {
+  //  white-space: nowrap;
+  //}
+
   .ant-popconfirm-buttons {
     .ant-btn {
       margin-inline-start: 4px !important;

--
Gitblit v1.9.3