xwt
2 天以前 0d3eadb50310ca60b8871e967e64da01aa25a9ad
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<template>
  <view>
    <view class="form-container">
      <form :modelValue="formData">
        <view class="form-group">
          <label class="form-label">生产车间:</label>
          <superwei-combox :candidates="deptList" placeholder="请选择或输入"
                           v-model="formData.deptName"
                           :isJSON="true" keyName="departmentname"
                           @select="checkDept"
                           class="picker form-input"
                           style="border: none;"></superwei-combox>
        </view>
        <view class="form-group">
          <label class="form-label">产线编码:</label>
          <superwei-combox :candidates="lineList" placeholder="请选择或输入"
                           v-model="formData.lineNo"
                           :isJSON="true" keyName="lineNo"
                           @select="checkLine"
                           class="picker form-input"
                           style="border: none;"></superwei-combox>
        </view>
        <view class="form-group">
          <label class="form-label">线体名称:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.lineName"/>
        </view>
        <view class="form-group">
          <label class="form-label">暂停原因:</label>
          <radio-group name="gender" ref="suspendRadio" v-model="formData.isSuspend" @change="radioChange">
            <label>
              <radio value="0"/>
              <text>故障/异常</text>
            </label>
            <label>
              <radio value="0"/>
              <text>产线休息</text>
            </label>
          </radio-group>
        </view>
        <view class="form-group">
          <label class="form-label">备注:</label>
          <input class="form-input" type="text" v-model="formData.remarks"/>
        </view>
      </form>
    </view>
 
    <view class="plus-button">
      <button type="warn" @click="save">提交暂停</button>
    </view>
  </view>
</template>
 
<script>
export default {
  data() {
    return {
      formData: {},
      deptList: [],
      lineList: [],
    }
  },
  onLoad(options) {
    //初始化检验单号
    this.$post({
      url: "/Suspend/getDept"
    }).then(res => {
      this.deptList = res.data.tbBillList;
    });
  },
  methods: {
    save() {
 
      if (!this.formData.deptName) {
        this.$showMessage("请选择生产车间");
        return;
      }
 
      if (!this.formData.lineNo) {
        this.$showMessage("请选择产线编码");
        return;
      }
 
      if (this.formData.isSuspend != '0') {
        this.$showMessage("请选择暂停原因");
        return;
      }
 
      this.$post({
        url: "/Suspend/save",
        data: {
          entity: this.formData
        }
      }).then(res => {
        if (res.data.tbBillList > 0) {
          this.formData = {};
          this.formData.isSuspend = 0;
          // 取消选中单选框
          // this.$refs.suspendRadio.radioList.forEach(radio => {
          //   radio.radioChecked = false;
          // });
          this.$showMessage("暂停成功");
        } else {
          this.$showMessage("暂停失败");
        }
      });
 
    },
    checkDept(event) {
      this.formData.deptNo = event.departmentcode;
      this.formData.deptName = event.departmentname;
 
      this.$post({
        url: "/Suspend/getDeptCode",
        data: {
          deptCode: this.formData.deptNo
        }
      }).then(res => {
        this.lineList = res.data.tbBillList;
      });
 
    },
    checkLine(event) {
      this.formData.lineNo = event.lineNo;
      this.formData.lineName = event.lineName;
    },
    radioChange(e) {
      this.formData.isSuspend = e.detail.value;
    },
  }
}
</script>
 
<style>
.form-group {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #c9c9c9;
}
 
.form-label {
  margin-bottom: 0;
  padding: 5px;
}
 
.form-input {
  flex: 1;
  margin-bottom: 0;
  padding: 5px;
}
 
 
.picker {
  flex: 1;
  margin-bottom: 0;
  padding: 5px;
  font-size: 12px;
}
 
.form-container {
  padding: 10px;
  /* 可选:添加一些内边距,使表单内容更美观 */
}
 
.plus-button {
  line-height: 59px;
  font-size: 24px;
  cursor: pointer;
  z-index: 1000;
  margin-bottom: 35px;
}
 
</style>