From 91c82965b2d987452ca276e3a03b48c8dcda2ae9 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 19 八月 2026 11:47:26 +0800
Subject: [PATCH] config(env): 更新生产环境配置和公司名称
---
src/views/mes/pro/batch/index.vue | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 238 insertions(+), 0 deletions(-)
diff --git a/src/views/mes/pro/batch/index.vue b/src/views/mes/pro/batch/index.vue
new file mode 100644
index 0000000..73dfe65
--- /dev/null
+++ b/src/views/mes/pro/batch/index.vue
@@ -0,0 +1,238 @@
+<script lang="ts" setup>
+ import type { VxeTableGridOptions } from "#/adapter/vxe-table";
+ import type { MesProBatchApi } from "#/api/mes/pro/batch";
+
+ import { Page, useVbenModal } from "@vben/common-ui";
+ import { MesProBatchStatusEnum } from "@vben/constants";
+ import { downloadFileFromBlobPart } from "@vben/utils";
+
+ import { Button, message } from "ant-design-vue";
+
+ import { ACTION_ICON, TableAction, useVbenVxeGrid } from "#/adapter/vxe-table";
+ import {
+ deleteBatch,
+ exportBatchExcel,
+ exportBatchQr,
+ getBatchPage,
+ updateBatchStatus,
+ } from "#/api/mes/pro/batch";
+ import { $t } from "#/locales";
+
+ import { useGridColumns, useGridFormSchema } from "./data";
+ import Form from "./modules/form.vue";
+ import QrTraceModal from "../components/qr-trace-modal.vue";
+
+ const [FormModal, formModalApi] = useVbenModal({
+ connectedComponent: Form,
+ destroyOnClose: true,
+ });
+
+ const [QrTraceQueryModal, qrTraceQueryModalApi] = useVbenModal({
+ connectedComponent: QrTraceModal,
+ destroyOnClose: true,
+ });
+
+ /** 鍒锋柊琛ㄦ牸 */
+ function handleRefresh() {
+ gridApi.query();
+ }
+
+ /** 鎵爜杩芥函 */
+ function handleTrace() {
+ qrTraceQueryModalApi.open();
+ }
+
+ /** 鏌ョ湅浜岀淮鐮侊紙琛屽唴棰勫~鐮佸�硷級 */
+ function handleViewQr(row: MesProBatchApi.Batch) {
+ qrTraceQueryModalApi.setData({ code: row.code }).open();
+ }
+
+ /** 鎵撳嵃鏁村浜岀淮鐮侊紙鎵规鍥� + 鍏ㄩ儴鎵樼洏鍥� ZIP锛� */
+ async function handlePrintQrSet(row: MesProBatchApi.Batch) {
+ const data = await exportBatchQr(row.id!);
+ downloadFileFromBlobPart({
+ fileName: `鎵规浜岀淮鐮�-${row.code}.zip`,
+ source: data,
+ });
+ }
+
+ /** 鏂板鎵规 */
+ function handleCreate() {
+ formModalApi.setData({ formType: "create" }).open();
+ }
+
+ /** 鏌ョ湅璇︽儏 */
+ function handleDetail(row: MesProBatchApi.Batch) {
+ formModalApi.setData({ formType: "detail", id: row.id }).open();
+ }
+
+ /** 缂栬緫鎵规 */
+ function handleEdit(row: MesProBatchApi.Batch) {
+ formModalApi.setData({ formType: "update", id: row.id }).open();
+ }
+
+ /** 鍒犻櫎鎵规 */
+ async function handleDelete(row: MesProBatchApi.Batch) {
+ await deleteBatch(row.id!);
+ message.success($t("ui.actionMessage.deleteSuccess", [row.code]));
+ handleRefresh();
+ }
+
+ /** 鏇存柊鎵规鐘舵�� */
+ async function handleUpdateStatus(
+ row: MesProBatchApi.Batch,
+ status: number,
+ statusName: string
+ ) {
+ await updateBatchStatus(row.id!, status);
+ message.success(`鎵规宸�${statusName}`);
+ handleRefresh();
+ }
+
+ /** 瀵煎嚭琛ㄦ牸 */
+ async function handleExport() {
+ const data = await exportBatchExcel(await gridApi.formApi.getValues());
+ downloadFileFromBlobPart({ fileName: "鐢熶骇鎵规.xls", source: data });
+ }
+
+ const [Grid, gridApi] = useVbenVxeGrid({
+ formOptions: {
+ schema: useGridFormSchema(),
+ },
+ gridOptions: {
+ columns: useGridColumns(),
+ height: "auto",
+ keepSource: true,
+ proxyConfig: {
+ ajax: {
+ query: async ({ page }, formValues) => {
+ return await getBatchPage({
+ pageNo: page.currentPage,
+ pageSize: page.pageSize,
+ ...formValues,
+ });
+ },
+ },
+ },
+ rowConfig: {
+ keyField: "id",
+ isHover: true,
+ },
+ toolbarConfig: {
+ refresh: true,
+ search: true,
+ },
+ } as VxeTableGridOptions<MesProBatchApi.Batch>,
+ });
+</script>
+
+<template>
+ <Page auto-content-height>
+ <FormModal @success="handleRefresh" />
+ <QrTraceQueryModal />
+ <Grid table-title="鐢熶骇鎵规鍒楄〃">
+ <template #toolbar-tools>
+ <TableAction :actions="[
+ {
+ 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,
+ },
+ ]" />
+ </template>
+ <template #code="{ row }">
+ <Button type="link" @click="handleDetail(row)">
+ {{ row.code }}
+ </Button>
+ </template>
+ <template #actions="{ row }">
+ <TableAction :actions="[
+ {
+ label: '鏌ョ湅浜岀淮鐮�',
+ type: 'link',
+ auth: ['mes:pro-batch:query'],
+ onClick: handleViewQr.bind(null, row),
+ },
+ {
+ label: $t('common.edit'),
+ type: 'link',
+ icon: ACTION_ICON.EDIT,
+ auth: ['mes:pro-batch:update'],
+ ifShow:
+ row.status === MesProBatchStatusEnum.DRAFT ||
+ row.status === MesProBatchStatusEnum.PRODUCING,
+ onClick: handleEdit.bind(null, row),
+ },
+ {
+ label: $t('common.delete'),
+ type: 'link',
+ danger: true,
+ icon: ACTION_ICON.DELETE,
+ auth: ['mes:pro-batch:delete'],
+ ifShow:
+ row.status === MesProBatchStatusEnum.DRAFT ||
+ row.status === MesProBatchStatusEnum.CANCELED,
+ popConfirm: {
+ title: $t('ui.actionMessage.deleteConfirm', [row.code]),
+ confirm: handleDelete.bind(null, row),
+ },
+ },
+ ]"
+ :drop-down-actions="[
+ {
+ label: '寮�濮嬬敓浜�',
+ auth: ['mes:pro-batch:update'],
+ ifShow: row.status === MesProBatchStatusEnum.DRAFT,
+ popConfirm: {
+ title: '纭寮�濮嬬敓浜ц鎵规鍚楋紵',
+ confirm: () =>
+ handleUpdateStatus(row, MesProBatchStatusEnum.PRODUCING, '寮�濮嬬敓浜�'),
+ },
+ },
+ {
+ label: '瀹屾垚',
+ auth: ['mes:pro-batch:update'],
+ ifShow: row.status === MesProBatchStatusEnum.PRODUCING,
+ popConfirm: {
+ title: '纭瀹屾垚璇ユ壒娆″悧锛�',
+ confirm: () =>
+ handleUpdateStatus(row, MesProBatchStatusEnum.FINISHED, '瀹屾垚'),
+ },
+ },
+ {
+ label: '浣滃簾',
+ auth: ['mes:pro-batch:update'],
+ ifShow:
+ row.status === MesProBatchStatusEnum.DRAFT ||
+ row.status === MesProBatchStatusEnum.PRODUCING,
+ popConfirm: {
+ title: '纭浣滃簾璇ユ壒娆″悧锛熶綔搴熷悗涓嶅彲鎭㈠銆�',
+ confirm: () =>
+ handleUpdateStatus(row, MesProBatchStatusEnum.CANCELED, '浣滃簾'),
+ },
+ },
+ {
+ label: '鎵撳嵃鏁村浜岀淮鐮�',
+ auth: ['mes:pro-batch:export'],
+ onClick: () => handlePrintQrSet(row),
+ },
+ ]" />
+ </template>
+ </Grid>
+ </Page>
+</template>
--
Gitblit v1.9.3