huoyi 3 weeks ago
parent
commit
ea88e8a874
1 changed files with 482 additions and 467 deletions
  1. 482 467
      src/pages/missedInspectionList/index.vue

+ 482 - 467
src/pages/missedInspectionList/index.vue

@@ -1,142 +1,137 @@
1 1
 <template>
2
-  <home-container>
3
-  
4
-
5
-      <scroll-view class="form-scroll" scroll-y>
6
-        <view class="form-container">
7
-          <uni-forms ref="formRef" :rules="rules" :modelValue="formData" label-position="left" err-show-type="modal" :label-width="100">
8
-            <view class="form-row">
9
-              <uni-forms-item label="大队" name="brigadeId" required>
10
-                <uni-data-picker :localdata="brigadeOptions" popup-title="请选择大队" 
11
-                  v-model="formData.brigadeId" @change="handleFormBrigadeChange" />
12
-              </uni-forms-item>
2
+    <home-container :customStyle="{ background: 'none' }" :customHomeStyle="{ overflow: 'hidden' }">
3
+        <scroll-view scroll-y class="form-scroll">
4
+            <view class="form-container">
5
+                <uni-forms ref="formRef" :rules="rules" :modelValue="formData" label-position="left" err-show-type="modal"
6
+                    :label-width="150">
7
+                    <view class="form-row">
8
+                        <uni-forms-item label="大队" name="brigadeId" required>
9
+                            <uni-data-picker :localdata="brigadeOptions" popup-title="请选择大队" v-model="formData.brigadeId"
10
+                                @change="handleFormBrigadeChange" />
11
+                        </uni-forms-item>
12
+                    </view>
13
+                    <view class="form-row">
14
+                        <uni-forms-item label="被回查人" name="reviewedUserId" required>
15
+                            <uni-data-picker :localdata="personOptions" popup-title="请选择被回查人" v-model="formData.reviewedUserId"
16
+                                @change="handleReviewedUserChange" />
17
+                        </uni-forms-item>
18
+                    </view>
19
+                    <view class="form-row">
20
+                        <uni-forms-item label="回查日期" name="reviewDate" required>
21
+                            <uni-datetime-picker type="date" v-model="formData.reviewDate" />
22
+                        </uni-forms-item>
23
+                    </view>
24
+                    <view class="form-row">
25
+                        <uni-forms-item label="漏检时间" name="missCheckTime" required>
26
+                            <uni-datetime-picker type="datetime" v-model="formData.missCheckTime" />
27
+                        </uni-forms-item>
28
+                    </view>
29
+                    <view class="form-row">
30
+                        <uni-forms-item label="漏检时间段" name="missCheckTimePeriod" required>
31
+                            <uni-data-picker :localdata="blockedTimePeriodOptions" popup-title="请选择漏检时间段"
32
+                                v-model="formData.missCheckTimePeriod" />
33
+                        </uni-forms-item>
34
+                    </view>
35
+                    <view class="form-row">
36
+                        <uni-forms-item label="上岗位置" name="channelId" required>
37
+                            <uni-data-picker :localdata="areaOptions" popup-title="请选择上岗位置" v-model="formData.channelId" />
38
+                        </uni-forms-item>
39
+                    </view>
40
+                    <view class="form-row">
41
+                        <uni-forms-item label="漏检物品" name="missCheckItem" required>
42
+                            <uni-data-picker :localdata="missCheckItemOptions" popup-title="请选择漏检物品"
43
+                                v-model="formData.missCheckItem" />
44
+                        </uni-forms-item>
45
+                    </view>
46
+                    <view class="form-row">
47
+                        <uni-forms-item label="分管主管" name="supervisorId" required>
48
+                            <uni-data-picker :localdata="supervisorOptions" popup-title="请选择分管主管"
49
+                                v-model="formData.supervisorId" />
50
+                        </uni-forms-item>
51
+                    </view>
52
+                    <view class="form-row">
53
+                        <uni-forms-item label="代管主管" name="actingSupervisorId">
54
+                            <uni-data-picker :localdata="supervisorOptions" popup-title="请选择代管主管"
55
+                                v-model="formData.actingSupervisorId" />
56
+                        </uni-forms-item>
57
+                    </view>
58
+                    <view class="form-row">
59
+                        <uni-forms-item label="分管班组长" name="teamLeaderId" required>
60
+                            <uni-data-picker :localdata="teamLeaderOptions" popup-title="请选择分管班组长"
61
+                                v-model="formData.teamLeaderId" />
62
+                        </uni-forms-item>
63
+                    </view>
64
+                    <view class="form-row">
65
+                        <uni-forms-item label="物品位置" name="itemLocation" required>
66
+                            <uni-data-picker :localdata="blockedItemPositionOptions" popup-title="请选择物品位置"
67
+                                v-model="formData.itemLocation" />
68
+                        </uni-forms-item>
69
+                    </view>
70
+                    <view class="form-row">
71
+                        <uni-forms-item label="简单/难" name="difficultyLevel" required>
72
+                            <uni-data-picker :localdata="difficultyLevelOptions" popup-title="请选择难度"
73
+                                v-model="formData.difficultyLevel" />
74
+                        </uni-forms-item>
75
+                    </view>
76
+                    <view class="form-row">
77
+                        <uni-forms-item label="回查人" name="reviewUserId" required>
78
+                            <uni-data-picker :localdata="personOptions" popup-title="请选择回查人" v-model="formData.reviewUserId" />
79
+                        </uni-forms-item>
80
+                    </view>
81
+                    <view class="form-row">
82
+                        <uni-forms-item label="判别类型" name="discriminationType" required>
83
+                            <uni-data-picker :localdata="discriminationTypeOptions" popup-title="请选择判别类型"
84
+                                v-model="formData.discriminationType" />
85
+                        </uni-forms-item>
86
+                    </view>
87
+                    <view class="form-row">
88
+                        <uni-forms-item label="是否追回" name="isRecovered" required>
89
+                            <uni-data-picker :localdata="isRecoveredOptions" popup-title="请选择是否追回"
90
+                                v-model="formData.isRecovered" />
91
+                        </uni-forms-item>
92
+                    </view>
93
+                    <view class="form-row">
94
+                        <uni-forms-item label="开机年限" name="machineOperatingYears" required>
95
+                            <uni-data-picker :localdata="blockedOperatingYearsOptions" popup-title="请选择开机年限"
96
+                                v-model="formData.machineOperatingYears" />
97
+                        </uni-forms-item>
98
+                    </view>
99
+                    <view class="form-row">
100
+                        <uni-forms-item label="证书级别" name="certificateLevel" required>
101
+                            <uni-data-picker :localdata="certificateLevelOptions" popup-title="请选择证书级别"
102
+                                v-model="formData.certificateLevel" />
103
+                        </uni-forms-item>
104
+                    </view>
105
+                    <view class="form-row">
106
+                        <uni-forms-item label="人员性别" name="gender" required>
107
+                            <uni-data-picker :localdata="genderOptions" popup-title="请选择人员性别" v-model="formData.gender" />
108
+                        </uni-forms-item>
109
+                    </view>
110
+                    <view class="form-row">
111
+                        <uni-forms-item label="漏检原因分类" name="missCheckReasonCategory" required>
112
+                            <uni-data-picker :localdata="blockedMissCheckReasonOptions" popup-title="请选择漏检原因分类"
113
+                                v-model="formData.missCheckReasonCategory" />
114
+                        </uni-forms-item>
115
+                    </view>
116
+                    <view class="form-row">
117
+                        <uni-forms-item label="月考成绩" name="monthlyAssessment" required>
118
+                            <uni-data-picker :localdata="blockedMonthlyExamResultOptions" popup-title="请选择月考成绩"
119
+                                v-model="formData.monthlyAssessment" />
120
+                        </uni-forms-item>
121
+                    </view>
122
+                    <view class="form-row">
123
+                        <uni-forms-item label="本月自测有无漏检(请输入0-2的整数)" name="selfTestHasMissCheck" required>
124
+                            <uni-number-box :min="0" :max="2" v-model="formData.selfTestHasMissCheck"  ></uni-number-box>
125
+                        </uni-forms-item>
126
+                    </view>
127
+                </uni-forms>
13 128
             </view>
14
-            <view class="form-row">
15
-              <uni-forms-item label="被回查人" name="reviewedUserId" required>
16
-                <uni-data-picker :localdata="personOptions" popup-title="请选择被回查人" 
17
-                  v-model="formData.reviewedUserId" @change="handleReviewedUserChange" />
18
-              </uni-forms-item>
19
-            </view>
20
-            <view class="form-row">
21
-              <uni-forms-item label="回查日期" name="reviewDate" required>
22
-                <uni-datetime-picker type="date" v-model="formData.reviewDate" />
23
-              </uni-forms-item>
24
-            </view>
25
-            <view class="form-row">
26
-              <uni-forms-item label="漏检时间" name="missCheckTime" required>
27
-                <uni-datetime-picker type="datetime" v-model="formData.missCheckTime" />
28
-              </uni-forms-item>
29
-            </view>
30
-            <view class="form-row">
31
-              <uni-forms-item label="漏检时间段" name="missCheckTimePeriod" required>
32
-                <uni-data-picker :localdata="blockedTimePeriodOptions" popup-title="请选择漏检时间段" 
33
-                  v-model="formData.missCheckTimePeriod" />
34
-              </uni-forms-item>
35
-            </view>
36
-            <view class="form-row">
37
-              <uni-forms-item label="上岗位置" name="channelId" required>
38
-                <uni-data-picker :localdata="areaOptions" popup-title="请选择上岗位置" 
39
-                  v-model="formData.channelId" />
40
-              </uni-forms-item>
41
-            </view>
42
-            <view class="form-row">
43
-              <uni-forms-item label="漏检物品" name="missCheckItem" required>
44
-                <uni-data-picker :localdata="missCheckItemOptions" popup-title="请选择漏检物品" 
45
-                  v-model="formData.missCheckItem" />
46
-              </uni-forms-item>
47
-            </view>
48
-            <view class="form-row">
49
-              <uni-forms-item label="分管主管" name="supervisorId" required>
50
-                <uni-data-picker :localdata="supervisorOptions" popup-title="请选择分管主管" 
51
-                  v-model="formData.supervisorId" />
52
-              </uni-forms-item>
53
-            </view>
54
-            <view class="form-row">
55
-              <uni-forms-item label="代管主管" name="actingSupervisorId">
56
-                <uni-data-picker :localdata="supervisorOptions" popup-title="请选择代管主管" 
57
-                  v-model="formData.actingSupervisorId" />
58
-              </uni-forms-item>
59
-            </view>
60
-            <view class="form-row">
61
-              <uni-forms-item label="分管班组长" name="teamLeaderId" required>
62
-                <uni-data-picker :localdata="teamLeaderOptions" popup-title="请选择分管班组长" 
63
-                  v-model="formData.teamLeaderId" />
64
-              </uni-forms-item>
65
-            </view>
66
-            <view class="form-row">
67
-              <uni-forms-item label="物品位置" name="itemLocation" required>
68
-                <uni-data-picker :localdata="blockedItemPositionOptions" popup-title="请选择物品位置" 
69
-                  v-model="formData.itemLocation" />
70
-              </uni-forms-item>
71
-            </view>
72
-            <view class="form-row">
73
-              <uni-forms-item label="简单/难" name="difficultyLevel" required>
74
-                <uni-data-picker :localdata="difficultyLevelOptions" popup-title="请选择难度" 
75
-                  v-model="formData.difficultyLevel" />
76
-              </uni-forms-item>
77
-            </view>
78
-            <view class="form-row">
79
-              <uni-forms-item label="回查人" name="reviewUserId" required>
80
-                <uni-data-picker :localdata="personOptions" popup-title="请选择回查人" 
81
-                  v-model="formData.reviewUserId" />
82
-              </uni-forms-item>
83
-            </view>
84
-            <view class="form-row">
85
-              <uni-forms-item label="判别类型" name="discriminationType" required>
86
-                <uni-data-picker :localdata="discriminationTypeOptions" popup-title="请选择判别类型" 
87
-                  v-model="formData.discriminationType" />
88
-              </uni-forms-item>
89
-            </view>
90
-            <view class="form-row">
91
-              <uni-forms-item label="是否追回" name="isRecovered" required>
92
-                <uni-data-picker :localdata="isRecoveredOptions" popup-title="请选择是否追回" 
93
-                  v-model="formData.isRecovered" />
94
-              </uni-forms-item>
95
-            </view>
96
-            <view class="form-row">
97
-              <uni-forms-item label="开机年限" name="machineOperatingYears" required>
98
-                <uni-data-picker :localdata="blockedOperatingYearsOptions" popup-title="请选择开机年限" 
99
-                  v-model="formData.machineOperatingYears" />
100
-              </uni-forms-item>
101
-            </view>
102
-            <view class="form-row">
103
-              <uni-forms-item label="证书级别" name="certificateLevel" required>
104
-                <uni-data-picker :localdata="certificateLevelOptions" popup-title="请选择证书级别" 
105
-                  v-model="formData.certificateLevel" />
106
-              </uni-forms-item>
107
-            </view>
108
-            <view class="form-row">
109
-              <uni-forms-item label="人员性别" name="gender" required>
110
-                <uni-data-picker :localdata="genderOptions" popup-title="请选择人员性别" 
111
-                  v-model="formData.gender" />
112
-              </uni-forms-item>
113
-            </view>
114
-            <view class="form-row">
115
-              <uni-forms-item label="漏检原因分类" name="missCheckReasonCategory" required>
116
-                <uni-data-picker :localdata="blockedMissCheckReasonOptions" popup-title="请选择漏检原因分类" 
117
-                  v-model="formData.missCheckReasonCategory" />
118
-              </uni-forms-item>
119
-            </view>
120
-            <view class="form-row">
121
-              <uni-forms-item label="月考成绩" name="monthlyAssessment" required>
122
-                <uni-data-picker :localdata="blockedMonthlyExamResultOptions" popup-title="请选择月考成绩" 
123
-                  v-model="formData.monthlyAssessment" />
124
-              </uni-forms-item>
125
-            </view>
126
-            <view class="form-row">
127
-              <uni-forms-item label="本月自测有无漏检" name="selfTestHasMissCheck" required>
128
-                <uni-easyinput type="number" v-model="formData.selfTestHasMissCheck" placeholder="请输入0-2的整数" />
129
-              </uni-forms-item>
130
-            </view>
131
-          </uni-forms>
132
-        </view>
133
-      </scroll-view>
129
+        </scroll-view>
134 130
 
135
-      <view class="submit-bar">
136
-        <view class="submit-btn" @click="submitForm">提交</view>
137
-      </view>
138
-  
139
-  </home-container>
131
+        <view class="submit-bar">
132
+            <view class="submit-btn" @click="submitForm">提交</view>
133
+        </view>
134
+    </home-container>
140 135
 </template>
141 136
 
142 137
 <script>
@@ -150,360 +145,380 @@ import { formatTime } from '@/utils/formatUtils';
150 145
 import useDictMixin from '@/utils/dict';
151 146
 
152 147
 export default {
153
-  name: 'MissedInspectionAdd',
154
-  components: {
155
-    HomeContainer
156
-  },
157
-  mixins: [useDictMixin],
158
-  data() {
159
-    return {
160
-      formData: {
161
-        id: null,
162
-        brigadeId: null,
163
-        brigadeName: null,
164
-        reviewedUserId: null,
165
-        reviewedUserName: null,
166
-        reviewDate: '',
167
-        missCheckTime: '',
168
-        missCheckTimePeriod: null,
169
-        channelId: null,
170
-        channelName: null,
171
-        missCheckItem: null,
172
-        supervisorId: null,
173
-        supervisorName: null,
174
-        actingSupervisorId: null,
175
-        actingSupervisorName: null,
176
-        teamLeaderId: null,
177
-        teamLeaderName: null,
178
-        itemLocation: null,
179
-        difficultyLevel: null,
180
-        reviewUserId: null,
181
-        reviewUserName: null,
182
-        discriminationType: null,
183
-        isRecovered: null,
184
-        machineOperatingYears: null,
185
-        certificateLevel: null,
186
-        gender: null,
187
-        missCheckReasonCategory: null,
188
-        monthlyAssessment: null,
189
-        selfTestHasMissCheck: 0
190
-      },
191
-      
192
-      rules: {
193
-        brigadeId: [{ required: true, errorMessage: '大队不能为空' }],
194
-        reviewedUserId: [{ required: true, errorMessage: '被回查人不能为空' }],
195
-        reviewDate: [{ required: true, errorMessage: '回查日期不能为空' }],
196
-        missCheckTime: [{ required: true, errorMessage: '漏检时间不能为空' }],
197
-        missCheckTimePeriod: [{ required: true, errorMessage: '漏检时间段不能为空' }],
198
-        channelId: [{ required: true, errorMessage: '上岗位置不能为空' }],
199
-        missCheckItem: [{ required: true, errorMessage: '漏检物品不能为空' }],
200
-        supervisorId: [{ required: true, errorMessage: '分管主管不能为空' }],
201
-        teamLeaderId: [{ required: true, errorMessage: '分管班组长不能为空' }],
202
-        itemLocation: [{ required: true, errorMessage: '物品位置不能为空' }],
203
-        difficultyLevel: [{ required: true, errorMessage: '简单/难不能为空' }],
204
-        reviewUserId: [{ required: true, errorMessage: '回查人不能为空' }],
205
-        discriminationType: [{ required: true, errorMessage: '判别类型不能为空' }],
206
-        isRecovered: [{ required: true, errorMessage: '是否追回不能为空' }],
207
-        machineOperatingYears: [{ required: true, errorMessage: '开机年限不能为空' }],
208
-        certificateLevel: [{ required: true, errorMessage: '证书级别不能为空' }],
209
-        gender: [{ required: true, errorMessage: '人员性别不能为空' }],
210
-        missCheckReasonCategory: [{ required: true, errorMessage: '漏检原因分类不能为空' }],
211
-        monthlyAssessment: [{ required: true, errorMessage: '月考成绩不能为空' }],
212
-        selfTestHasMissCheck: [{ required: true, errorMessage: '本月自测有无漏检不能为空' }]
213
-      },
214
-      
215
-      brigadeOptions: [],
216
-      personOptions: [],
217
-      teamLeaderOptions: [],
218
-      supervisorOptions: [],
219
-      areaOptions: [],
220
-      missCheckItemOptions: [],
221
-      
222
-      discriminationTypeOptions: [],
223
-      blockedTimePeriodOptions: [],
224
-      blockedItemPositionOptions: [],
225
-      blockedMonthlyExamResultOptions: [],
226
-      blockedOperatingYearsOptions: [],
227
-      blockedMissCheckReasonOptions: [],
228
-      difficultyLevelOptions: [
229
-        { text: '简单', value: '简单' },
230
-        { text: '难', value: '难' }
231
-      ],
232
-      isRecoveredOptions: [
233
-        { text: '是', value: 1 },
234
-        { text: '否', value: 0 }
235
-      ],
236
-      certificateLevelOptions: [
237
-        { text: '高级', value: '高级' },
238
-        { text: '中级', value: '中级' },
239
-        { text: '初级', value: '初级' }
240
-      ],
241
-      genderOptions: [
242
-        { text: '男', value: '男' },
243
-        { text: '女', value: '女' }
244
-      ]
245
-    }
246
-  },
247
-  onLoad() {
248
-    this.initData();
249
-  },
250
-  methods: {
251
-    initData() {
252
-      this.getUserAll();
253
-      this.getDeptList();
254
-      this.getPositionList();
255
-      this.getTeamLeaderOptions();
256
-      this.getSupervisorOptions();
257
-      this.getMissCheckItemOptions();
258
-      this.getDictData();
259
-      this.formData.missCheckTime = formatTime(new Date(), 'YYYY-MM-DD hh:mm');
260
-      this.formData.reviewDate = formatTime(new Date(), 'YYYY-MM-DD');
261
-    },
262
-    
263
-    async getDictData() {
264
-      const dict = await this.useDict(
265
-        'discrimination_type',
266
-        'blocked_time_period',
267
-        'blocked_item_position',
268
-        'blocked_monthly_exam_result',
269
-        'blocked_operating_years',
270
-        'blocked_miss_check_reason'
271
-      );
272
-      
273
-      const formatDict = (options) => {
274
-        return (options || []).map(item => ({
275
-          value: item.value,
276
-          text: item.label || item.text
277
-        }));
278
-      };
279
-      
280
-      this.discriminationTypeOptions = formatDict(dict.discrimination_type);
281
-      this.blockedTimePeriodOptions = formatDict(dict.blocked_time_period);
282
-      this.blockedItemPositionOptions = formatDict(dict.blocked_item_position);
283
-      this.blockedMonthlyExamResultOptions = formatDict(dict.blocked_monthly_exam_result);
284
-      this.blockedOperatingYearsOptions = formatDict(dict.blocked_operating_years);
285
-      this.blockedMissCheckReasonOptions = formatDict(dict.blocked_miss_check_reason);
286
-    },
287
-    
288
-    getDeptList() {
289
-      listDept({}).then(res => {
290
-        const deptList = res.data || [];
291
-        this.brigadeOptions = deptList.filter(item => item.deptType === 'BRIGADE' && [311, 314, 315].includes(item.deptId)).map(item => ({
292
-          value: item.deptId,
293
-          text: item.deptName
294
-        }));
295
-      });
296
-    },
297
-    
298
-    getUserAll() {
299
-      getUserList({ pageNum: 1, pageSize: 1000 }).then(res => {
300
-        this.personOptions = (res.rows || []).map(item => ({
301
-          value: item.userId,
302
-          text: item.nickName
303
-        }));
304
-      });
148
+    name: 'MissedInspectionAdd',
149
+    components: {
150
+        HomeContainer
305 151
     },
306
-    
307
-    getPositionList() {
308
-      listPosition({ positionType: 'CHANNEL' }).then(res => {
309
-        this.areaOptions = (res.data || []).map(item => ({
310
-          value: item.id,
311
-          text: item.name
312
-        }));
313
-      });
314
-    },
315
-    
316
-    getTeamLeaderOptions() {
317
-      selectUserLeaderListByCondition({ roleKeyList: ['banzuzhang'] }).then(res => {
318
-        this.teamLeaderOptions = (res.data || []).map(item => ({
319
-          value: item.userId,
320
-          text: item.nickName
321
-        }));
322
-      });
323
-    },
324
-    
325
-    getSupervisorOptions() {
326
-      selectUserLeaderListByCondition({ roleKeyList: ['kezhang'] }).then(res => {
327
-        this.supervisorOptions = (res.data || []).map(item => ({
328
-          value: item.userId,
329
-          text: item.nickName
330
-        }));
331
-      });
332
-    },
333
-    
334
-    getMissCheckItemOptions() {
335
-      listCategory().then(res => {
336
-        const data = res.data || [];
337
-        this.missCheckItemOptions = this.flattenTree(data);
338
-      });
339
-    },
340
-    
341
-    flattenTree(data, parentLabel = '') {
342
-      const result = [];
343
-      data.forEach(item => {
344
-        const label = parentLabel ? `${parentLabel} / ${item.name}` : item.name;
345
-        if (item.children && item.children.length > 0) {
346
-          result.push(...this.flattenTree(item.children, label));
347
-        } else {
348
-          result.push({
349
-            value: item.name,
350
-            text: label
351
-          });
152
+    mixins: [useDictMixin],
153
+    data() {
154
+        return {
155
+            formData: {
156
+                id: null,
157
+                brigadeId: null,
158
+                brigadeName: null,
159
+                reviewedUserId: null,
160
+                reviewedUserName: null,
161
+                reviewDate: '',
162
+                missCheckTime: '',
163
+                missCheckTimePeriod: null,
164
+                channelId: null,
165
+                channelName: null,
166
+                missCheckItem: null,
167
+                supervisorId: null,
168
+                supervisorName: null,
169
+                actingSupervisorId: null,
170
+                actingSupervisorName: null,
171
+                teamLeaderId: null,
172
+                teamLeaderName: null,
173
+                itemLocation: null,
174
+                difficultyLevel: null,
175
+                reviewUserId: null,
176
+                reviewUserName: null,
177
+                discriminationType: null,
178
+                isRecovered: null,
179
+                machineOperatingYears: null,
180
+                certificateLevel: null,
181
+                gender: null,
182
+                missCheckReasonCategory: null,
183
+                monthlyAssessment: null,
184
+                selfTestHasMissCheck: 0
185
+            },
186
+
187
+            rules: {
188
+                brigadeId: [{ required: true, errorMessage: '大队不能为空' }],
189
+                reviewedUserId: [{ required: true, errorMessage: '被回查人不能为空' }],
190
+                reviewDate: [{ required: true, errorMessage: '回查日期不能为空' }],
191
+                missCheckTime: [{ required: true, errorMessage: '漏检时间不能为空' }],
192
+                missCheckTimePeriod: [{ required: true, errorMessage: '漏检时间段不能为空' }],
193
+                channelId: [{ required: true, errorMessage: '上岗位置不能为空' }],
194
+                missCheckItem: [{ required: true, errorMessage: '漏检物品不能为空' }],
195
+                supervisorId: [{ required: true, errorMessage: '分管主管不能为空' }],
196
+                teamLeaderId: [{ required: true, errorMessage: '分管班组长不能为空' }],
197
+                itemLocation: [{ required: true, errorMessage: '物品位置不能为空' }],
198
+                difficultyLevel: [{ required: true, errorMessage: '简单/难不能为空' }],
199
+                reviewUserId: [{ required: true, errorMessage: '回查人不能为空' }],
200
+                discriminationType: [{ required: true, errorMessage: '判别类型不能为空' }],
201
+                isRecovered: [{ 
202
+                    validateFunction: function(rule, value, data, callback) {
203
+                        if (value === null || value === undefined || value === '') {
204
+                            callback('是否追回不能为空');
205
+                        }
206
+                        callback();
207
+                    }
208
+                }],
209
+                machineOperatingYears: [{ required: true, errorMessage: '开机年限不能为空' }],
210
+                certificateLevel: [{ required: true, errorMessage: '证书级别不能为空' }],
211
+                gender: [{ required: true, errorMessage: '人员性别不能为空' }],
212
+                missCheckReasonCategory: [{ required: true, errorMessage: '漏检原因分类不能为空' }],
213
+                monthlyAssessment: [{ required: true, errorMessage: '月考成绩不能为空' }],
214
+                selfTestHasMissCheck: [{ required: true, errorMessage: '本月自测有无漏检不能为空' }]
215
+            },
216
+
217
+            brigadeOptions: [],
218
+            personOptions: [],
219
+            teamLeaderOptions: [],
220
+            supervisorOptions: [],
221
+            areaOptions: [],
222
+            missCheckItemOptions: [],
223
+
224
+            discriminationTypeOptions: [],
225
+            blockedTimePeriodOptions: [],
226
+            blockedItemPositionOptions: [],
227
+            blockedMonthlyExamResultOptions: [],
228
+            blockedOperatingYearsOptions: [],
229
+            blockedMissCheckReasonOptions: [],
230
+            difficultyLevelOptions: [
231
+                { text: '简单', value: '简单' },
232
+                { text: '难', value: '难' }
233
+            ],
234
+            isRecoveredOptions: [
235
+                { text: '是', value: 1 },
236
+                { text: '否', value: 0 }
237
+            ],
238
+            certificateLevelOptions: [
239
+                { text: '高级', value: '高级' },
240
+                { text: '中级', value: '中级' },
241
+                { text: '初级', value: '初级' }
242
+            ],
243
+            genderOptions: [
244
+                { text: '男', value: '男' },
245
+                { text: '女', value: '女' }
246
+            ]
352 247
         }
353
-      });
354
-      return result;
355
-    },
356
-    
357
-    handleReviewedUserChange(e) {
358
-      let userId = e.detail.value;
359
-      if (Array.isArray(userId)) {
360
-        userId = userId[0]?.value;
361
-      } else if (userId && typeof userId === 'object') {
362
-        userId = userId.value;
363
-      }
364
-      if (userId) {
365
-        selectUserLeaderListByCondition({ userId: userId, roleKeyList: ['banzuzhang'] }).then(res => {
366
-          if (res.data && res.data.length > 0) {
367
-            this.formData.teamLeaderId = res.data[0].userId;
368
-          }
369
-        });
370
-        selectUserLeaderListByCondition({ userId: userId, roleKeyList: ['kezhang'] }).then(res => {
371
-          if (res.data && res.data.length > 0) {
372
-            this.formData.supervisorId = res.data[0].userId;
373
-          }
374
-        });
375
-        getUserInfoById(userId).then(res => {
376
-          const data = res?.data;
377
-          if (data) {
378
-            this.formData.gender = data.sex === '0' ? '男' : '女';
379
-          }
380
-        });
381
-      } else {
382
-        this.formData.supervisorId = null;
383
-        this.formData.teamLeaderId = null;
384
-        this.formData.gender = null;
385
-      }
386 248
     },
387
-    
388
-    handleFormBrigadeChange(e) {
389
-      const brigadeId = e.detail.value;
390
-      const brigade = this.brigadeOptions.find(item => item.value === brigadeId);
391
-      this.formData.brigadeName = brigade ? brigade.label : null;
249
+    onLoad() {
250
+        this.initData();
392 251
     },
252
+    methods: {
253
+        initData() {
254
+            this.getUserAll();
255
+            this.getDeptList();
256
+            this.getPositionList();
257
+            this.getTeamLeaderOptions();
258
+            this.getSupervisorOptions();
259
+            this.getMissCheckItemOptions();
260
+            this.getDictData();
261
+            this.formData.missCheckTime = formatTime(new Date(), 'YYYY-MM-DD hh:mm');
262
+            this.formData.reviewDate = formatTime(new Date(), 'YYYY-MM-DD');
263
+        },
264
+
265
+        async getDictData() {
266
+            const dict = await this.useDict(
267
+                'discrimination_type',
268
+                'blocked_time_period',
269
+                'blocked_item_position',
270
+                'blocked_monthly_exam_result',
271
+                'blocked_operating_years',
272
+                'blocked_miss_check_reason'
273
+            );
274
+
275
+            const formatDict = (options) => {
276
+                return (options || []).map(item => ({
277
+                    value: item.value,
278
+                    text: item.label || item.text
279
+                }));
280
+            };
281
+
282
+            this.discriminationTypeOptions = formatDict(dict.discrimination_type);
283
+            this.blockedTimePeriodOptions = formatDict(dict.blocked_time_period);
284
+            this.blockedItemPositionOptions = formatDict(dict.blocked_item_position);
285
+            this.blockedMonthlyExamResultOptions = formatDict(dict.blocked_monthly_exam_result);
286
+            this.blockedOperatingYearsOptions = formatDict(dict.blocked_operating_years);
287
+            this.blockedMissCheckReasonOptions = formatDict(dict.blocked_miss_check_reason);
288
+        },
289
+
290
+        getDeptList() {
291
+            listDept({}).then(res => {
292
+                const deptList = res.data || [];
293
+                this.brigadeOptions = deptList.filter(item => item.deptType === 'BRIGADE' && [311, 314, 315].includes(item.deptId)).map(item => ({
294
+                    value: item.deptId,
295
+                    text: item.deptName
296
+                }));
297
+            });
298
+        },
299
+
300
+        getUserAll() {
301
+            getUserList({ pageNum: 1, pageSize: 1000 }).then(res => {
302
+                this.personOptions = (res.rows || []).map(item => ({
303
+                    value: item.userId,
304
+                    text: item.nickName
305
+                }));
306
+            });
307
+        },
308
+
309
+        getPositionList() {
310
+            listPosition({ positionType: 'CHANNEL' }).then(res => {
311
+                this.areaOptions = (res.data || []).map(item => ({
312
+                    value: item.id,
313
+                    text: item.name
314
+                }));
315
+            });
316
+        },
317
+
318
+        getTeamLeaderOptions() {
319
+            selectUserLeaderListByCondition({ roleKeyList: ['banzuzhang'] }).then(res => {
320
+                this.teamLeaderOptions = (res.data || []).map(item => ({
321
+                    value: item.userId,
322
+                    text: item.nickName
323
+                }));
324
+            });
325
+        },
326
+
327
+        getSupervisorOptions() {
328
+            selectUserLeaderListByCondition({ roleKeyList: ['kezhang'] }).then(res => {
329
+                this.supervisorOptions = (res.data || []).map(item => ({
330
+                    value: item.userId,
331
+                    text: item.nickName
332
+                }));
333
+            });
334
+        },
335
+
336
+        getMissCheckItemOptions() {
337
+            listCategory().then(res => {
338
+                const data = res.data || [];
339
+                this.missCheckItemOptions = this.flattenTree(data);
340
+            });
341
+        },
342
+
343
+        flattenTree(data, parentLabel = '') {
344
+            const result = [];
345
+            data.forEach(item => {
346
+                const label = parentLabel ? `${parentLabel} / ${item.name}` : item.name;
347
+                if (item.children && item.children.length > 0) {
348
+                    result.push(...this.flattenTree(item.children, label));
349
+                } else {
350
+                    result.push({
351
+                        value: item.name,
352
+                        text: label
353
+                    });
354
+                }
355
+            });
356
+            return result;
357
+        },
358
+
359
+        handleReviewedUserChange(e) {
360
+            let userId = e.detail.value;
361
+            if (Array.isArray(userId)) {
362
+                userId = userId[0]?.value;
363
+            } else if (userId && typeof userId === 'object') {
364
+                userId = userId.value;
365
+            }
366
+            if (userId) {
367
+                selectUserLeaderListByCondition({ userId: userId, roleKeyList: ['banzuzhang'] }).then(res => {
368
+                    if (res.data && res.data.length > 0) {
369
+                        this.formData.teamLeaderId = res.data[0].userId;
370
+                    }
371
+                });
372
+                selectUserLeaderListByCondition({ userId: userId, roleKeyList: ['kezhang'] }).then(res => {
373
+                    if (res.data && res.data.length > 0) {
374
+                        this.formData.supervisorId = res.data[0].userId;
375
+                    }
376
+                });
377
+                getUserInfoById(userId).then(res => {
378
+                    const data = res?.data;
379
+                    if (data) {
380
+                        this.formData.gender = data.sex === '0' ? '男' : '女';
381
+                    }
382
+                });
383
+            } else {
384
+                this.formData.supervisorId = null;
385
+                this.formData.teamLeaderId = null;
386
+                this.formData.gender = null;
387
+            }
388
+        },
389
+
390
+        handleFormBrigadeChange(e) {
391
+            const brigadeId = e.detail.value;
392
+            const brigade = this.brigadeOptions.find(item => item.value === brigadeId);
393
+            this.formData.brigadeName = brigade ? brigade.label : null;
394
+        },
395
+
396
+        submitForm() {
397
+       
398
+
399
+            const requiredFields = [
400
+                { key: 'brigadeId', label: '大队' },
401
+                { key: 'reviewedUserId', label: '被回查人' },
402
+                { key: 'reviewDate', label: '回查日期' },
403
+                { key: 'missCheckTime', label: '漏检时间' },
404
+                { key: 'missCheckTimePeriod', label: '漏检时间段' },
405
+                { key: 'channelId', label: '上岗位置' },
406
+                { key: 'missCheckItem', label: '漏检物品' },
407
+                { key: 'supervisorId', label: '分管主管' },
408
+                { key: 'teamLeaderId', label: '分管班组长' },
409
+                { key: 'itemLocation', label: '物品位置' },
410
+                { key: 'difficultyLevel', label: '简单/难' },
411
+                { key: 'reviewUserId', label: '回查人' },
412
+                { key: 'discriminationType', label: '判别类型' },
413
+                { key: 'isRecovered', label: '是否追回' },
414
+                { key: 'machineOperatingYears', label: '开机年限' },
415
+                { key: 'certificateLevel', label: '证书级别' },
416
+                { key: 'gender', label: '人员性别' },
417
+                { key: 'missCheckReasonCategory', label: '漏检原因分类' },
418
+                { key: 'monthlyAssessment', label: '月考成绩' },
419
+                { key: 'selfTestHasMissCheck', label: '本月自测有无漏检' }
420
+            ];
421
+
422
+            for (const field of requiredFields) {
423
+                const value = this.formData[field.key];
424
+                if (value === null || value === undefined || value === '') {
425
+                    uni.showToast({ title: `${field.label}不能为空`, icon: 'none' });
426
+                    return;
427
+                }
428
+            }
429
+
430
+            this.mapNames();
431
+            console.log(this.formData);
432
+            addMissedInspection(this.formData).then(() => {
433
+                uni.showToast({ title: '新增成功', icon: 'success' });
434
+                
435
+                setTimeout(() => {
436
+                    uni.navigateBack();
437
+                }, 1500);
438
+            }).catch(() => {
439
+                uni.showToast({ title: '新增失败', icon: 'none' });
440
+            });
441
+        },
442
+        
393 443
     
394
-    submitForm() {
395
-      this.$refs.formRef.validate((valid) => {
396
-        if (valid) {
397
-          this.mapNames();
398
-          
399
-          addMissedInspection(this.formData).then(() => {
400
-            uni.showToast({ title: '新增成功', icon: 'success' });
401
-            setTimeout(() => {
402
-              uni.navigateBack();
403
-            }, 1500);
404
-          }).catch(() => {
405
-            uni.showToast({ title: '新增失败', icon: 'none' });
406
-          });
444
+
445
+        mapNames() {
446
+            if (this.formData.brigadeId) {
447
+                console.log(this.formData.brigadeId,this.brigadeOptions,11);
448
+                const brigade = this.brigadeOptions.find(item => item.value === this.formData.brigadeId);
449
+                this.formData.brigadeName = brigade ? brigade.text : null;
450
+            }
451
+
452
+            if (this.formData.reviewedUserId) {
453
+                const reviewedUser = this.personOptions.find(item => item.value === this.formData.reviewedUserId);
454
+                this.formData.reviewedUserName = reviewedUser ? reviewedUser.text : null;
455
+            }
456
+
457
+            if (this.formData.channelId) {
458
+                const channel = this.areaOptions.find(item => item.value === this.formData.channelId);
459
+                this.formData.channelName = channel ? channel.text : null;
460
+            }
461
+
462
+            if (this.formData.supervisorId) {
463
+                const supervisor = this.supervisorOptions.find(item => item.value === this.formData.supervisorId);
464
+                this.formData.supervisorName = supervisor ? supervisor.text : null;
465
+            }
466
+
467
+            if (this.formData.actingSupervisorId) {
468
+                const actingSupervisor = this.supervisorOptions.find(item => item.value === this.formData.actingSupervisorId);
469
+                this.formData.actingSupervisorName = actingSupervisor ? actingSupervisor.text : null;
470
+            }
471
+
472
+            if (this.formData.teamLeaderId) {
473
+                const teamLeader = this.teamLeaderOptions.find(item => item.value === this.formData.teamLeaderId);
474
+                this.formData.teamLeaderName = teamLeader ? teamLeader.text : null;
475
+            }
476
+
477
+            if (this.formData.reviewUserId) {
478
+                const reviewUser = this.personOptions.find(item => item.value === this.formData.reviewUserId);
479
+                this.formData.reviewUserName = reviewUser ? reviewUser.text : null;
480
+            }
407 481
         }
408
-      });
409
-    },
410
-    
411
-    mapNames() {
412
-      if (this.formData.brigadeId) {
413
-        const brigade = this.brigadeOptions.find(item => item.value === this.formData.brigadeId);
414
-        this.formData.brigadeName = brigade ? brigade.text : null;
415
-      }
416
-      
417
-      if (this.formData.reviewedUserId) {
418
-        const reviewedUser = this.personOptions.find(item => item.value === this.formData.reviewedUserId);
419
-        this.formData.reviewedUserName = reviewedUser ? reviewedUser.text : null;
420
-      }
421
-      
422
-      if (this.formData.channelId) {
423
-        const channel = this.areaOptions.find(item => item.value === this.formData.channelId);
424
-        this.formData.channelName = channel ? channel.text : null;
425
-      }
426
-      
427
-      if (this.formData.supervisorId) {
428
-        const supervisor = this.supervisorOptions.find(item => item.value === this.formData.supervisorId);
429
-        this.formData.supervisorName = supervisor ? supervisor.text : null;
430
-      }
431
-      
432
-      if (this.formData.actingSupervisorId) {
433
-        const actingSupervisor = this.supervisorOptions.find(item => item.value === this.formData.actingSupervisorId);
434
-        this.formData.actingSupervisorName = actingSupervisor ? actingSupervisor.text : null;
435
-      }
436
-      
437
-      if (this.formData.teamLeaderId) {
438
-        const teamLeader = this.teamLeaderOptions.find(item => item.value === this.formData.teamLeaderId);
439
-        this.formData.teamLeaderName = teamLeader ? teamLeader.text : null;
440
-      }
441
-      
442
-      if (this.formData.reviewUserId) {
443
-        const reviewUser = this.personOptions.find(item => item.value === this.formData.reviewUserId);
444
-        this.formData.reviewUserName = reviewUser ? reviewUser.text : null;
445
-      }
446 482
     }
447
-  }
448 483
 }
449 484
 </script>
450 485
 
451 486
 <style scoped>
452
-.missed-inspection-page {
453
-  width: 100%;
454
-  min-height: 100vh;
455
-  background-color: #f5f7fa;
456
-  display: flex;
457
-  flex-direction: column;
458
-}
459
-
460
-.page-header {
461
-  background-color: #fff;
462
-  padding: 16px;
463
-  border-bottom: 1px solid #f0f0f0;
464
-}
465
-
466
-.page-title {
467
-  font-size: 18px;
468
-  font-weight: bold;
469
-  color: #333;
470
-}
471
-
472 487
 .form-scroll {
473
-  flex: 1;
474
-  
488
+    height: calc(100vh - 160rpx);
489
+    width: 100%;
490
+    box-sizing: border-box;
475 491
 }
476 492
 
477 493
 .form-container {
478
-  background-color: #fff;
479
-  border-radius: 12px;
480
-  padding: 16px;
481
-  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
494
+    padding: 20rpx;
495
+    background-color: #fff;
482 496
 }
483 497
 
484 498
 .form-row {
485
-  margin-bottom: 16px;
499
+    margin-bottom: 20rpx;
486 500
 }
487 501
 
488 502
 .submit-bar {
489
-  position: fixed;
490
-  bottom: 0;
491
-  left: 0;
492
-  right: 0;
493
-  background-color: #fff;
494
-  padding: 12px 16px;
495
-  border-top: 1px solid #f0f0f0;
496
-  padding-bottom: calc(12px + env(safe-area-inset-bottom));
503
+    position: fixed;
504
+    bottom: 0;
505
+    left: 0;
506
+    right: 0;
507
+    background-color: #fff;
508
+    padding: 15rpx 20rpx;
509
+    border-top: 1px solid #f0f0f0;
510
+    padding-bottom: calc(15rpx + env(safe-area-inset-bottom));
511
+    box-sizing: border-box;
497 512
 }
498 513
 
499 514
 .submit-btn {
500
-  height: 44px;
501
-  display: flex;
502
-  align-items: center;
503
-  justify-content: center;
504
-  border-radius: 8px;
505
-  font-size: 16px;
506
-  color: #fff;
507
-  background-color: #409EFF;
515
+    height: 88rpx;
516
+    display: flex;
517
+    align-items: center;
518
+    justify-content: center;
519
+    border-radius: 8rpx;
520
+    font-size: 32rpx;
521
+    color: #fff;
522
+    background-color: #409EFF;
508 523
 }
509 524
 </style>