| | |
| | | <script lang="ts" setup> |
| | | import { ref } from 'vue'; |
| | | import type { VxeTableGridOptions } from "#/adapter/vxe-table"; |
| | | import type { MesProBatchApi } from "#/api/mes/pro/batch"; |
| | | |
| | |
| | | updateBatchStatus, |
| | | } from "#/api/mes/pro/batch"; |
| | | import { IconifyIcon } from "@vben/icons"; |
| | | import { countQrExport, submitQrExport } from '#/api/mes/pro/qrExport'; |
| | | import { $t } from "#/locales"; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from "./data"; |
| | |
| | | import PreGenerateModal from "./modules/pre-generate.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'; |
| | | |
| | | const qrExportTaskModal = ref<InstanceType<typeof QrExportTaskModal>>(); |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | |
| | | } |
| | | async function handleExportBusiness(row: MesProBatchApi.Batch) { |
| | | if (row.id == null) return; |
| | | const params = { bizType: 'BATCH_BUSINESS' as const, batchId: row.id }; |
| | | const count = await countQrExport(params); |
| | | if (count.mode === 'ASYNC') { |
| | | qrExportTaskModal.value?.show(await submitQrExport(params)); |
| | | message.success(`已提交 ${count.totalCount} 张二维码的后台导出任务`); |
| | | return; |
| | | } |
| | | const data = await exportBatchBusinessQr(row.id); |
| | | downloadFileFromBlobPart({ fileName: '批次与托盘业务二维码.zip', source: data }); |
| | | } |
| | |
| | | |
| | | /** 打印整套二维码(批次图 + 全部托盘图 ZIP) */ |
| | | async function handlePrintQrSet(row: MesProBatchApi.Batch) { |
| | | const params = { bizType: 'BATCH_LABEL' as const, batchId: row.id! }; |
| | | const count = await countQrExport(params); |
| | | if (count.mode === 'ASYNC') { |
| | | qrExportTaskModal.value?.show(await submitQrExport(params)); |
| | | message.success(`已提交 ${count.totalCount} 张二维码的后台导出任务`); |
| | | return; |
| | | } |
| | | const data = await exportBatchQr(row.id!); |
| | | downloadFileFromBlobPart({ |
| | | fileName: `批次二维码-${getDisplayCode(row)}.zip`, |
| | |
| | | <PreGenerateModalApi @success="handlePreGenerateSuccess" /> |
| | | <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> |
| | |
| | | <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> |
| | | <Button @click="qrExportTaskModal?.showLast()">后台导出任务</Button> |
| | | </div> |
| | | </template> |
| | | <template #code="{ row }"> |