Browse Source

建单BUG修复

seimin 11 months ago
parent
commit
34ffa54546
2 changed files with 125 additions and 54 deletions
  1. 45 1
      pages/assign/assign.vue
  2. 80 53
      pages/buildIncident/buildIncident.vue

+ 45 - 1
pages/assign/assign.vue

@@ -177,6 +177,7 @@
177
     Promise.all(requestList).then(resList => {
177
     Promise.all(requestList).then(resList => {
178
       uni.hideLoading();
178
       uni.hideLoading();
179
       console.log(resList);
179
       console.log(resList);
180
+      incidentBuildStore.clearIncidentBuildData();
180
       uni.showToast({
181
       uni.showToast({
181
       	icon: 'none',
182
       	icon: 'none',
182
         title: '建单成功',
183
         title: '建单成功',
@@ -560,6 +561,7 @@
560
     postData.incident.closecode = {id: dataInfo.closecode};
561
     postData.incident.closecode = {id: dataInfo.closecode};
561
     postData.incident.category = dataInfo.category;
562
     postData.incident.category = dataInfo.category;
562
     postData.incident.synergetic = dataInfo.synergetic;
563
     postData.incident.synergetic = dataInfo.synergetic;
564
+    postData.incident.directProcess = 1;//直接解决
563
     
565
     
564
     return api_incidentTask('accept', postData);
566
     return api_incidentTask('accept', postData);
565
   }
567
   }
@@ -665,6 +667,7 @@
665
         uni.hideLoading();
667
         uni.hideLoading();
666
         console.log(resList);
668
         console.log(resList);
667
         if(resList[0].state == 200){
669
         if(resList[0].state == 200){
670
+          incidentBuildStore.clearIncidentBuildData();
668
           uni.showToast({
671
           uni.showToast({
669
           	icon: 'none',
672
           	icon: 'none',
670
             title: '建单成功',
673
             title: '建单成功',
@@ -741,6 +744,7 @@
741
         uni.hideLoading();
744
         uni.hideLoading();
742
         console.log(resList);
745
         console.log(resList);
743
         if(resList[0].state == 200){
746
         if(resList[0].state == 200){
747
+          incidentBuildStore.clearIncidentBuildData();
744
           uni.showToast({
748
           uni.showToast({
745
           	icon: 'none',
749
           	icon: 'none',
746
             title: '建单成功',
750
             title: '建单成功',
@@ -768,11 +772,51 @@
768
       Object.assign(dataInfo, handlerStore.handler.data);
772
       Object.assign(dataInfo, handlerStore.handler.data);
769
       console.log(dataInfo)
773
       console.log(dataInfo)
770
       handlerStore.clearHandlerData();
774
       handlerStore.clearHandlerData();
775
+      
776
+      if(dataInfo.category){
777
+         dataInfo.incidentData.category = dataInfo.category;
778
+        
779
+        // 处理责任科室
780
+        if(dataInfo.category.branchType == 1){
781
+          // 分院区
782
+          if(dataInfo.incidentData.branch){
783
+            let dutyConfig = dataInfo.category.branchUserGroups.find(v=>v.branchId == dataInfo.incidentData.branch);
784
+            if(dutyConfig && dutyConfig.dutyId && dutyConfig.dutyName){
785
+              dataInfo.incidentData.duty = {id:dutyConfig.dutyId,dept:dutyConfig.dutyName};
786
+            }else{
787
+              dataInfo.incidentData.duty = undefined;
788
+            }
789
+          }else{
790
+            dataInfo.incidentData.duty = undefined;
791
+          }
792
+        }else{
793
+          // 不分院区
794
+          dataInfo.incidentData.duty = dataInfo.category.dutyDepartment;
795
+        }
796
+      }
771
     }else if(incidentBuildStore.incidentBuild.data){
797
     }else if(incidentBuildStore.incidentBuild.data){
772
       // 初始化
798
       // 初始化
773
-      dataInfo.incidentData = incidentBuildStore.incidentBuild.data || {};
799
+      Object.assign(dataInfo.incidentData, incidentBuildStore.incidentBuild.data);
774
       if(dataInfo.incidentData.category){
800
       if(dataInfo.incidentData.category){
775
         dataInfo.category = dataInfo.incidentData.category;
801
         dataInfo.category = dataInfo.incidentData.category;
802
+        
803
+        // 处理责任科室
804
+        if(dataInfo.category.branchType == 1){
805
+          // 分院区
806
+          if(dataInfo.incidentData.branch){
807
+            let dutyConfig = dataInfo.category.branchUserGroups.find(v=>v.branchId == dataInfo.incidentData.branch);
808
+            if(dutyConfig && dutyConfig.dutyId && dutyConfig.dutyName){
809
+              dataInfo.incidentData.duty = {id:dutyConfig.dutyId,dept:dutyConfig.dutyName};
810
+            }else{
811
+              dataInfo.incidentData.duty = undefined;
812
+            }
813
+          }else{
814
+            dataInfo.incidentData.duty = undefined;
815
+          }
816
+        }else{
817
+          // 不分院区
818
+          dataInfo.incidentData.duty = dataInfo.category.dutyDepartment;
819
+        }
776
       }
820
       }
777
       if(dataInfo.incidentData.priority){
821
       if(dataInfo.incidentData.priority){
778
         dataInfo.incidentData.priority = { id: dataInfo.incidentData.priority };
822
         dataInfo.incidentData.priority = { id: dataInfo.incidentData.priority };

+ 80 - 53
pages/buildIncident/buildIncident.vue

@@ -43,12 +43,12 @@
43
         </view>
43
         </view>
44
       </view>
44
       </view>
45
       <view class="form_item">
45
       <view class="form_item">
46
-        <view class="title select"><text class="required newicon newicon-bitian transparent"></text>故障来源:</view>
47
-        <uni-data-select readonly class="value" v-model="incidentData.source" :localdata="dataInfo.sourceList" placeholder="请选择故障来源"></uni-data-select>
46
+        <view class="title select"><text class="required newicon newicon-bitian"></text>故障来源:</view>
47
+        <uni-data-select readonly class="value" v-model="incidentData.source" :localdata="dataInfo.sourceList" placeholder="请选择故障来源" :class="{formRed: isSubmit && !incidentData.source}"></uni-data-select>
48
       </view>
48
       </view>
49
       <view class="form_item">
49
       <view class="form_item">
50
-        <view class="title select"><text class="required newicon newicon-bitian transparent"></text>优先级:</view>
51
-        <uni-data-select placement="top" readonly class="value" v-model="incidentData.priority" :localdata="dataInfo.priorityList" placeholder="请选择优先级"></uni-data-select>
50
+        <view class="title select"><text class="required newicon newicon-bitian"></text>优先级:</view>
51
+        <uni-data-select placement="top" readonly class="value" v-model="incidentData.priority" :localdata="dataInfo.priorityList" placeholder="请选择优先级" :class="{formRed: isSubmit && !incidentData.priority}"></uni-data-select>
52
       </view>
52
       </view>
53
       <view class="form_item column">
53
       <view class="form_item column">
54
         <view class="title select"><text class="required newicon newicon-bitian"></text>故障描述:</view>
54
         <view class="title select"><text class="required newicon newicon-bitian"></text>故障描述:</view>
@@ -68,7 +68,7 @@
68
           </view>
68
           </view>
69
         </view>
69
         </view>
70
       </view>
70
       </view>
71
-      
71
+
72
     </scroll-view>
72
     </scroll-view>
73
     <view class="foot_common_btns">
73
     <view class="foot_common_btns">
74
       <button @click="goBack" type="default" class="cancelButton btn">返回</button>
74
       <button @click="goBack" type="default" class="cancelButton btn">返回</button>
@@ -87,16 +87,16 @@
87
   import { useLoginUserStore } from '@/stores/loginUser'
87
   import { useLoginUserStore } from '@/stores/loginUser'
88
   import { useIncidentBuildStore } from '@/stores/incidentBuild'
88
   import { useIncidentBuildStore } from '@/stores/incidentBuild'
89
   import { useUploadFile } from '@/share/useUploadFile.js'
89
   import { useUploadFile } from '@/share/useUploadFile.js'
90
-  
90
+
91
   useSetTitle();
91
   useSetTitle();
92
   const loginUserStore = useLoginUserStore();
92
   const loginUserStore = useLoginUserStore();
93
   const incidentBuildStore = useIncidentBuildStore();
93
   const incidentBuildStore = useIncidentBuildStore();
94
   const { uploadFile }  = useUploadFile();
94
   const { uploadFile }  = useUploadFile();
95
   const { goBack }  = useGoBack();
95
   const { goBack }  = useGoBack();
96
-  
96
+
97
   // 主题颜色
97
   // 主题颜色
98
   const primaryColor = ref(defaultColor)
98
   const primaryColor = ref(defaultColor)
99
-  
99
+
100
   // 工单对象
100
   // 工单对象
101
   const incidentData = reactive({
101
   const incidentData = reactive({
102
     "deleteFlag": 0,
102
     "deleteFlag": 0,
@@ -118,10 +118,10 @@
118
     "acceptUser": loginUserStore.loginUser.user,
118
     "acceptUser": loginUserStore.loginUser.user,
119
     repairImgList: [],//报修图片列表
119
     repairImgList: [],//报修图片列表
120
   })
120
   })
121
-  
121
+
122
   // 报修图片
122
   // 报修图片
123
   const handlerImgRef = ref(null)
123
   const handlerImgRef = ref(null)
124
-  
124
+
125
   // 数据
125
   // 数据
126
   const dataInfo = reactive({
126
   const dataInfo = reactive({
127
     branchList: [], //院区列表
127
     branchList: [], //院区列表
@@ -129,10 +129,10 @@
129
     sourceList: [], //故障来源列表
129
     sourceList: [], //故障来源列表
130
     priorityList: [], //优先级列表
130
     priorityList: [], //优先级列表
131
   })
131
   })
132
-  
132
+
133
   // 是否提交
133
   // 是否提交
134
   const isSubmit = ref(false)
134
   const isSubmit = ref(false)
135
-  
135
+
136
   // 上传报修图片成功
136
   // 上传报修图片成功
137
   function handlerImgSuccess(e){
137
   function handlerImgSuccess(e){
138
     incidentData.repairImgList.forEach(v => {
138
     incidentData.repairImgList.forEach(v => {
@@ -140,7 +140,7 @@
140
     })
140
     })
141
     console.log(incidentData.repairImgList);
141
     console.log(incidentData.repairImgList);
142
   }
142
   }
143
-  
143
+
144
   // 上传报修图片失败
144
   // 上传报修图片失败
145
   function handlerImgFail(e){
145
   function handlerImgFail(e){
146
     incidentData.repairImgList.forEach(v => {
146
     incidentData.repairImgList.forEach(v => {
@@ -148,19 +148,19 @@
148
     })
148
     })
149
     console.log(incidentData.repairImgList);
149
     console.log(incidentData.repairImgList);
150
   }
150
   }
151
-  
151
+
152
   // 选择上传图片
152
   // 选择上传图片
153
   function handlerImgSelect(e){
153
   function handlerImgSelect(e){
154
     incidentData.repairImgList = incidentData.repairImgList.concat(e.tempFiles);
154
     incidentData.repairImgList = incidentData.repairImgList.concat(e.tempFiles);
155
     console.log(incidentData.repairImgList);
155
     console.log(incidentData.repairImgList);
156
   }
156
   }
157
-  
157
+
158
   // 删除上传图片
158
   // 删除上传图片
159
   function handlerImgDelete(e){
159
   function handlerImgDelete(e){
160
     incidentData.repairImgList = incidentData.repairImgList.filter(v => e.tempFile.uuid != v.uuid);
160
     incidentData.repairImgList = incidentData.repairImgList.filter(v => e.tempFile.uuid != v.uuid);
161
     console.log(incidentData.repairImgList);
161
     console.log(incidentData.repairImgList);
162
   }
162
   }
163
-  
163
+
164
   // 选择故障现象
164
   // 选择故障现象
165
   function selectCategory(){
165
   function selectCategory(){
166
     incidentBuildStore.setIncidentBuildData(incidentData, 'buildIncident');
166
     incidentBuildStore.setIncidentBuildData(incidentData, 'buildIncident');
@@ -168,7 +168,7 @@
168
       url: `/pages/categoryOne/categoryOne`
168
       url: `/pages/categoryOne/categoryOne`
169
     })
169
     })
170
   }
170
   }
171
-  
171
+
172
   // 选择楼栋楼层
172
   // 选择楼栋楼层
173
   function selectAreaPlace(){
173
   function selectAreaPlace(){
174
     incidentBuildStore.setIncidentBuildData(incidentData, 'buildIncident');
174
     incidentBuildStore.setIncidentBuildData(incidentData, 'buildIncident');
@@ -176,7 +176,7 @@
176
       url: `/pages/searchArea/searchArea`
176
       url: `/pages/searchArea/searchArea`
177
     })
177
     })
178
   }
178
   }
179
-  
179
+
180
   // 跳转到搜索报修科室
180
   // 跳转到搜索报修科室
181
   function selectDepartment(){
181
   function selectDepartment(){
182
     incidentBuildStore.setIncidentBuildData(incidentData, 'buildIncident');
182
     incidentBuildStore.setIncidentBuildData(incidentData, 'buildIncident');
@@ -184,7 +184,7 @@
184
       url: `/pages/searchDept/searchDept`
184
       url: `/pages/searchDept/searchDept`
185
     })
185
     })
186
   }
186
   }
187
-  
187
+
188
   // 获取院区列表
188
   // 获取院区列表
189
   function getBranchs(){
189
   function getBranchs(){
190
     uni.showLoading({
190
     uni.showLoading({
@@ -203,15 +203,17 @@
203
           text: v.hosName,
203
           text: v.hosName,
204
           value: v.id,
204
           value: v.id,
205
         }));
205
         }));
206
-        
207
-        if(loginUserStore.loginUser.user.duty){
208
-          // 当前的所属责任科室
209
-          incidentData.branch = loginUserStore.loginUser.user.duty.branch;
210
-        }else if(loginUserStore.loginUser.user.branch){
211
-          // 当前的所属院区
212
-          incidentData.branch = loginUserStore.loginUser.user.branch.id;
206
+
207
+        if(!incidentBuildStore.incidentBuild.data){
208
+          if(loginUserStore.loginUser.user.duty){
209
+            // 当前的所属责任科室
210
+            incidentData.branch = loginUserStore.loginUser.user.duty.branch;
211
+          }else if(loginUserStore.loginUser.user.branch){
212
+            // 当前的所属院区
213
+            incidentData.branch = loginUserStore.loginUser.user.branch.id;
214
+          }
213
         }
215
         }
214
-        
216
+
215
       }else{
217
       }else{
216
         uni.showToast({
218
         uni.showToast({
217
           icon: 'none',
219
           icon: 'none',
@@ -220,7 +222,7 @@
220
       }
222
       }
221
     })
223
     })
222
   }
224
   }
223
-  
225
+
224
   // 获取报修人列表
226
   // 获取报修人列表
225
   function getRequesters(){
227
   function getRequesters(){
226
     uni.showLoading({
228
     uni.showLoading({
@@ -242,7 +244,7 @@
242
           text: v.name,
244
           text: v.name,
243
           value: v.id,
245
           value: v.id,
244
         }));
246
         }));
245
-        
247
+
246
       }else{
248
       }else{
247
         uni.showToast({
249
         uni.showToast({
248
           icon: 'none',
250
           icon: 'none',
@@ -251,7 +253,7 @@
251
       }
253
       }
252
     })
254
     })
253
   }
255
   }
254
-  
256
+
255
   // 获取故障来源列表
257
   // 获取故障来源列表
256
   function getSources(){
258
   function getSources(){
257
     uni.showLoading({
259
     uni.showLoading({
@@ -268,10 +270,15 @@
268
       dataInfo.sourceList = res.map(v => ({
270
       dataInfo.sourceList = res.map(v => ({
269
         text: v.name,
271
         text: v.name,
270
         value: v.id,
272
         value: v.id,
273
+        key: v.value,
271
       }));
274
       }));
275
+      let discover = dataInfo.sourceList.find(v => v.key === 'discover');
276
+      if(discover){
277
+        incidentData.source = discover.value;
278
+      }
272
     })
279
     })
273
   }
280
   }
274
-  
281
+
275
   // 获取优先级列表
282
   // 获取优先级列表
276
   function getPrioritys(){
283
   function getPrioritys(){
277
     uni.showLoading({
284
     uni.showLoading({
@@ -291,30 +298,35 @@
291
       }));
298
       }));
292
     })
299
     })
293
   }
300
   }
294
-  
301
+
295
   // 选择院区
302
   // 选择院区
296
-  function changeBranch(){}
297
-  
303
+  function changeBranch(){
304
+    incidentData.department = undefined;
305
+    incidentData.contactsInformation = '';
306
+    incidentData.place = undefined;
307
+    incidentData.houseNumber = undefined;
308
+  }
309
+
298
   // 处理提交事件
310
   // 处理提交事件
299
   function handlerOrder(){
311
   function handlerOrder(){
300
     let postData = {
312
     let postData = {
301
       incident: dataInfo.incidentData,
313
       incident: dataInfo.incidentData,
302
     }
314
     }
303
-    
315
+
304
     postData.incident.handleDescription = dataInfo.handleDescription;
316
     postData.incident.handleDescription = dataInfo.handleDescription;
305
     postData.incident.handleCategory = {id: dataInfo.handleCategory};
317
     postData.incident.handleCategory = {id: dataInfo.handleCategory};
306
     postData.incident.closecode = {id: dataInfo.closecode};
318
     postData.incident.closecode = {id: dataInfo.closecode};
307
     postData.incident.category = dataInfo.category;
319
     postData.incident.category = dataInfo.category;
308
     postData.incident.synergetic = dataInfo.synergetic;
320
     postData.incident.synergetic = dataInfo.synergetic;
309
-    
321
+
310
     return api_incidentTask('accept', postData);
322
     return api_incidentTask('accept', postData);
311
   }
323
   }
312
-  
324
+
313
   // 报修图片
325
   // 报修图片
314
   function handlerOrderImg(imgObj){
326
   function handlerOrderImg(imgObj){
315
     return uploadFile(imgObj, 'incident', dataInfo.incidentId)
327
     return uploadFile(imgObj, 'incident', dataInfo.incidentId)
316
   }
328
   }
317
-  
329
+
318
   // 提交
330
   // 提交
319
   function submit(){
331
   function submit(){
320
     isSubmit.value = true;
332
     isSubmit.value = true;
@@ -326,7 +338,7 @@
326
       });
338
       });
327
       return;
339
       return;
328
     }
340
     }
329
-    
341
+
330
     if(!incidentData.department){
342
     if(!incidentData.department){
331
       uni.showToast({
343
       uni.showToast({
332
       	icon: 'none',
344
       	icon: 'none',
@@ -334,7 +346,7 @@
334
       });
346
       });
335
       return;
347
       return;
336
     }
348
     }
337
-    
349
+
338
     if(!incidentData.contactsInformation.trim()){
350
     if(!incidentData.contactsInformation.trim()){
339
       uni.showToast({
351
       uni.showToast({
340
       	icon: 'none',
352
       	icon: 'none',
@@ -342,7 +354,7 @@
342
       });
354
       });
343
       return;
355
       return;
344
     }
356
     }
345
-    
357
+
346
     if(!incidentData.category){
358
     if(!incidentData.category){
347
       uni.showToast({
359
       uni.showToast({
348
       	icon: 'none',
360
       	icon: 'none',
@@ -350,7 +362,23 @@
350
       });
362
       });
351
       return;
363
       return;
352
     }
364
     }
353
-    
365
+
366
+    if(!incidentData.source){
367
+      uni.showToast({
368
+      	icon: 'none',
369
+        title: '请选择故障来源'
370
+      });
371
+      return;
372
+    }
373
+
374
+    if(!incidentData.priority){
375
+      uni.showToast({
376
+      	icon: 'none',
377
+        title: '请选择优先级'
378
+      });
379
+      return;
380
+    }
381
+
354
     if(!incidentData.description.trim()){
382
     if(!incidentData.description.trim()){
355
       uni.showToast({
383
       uni.showToast({
356
       	icon: 'none',
384
       	icon: 'none',
@@ -359,12 +387,12 @@
359
       return;
387
       return;
360
     }
388
     }
361
     console.log(incidentData);
389
     console.log(incidentData);
362
-    
390
+
363
     // 处理责任科室
391
     // 处理责任科室
364
     if(incidentData.category.branchType == 1){
392
     if(incidentData.category.branchType == 1){
365
       // 分院区
393
       // 分院区
366
       if(incidentData.branch){
394
       if(incidentData.branch){
367
-        var dutyConfig = incidentData.category.branchUserGroups.find(v=>v.branchId == incidentData.branch);
395
+        let dutyConfig = incidentData.category.branchUserGroups.find(v=>v.branchId == incidentData.branch);
368
         if(dutyConfig && dutyConfig.dutyId && dutyConfig.dutyName){
396
         if(dutyConfig && dutyConfig.dutyId && dutyConfig.dutyName){
369
           incidentData.duty = {id:dutyConfig.dutyId,dept:dutyConfig.dutyName};
397
           incidentData.duty = {id:dutyConfig.dutyId,dept:dutyConfig.dutyName};
370
         }else{
398
         }else{
@@ -377,30 +405,29 @@
377
       // 不分院区
405
       // 不分院区
378
       incidentData.duty = incidentData.category.dutyDepartment;
406
       incidentData.duty = incidentData.category.dutyDepartment;
379
     }
407
     }
380
-    
408
+
381
     incidentData.title = incidentData.category.category;
409
     incidentData.title = incidentData.category.category;
382
     incidentBuildStore.setIncidentBuildData(incidentData, 'buildIncident');
410
     incidentBuildStore.setIncidentBuildData(incidentData, 'buildIncident');
383
     uni.navigateTo({
411
     uni.navigateTo({
384
       url: '/pages/assign/assign'
412
       url: '/pages/assign/assign'
385
     })
413
     })
386
   }
414
   }
387
-  
415
+
388
   onLoad((option) => {
416
   onLoad((option) => {
389
     if(incidentBuildStore.incidentBuild.data){
417
     if(incidentBuildStore.incidentBuild.data){
390
       Object.assign(incidentData, incidentBuildStore.incidentBuild.data);
418
       Object.assign(incidentData, incidentBuildStore.incidentBuild.data);
391
-      // incidentBuildStore.clearIncidentBuildData();
392
-      
419
+
393
       // 修改报修科室,则回显楼栋,楼层,详细地址,联系电话
420
       // 修改报修科室,则回显楼栋,楼层,详细地址,联系电话
394
       if(!incidentData.place){
421
       if(!incidentData.place){
395
-        incidentData.place = incidentData.department.place || undefined;
422
+        incidentData.place = incidentData.department ? incidentData.department.place : undefined;
396
       }
423
       }
397
-      
424
+
398
       if(!incidentData.houseNumber){
425
       if(!incidentData.houseNumber){
399
-        incidentData.houseNumber = incidentData.department.address || '';
426
+        incidentData.houseNumber = incidentData.department ? incidentData.department.address : '';
400
       }
427
       }
401
-      
428
+
402
       if(!incidentData.contactsInformation){
429
       if(!incidentData.contactsInformation){
403
-        incidentData.contactsInformation = incidentData.department.phone || '';
430
+        incidentData.contactsInformation = incidentData.department ? incidentData.department.phone : '';
404
       }
431
       }
405
     }
432
     }
406
     getBranchs();
433
     getBranchs();