|
@@ -0,0 +1,521 @@
|
|
1
|
+<template>
|
|
2
|
+ <view class="buildIncident">
|
|
3
|
+ <scroll-view scroll-y class="body">
|
|
4
|
+ <view class="form_item">
|
|
5
|
+ <view class="title select"><text class="required newicon newicon-bitian"></text>院区:</view>
|
|
6
|
+ <uni-data-select class="value" v-model="dataInfo.groupId" :localdata="dataInfo.groupList" :clear="false" placeholder="请选择院区" @change="changeGroup" :class="{formRed: isSubmit && !dataInfo.groupId}"></uni-data-select>
|
|
7
|
+ </view>
|
|
8
|
+ <view class="form_item">
|
|
9
|
+ <view class="title select"><text class="required newicon newicon-bitian"></text>报修科室:</view>
|
|
10
|
+ <uni-data-select class="value" v-model="dataInfo.groupId" :localdata="dataInfo.groupList" :clear="false" placeholder="请选择报修科室" @change="changeGroup" :class="{formRed: isSubmit && !dataInfo.groupId}"></uni-data-select>
|
|
11
|
+ </view>
|
|
12
|
+ <view class="form_item">
|
|
13
|
+ <view class="title select"><text class="required newicon newicon-bitian transparent"></text>报修人:</view>
|
|
14
|
+ <uni-data-select class="value" v-model="dataInfo.groupId" :localdata="dataInfo.groupList" :clear="false" placeholder="请选择报修人" @change="changeGroup" :class="{formRed: isSubmit && !dataInfo.groupId}"></uni-data-select>
|
|
15
|
+ </view>
|
|
16
|
+ </scroll-view>
|
|
17
|
+ <view class="foot_common_btns">
|
|
18
|
+ <button @click="goBack" type="default" class="cancelButton btn">返回</button>
|
|
19
|
+ <button @click="submit" type="default" class="primaryButton btn">下一步</button>
|
|
20
|
+ </view>
|
|
21
|
+ </view>
|
|
22
|
+</template>
|
|
23
|
+
|
|
24
|
+<script setup>
|
|
25
|
+ import { ref, reactive } from 'vue'
|
|
26
|
+ import { onLoad } from '@dcloudio/uni-app'
|
|
27
|
+ import { api_group, api_incidentDetail, api_user, api_incidentTask, api_branch, api_dutyDepartment } from "@/http/api.js"
|
|
28
|
+ import { defaultColor } from '@/static/js/theme.js'
|
|
29
|
+ import { useSetTitle } from '@/share/useSetTitle.js'
|
|
30
|
+ import { useMakePhoneCall } from '@/share/useMakePhoneCall.js'
|
|
31
|
+ import { useGoBack } from '@/share/useGoBack.js'
|
|
32
|
+ import { useLoginUserStore } from '@/stores/loginUser'
|
|
33
|
+
|
|
34
|
+ useSetTitle();
|
|
35
|
+ const loginUserStore = useLoginUserStore();
|
|
36
|
+ const { makePhoneCall } = useMakePhoneCall();
|
|
37
|
+ const { goBack } = useGoBack();
|
|
38
|
+
|
|
39
|
+ // 主题颜色
|
|
40
|
+ const primaryColor = ref(defaultColor)
|
|
41
|
+
|
|
42
|
+ // 数据
|
|
43
|
+ const dataInfo = reactive({
|
|
44
|
+ incidentId: undefined,//事件ID
|
|
45
|
+ incidentData: {},//事件对象
|
|
46
|
+ groupList: [], //工作组列表
|
|
47
|
+ groupId: undefined, //工作组ID
|
|
48
|
+ userList: [], //用户列表
|
|
49
|
+ userId: undefined, //用户ID
|
|
50
|
+ branchList: [], //院区列表
|
|
51
|
+ branchId: undefined, //院区ID
|
|
52
|
+ dutyList: [], //责任科室列表
|
|
53
|
+ dutyId: undefined, //责任科室ID
|
|
54
|
+ isAssignUser: 1, //工作组是否转派到人
|
|
55
|
+ isAssignUserList: [
|
|
56
|
+ { text: '是', value: 1 },
|
|
57
|
+ { text: '否', value: 0 },
|
|
58
|
+ ], //工作组是否转派到人选项
|
|
59
|
+ reassignRemark: '',//退回原因
|
|
60
|
+ })
|
|
61
|
+
|
|
62
|
+ // 是否提交
|
|
63
|
+ const isSubmit = ref(false)
|
|
64
|
+
|
|
65
|
+ // 重置
|
|
66
|
+ function reset(){
|
|
67
|
+ dataInfo.branchId = undefined;
|
|
68
|
+ dataInfo.branchList = [];
|
|
69
|
+
|
|
70
|
+ dataInfo.dutyId = undefined;
|
|
71
|
+ dataInfo.dutyList = [];
|
|
72
|
+
|
|
73
|
+ dataInfo.groupId = undefined;
|
|
74
|
+ dataInfo.groupList = [];
|
|
75
|
+
|
|
76
|
+ dataInfo.userId = undefined;
|
|
77
|
+ dataInfo.userList = [];
|
|
78
|
+
|
|
79
|
+ dataInfo.isAssignUser = 1;
|
|
80
|
+
|
|
81
|
+ dataInfo.reassignRemark = '';
|
|
82
|
+ }
|
|
83
|
+
|
|
84
|
+ // 获取事件详情
|
|
85
|
+ function getIncidentDetail(){
|
|
86
|
+ uni.showLoading({
|
|
87
|
+ title: "加载中",
|
|
88
|
+ mask: true,
|
|
89
|
+ });
|
|
90
|
+
|
|
91
|
+ api_incidentDetail(dataInfo.incidentId).then(res => {
|
|
92
|
+ uni.hideLoading();
|
|
93
|
+ if(res.status == 200){
|
|
94
|
+ dataInfo.incidentData = res.data || {};
|
|
95
|
+
|
|
96
|
+ initForm()
|
|
97
|
+ }else{
|
|
98
|
+ uni.showToast({
|
|
99
|
+ icon: 'none',
|
|
100
|
+ title: res.msg || '请求数据失败!'
|
|
101
|
+ });
|
|
102
|
+ }
|
|
103
|
+ })
|
|
104
|
+ }
|
|
105
|
+
|
|
106
|
+ // 获取院区列表
|
|
107
|
+ function getBranchs(){
|
|
108
|
+ uni.showLoading({
|
|
109
|
+ title: "加载中",
|
|
110
|
+ mask: true,
|
|
111
|
+ });
|
|
112
|
+ let postData = {
|
|
113
|
+ "idx": 0,
|
|
114
|
+ "sum": 9999,
|
|
115
|
+ };
|
|
116
|
+ api_branch(postData).then(res => {
|
|
117
|
+ uni.hideLoading();
|
|
118
|
+ if(res.status == 200){
|
|
119
|
+ res.list = res.list || [];
|
|
120
|
+ dataInfo.branchList = res.list.map(v => ({
|
|
121
|
+ text: v.hosName,
|
|
122
|
+ value: v.id,
|
|
123
|
+ }));
|
|
124
|
+
|
|
125
|
+ if(loginUserStore.loginUser.user.duty){
|
|
126
|
+ // 当前的所属责任科室
|
|
127
|
+ dataInfo.branchId = loginUserStore.loginUser.user.duty.branch;
|
|
128
|
+ changeBranch();
|
|
129
|
+
|
|
130
|
+ dataInfo.dutyId = loginUserStore.loginUser.user.duty.id;
|
|
131
|
+ changeDuty();
|
|
132
|
+ }else if(loginUserStore.loginUser.user.branch){
|
|
133
|
+ // 当前的所属院区
|
|
134
|
+ dataInfo.branchId = loginUserStore.loginUser.user.branch.id;
|
|
135
|
+ }
|
|
136
|
+ }else{
|
|
137
|
+ uni.showToast({
|
|
138
|
+ icon: 'none',
|
|
139
|
+ title: res.msg || '请求数据失败!'
|
|
140
|
+ });
|
|
141
|
+ }
|
|
142
|
+ })
|
|
143
|
+ }
|
|
144
|
+
|
|
145
|
+ // 获取责任科室列表
|
|
146
|
+ function getDutys(){
|
|
147
|
+ uni.showLoading({
|
|
148
|
+ title: "加载中",
|
|
149
|
+ mask: true,
|
|
150
|
+ });
|
|
151
|
+ let postData = {
|
|
152
|
+ "idx": 0,
|
|
153
|
+ "sum": 9999,
|
|
154
|
+ "dutyDepartment": {
|
|
155
|
+ "branch": dataInfo.branchId,
|
|
156
|
+ }
|
|
157
|
+ };
|
|
158
|
+ api_dutyDepartment(postData).then(res => {
|
|
159
|
+ uni.hideLoading();
|
|
160
|
+ if(res.status == 200){
|
|
161
|
+ res.list = res.list || [];
|
|
162
|
+ dataInfo.dutyList = res.list.map(v => ({
|
|
163
|
+ text: v.dept,
|
|
164
|
+ value: v.id,
|
|
165
|
+ }));
|
|
166
|
+ }else{
|
|
167
|
+ uni.showToast({
|
|
168
|
+ icon: 'none',
|
|
169
|
+ title: res.msg || '请求数据失败!'
|
|
170
|
+ });
|
|
171
|
+ }
|
|
172
|
+ })
|
|
173
|
+ }
|
|
174
|
+
|
|
175
|
+ // 获取工作组列表
|
|
176
|
+ function getGroups(){
|
|
177
|
+ uni.showLoading({
|
|
178
|
+ title: "加载中",
|
|
179
|
+ mask: true,
|
|
180
|
+ });
|
|
181
|
+
|
|
182
|
+ let duty = undefined;
|
|
183
|
+
|
|
184
|
+ let postData = {
|
|
185
|
+ "idx": 0,
|
|
186
|
+ "sum": 9999,
|
|
187
|
+ "group": {
|
|
188
|
+ "duty": duty,
|
|
189
|
+ "selectType": "nouser"
|
|
190
|
+ }
|
|
191
|
+ };
|
|
192
|
+ api_group(postData).then(res => {
|
|
193
|
+ uni.hideLoading();
|
|
194
|
+ if(res.status == 200){
|
|
195
|
+ res.list = res.list || [];
|
|
196
|
+ dataInfo.groupList = res.list.map(v => ({
|
|
197
|
+ text: v.groupName,
|
|
198
|
+ value: v.id,
|
|
199
|
+ }));
|
|
200
|
+ }else{
|
|
201
|
+ uni.showToast({
|
|
202
|
+ icon: 'none',
|
|
203
|
+ title: res.msg || '请求数据失败!'
|
|
204
|
+ });
|
|
205
|
+ }
|
|
206
|
+ })
|
|
207
|
+ }
|
|
208
|
+
|
|
209
|
+ // 获取用户列表
|
|
210
|
+ function getUsers(){
|
|
211
|
+ uni.showLoading({
|
|
212
|
+ title: "加载中",
|
|
213
|
+ mask: true,
|
|
214
|
+ });
|
|
215
|
+ let postData = {
|
|
216
|
+ "idx": 0,
|
|
217
|
+ "sum": 9999,
|
|
218
|
+ "user": {
|
|
219
|
+ "groupdata":{
|
|
220
|
+ "id": dataInfo.groupId,
|
|
221
|
+ },
|
|
222
|
+ "roledata": {
|
|
223
|
+ "rolecode": "first-line support"
|
|
224
|
+ },
|
|
225
|
+ "roledata2": {
|
|
226
|
+ "rolecode": "second-line support"
|
|
227
|
+ },
|
|
228
|
+ "selectType": "1",
|
|
229
|
+ "selectDetails": 1,
|
|
230
|
+ "simple": true,
|
|
231
|
+ "engineer": 1
|
|
232
|
+ }
|
|
233
|
+ };
|
|
234
|
+ api_user(postData).then(res => {
|
|
235
|
+ uni.hideLoading();
|
|
236
|
+ if(res.status == 200){
|
|
237
|
+ res.list = res.list || [];
|
|
238
|
+ dataInfo.userList = res.list.map(v => ({
|
|
239
|
+ text: v.name,
|
|
240
|
+ value: v.id,
|
|
241
|
+ }));
|
|
242
|
+ }else{
|
|
243
|
+ uni.showToast({
|
|
244
|
+ icon: 'none',
|
|
245
|
+ title: res.msg || '请求数据失败!'
|
|
246
|
+ });
|
|
247
|
+ }
|
|
248
|
+ })
|
|
249
|
+ }
|
|
250
|
+
|
|
251
|
+ // 选择院区
|
|
252
|
+ function changeBranch(){
|
|
253
|
+ dataInfo.dutyId = undefined;
|
|
254
|
+ dataInfo.dutyList = [];
|
|
255
|
+
|
|
256
|
+ dataInfo.groupId = undefined;
|
|
257
|
+ dataInfo.groupList = [];
|
|
258
|
+
|
|
259
|
+ dataInfo.userId = undefined;
|
|
260
|
+ dataInfo.userList = [];
|
|
261
|
+ getDutys();
|
|
262
|
+ }
|
|
263
|
+
|
|
264
|
+ // 选择责任科室
|
|
265
|
+ function changeDuty(){
|
|
266
|
+ dataInfo.groupId = undefined;
|
|
267
|
+ dataInfo.groupList = [];
|
|
268
|
+
|
|
269
|
+ dataInfo.userId = undefined;
|
|
270
|
+ dataInfo.userList = [];
|
|
271
|
+ getGroups();
|
|
272
|
+ }
|
|
273
|
+
|
|
274
|
+ // 选择工作组
|
|
275
|
+ function changeGroup(){
|
|
276
|
+ dataInfo.userId = undefined;
|
|
277
|
+ dataInfo.userList = [];
|
|
278
|
+ getUsers();
|
|
279
|
+ }
|
|
280
|
+
|
|
281
|
+ // 选择是否转派到人
|
|
282
|
+ function changeIsAssignUser(){
|
|
283
|
+ dataInfo.userId = undefined;
|
|
284
|
+ }
|
|
285
|
+
|
|
286
|
+ // 提交
|
|
287
|
+ function submit(){
|
|
288
|
+ isSubmit.value = true;
|
|
289
|
+
|
|
290
|
+ }
|
|
291
|
+
|
|
292
|
+ // 转派提交
|
|
293
|
+ function submitRedeploy(){
|
|
294
|
+ if(!dataInfo.groupId){
|
|
295
|
+ uni.showToast({
|
|
296
|
+ icon: 'none',
|
|
297
|
+ title: '请选择工作组'
|
|
298
|
+ });
|
|
299
|
+ return;
|
|
300
|
+ }
|
|
301
|
+
|
|
302
|
+ if(dataInfo.isAssignUser == 1 && !dataInfo.userId){
|
|
303
|
+ uni.showToast({
|
|
304
|
+ icon: 'none',
|
|
305
|
+ title: '请选择指派对象'
|
|
306
|
+ });
|
|
307
|
+ return;
|
|
308
|
+ }
|
|
309
|
+
|
|
310
|
+ uni.showLoading({
|
|
311
|
+ title: "加载中",
|
|
312
|
+ mask: true,
|
|
313
|
+ });
|
|
314
|
+
|
|
315
|
+ let postData = {
|
|
316
|
+ incident: dataInfo.incidentData,
|
|
317
|
+ }
|
|
318
|
+
|
|
319
|
+ if(dataInfo.userId){
|
|
320
|
+ // 派人
|
|
321
|
+ postData.incident.assignee = dataInfo.userId;
|
|
322
|
+ } else {
|
|
323
|
+ // 派组
|
|
324
|
+ postData.incident.candidateGroups = dataInfo.groupId;
|
|
325
|
+ }
|
|
326
|
+
|
|
327
|
+ // api_incidentTask('' postData).then(res => {
|
|
328
|
+ // uni.hideLoading();
|
|
329
|
+ // if(res.state == 200){
|
|
330
|
+ // uni.showToast({
|
|
331
|
+ // icon: 'none',
|
|
332
|
+ // title: '转派成功',
|
|
333
|
+ // mask: true,
|
|
334
|
+ // });
|
|
335
|
+ // setTimeout(() => {
|
|
336
|
+ // uni.reLaunch({
|
|
337
|
+ // url: '/pages/incidentList/incidentList',
|
|
338
|
+ // })
|
|
339
|
+ // }, 1500)
|
|
340
|
+ // }else{
|
|
341
|
+ // uni.showToast({
|
|
342
|
+ // icon: 'none',
|
|
343
|
+ // title: res.msg || '请求数据失败!'
|
|
344
|
+ // });
|
|
345
|
+ // }
|
|
346
|
+ // })
|
|
347
|
+ }
|
|
348
|
+
|
|
349
|
+ // 指派提交
|
|
350
|
+ function submitAssign(){
|
|
351
|
+ if(!dataInfo.branchId){
|
|
352
|
+ uni.showToast({
|
|
353
|
+ icon: 'none',
|
|
354
|
+ title: '请选择院区'
|
|
355
|
+ });
|
|
356
|
+ return;
|
|
357
|
+ }
|
|
358
|
+
|
|
359
|
+ if(!dataInfo.dutyId){
|
|
360
|
+ uni.showToast({
|
|
361
|
+ icon: 'none',
|
|
362
|
+ title: '请选择责任科室'
|
|
363
|
+ });
|
|
364
|
+ return;
|
|
365
|
+ }
|
|
366
|
+
|
|
367
|
+ if(!dataInfo.groupId){
|
|
368
|
+ uni.showToast({
|
|
369
|
+ icon: 'none',
|
|
370
|
+ title: '请选择工作组'
|
|
371
|
+ });
|
|
372
|
+ return;
|
|
373
|
+ }
|
|
374
|
+
|
|
375
|
+ if(dataInfo.isAssignUser == 1 && !dataInfo.userId){
|
|
376
|
+ uni.showToast({
|
|
377
|
+ icon: 'none',
|
|
378
|
+ title: '请选择指派对象'
|
|
379
|
+ });
|
|
380
|
+ return;
|
|
381
|
+ }
|
|
382
|
+
|
|
383
|
+ uni.showLoading({
|
|
384
|
+ title: "加载中",
|
|
385
|
+ mask: true,
|
|
386
|
+ });
|
|
387
|
+
|
|
388
|
+ let postData = {
|
|
389
|
+ incident: dataInfo.incidentData,
|
|
390
|
+ }
|
|
391
|
+
|
|
392
|
+ if(dataInfo.userId){
|
|
393
|
+ // 派人
|
|
394
|
+ postData.incident.assignee = dataInfo.userId;
|
|
395
|
+ } else {
|
|
396
|
+ // 派组
|
|
397
|
+ postData.incident.candidateGroups = dataInfo.groupId;
|
|
398
|
+ }
|
|
399
|
+
|
|
400
|
+ // api_incidentTask('', postData).then(res => {
|
|
401
|
+ // uni.hideLoading();
|
|
402
|
+ // if(res.state == 200){
|
|
403
|
+ // uni.showToast({
|
|
404
|
+ // icon: 'none',
|
|
405
|
+ // title: '指派成功',
|
|
406
|
+ // mask: true,
|
|
407
|
+ // });
|
|
408
|
+ // setTimeout(() => {
|
|
409
|
+ // uni.reLaunch({
|
|
410
|
+ // url: '/pages/incidentList/incidentList',
|
|
411
|
+ // })
|
|
412
|
+ // }, 1500)
|
|
413
|
+ // }else{
|
|
414
|
+ // uni.showToast({
|
|
415
|
+ // icon: 'none',
|
|
416
|
+ // title: res.msg || '请求数据失败!'
|
|
417
|
+ // });
|
|
418
|
+ // }
|
|
419
|
+ // })
|
|
420
|
+ }
|
|
421
|
+
|
|
422
|
+ // 退回提交
|
|
423
|
+ function submitReassign(){
|
|
424
|
+ if(!dataInfo.reassignRemark.trim()){
|
|
425
|
+ uni.showToast({
|
|
426
|
+ icon: 'none',
|
|
427
|
+ title: '请填写退回原因'
|
|
428
|
+ });
|
|
429
|
+ return;
|
|
430
|
+ }
|
|
431
|
+
|
|
432
|
+ uni.showLoading({
|
|
433
|
+ title: "加载中",
|
|
434
|
+ mask: true,
|
|
435
|
+ });
|
|
436
|
+
|
|
437
|
+ let postData = {
|
|
438
|
+ incident: dataInfo.incidentData,
|
|
439
|
+ }
|
|
440
|
+
|
|
441
|
+ postData.incident.reassignRemark = dataInfo.reassignRemark;
|
|
442
|
+
|
|
443
|
+ // api_incidentTask('', postData).then(res => {
|
|
444
|
+ // uni.hideLoading();
|
|
445
|
+ // if(res.state == 200){
|
|
446
|
+ // uni.showToast({
|
|
447
|
+ // icon: 'none',
|
|
448
|
+ // title: '退回成功',
|
|
449
|
+ // mask: true,
|
|
450
|
+ // });
|
|
451
|
+ // setTimeout(() => {
|
|
452
|
+ // uni.reLaunch({
|
|
453
|
+ // url: '/pages/incidentList/incidentList',
|
|
454
|
+ // })
|
|
455
|
+ // }, 1500)
|
|
456
|
+ // }else{
|
|
457
|
+ // uni.showToast({
|
|
458
|
+ // icon: 'none',
|
|
459
|
+ // title: res.msg || '请求数据失败!'
|
|
460
|
+ // });
|
|
461
|
+ // }
|
|
462
|
+ // })
|
|
463
|
+ }
|
|
464
|
+
|
|
465
|
+ onLoad((option) => {
|
|
466
|
+ dataInfo.incidentId = option.incidentId;
|
|
467
|
+ getIncidentDetail();
|
|
468
|
+ })
|
|
469
|
+</script>
|
|
470
|
+
|
|
471
|
+<style lang="scss" scoped>
|
|
472
|
+.buildIncident{
|
|
473
|
+ height: 100%;
|
|
474
|
+ display: flex;
|
|
475
|
+ flex-direction: column;
|
|
476
|
+ justify-content: space-between;
|
|
477
|
+ .body{
|
|
478
|
+ margin-top: 88rpx;
|
|
479
|
+ padding: 0 24rpx;
|
|
480
|
+ box-sizing: border-box;
|
|
481
|
+ flex: 1;
|
|
482
|
+ min-height: 0;
|
|
483
|
+ .form_item{
|
|
484
|
+ display: flex;
|
|
485
|
+ align-items: center;
|
|
486
|
+ padding-top: 24rpx;
|
|
487
|
+ min-height: 86rpx;
|
|
488
|
+ &.column{
|
|
489
|
+ height: auto;
|
|
490
|
+ flex-direction: column;
|
|
491
|
+ align-items: flex-start;
|
|
492
|
+ .title{
|
|
493
|
+ margin-right: 0;
|
|
494
|
+ }
|
|
495
|
+ .value{
|
|
496
|
+ margin-top: 10rpx;
|
|
497
|
+ padding-left: 20rpx;
|
|
498
|
+ box-sizing: border-box;
|
|
499
|
+ }
|
|
500
|
+ .tips{
|
|
501
|
+ padding: 24rpx;
|
|
502
|
+ text-align: center;
|
|
503
|
+ font-size: 22rpx;
|
|
504
|
+ color: #909399;
|
|
505
|
+ width: 100%;
|
|
506
|
+ box-sizing: border-box;
|
|
507
|
+ }
|
|
508
|
+ }
|
|
509
|
+ .title{
|
|
510
|
+ font-size: 26rpx;
|
|
511
|
+ display: flex;
|
|
512
|
+ align-items: center;
|
|
513
|
+ margin-right: 12rpx;
|
|
514
|
+ &.select{
|
|
515
|
+ width: calc(5em + 20rpx);
|
|
516
|
+ }
|
|
517
|
+ }
|
|
518
|
+ }
|
|
519
|
+ }
|
|
520
|
+}
|
|
521
|
+</style>
|