|
@@ -5,6 +5,8 @@ import { FormBuilder, Validators, FormGroup } from "@angular/forms";
|
5
|
5
|
import { MainService } from "../../services/main.service";
|
6
|
6
|
import { ToolService } from "../../services/tool.service";
|
7
|
7
|
import { NzMessageService } from 'ng-zorro-antd';
|
|
8
|
+import { Subject } from 'rxjs';
|
|
9
|
+import { debounceTime } from 'rxjs/operators';
|
8
|
10
|
@Component({
|
9
|
11
|
selector: "app-inspection-configuration",
|
10
|
12
|
templateUrl: "./inspection-configuration.component.html",
|
|
@@ -39,7 +41,23 @@ export class InspectionConfigurationComponent implements OnInit {
|
39
|
41
|
nextSchemeName = ""; //下一个开启的方案名称
|
40
|
42
|
modelName = ""; //模态框名称
|
41
|
43
|
|
|
44
|
+ changeInpSubject = new Subject(); //防抖
|
|
45
|
+
|
42
|
46
|
ngOnInit() {
|
|
47
|
+ //防抖
|
|
48
|
+ this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
|
|
49
|
+ if(v[0] === 'repairDept'){
|
|
50
|
+ this.getRepairDeptList(v[1]);
|
|
51
|
+ }else if(v[0] === 'category'){
|
|
52
|
+ this.getCategoryList(v[1]);
|
|
53
|
+ }else if(v[0] === 'priority'){
|
|
54
|
+ this.getPriorityList(v[1]);
|
|
55
|
+ }else if(v[0] === 'group'){
|
|
56
|
+ this.getGroupList(v[1]);
|
|
57
|
+ }else if(v[0] === 'user'){
|
|
58
|
+ this.getUserList(v[1]);
|
|
59
|
+ }
|
|
60
|
+ });
|
43
|
61
|
this.currentHospital = this.tool.getCurrentHospital();
|
44
|
62
|
this.coopBtns = this.tool.initCoopBtns(this.route);
|
45
|
63
|
this.initForm();
|
|
@@ -49,6 +67,123 @@ export class InspectionConfigurationComponent implements OnInit {
|
49
|
67
|
// 初始化增删改按钮
|
50
|
68
|
coopBtns: any = {};
|
51
|
69
|
|
|
70
|
+ // 边输边搜节流阀
|
|
71
|
+ isLoading = false;
|
|
72
|
+ changeInp(type, e) {
|
|
73
|
+ this.isLoading = true;
|
|
74
|
+ this.changeInpSubject.next([type, e]);
|
|
75
|
+ }
|
|
76
|
+
|
|
77
|
+ // 获取报修科室
|
|
78
|
+ repairDeptList: any = [];
|
|
79
|
+ getRepairDeptList(keyWord) {
|
|
80
|
+ let postData:any = {
|
|
81
|
+ department: {
|
|
82
|
+ searchType: 1,// 简单查询
|
|
83
|
+ flag: 1,
|
|
84
|
+ keyWord,
|
|
85
|
+ cascadeHosId: this.currentHospital.id,
|
|
86
|
+ },
|
|
87
|
+ idx: 0,
|
|
88
|
+ sum: 20,
|
|
89
|
+ };
|
|
90
|
+ this.mainService
|
|
91
|
+ .getFetchDataList("data", "department", postData)
|
|
92
|
+ .subscribe((data) => {
|
|
93
|
+ this.repairDeptList = data.list;
|
|
94
|
+ this.isLoading = false;
|
|
95
|
+ });
|
|
96
|
+ }
|
|
97
|
+
|
|
98
|
+ // 获取维修组
|
|
99
|
+ groupList: any = [];
|
|
100
|
+ getGroupList(keyWord) {
|
|
101
|
+ let postData:any = {
|
|
102
|
+ group2: {
|
|
103
|
+ type: 3,
|
|
104
|
+ groupName: keyWord,
|
|
105
|
+ hospitals: this.currentHospital.id,
|
|
106
|
+ },
|
|
107
|
+ idx: 0,
|
|
108
|
+ sum: 20,
|
|
109
|
+ };
|
|
110
|
+ this.mainService
|
|
111
|
+ .getFetchDataList("simple/data", "group2", postData)
|
|
112
|
+ .subscribe((data) => {
|
|
113
|
+ this.groupList = data.list;
|
|
114
|
+ this.isLoading = false;
|
|
115
|
+ });
|
|
116
|
+ }
|
|
117
|
+
|
|
118
|
+ // 获取维修人
|
|
119
|
+ userList: any = [];
|
|
120
|
+ getUserList(keyWord) {
|
|
121
|
+ let postData:any = {
|
|
122
|
+ user: {
|
|
123
|
+ simpleQuery: true,// 简单查询
|
|
124
|
+ name: keyWord,
|
|
125
|
+ groupdata: {
|
|
126
|
+ id: this.validateForm.value.groupId,
|
|
127
|
+ },
|
|
128
|
+ roleCodes: "first-line support",
|
|
129
|
+ engineer: 1,
|
|
130
|
+ },
|
|
131
|
+ idx: 0,
|
|
132
|
+ sum: 20,
|
|
133
|
+ };
|
|
134
|
+ this.mainService
|
|
135
|
+ .getFetchDataList("simple/data", "user", postData)
|
|
136
|
+ .subscribe((data) => {
|
|
137
|
+ this.userList = data.list;
|
|
138
|
+ this.isLoading = false;
|
|
139
|
+ });
|
|
140
|
+ }
|
|
141
|
+
|
|
142
|
+ // 获取故障现象
|
|
143
|
+ categoryList: any = [];
|
|
144
|
+ getCategoryList(keyWord) {
|
|
145
|
+ let dutyIds;
|
|
146
|
+ let { hospital, type } = this.tool.getHospitalOrDuty();
|
|
147
|
+ if(type === 'duty'){
|
|
148
|
+ // 是责任部门
|
|
149
|
+ dutyIds = hospital.id.toString();
|
|
150
|
+ }else{
|
|
151
|
+ this.isLoading = false;
|
|
152
|
+ this.categoryList = [];
|
|
153
|
+ return;
|
|
154
|
+ }
|
|
155
|
+ let postData:any = {
|
|
156
|
+ category: {
|
|
157
|
+ category: keyWord,
|
|
158
|
+ selectType: 'mutlQuery',
|
|
159
|
+ hierarchy: 3,//只差有三级的故障现象列表
|
|
160
|
+ dutyIds,
|
|
161
|
+ },
|
|
162
|
+ };
|
|
163
|
+ this.mainService
|
|
164
|
+ .incidentPost("listIncidentCategory", postData)
|
|
165
|
+ .subscribe((data) => {
|
|
166
|
+ this.categoryList = data.data;
|
|
167
|
+ this.isLoading = false;
|
|
168
|
+ });
|
|
169
|
+ }
|
|
170
|
+
|
|
171
|
+ // 获取优先级
|
|
172
|
+ priorityList: any = [];
|
|
173
|
+ getPriorityList(keyWord) {
|
|
174
|
+ let postData:any = {
|
|
175
|
+ priority: {},
|
|
176
|
+ idx: 0,
|
|
177
|
+ sum: 9999,
|
|
178
|
+ };
|
|
179
|
+ this.mainService
|
|
180
|
+ .getFetchDataList("data", "priority", postData)
|
|
181
|
+ .subscribe((data) => {
|
|
182
|
+ this.priorityList = data.list;
|
|
183
|
+ this.isLoading = false;
|
|
184
|
+ });
|
|
185
|
+ }
|
|
186
|
+
|
52
|
187
|
// 表格数据
|
53
|
188
|
loading1 = false;
|
54
|
189
|
getList(type) {
|
|
@@ -94,7 +229,13 @@ export class InspectionConfigurationComponent implements OnInit {
|
94
|
229
|
this.validateForm = this.fb.group({
|
95
|
230
|
name: ['', [Validators.required, Validators.pattern(/\S/)]],
|
96
|
231
|
showOrder: [0, [Validators.required]],
|
97
|
|
- createOrder: [0, [Validators.required]],
|
|
232
|
+ createOrder: [0],
|
|
233
|
+ repairDeptId: [null],
|
|
234
|
+ categoryId: [null],
|
|
235
|
+ priorityId: [null],
|
|
236
|
+ userGroup: [1],
|
|
237
|
+ groupId: [null],
|
|
238
|
+ userId: [null],
|
98
|
239
|
});
|
99
|
240
|
}
|
100
|
241
|
|
|
@@ -116,6 +257,12 @@ export class InspectionConfigurationComponent implements OnInit {
|
116
|
257
|
name: this.validateForm.value.name,
|
117
|
258
|
showOrder: this.validateForm.value.showOrder,
|
118
|
259
|
createOrder: this.validateForm.value.createOrder,
|
|
260
|
+ repairDeptId: this.validateForm.value.repairDeptId || undefined,
|
|
261
|
+ categoryId: this.validateForm.value.categoryId || undefined,
|
|
262
|
+ priorityId: this.validateForm.value.priorityId || undefined,
|
|
263
|
+ userGroup: this.validateForm.value.userGroup || undefined,
|
|
264
|
+ groupId: this.validateForm.value.groupId || undefined,
|
|
265
|
+ userId: this.validateForm.value.userId || undefined,
|
119
|
266
|
hosId: this.currentHospital.id,
|
120
|
267
|
};
|
121
|
268
|
} else {
|
|
@@ -126,6 +273,12 @@ export class InspectionConfigurationComponent implements OnInit {
|
126
|
273
|
name: this.validateForm.value.name,
|
127
|
274
|
showOrder: this.validateForm.value.showOrder,
|
128
|
275
|
createOrder: this.validateForm.value.createOrder,
|
|
276
|
+ repairDeptId: this.validateForm.value.repairDeptId || undefined,
|
|
277
|
+ categoryId: this.validateForm.value.categoryId || undefined,
|
|
278
|
+ priorityId: this.validateForm.value.priorityId || undefined,
|
|
279
|
+ userGroup: this.validateForm.value.userGroup || undefined,
|
|
280
|
+ groupId: this.validateForm.value.groupId || undefined,
|
|
281
|
+ userId: this.validateForm.value.userId || undefined,
|
129
|
282
|
}
|
130
|
283
|
};
|
131
|
284
|
}
|
|
@@ -163,7 +316,35 @@ export class InspectionConfigurationComponent implements OnInit {
|
163
|
316
|
this.coopData = data;
|
164
|
317
|
this.validateForm.controls.name.setValue(data.name); //名称
|
165
|
318
|
this.validateForm.controls.showOrder.setValue(data.showOrder);
|
166
|
|
- this.validateForm.controls.createOrder.setValue(data.createOrder);
|
|
319
|
+ if(data.showOrder == 1){
|
|
320
|
+ this.validateForm.controls.createOrder.setValue(data.createOrder);
|
|
321
|
+
|
|
322
|
+ data.repairDeptDTO && (this.repairDeptList = [data.repairDeptDTO]);
|
|
323
|
+ this.validateForm.controls.repairDeptId.setValue(data.repairDeptId);
|
|
324
|
+ this.requiredChange('repairDeptId', data.createOrder == 1);
|
|
325
|
+
|
|
326
|
+ data.categoryDTO && (this.categoryList = [data.categoryDTO]);
|
|
327
|
+ this.validateForm.controls.categoryId.setValue(data.categoryId);
|
|
328
|
+ this.requiredChange('categoryId', data.createOrder == 1);
|
|
329
|
+
|
|
330
|
+ data.priorityDTO && (this.priorityList = [data.priorityDTO]);
|
|
331
|
+ this.validateForm.controls.priorityId.setValue(data.priorityId);
|
|
332
|
+
|
|
333
|
+ if(data.createOrder == 1){
|
|
334
|
+ this.validateForm.controls.userGroup.setValue(data.userGroup);
|
|
335
|
+
|
|
336
|
+ data.groupDTO && (this.groupList = [data.groupDTO]);
|
|
337
|
+ this.validateForm.controls.groupId.setValue(data.groupId);
|
|
338
|
+ this.requiredChange('groupId', data.userGroup == 2 || data.userGroup == 3);
|
|
339
|
+
|
|
340
|
+ data.userDTO && (this.userList = [data.userDTO]);
|
|
341
|
+ this.validateForm.controls.userId.setValue(data.userId);
|
|
342
|
+ this.requiredChange('userId', data.userGroup == 3);
|
|
343
|
+ }
|
|
344
|
+ }else{
|
|
345
|
+ this.requiredChange('createOrder', false);
|
|
346
|
+ this.validateForm.controls.createOrder.setValue(0);
|
|
347
|
+ }
|
167
|
348
|
}
|
168
|
349
|
|
169
|
350
|
// 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
|
|
@@ -183,6 +364,71 @@ export class InspectionConfigurationComponent implements OnInit {
|
183
|
364
|
this.router.navigateByUrl(`/main/inspectionConfigurationItem/${data.id}`);
|
184
|
365
|
}
|
185
|
366
|
|
|
367
|
+ requiredChange(field, required: boolean): void {
|
|
368
|
+ if (!required) {
|
|
369
|
+ this.validateForm.get(field)!.clearValidators();
|
|
370
|
+ this.validateForm.get(field)!.markAsPristine();
|
|
371
|
+ } else {
|
|
372
|
+ this.validateForm.get(field)!.setValidators(Validators.required);
|
|
373
|
+ this.validateForm.get(field)!.markAsDirty();
|
|
374
|
+ }
|
|
375
|
+ this.validateForm.get(field)!.updateValueAndValidity();
|
|
376
|
+ }
|
|
377
|
+
|
|
378
|
+ changeShowOrder(value){
|
|
379
|
+ this.requiredChange('createOrder', value == 1);
|
|
380
|
+ this.validateForm.controls.createOrder.setValue(0);
|
|
381
|
+
|
|
382
|
+ this.requiredChange('repairDeptId', value == 1);
|
|
383
|
+ this.validateForm.controls.repairDeptId.setValue(null);
|
|
384
|
+ this.repairDeptList = [];
|
|
385
|
+
|
|
386
|
+ this.requiredChange('categoryId', value == 1);
|
|
387
|
+ this.validateForm.controls.categoryId.setValue(null);
|
|
388
|
+ this.categoryList = [];
|
|
389
|
+
|
|
390
|
+ this.validateForm.controls.priorityId.setValue(null);
|
|
391
|
+ this.priorityList = [];
|
|
392
|
+
|
|
393
|
+ this.requiredChange('userGroup', false);
|
|
394
|
+ this.validateForm.controls.userGroup.setValue(null);
|
|
395
|
+
|
|
396
|
+ this.requiredChange('groupId', false);
|
|
397
|
+ this.validateForm.controls.groupId.setValue(null);
|
|
398
|
+ this.groupList = [];
|
|
399
|
+
|
|
400
|
+ this.requiredChange('userId', false);
|
|
401
|
+ this.validateForm.controls.userId.setValue(null);
|
|
402
|
+ this.userList = [];
|
|
403
|
+ }
|
|
404
|
+
|
|
405
|
+ changeCreateOrder(value){
|
|
406
|
+ this.requiredChange('repairDeptId', value == 1);
|
|
407
|
+
|
|
408
|
+ this.requiredChange('categoryId', value == 1);
|
|
409
|
+
|
|
410
|
+ this.requiredChange('userGroup', value == 1);
|
|
411
|
+ this.validateForm.controls.userGroup.setValue(value == 1 ? 1 : null);
|
|
412
|
+
|
|
413
|
+ this.requiredChange('groupId', false);
|
|
414
|
+ this.validateForm.controls.groupId.setValue(null);
|
|
415
|
+ this.groupList = [];
|
|
416
|
+
|
|
417
|
+ this.requiredChange('userId', false);
|
|
418
|
+ this.validateForm.controls.userId.setValue(null);
|
|
419
|
+ this.userList = [];
|
|
420
|
+ }
|
|
421
|
+
|
|
422
|
+ changeUserGroup(value){
|
|
423
|
+ this.requiredChange('groupId', value == 2 || value == 3);
|
|
424
|
+ this.validateForm.controls.groupId.setValue(null);
|
|
425
|
+ this.groupList = [];
|
|
426
|
+
|
|
427
|
+ this.requiredChange('userId', value == 3);
|
|
428
|
+ this.validateForm.controls.userId.setValue(null);
|
|
429
|
+ this.userList = [];
|
|
430
|
+ }
|
|
431
|
+
|
186
|
432
|
delModal: boolean = false; //删除模态框
|
187
|
433
|
tipsMsg1: string; //提示框信息
|
188
|
434
|
tipsMsg2: string; //操作后信息
|