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/bind-pallet.vue | 121 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 121 insertions(+), 0 deletions(-)
diff --git a/src/views/mes/pro/bagCode/modules/bind-pallet.vue b/src/views/mes/pro/bagCode/modules/bind-pallet.vue
new file mode 100644
index 0000000..a84abba
--- /dev/null
+++ b/src/views/mes/pro/bagCode/modules/bind-pallet.vue
@@ -0,0 +1,121 @@
+<script lang="ts" setup>
+ import type { VbenFormSchema } from "#/adapter/form";
+
+ import { useVbenModal } from "@vben/common-ui";
+ import { MesProPalletStatusEnum } from "@vben/constants";
+
+ import { message } from "ant-design-vue";
+
+ import { useVbenForm } from "#/adapter/form";
+ import { bindBagCodePallet } from "#/api/mes/pro/bagCode";
+ import { getPalletSimpleList } from "#/api/mes/pro/pallet";
+ import { $t } from "#/locales";
+
+ defineOptions({ name: "MesProBagCodeBindPallet" });
+
+ /** 寮圭獥浼犲叆鏁版嵁 */
+ interface ModalData {
+ batchId: number;
+ batchCode?: string;
+ ids: number[];
+ }
+
+ const emit = defineEmits(["success"]);
+
+ /** 鏋勫缓琛ㄥ崟锛堟墭鐩樹笅鎷夐�夐」鐢卞閮ㄥ姞杞芥敞鍏ワ級 */
+ function buildSchema(palletOptions: { label: string; value: number }[]): VbenFormSchema[] {
+ return [
+ {
+ fieldName: "batchCode",
+ label: "鐢熶骇鎵规",
+ component: "Input",
+ componentProps: {
+ disabled: true,
+ },
+ },
+ {
+ fieldName: "bagCount",
+ label: "缁戝畾琚嬫暟",
+ component: "InputNumber",
+ componentProps: {
+ class: "!w-full",
+ disabled: true,
+ },
+ },
+ {
+ fieldName: "palletId",
+ label: "鐩爣鎵樼洏",
+ component: "Select",
+ componentProps: {
+ optionFilterProp: "label",
+ options: palletOptions,
+ placeholder: "璇烽�夋嫨鐩爣鎵樼洏",
+ showSearch: true,
+ },
+ rules: "selectRequired",
+ },
+ ];
+ }
+
+ 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;
+ const data = modalApi.getData<ModalData>();
+ const values = await formApi.getValues();
+ modalApi.lock();
+ try {
+ await bindBagCodePallet({ palletId: values.palletId, ids: data.ids });
+ message.success($t("ui.actionMessage.operationSuccess"));
+ emit("success");
+ await modalApi.close();
+ } finally {
+ modalApi.unlock();
+ }
+ },
+ async onOpenChange(isOpen: boolean) {
+ if (!isOpen) return;
+ const data = modalApi.getData<ModalData>();
+ modalApi.lock();
+ try {
+ // 鍔犺浇璇ユ壒娆′笅鐨勬墭鐩橈紙鎺掗櫎宸蹭綔搴燂級
+ const pallets = await getPalletSimpleList(data.batchId);
+ const options = pallets
+ .filter(
+ (pallet) => pallet.status !== MesProPalletStatusEnum.CANCELED
+ )
+ .map((pallet) => ({
+ label: `${pallet.code}锛堝凡瑁� ${pallet.bagCount ?? 0} 琚� / 鍙 ${
+ pallet.capacity ?? "涓嶉檺"
+ } 琚嬶級`,
+ value: pallet.id!,
+ }));
+ await formApi.setState({ schema: buildSchema(options) });
+ await formApi.setValues({
+ bagCount: data.ids.length,
+ batchCode: data.batchCode,
+ });
+ } finally {
+ modalApi.unlock();
+ }
+ },
+ });
+</script>
+
+<template>
+ <Modal title="琚嬬爜缁戝畾鎵樼洏" class="w-2/5">
+ <Form class="mx-4" />
+ </Modal>
+</template>
--
Gitblit v1.9.3