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
| <template>
| <wd-form ref="form" :model="model" class="relative form_box">
| <wd-cell-group :border="true">
| <wd-input
| v-model="model.diskMaterial"
| label="盘具类型"
| label-width="100px"
| prop="diskMaterial"
| clearable
| placeholder="请输入盘具类型"
| />
| <wd-input
| v-model="model.model"
| label="尺寸"
| label-width="100px"
| prop="model"
| clearable
| placeholder="请输入尺寸"
| />
| <wd-input
| v-model="model.amount"
| label="数量"
| label-width="100px"
| prop="amount"
| clearable
| placeholder="请输入数量"
| />
| <wd-input
| v-model="model.supplier"
| label="厂家"
| label-width="100px"
| prop="supplier"
| clearable
| placeholder="请输入厂家"
| />
| </wd-cell-group>
| <wd-toast />
| </wd-form>
| </template>
|
| <script setup lang="ts">
| import useFormData from "@/hooks/useFormData";
| import TwistApi from "@/api/product/twist";
| import { useToast } from "wot-design-uni";
|
| const emits = defineEmits(["refresh"]);
| const paramsId = ref();
| const toast = useToast();
| const { form: model } = useFormData({
| diskMaterial: undefined, // 盘具类型
| model: undefined, // 尺寸
| amount: undefined, // 数量
| supplier: undefined,
| type: "盘具",
| });
|
| const submit = async () => {
| const { code } = await TwistApi.addStrandedWireDish([
| {
| wireId: paramsId.value,
| ...model,
| },
| ]);
| if (code == 200) {
| toast.success("新增成功");
| emits("refresh");
| return true;
| }
| };
|
| onLoad((options: any) => {
| paramsId.value = options.id;
| });
|
| defineExpose({
| submit,
| });
| </script>
| <style lang="scss" scoped>
| .form_box {
| }
| .submit_btn {
| position: absolute;
| bottom: 0;
| width: 100%;
| }
| </style>
|
|