From 2271982de09628a04da06630c4ab690ef64fbfab Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 19 八月 2026 10:55:06 +0800
Subject: [PATCH] refactor(mdm): 将物料相关字段统一改为品种并优化下拉菜单确认逻辑
---
src/components/table-action/table-action.vue | 62 +++++++++++++++----------------
1 files changed, 30 insertions(+), 32 deletions(-)
diff --git a/src/components/table-action/table-action.vue b/src/components/table-action/table-action.vue
index 78220f5..55e2183 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,
@@ -122,7 +123,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();
}
}
@@ -201,39 +218,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