seimin 4 months ago
parent
commit
c59d228c9a
1 changed files with 59 additions and 60 deletions
  1. 59 60
      pages/repair/rapidRepNext.vue

+ 59 - 60
pages/repair/rapidRepNext.vue

@@ -17,7 +17,7 @@
17 17
 				</view>
18 18
 <!--        <view class="form_item">
19 19
           <view class="title select"><text class="required newicon newicon-bitian"></text>报修科室:</view>
20
-        	<uni-data-picker class="value" placeholder="请选择报修科室" 
20
+        	<uni-data-picker class="value" placeholder="请选择报修科室"
21 21
         		v-model="dataInfo.department" :localdata="dataInfo.repairTypeList"
22 22
         		:clear-icon="false" :class="{formRed: isSubmit && !dataInfo.department}">
23 23
         	</uni-data-picker>
@@ -32,7 +32,7 @@
32 32
 				<view class="candidate" v-if="itemUser">
33 33
 					<view class="candidate-item" v-for="(item, index) in itemUser.commonDeptDTO" :key="item" @click="itemCandidate(item)">{{item.dept}}</view>
34 34
 				</view>
35
-				
35
+
36 36
 				<view class="form_item column">
37 37
 					<view class="title"><text class="required newicon newicon-bitian"></text>详细地址:</view>
38 38
 					<uni-easyinput class="value" type="textarea" v-model="dataInfo.address" placeholder="请输入详细地址"  :class="{formRed: isSubmit && !dataInfo.address }" />
@@ -40,12 +40,12 @@
40 40
 				<view class="candidate">
41 41
 					<view class="candidate-item" v-for="item in dataInfo.addressList" :key="item.id" @click="itemAddres(item)">{{item.name}}</view>
42 42
 				</view>
43
-				
43
+
44 44
 				<view class="form_item" :class="{formRed: isSubmit && !dataInfo.contacts}">
45 45
 					<view class="title select"><text class="required newicon newicon-bitian"></text>联系人:</view>
46 46
 					<input class="item-input" placeholder="请输入联系人" v-model="dataInfo.contacts" />
47 47
 				</view>
48
-				
48
+
49 49
 				<view class="form_item" :class="{formRed: isSubmit && !dataInfo.contactsInformation}">
50 50
 					<view class="title select"><text class="required newicon newicon-bitian"></text>联系电话:</view>
51 51
 					<input class="item-input" placeholder="请输入联系电话" v-model="dataInfo.contactsInformation"/>
@@ -68,7 +68,7 @@
68 68
        		:clear-icon="false" :class="{formRed: isSubmit && !dataInfo.areaId}">
69 69
        	</uni-data-picker>
70 70
        </view>
71
-       
71
+
72 72
 			 <view class="form_item" v-if="isRepair.valueconfig==1">
73 73
 			   <view class="title select"><text class="required newicon newicon-bitian"></text>楼层:</view>
74 74
 			 	<uni-data-picker class="value" placeholder="请选择楼层"
@@ -76,17 +76,17 @@
76 76
 			 		:clear-icon="false" :class="{formRed: isSubmit && !dataInfo.placeId}">
77 77
 			 	</uni-data-picker>
78 78
 			 </view>
79
-			 
79
+
80 80
        <view class="form_item column" v-if="isRepair.valueconfig==1">
81 81
        	<view class="title"><text class="required newicon newicon-bitian"></text>详细地址:</view>
82 82
        	<uni-easyinput class="value" type="textarea" v-model="dataInfo.address" placeholder="请输入详细地址" :class="{formRed: isSubmit && !dataInfo.address}" />
83 83
        </view>
84
-       
84
+
85 85
        <view class="form_item" :class="{formRed: isSubmit && !dataInfo.contacts}">
86 86
        	<view class="title select"><text class="required newicon newicon-bitian"></text>联系人:</view>
87 87
        	<input class="item-input value" placeholder="请输入联系人" v-model="dataInfo.contacts"/>
88 88
        </view>
89
-       
89
+
90 90
        <view class="form_item" :class="{formRed: isSubmit && !dataInfo.contactsInformation}">
91 91
        	<view class="title select"><text class="required newicon newicon-bitian"></text>联系电话:</view>
92 92
        	<input class="item-input value" placeholder="请输入联系电话" v-model="dataInfo.contactsInformation"/>
@@ -98,7 +98,7 @@
98 98
       <button @click="submit" type="default" class="primaryButton btn">提交</button>
99 99
     </view>
100 100
     <NumberModal v-if="dataInfo.isNumber" @cancelEmit="cancelNumber" @confirmEmit="conformNumber" @removeEmit="removeNumber" :selectData="dataInfo.selectData" :selectType="dataInfo.selectType" :evtNumber="dataInfo.evtNumber" showRemove></NumberModal>
101
-		
101
+
102 102
 	</view>
103 103
 </template>
104 104
 
@@ -115,17 +115,17 @@
115 115
   import { useGoBack } from '@/share/useGoBack.js'
116 116
   import { useLoginUserStore } from '@/stores/loginUser'
117 117
   import { useHandlerStore } from '@/stores/handler'
118
-  
118
+
119 119
   useSetTitle();
120 120
   const loginUserStore = useLoginUserStore();
121 121
   const handlerStore = useHandlerStore();
122 122
   const { makePhoneCall }  = useMakePhoneCall();
123 123
   const { uploadFile }  = useUploadFile();
124 124
   const { goBack }  = useGoBack();
125
-  
125
+
126 126
   // 主题颜色
127 127
   const primaryColor = ref(defaultColor)
128
-  
128
+
129 129
 	// 备用机选项
130 130
 	const machineData = ref([
131 131
 		{
@@ -137,14 +137,14 @@
137 137
 			value:0
138 138
 		},
139 139
 	])
140
-	
140
+
141 141
 	const isDept = ref({})
142 142
 	const isRepair = ref({})
143 143
 	const branchData = ref([])
144 144
 	const candidateData = ref(loginUserStore.loginUser.user)
145
-	
145
+
146 146
 	const repairIncident = ref(null)
147
-	
147
+
148 148
   // 数据
149 149
   const dataInfo = reactive({
150 150
     tabs: [
@@ -174,28 +174,28 @@
174 174
 		branch:'', //院区
175 175
 		addressList: [], //科室地点
176 176
   })
177
-  
178
-	
177
+
178
+
179 179
 	// 故障处理用是否提供备用机
180 180
 	const newProvideBackupMachine = ref(0)
181
-	
181
+
182 182
 	// 知识库id
183 183
 	const solutionId = ref(null)
184
-	
184
+
185 185
   // 是否提交
186 186
   const isSubmit = ref(false)
187
-  
187
+
188 188
   // 处理图片
189 189
   const handlerImgRef = ref(null)
190
-  
190
+
191 191
 	// 用户信息
192 192
 	const itemUser = ref(null)
193
-		
193
+
194 194
   // 是否进入汇总单
195 195
   const isInSummaryOrder = computed(() => {
196 196
     return dataInfo.tabActiveValue === 'doing' && dataInfo.incidentData.duty && dataInfo.incidentData.duty.addSummary == 1 && (dataInfo.incidentData.handlingPersonnelUser.id == loginUserStore.loginUser.user.id);
197 197
   })
198
-  
198
+
199 199
   // 上一步或者返回列表
200 200
   function goBackOrToList(){
201 201
 		uni.setStorageSync('rapidRepNext',JSON.stringify(dataInfo))
@@ -203,7 +203,7 @@
203 203
 		  url: `/pages/repair/rapidRep`
204 204
 		})
205 205
   }
206
-  
206
+
207 207
   // 重置
208 208
   function reset(){
209 209
 		// dataInfo.department = '',//报修科室
@@ -214,7 +214,7 @@
214 214
 		dataInfo.placeId = '' //院区
215 215
 		dataInfo.placeTypeList = []
216 216
   }
217
-  
217
+
218 218
   // 初始化表单
219 219
   function initForm(){
220 220
     if(dataInfo.tabActiveValue === 'doing'){
@@ -224,7 +224,7 @@
224 224
 			getbuildingList()
225 225
     }
226 226
   }
227
-  
227
+
228 228
 	function itemCandidate(item){
229 229
 		// console.log(55,index)
230 230
 		// let arr = loginUserStore.loginUser.user.commonDept.split(',')
@@ -232,11 +232,11 @@
232 232
 		dataInfo.department = item.id
233 233
 		dataInfo.departmentName = item.dept
234 234
 	}
235
-	
235
+
236 236
 	function itemAddres(item){
237 237
 		dataInfo.address = item.name
238 238
 	}
239
-	
239
+
240 240
 	function getUserInfo(){
241 241
 		let user = loginUserStore.loginUser.user
242 242
 		let postData = {
@@ -255,7 +255,7 @@
255 255
 				if(uni.getStorageSync('rapidRepNext')){
256 256
 					let data = JSON.parse(uni.getStorageSync('rapidRepNext'))
257 257
 					if(data){
258
-						dataInfo.departmentName = data.departmentName 
258
+						dataInfo.departmentName = data.departmentName
259 259
 						dataInfo.department = data.department
260 260
 					}
261 261
 				}else{
@@ -263,7 +263,7 @@
263 263
 					dataInfo.department = res.list[0].dept.id
264 264
 				}
265 265
 		    itemUser.value = res.list.find(i=>i.id==user.id)
266
-				
266
+
267 267
 		  }else{
268 268
 		    uni.showToast({
269 269
 		      icon: 'none',
@@ -272,7 +272,7 @@
272 272
 		  }
273 273
 		})
274 274
 	}
275
-	
275
+
276 276
   // 点击tab
277 277
   function clickTab(tabValue){
278 278
     if(dataInfo.tabActiveValue == tabValue){
@@ -294,7 +294,7 @@
294 294
 		newProvideBackupMachine.value = dataInfo.incidentData.provideBackupMachine
295 295
     initForm();
296 296
   }
297
-  
297
+
298 298
   // 获取事件详情
299 299
   function getIncidentDetail(){
300 300
 		let user = loginUserStore.loginUser.user
@@ -331,7 +331,7 @@
331 331
 				dataInfo.assetId = data.assetId
332 332
 			}
333 333
 		}
334
-		
334
+
335 335
 		let data = JSON.parse(uni.getStorageSync('sysData'))
336 336
 		isDept.value = data.find(i=>i.keyconfig=='deptRepair')
337 337
 		isRepair.value = data.find(i=>i.keyconfig=='publicRepair')
@@ -354,7 +354,7 @@
354 354
 			getbuildingList()
355 355
 		}
356 356
 
357
-		
357
+
358 358
 		let postData = {
359 359
 		  "key": 'repair_incident_type',
360 360
 		  "type": "list",
@@ -365,7 +365,7 @@
365 365
 		})
366 366
 		getBranch()
367 367
   }
368
-  
368
+
369 369
 	// 获取院区列表
370 370
 	function getBranch(){
371 371
 		let arr = loginUserStore.loginUser.hospital.filter(i=>i.parent==undefined)
@@ -374,19 +374,19 @@
374 374
 		  value: v.id,
375 375
 		}));
376 376
 	}
377
-	
377
+
378 378
 	// 科内报修选择院区
379 379
 	function doingDeptChange(){
380 380
 		dataInfo.department = ''
381 381
 		dataInfo.departmentName = ''
382 382
 		// getRepairTypes()
383 383
 	}
384
-	
384
+
385 385
 	// 公区报修选择院区
386 386
 	function overDeptChange(){
387 387
 		getbuildingList()
388 388
 	}
389
-	
389
+
390 390
 	// 跳转到搜索报修科室
391 391
 	function selectDepartment(){
392 392
 		uni.setStorageSync('rapidRepNext',JSON.stringify(dataInfo))
@@ -394,7 +394,7 @@
394 394
 	    url: `/pages/searchDept/searchDept?type=repair&branchId=${dataInfo.branch}`
395 395
 	  })
396 396
 	}
397
-	
397
+
398 398
   // 获取报修科室列表
399 399
   function getRepairTypes(){
400 400
     uni.showLoading({
@@ -422,7 +422,7 @@
422 422
 			}
423 423
     })
424 424
   }
425
-  
425
+
426 426
   // 获取楼栋
427 427
   function getbuildingList(){
428 428
     uni.showLoading({
@@ -446,7 +446,7 @@
446 446
 		    }));
447 447
 		  });
448 448
   }
449
-  
449
+
450 450
   // 获取科室地点
451 451
   function getAddressList(){
452 452
     uni.showLoading({
@@ -466,11 +466,11 @@
466 466
   	    dataInfo.addressList = res.list || [];
467 467
   	  });
468 468
   }
469
-  
469
+
470 470
 	function areaChange(e){
471 471
 		getPlaceList(dataInfo.areaId)
472 472
 	}
473
-	
473
+
474 474
 	// 获取楼层
475 475
 	function getPlaceList(e){
476 476
 	  let postData = {
@@ -481,7 +481,7 @@
481 481
 				hosId:dataInfo.branch
482 482
 			}
483 483
 	  };
484
-		
484
+
485 485
 		getFetchDataList("simple/data", "floor", postData)
486 486
 		  .then((res) => {
487 487
 				uni.hideLoading();
@@ -492,13 +492,13 @@
492 492
 		    }));
493 493
 		  });
494 494
 	}
495
-	
495
+
496 496
   // 提交
497 497
   function submit(){
498 498
 		isSubmit.value = true;
499 499
     submitHandler()
500 500
   }
501
-  
501
+
502 502
   // 处理提交事件
503 503
    async function handlerOrder(){
504 504
 		let postData = {
@@ -512,26 +512,25 @@
512 512
       let result = await api_departmentDetail(dataInfo.department);
513 513
       let deptDTO = result.data || {};
514 514
       postData.incident.place.id = deptDTO.floor ? deptDTO.floor.id : undefined;
515
-      postData.incident.houseNumber = deptDTO.address || undefined;
516 515
 		}else if(dataInfo.tabActiveValue === 'overtime'){
517 516
 			let data = repairIncident.value.find(i=>i.value=='public')
518 517
 			dataInfo.incidentData.repairIncidentType.id = data.id
519 518
 			postData.incident.place.id = dataInfo.placeId;
520
-      postData.incident.houseNumber = dataInfo.address;
521 519
 		}
522 520
     dataInfo.incidentData.department.id = dataInfo.department
523 521
     postData.incident.description = dataInfo.description;
524 522
 		if(dataInfo.serverId){
525 523
 			postData.serverId = dataInfo.serverId;
526 524
 		}else{
527
-			delete postData.serverId 
525
+			delete postData.serverId
528 526
 		}
529 527
     postData.incident.assetId = dataInfo.assetId;
528
+    postData.incident.houseNumber = dataInfo.address;
530 529
 		postData.incident.contacts = dataInfo.contacts;
531 530
 		postData.incident.contactsInformation = dataInfo.contactsInformation;
532 531
 		postData.incident.hosId = dataInfo.branch;
533 532
 		let repairsType = uni.getStorageSync('repairsType')
534
-		// postData.incident.buildId = dataInfo.areaId; //areaId:楼栋   
533
+		// postData.incident.buildId = dataInfo.areaId; //areaId:楼栋
535 534
   //   postData.incident.floorId = dataInfo.placeId;//placeId:楼层
536 535
 		// buildId
537 536
 		// floorId
@@ -619,13 +618,13 @@
619 618
 		})
620 619
 
621 620
   }
622
-  
621
+
623 622
   // 处理图片
624 623
   function handlerOrderImg(imgObj){
625 624
 		let allData = null
626 625
 		if(imgObj.extname=='mp4' ||
627
-			imgObj.extname=='avi' || 
628
-			imgObj.extname=='mpeg' || 
626
+			imgObj.extname=='avi' ||
627
+			imgObj.extname=='mpeg' ||
629 628
 			imgObj.extname=='wmv'){
630 629
 				allData = uploadFile(imgObj, 'wechatIncidentVideo', dataInfo.incidentId)
631 630
 			}else{
@@ -633,7 +632,7 @@
633 632
 			}
634 633
 		return allData
635 634
   }
636
-  
635
+
637 636
   // 处理提交
638 637
   function submitHandler(){
639 638
     console.log(dataInfo);
@@ -653,7 +652,7 @@
653 652
 			  });
654 653
 			  return;
655 654
 			}
656
-			
655
+
657 656
 			if(dataInfo.areaId==''){
658 657
 			  uni.showToast({
659 658
 			  	icon: 'none',
@@ -661,7 +660,7 @@
661 660
 			  });
662 661
 			  return;
663 662
 			}
664
-			
663
+
665 664
 			if(dataInfo.placeId==''){
666 665
 			  uni.showToast({
667 666
 			  	icon: 'none',
@@ -678,7 +677,7 @@
678 677
       });
679 678
       return;
680 679
     }
681
-    
680
+
682 681
     if(dataInfo.contacts==''){
683 682
       uni.showToast({
684 683
       	icon: 'none',
@@ -686,7 +685,7 @@
686 685
       });
687 686
       return;
688 687
     }
689
-    
688
+
690 689
     if(dataInfo.contactsInformation==''){
691 690
       uni.showToast({
692 691
       	icon: 'none',
@@ -701,14 +700,14 @@
701 700
     });
702 701
 		handlerOrder()
703 702
   }
704
-	
703
+
705 704
 	// 获取文本内容
706 705
 	function getHtml(html) {
707 706
 	  const tempDiv = document.createElement('div');
708 707
 	  tempDiv.innerHTML = html;
709 708
 	  return tempDiv.textContent || tempDiv.innerText || '';
710 709
 	}
711
-	
710
+
712 711
   onLoad((option) => {
713 712
 		initForm()
714 713
     getIncidentDetail();