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 | 68 +++++++++++++++++----------------
1 files changed, 35 insertions(+), 33 deletions(-)
diff --git a/src/components/table-action/table-action.vue b/src/components/table-action/table-action.vue
index 78220f5..724e62c 100644
--- a/src/components/table-action/table-action.vue
+++ b/src/components/table-action/table-action.vue
@@ -15,6 +15,7 @@
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'],
},
});
@@ -122,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();
}
}
@@ -186,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>
@@ -201,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>
--
Gitblit v1.9.3