From e4994fccfb49ebfb108ba62cbd82aea4e004f6d8 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 15 十月 2026 10:02:46 +0800
Subject: [PATCH] fix(mes/qc): 不合格品处理单的不合格物料改查 MDM 物料
---
src/views/mes/dv/machinery/index.vue | 62 ++++++++++++++++++++++++++++++-
1 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/src/views/mes/dv/machinery/index.vue b/src/views/mes/dv/machinery/index.vue
index a048b48..06aa887 100644
--- a/src/views/mes/dv/machinery/index.vue
+++ b/src/views/mes/dv/machinery/index.vue
@@ -5,14 +5,15 @@
import { ref } from 'vue';
-import { Page, useVbenModal } from '../../../../packages/effects/common-ui/src';
-import { downloadFileFromBlobPart } from '../../../../packages/utils/src';
+import { Page, useVbenModal } from '@vben/common-ui';
+import { downloadFileFromBlobPart } from '@vben/utils';
import { Button, message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deleteMachinery,
+ deleteMachineryList,
exportMachinery,
getMachineryPage,
} from '#/api/mes/dv/machinery';
@@ -24,6 +25,23 @@
import ImportForm from './modules/import-form.vue';
const selectedMachineryTypeId = ref<number>(); // 閫変腑璁惧绫诲瀷缂栧彿
+const checkedIds = ref<number[]>([]);
+function handleRowCheckboxChange({
+ records,
+}: {
+ records: MesDvMachineryApi.Machinery[];
+}) {
+ checkedIds.value = records.map((item) => item.id!);
+}
+
+/**
+ * 琛ㄦ牸鏁版嵁閲嶈浇鍚庯紙鏌ヨ/缈婚〉/鍒锋柊/鍒囨崲璁惧绫诲瀷锛夋竻绌哄嬀閫夛紝
+ * 閬垮厤鍕鹃�変簡涓婁竴椤电殑璁惧鍚庯紝椤甸潰宸插埛鏂颁絾浠嶆寜鏃у嬀閫夊垹闄�
+ */
+function handleDataChange() {
+ checkedIds.value = [];
+ gridApi.grid.clearCheckboxRow();
+}
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
@@ -66,6 +84,26 @@
handleRefresh();
} finally {
hideLoading();
+ }
+}
+
+/** 鎵归噺鍒犻櫎璁惧 */
+async function handleDeleteBatch() {
+ if (checkedIds.value.length === 0) {
+ return;
+ }
+ const count = checkedIds.value.length;
+ const hideLoading = message.loading({
+ content: $t('ui.actionMessage.deleting', [`${count} 鍙癭]),
+ duration: 0,
+ });
+ try {
+ await deleteMachineryList(checkedIds.value);
+ message.success($t('ui.actionMessage.deleteSuccess', [`${count} 鍙癭]));
+ } finally {
+ hideLoading();
+ handleDataChange();
+ handleRefresh();
}
}
@@ -116,6 +154,11 @@
search: true,
},
} as VxeTableGridOptions<MesDvMachineryApi.Machinery>,
+ gridEvents: {
+ checkboxAll: handleRowCheckboxChange,
+ checkboxChange: handleRowCheckboxChange,
+ dataChange: handleDataChange,
+ },
});
</script>
@@ -139,6 +182,21 @@
onClick: handleCreate,
},
{
+ label: $t('ui.actionTitle.deleteBatch'),
+ type: 'primary',
+ danger: true,
+ icon: ACTION_ICON.DELETE,
+ auth: ['mes:dv-machinery:delete'],
+ disabled: checkedIds.length === 0,
+ popConfirm: {
+ disabled: checkedIds.length === 0,
+ title: $t('ui.actionMessage.deleteConfirm', [
+ `${checkedIds.length} 鍙癭,
+ ]),
+ confirm: handleDeleteBatch,
+ },
+ },
+ {
label: $t('ui.actionTitle.import'),
type: 'primary',
icon: ACTION_ICON.UPLOAD,
--
Gitblit v1.9.3