From e7ccf9dafa1dac3c5000ff85f16f8d0ca1c2a6a7 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 30 十月 2026 20:48:18 +0800
Subject: [PATCH] 1
---
src/views/mes/pro/bagCode/index.vue | 44 +++++++++++++++++++++++++++++++++++---------
1 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/src/views/mes/pro/bagCode/index.vue b/src/views/mes/pro/bagCode/index.vue
index cf22f99..891aaca 100644
--- a/src/views/mes/pro/bagCode/index.vue
+++ b/src/views/mes/pro/bagCode/index.vue
@@ -1,4 +1,5 @@
<script lang="ts" setup>
+ import { ref } from 'vue';
import type { VxeTableGridOptions } from "#/adapter/vxe-table";
import type { MesProBagCodeApi } from "#/api/mes/pro/bagCode";
@@ -20,6 +21,7 @@
unbindBagCodePallet,
} from "#/api/mes/pro/bagCode";
import { IconifyIcon } from "@vben/icons";
+ import { countQrExport, submitQrExport } from '#/api/mes/pro/qrExport';
import { $t } from "#/locales";
import { useGridColumns, useGridFormSchema } from "./data";
@@ -30,8 +32,11 @@
import ReplaceModal from "./modules/replace-form.vue";
import QrTraceModal from "../components/qr-trace-modal.vue";
import BusinessQrModal from "../components/business-qr.vue";
+ import QrExportTaskModal from '../components/qr-export-task-modal.vue';
defineOptions({ name: "MesProBagCode" });
+
+ const qrExportTaskModal = ref<InstanceType<typeof QrExportTaskModal>>();
const [GenerateFormModal, generateFormModalApi] = useVbenModal({
connectedComponent: GenerateModal,
@@ -129,6 +134,14 @@
}
if (!params.uuid && !params.batchId) {
message.warning("璇峰厛鎸夌敓鎴愮粍鎴栨壒娆$瓫閫夊悗鍐嶅鍑轰簩缁寸爜");
+ return;
+ }
+ const bizType = kind === 'business' ? 'BAG_BUSINESS' : 'BAG_LABEL';
+ const count = await countQrExport({ bizType, ...params });
+ if (count.mode === 'ASYNC') {
+ const task = await submitQrExport({ bizType, ...params });
+ qrExportTaskModal.value?.show(task);
+ message.success(`宸叉彁浜� ${count.totalCount} 寮犱簩缁寸爜鐨勫悗鍙板鍑轰换鍔);
return;
}
const data = await (kind === 'business' ? exportBagBusinessQr : exportBagQr)(params);
@@ -238,15 +251,6 @@
function handleBindPallet() {
const records = getSelectedRecords();
if (!records) return;
- if (records.some((record) => !record.batchId)) {
- message.warning("璇峰厛褰曞叆鐢熶骇鎵规锛屽啀缁戝畾鎵樼洏");
- return;
- }
- const batchIds = new Set(records.map((record) => record.batchId));
- if (batchIds.size > 1) {
- message.warning("璇烽�夋嫨鍚屼竴鎵规涓嬬殑琚嬬爜杩涜缁戝畾");
- return;
- }
if (records.some((record) => record.palletId)) {
message.warning("鎵�閫夎鐮佷腑瀛樺湪宸茬粦瀹氭墭鐩樼殑璁板綍锛岃鍏堣В缁�");
return;
@@ -259,11 +263,31 @@
message.warning("宸蹭綔搴熺殑琚嬬爜涓嶅厑璁哥粦瀹氭墭鐩�");
return;
}
+ const withBatch = records.filter((record) => record.batchId);
+ // 宸插綍鎵规涓庢湭褰曟壒娆℃贩閫夋椂鍙�夋墭鐩樿寖鍥翠笉涓�鑷达紝瑕佹眰鍒嗗紑鎿嶄綔
+ if (withBatch.length > 0 && withBatch.length < records.length) {
+ message.warning("鎵�閫夎鐮侀儴鍒嗗凡褰曞叆鎵规锛岃鍒嗗紑閫夋嫨鍚庡啀缁戝畾鎵樼洏");
+ return;
+ }
const first = records[0]!;
+ if (withBatch.length > 0) {
+ const batchIds = new Set(records.map((record) => record.batchId));
+ if (batchIds.size > 1) {
+ message.warning("璇烽�夋嫨鍚屼竴鎵规涓嬬殑琚嬬爜杩涜缁戝畾");
+ return;
+ }
+ } else {
+ const itemIds = new Set(records.map((record) => record.itemId));
+ if (itemIds.size > 1) {
+ message.warning("璇烽�夋嫨鍚屼竴鍝佺涓嬬殑琚嬬爜杩涜缁戝畾");
+ return;
+ }
+ }
bindPalletFormModalApi
.setData({
batchId: first.batchId,
batchCode: first.batchCode,
+ itemId: first.itemId,
ids: records.map((record) => record.id!),
})
.open();
@@ -347,6 +371,7 @@
<ReplaceFormModal @success="handleReplaceSuccess" />
<QrTraceQueryModal />
<BusinessQrViewModal />
+ <QrExportTaskModal ref="qrExportTaskModal" />
<Grid table-title="琚嬬爜鍒楄〃锛堜竴琚嬩竴鐮侊級">
<template #table-title><span class="text-[1rem] font-bold" style="white-space:nowrap">琚嬬爜鍒楄〃锛堜竴琚嬩竴鐮侊級</span></template>
<template #toolbar-tools>
@@ -360,6 +385,7 @@
{ label: 'Excel 鏁版嵁鍖�', auth: ['mes:pro-bag-code:export'], onClick: handleExport }]">
<template #more><Button>瀵煎嚭 <IconifyIcon icon="lucide:chevron-down" /></Button></template>
</TableAction>
+ <Button @click="qrExportTaskModal?.showLast()">鍚庡彴瀵煎嚭浠诲姟</Button>
<TableAction :dropdown-trigger="['click']" :drop-down-actions="[{ label: '鐢熸垚鍘熷琚嬬爜', auth: ['mes:pro-bag-code:create'], onClick: handleRawGenerate },
{ label: '琛ョ敓鎴愪笟鍔$爜', auth: ['mes:pro-bag-code:create'], onClick: handleGenerateBusinessCodes },
{ label: '鐮存崯鏇挎崲', auth: ['mes:pro-bag-code:replace'], onClick: handleReplace },
--
Gitblit v1.9.3