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/bagCode/modules/generate-form.vue | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 111 insertions(+), 0 deletions(-)
diff --git a/src/views/mes/pro/bagCode/modules/generate-form.vue b/src/views/mes/pro/bagCode/modules/generate-form.vue
new file mode 100644
index 0000000..6ea36bc
--- /dev/null
+++ b/src/views/mes/pro/bagCode/modules/generate-form.vue
@@ -0,0 +1,111 @@
+<script lang="ts" setup>
+ import type { VbenFormSchema } from "#/adapter/form";
+ import type { MesProBagCodeApi } from "#/api/mes/pro/bagCode";
+
+ import { useVbenModal } from "@vben/common-ui";
+ import { MesProBatchStatusEnum } from "@vben/constants";
+
+ import { message } from "ant-design-vue";
+
+ import { useVbenForm } from "#/adapter/form";
+ import { generateBagCodes } from "#/api/mes/pro/bagCode";
+ import { getBatchSimpleList } from "#/api/mes/pro/batch";
+
+ defineOptions({ name: "MesProBagCodeGenerateForm" });
+
+ const emit = defineEmits(["success"]);
+
+ /** 鏋勫缓琛ㄥ崟锛堟壒娆′笅鎷夐�夐」鐢卞閮ㄥ姞杞芥敞鍏ワ級 */
+ function buildSchema(batchOptions: { label: string; value: number }[]): VbenFormSchema[] {
+ return [
+ {
+ fieldName: "batchId",
+ label: "鐢熶骇鎵规",
+ component: "Select",
+ componentProps: {
+ options: batchOptions,
+ optionFilterProp: "label",
+ placeholder: "璇烽�夋嫨鐢熶骇涓殑鎵规",
+ showSearch: true,
+ },
+ rules: "selectRequired",
+ },
+ {
+ fieldName: "count",
+ label: "鐢熸垚琚嬫暟",
+ component: "InputNumber",
+ componentProps: {
+ class: "!w-full",
+ min: 1,
+ placeholder: "璇疯緭鍏ラ渶瑕佺敓鎴愮殑琚嬬爜鏁伴噺",
+ precision: 0,
+ },
+ rules: "required",
+ },
+ {
+ fieldName: "remark",
+ label: "澶囨敞",
+ component: "Textarea",
+ componentProps: {
+ placeholder: "璇疯緭鍏ュ娉�",
+ rows: 2,
+ },
+ },
+ ];
+ }
+
+ const [Form, formApi] = useVbenForm({
+ commonConfig: {
+ componentProps: {
+ class: "w-full",
+ },
+ labelWidth: 100,
+ },
+ layout: "horizontal",
+ schema: [],
+ showDefaultActions: false,
+ });
+
+ const [Modal, modalApi] = useVbenModal({
+ async onConfirm() {
+ const { valid } = await formApi.validate();
+ if (!valid) return;
+ modalApi.lock();
+ try {
+ const values =
+ (await formApi.getValues()) as MesProBagCodeApi.GenerateParams;
+ await generateBagCodes(values);
+ message.success(`宸叉垚鍔熺敓鎴� ${values.count} 鏉¤鐮乣);
+ emit("success");
+ await modalApi.close();
+ } finally {
+ modalApi.unlock();
+ }
+ },
+ async onOpenChange(isOpen: boolean) {
+ if (!isOpen) return;
+ modalApi.lock();
+ try {
+ // 浠呯敓浜т腑鐨勬壒娆″厑璁哥敓鎴愯鐮�
+ const batches = await getBatchSimpleList();
+ const options = batches
+ .filter(
+ (batch) => batch.status === MesProBatchStatusEnum.PRODUCING
+ )
+ .map((batch) => ({
+ label: batch.code!,
+ value: batch.id!,
+ }));
+ await formApi.setState({ schema: buildSchema(options) });
+ } finally {
+ modalApi.unlock();
+ }
+ },
+ });
+</script>
+
+<template>
+ <Modal title="鐢熸垚琚嬬爜鏁版嵁鍖�" class="w-2/5">
+ <Form class="mx-4" />
+ </Modal>
+</template>
--
Gitblit v1.9.3