From fb4db4ae9b6a7f113ba049f6789e6916c0dcc276 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 12 十月 2026 09:15:08 +0800
Subject: [PATCH] feat(mes): 新增业务码支持并优化追溯查询功能
---
src/views/mes/pro/batch/index.vue | 70 ++++++++++++++++++++---------------
1 files changed, 40 insertions(+), 30 deletions(-)
diff --git a/src/views/mes/pro/batch/index.vue b/src/views/mes/pro/batch/index.vue
index 3f15dda..49e137d 100644
--- a/src/views/mes/pro/batch/index.vue
+++ b/src/views/mes/pro/batch/index.vue
@@ -13,15 +13,19 @@
deleteBatch,
exportBatchExcel,
exportBatchQr,
+ exportBatchBusinessQr,
+ generateBatchBusinessCodes,
getBatchPage,
updateBatchStatus,
} from "#/api/mes/pro/batch";
+ import { IconifyIcon } from "@vben/icons";
import { $t } from "#/locales";
import { useGridColumns, useGridFormSchema } from "./data";
import Form from "./modules/form.vue";
import PreGenerateModal from "./modules/pre-generate.vue";
import QrTraceModal from "../components/qr-trace-modal.vue";
+ import BusinessQrModal from "../components/business-qr.vue";
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
@@ -39,6 +43,21 @@
});
/** 鍒锋柊琛ㄦ牸 */
+ const [BusinessQrViewModal, businessQrApi] = useVbenModal({ connectedComponent: BusinessQrModal, destroyOnClose: true });
+ function handleBusinessQr(row: MesProBatchApi.Batch) {
+ businessQrApi.setData({ code: row.businessCode }).open();
+ }
+ async function handleGenerateBusiness(row: MesProBatchApi.Batch) {
+ if (row.id == null) return;
+ const count = await generateBatchBusinessCodes([row.id]);
+ message.success(`宸茶ˉ鐢熸垚 ${count} 浠戒笟鍔$爜锛屽凡鏈夌爜鍊间繚鎸佷笉鍙榒); handleRefresh();
+ }
+ async function handleExportBusiness(row: MesProBatchApi.Batch) {
+ if (row.id == null) return;
+ const data = await exportBatchBusinessQr(row.id);
+ downloadFileFromBlobPart({ fileName: '鎵规涓庢墭鐩樹笟鍔′簩缁寸爜.zip', source: data });
+ }
+
function handleRefresh() {
gridApi.query();
}
@@ -162,36 +181,18 @@
<FormModal @success="handleRefresh" />
<PreGenerateModalApi @success="handlePreGenerateSuccess" />
<QrTraceQueryModal />
+ <BusinessQrViewModal />
<Grid table-title="鐢熶骇鎵规鍒楄〃">
+ <template #table-title><span class="text-[1rem] font-bold" style="white-space:nowrap">鐢熶骇鎵规鍒楄〃</span></template>
<template #toolbar-tools>
- <TableAction :actions="[
- {
- label: '棰勭敓鎴愪簩缁寸爜',
- icon: ACTION_ICON.ADD,
- auth: ['mes:pro-batch:create'],
- onClick: handlePreGenerate,
- },
- {
- label: $t('ui.actionTitle.create', ['鎵规']),
- type: 'primary',
- icon: ACTION_ICON.ADD,
- auth: ['mes:pro-batch:create'],
- onClick: handleCreate,
- },
- {
- label: '鎵爜杩芥函',
- icon: ACTION_ICON.SEARCH,
- auth: ['mes:pro-batch:query'],
- onClick: handleTrace,
- },
- {
- label: $t('ui.actionTitle.export'),
- type: 'primary',
- icon: ACTION_ICON.DOWNLOAD,
- auth: ['mes:pro-batch:export'],
- onClick: handleExport,
- },
- ]" />
+ <div class="mes-code-toolbar">
+ <TableAction :actions="[{ label: '棰勭敓鎴愪簩缁寸爜', type: 'primary', icon: ACTION_ICON.ADD, auth: ['mes:pro-batch:create'], onClick: handlePreGenerate },
+ { label: '鏂板鎵规', auth: ['mes:pro-batch:create'], onClick: handleCreate },
+ { label: '鎵爜杩芥函', icon: ACTION_ICON.SEARCH, auth: ['mes:pro-batch:query'], onClick: handleTrace }]" />
+ <TableAction :dropdown-trigger="['click']" :drop-down-actions="[{ label: 'Excel 鏁版嵁', auth: ['mes:pro-batch:export'], onClick: handleExport }]">
+ <template #more><Button>瀵煎嚭 <IconifyIcon icon="lucide:chevron-down" /></Button></template>
+ </TableAction>
+ </div>
</template>
<template #code="{ row }">
<Button type="link" @click="handleDetail(row)">
@@ -202,7 +203,7 @@
<template #actions="{ row }">
<TableAction :actions="[
{
- label: '鏌ョ湅浜岀淮鐮�',
+ label: '杩芥函浜岀淮鐮�',
type: 'link',
auth: ['mes:pro-batch:query'],
onClick: handleViewQr.bind(null, row),
@@ -242,6 +243,9 @@
},
]"
:drop-down-actions="[
+ { label: '涓氬姟浜岀淮鐮�', auth: ['mes:pro-batch:query'], ifShow: !!row.businessCode, onClick: () => handleBusinessQr(row) },
+ { label: '琛ョ敓鎴愪笟鍔$爜', auth: ['mes:pro-batch:create'], ifShow: !row.businessCode && row.status !== MesProBatchStatusEnum.CANCELED, onClick: () => handleGenerateBusiness(row) },
+ { label: '瀵煎嚭鏁村涓氬姟浜岀淮鐮�', auth: ['mes:pro-batch:export'], ifShow: row.status !== MesProBatchStatusEnum.CANCELED, onClick: () => handleExportBusiness(row) },
{
label: '寮�濮嬬敓浜�',
auth: ['mes:pro-batch:update'],
@@ -275,7 +279,7 @@
},
},
{
- label: '鎵撳嵃鏁村浜岀淮鐮�',
+ label: '鎵撳嵃鏁村杩芥函浜岀淮鐮�',
auth: ['mes:pro-batch:export'],
onClick: () => handlePrintQrSet(row),
},
@@ -284,3 +288,9 @@
</Grid>
</Page>
</template>
+
+<style scoped>
+.mes-code-toolbar { display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px; }
+.mes-code-toolbar :deep(.ant-btn) { white-space:nowrap; }
+.mes-code-toolbar :deep(.ant-btn > .iconify) { display:inline-block;width:14px;height:14px;vertical-align:middle; }
+</style>
--
Gitblit v1.9.3