1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
| <script lang="ts" setup>
| import type { VbenFormSchema } from "#/adapter/form";
|
| import { useVbenModal } from "@vben/common-ui";
|
| import { message } from "ant-design-vue";
|
| import { useVbenForm } from "#/adapter/form";
| import { preGeneratePallet } from "#/api/mes/pro/pallet";
|
| defineOptions({ name: "MesProPalletGenerateForm" });
|
| const emit = defineEmits(["success"]);
|
| 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();
| const result = await preGeneratePallet({
| count: values.count,
| capacity: values.capacity,
| remark: values.remark,
| });
| message.success(`已生成 ${result.length} 个临时托盘码`);
| emit("success", result);
| await modalApi.close();
| } finally {
| modalApi.unlock();
| }
| },
| onOpenChange(isOpen: boolean) {
| if (!isOpen) return;
| const schema: VbenFormSchema[] = [
| {
| fieldName: "count",
| label: "生成数量",
| component: "InputNumber",
| componentProps: {
| class: "!w-full",
| min: 1,
| placeholder: "请输入需要生成的托盘数量",
| precision: 0,
| },
| rules: "required",
| },
| {
| fieldName: "capacity",
| label: "可装袋数",
| component: "InputNumber",
| componentProps: {
| class: "!w-full",
| min: 1,
| placeholder: "请输入每托盘可装袋数(袋/托盘)",
| precision: 0,
| },
| },
| {
| fieldName: "remark",
| label: "备注",
| component: "Textarea",
| componentProps: {
| placeholder: "请输入备注",
| rows: 2,
| },
| },
| ];
| formApi.setState({ schema });
| },
| });
| </script>
|
| <template>
| <Modal title="预生成托盘二维码" class="w-2/5">
| <Form class="mx-4" />
| </Modal>
| </template>
|
|