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/views/basicData/mdm/components/data.ts | 18 ++++----
src/views/basicData/mdm/components/select-dialog.vue | 6 +-
src/views/mes/pro/pallet/data.ts | 2
src/components/table-action/table-action.vue | 62 +++++++++++++++----------------
src/views/basicData/mdm/components/select.vue | 2
src/views/mes/pro/line/data.ts | 2
src/views/mes/pro/bagCode/data.ts | 2
src/views/mes/pro/batch/data.ts | 8 ++--
8 files changed, 50 insertions(+), 52 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>
diff --git a/src/views/basicData/mdm/components/data.ts b/src/views/basicData/mdm/components/data.ts
index 91c4743..d6c8b5a 100644
--- a/src/views/basicData/mdm/components/data.ts
+++ b/src/views/basicData/mdm/components/data.ts
@@ -12,28 +12,28 @@
return [
{
fieldName: 'code',
- label: '鐗╂枡缂栫爜',
+ label: '鍝佺缂栫爜',
component: 'Input',
componentProps: {
allowClear: true,
- placeholder: '璇疯緭鍏ョ墿鏂欑紪鐮�',
+ placeholder: '璇疯緭鍏ュ搧绉嶇紪鐮�',
},
},
{
fieldName: 'name',
- label: '鐗╂枡鍚嶇О',
+ label: '鍝佺鍚嶇О',
component: 'Input',
componentProps: {
allowClear: true,
- placeholder: '璇疯緭鍏ョ墿鏂欏悕绉�',
+ placeholder: '璇疯緭鍏ュ搧绉嶅悕绉�',
},
},
{
fieldName: 'categoryId',
- label: '鐗╂枡鍒嗙被',
+ label: '鍝佺鍒嗙被',
component: 'ApiSelect',
componentProps: {
- placeholder: '璇烽�夋嫨鐗╂枡鍒嗙被',
+ placeholder: '璇烽�夋嫨鍝佺鍒嗙被',
allowClear: true,
api: async () => {
const res = await getItemTypeSimpleList();
@@ -64,12 +64,12 @@
{ type: multiple ? 'checkbox' : 'radio', width: 50 },
{
field: 'code',
- title: '鐗╂枡缂栫爜',
+ title: '鍝佺缂栫爜',
minWidth: 120,
},
{
field: 'name',
- title: '鐗╂枡鍚嶇О',
+ title: '鍝佺鍚嶇О',
minWidth: 180,
align: 'left',
},
@@ -81,7 +81,7 @@
},
{
field: 'categoryId',
- title: '鐗╂枡鍒嗙被',
+ title: '鍝佺鍒嗙被',
minWidth: 120,
align: 'center',
slots: { default: 'categoryId' },
diff --git a/src/views/basicData/mdm/components/select-dialog.vue b/src/views/basicData/mdm/components/select-dialog.vue
index f42875f..2c37055 100644
--- a/src/views/basicData/mdm/components/select-dialog.vue
+++ b/src/views/basicData/mdm/components/select-dialog.vue
@@ -209,7 +209,7 @@
function handleConfirm() {
const rows = multiple.value ? getMultipleSelectedRows() : selectedRows.value;
if (rows.length === 0) {
- message.warning(multiple.value ? '璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�' : '璇烽�夋嫨涓�鏉℃暟鎹�');
+ message.warning(multiple.value ? '璇疯嚦灏戦�夋嫨涓�涓搧绉�' : '璇烽�夋嫨涓�涓搧绉�');
return;
}
emit('selected', multiple.value ? rows : [rows[0]!]);
@@ -222,13 +222,13 @@
<template>
<Modal
v-model:open="open"
- title="鐗╂枡閫夋嫨"
+ title="鍝佺閫夋嫨"
width="80%"
:destroy-on-close="true"
@ok="handleConfirm"
@cancel="closeModal"
>
- <Grid table-title="鐗╂枡鍒楄〃">
+ <Grid table-title="鍝佺鍒楄〃">
<template #categoryId="{ row }">
<Tag v-if="getCategoryColor(row.categoryId)" :color="getCategoryColor(row.categoryId)">{{ getCategoryName(row.categoryId) }}</Tag>
<span v-else>{{ getCategoryName(row.categoryId) || '-' }}</span>
diff --git a/src/views/basicData/mdm/components/select.vue b/src/views/basicData/mdm/components/select.vue
index 6149196..3841668 100644
--- a/src/views/basicData/mdm/components/select.vue
+++ b/src/views/basicData/mdm/components/select.vue
@@ -25,7 +25,7 @@
allowClear: true,
disabled: false,
modelValue: undefined,
- placeholder: '璇烽�夋嫨鐗╂枡',
+ placeholder: '璇烽�夋嫨鍝佺',
label: undefined,
},
);
diff --git a/src/views/mes/pro/bagCode/data.ts b/src/views/mes/pro/bagCode/data.ts
index f611bcc..09b3d69 100644
--- a/src/views/mes/pro/bagCode/data.ts
+++ b/src/views/mes/pro/bagCode/data.ts
@@ -122,7 +122,7 @@
},
{
title: '鎿嶄綔',
- width: 180,
+ width: 200,
fixed: 'right',
slots: { default: 'actions' },
},
diff --git a/src/views/mes/pro/batch/data.ts b/src/views/mes/pro/batch/data.ts
index f226782..1b765a7 100644
--- a/src/views/mes/pro/batch/data.ts
+++ b/src/views/mes/pro/batch/data.ts
@@ -7,7 +7,7 @@
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
-import { MdItemSelect } from '#/views/mes/md/item/components';
+import { MdmItemSelect } from '#/views/basicData/mdm/components';
import { ProLineSelect } from '#/views/mes/pro/line/components';
import { UserSelect } from '#/views/system/user/components';
import { getRangePickerDefaultProps } from '#/utils';
@@ -56,7 +56,7 @@
{
fieldName: 'itemId',
label: '鍝佺',
- component: markRaw(MdItemSelect),
+ component: markRaw(MdmItemSelect),
componentProps: {
disabled,
placeholder: '璇烽�夋嫨鍝佺锛堜骇鍝佸搧绉嶏級',
@@ -138,7 +138,7 @@
{
fieldName: 'itemId',
label: '鍝佺',
- component: markRaw(MdItemSelect),
+ component: markRaw(MdmItemSelect),
componentProps: {
placeholder: '璇烽�夋嫨鍝佺',
},
@@ -273,7 +273,7 @@
},
{
title: '鎿嶄綔',
- width: 200,
+ width: 300,
fixed: 'right',
slots: { default: 'actions' },
},
diff --git a/src/views/mes/pro/line/data.ts b/src/views/mes/pro/line/data.ts
index 4614e4e..4e95298 100644
--- a/src/views/mes/pro/line/data.ts
+++ b/src/views/mes/pro/line/data.ts
@@ -144,7 +144,7 @@
},
{
title: '鎿嶄綔',
- width: 150,
+ width: 180,
fixed: 'right',
slots: { default: 'actions' },
},
diff --git a/src/views/mes/pro/pallet/data.ts b/src/views/mes/pro/pallet/data.ts
index ee2db7a..c7f1ac0 100644
--- a/src/views/mes/pro/pallet/data.ts
+++ b/src/views/mes/pro/pallet/data.ts
@@ -101,7 +101,7 @@
},
{
title: '鎿嶄綔',
- width: 90,
+ width: 200,
fixed: 'right',
slots: { default: 'actions' },
},
--
Gitblit v1.9.3