曹睿
2025-04-24 5519cbf2e00c7ba4c650a542d98da99978124a30
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
92
93
94
95
96
97
98
99
100
101
102
103
<template>
  <wd-form ref="form" :model="model" class="relative form_box">
    <wd-cell-group :border="true">
      <wd-picker
        v-model="model.workbench"
        :columns="columns"
        label="杂工名称"
        label-width="100px"
        placeholder="请选择杂工名称"
      />
      <wd-input
        v-model="model.poleNo"
        label="杆号"
        label-width="100px"
        prop="poleNo"
        clearable
        placeholder="请输入杆号"
      />
      <wd-input
        v-model="model.unit"
        label="单位"
        label-width="100px"
        prop="unit"
        clearable
        placeholder="请输入单位"
      />
      <wd-input
        v-model="model.poleWeight"
        label="杆重"
        label-width="100px"
        prop="poleWeight"
        clearable
        placeholder="请输入杆重"
      />
      <wd-input
        v-model="model.useWeight"
        label="使用重量"
        label-width="100px"
        prop="useWeight"
        clearable
        placeholder="请输入使用重量"
      />
    </wd-cell-group>
  </wd-form>
</template>
 
<script setup lang="ts">
import useFormData from "@/hooks/useFormData";
import ManageApi from "@/api/product/manage";
import { onLoad } from "@dcloudio/uni-app";
import { useToast } from "wot-design-uni";
 
const columns = ref([]);
const paramsId = ref();
const toast = useToast();
const { form: model } = useFormData({
  backmanName: undefined, // 杂工名称
  unit: undefined, // 单位
  num: undefined, // 数量
  caller: undefined, // 报工人
  callerDate: undefined, // 报工日期
});
 
const getBackman = async () => {
  const { data } = await ManageApi.getBackmanDetailByType({ type: "拉丝" });
  columns.value = data.map((item: any) => item.backmanProject);
};
 
const submit = async () => {
  const { code } = await ManageApi.addBackmanDetail([
    {
      wireId: paramsId.value,
      type: "拉丝",
      ...model,
    },
  ]);
  if (code == 200) {
    toast.success("提交成功");
    return true;
  } else {
    toast.error("提交失败");
    return false;
  }
};
 
onLoad((options: any) => {
  paramsId.value = options.id;
  getBackman();
});
 
defineExpose({
  submit,
});
</script>
<style lang="scss" scoped>
.form_box {
}
.submit_btn {
  position: absolute;
  bottom: 0;
  width: 100%;
}
</style>