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