Browse Source

巡检功能调整

seimin 3 weeks ago
parent
commit
887b3ca7aa

+ 16 - 10
src/app/views/inspection-address/inspection-address.component.html

@@ -51,14 +51,13 @@
51 51
         [nzLoading]="loading1">
52 52
         <thead>
53 53
           <tr class="thead">
54
-            <th nzWidth="5%" nzShowCheckbox [(nzChecked)]="isAllDisplayDataChecked" (nzCheckedChange)="checkAll($event)"></th>
55
-            <th nzWidth="14%">巡检点名称</th>
56
-            <th nzWidth="14%">关联科室</th>
57
-            <th nzWidth="14%">楼栋</th>
58
-            <th nzWidth="14%">楼层</th>
59
-            <th nzWidth="14%">标签</th>
60
-            <th nzWidth="14%">支持签到模式</th>
61
-            <th nzWidth="11%">操作</th>
54
+            <th nzWidth="4%" nzShowCheckbox [(nzChecked)]="isAllDisplayDataChecked" (nzCheckedChange)="checkAll($event)"></th>
55
+            <th nzWidth="16%">巡检点名称</th>
56
+            <th nzWidth="16%">关联科室</th>
57
+            <th nzWidth="16%">详细地址</th>
58
+            <th nzWidth="16%">标签</th>
59
+            <th nzWidth="16%">支持签到模式</th>
60
+            <th nzWidth="16%">操作</th>
62 61
           </tr>
63 62
         </thead>
64 63
         <tbody>
@@ -66,8 +65,7 @@
66 65
             <td nzShowCheckbox [(nzChecked)]="mapOfCheckedId[data.id]" (nzCheckedChange)="refreshStatus()"></td>
67 66
             <td>{{data.name}}</td>
68 67
             <td>{{data.departmentDTO?.dept}}</td>
69
-            <td>{{data.buildingDTO?.buildingName}}</td>
70
-            <td>{{data.floorDTO?.floorName}}</td>
68
+            <td>{{data.buildingDTO?.buildingName}}{{data.floorDTO?.floorName}}层{{data.address}}</td>
71 69
             <td>{{data.tagIdsList|dataToName:'name':' '}}</td>
72 70
             <td>{{data.signType?.name}}</td>
73 71
             <td>
@@ -142,6 +140,14 @@
142 140
               </nz-select>
143 141
             </nz-form-control>
144 142
           </nz-form-item>
143
+          <nz-form-item style="margin: 4px 0 2px 0;">
144
+            <nz-form-label [nzSpan]="5" nzRequired nzFor="address">详细地址</nz-form-label>
145
+            <nz-form-control [nzSpan]="19" nzErrorTip="请输入详细地址!">
146
+              <nz-input-group>
147
+                  <textarea formControlName="address" nz-input placeholder="请输入详细地址"></textarea>
148
+              </nz-input-group>
149
+            </nz-form-control>
150
+          </nz-form-item>
145 151
           <nz-form-item>
146 152
             <nz-form-label [nzSpan]="5" nzRequired nzFor="tagIds">标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;签</nz-form-label>
147 153
             <nz-form-control [nzSpan]="19" nzErrorTip="请选择标签!">

+ 4 - 0
src/app/views/inspection-address/inspection-address.component.ts

@@ -248,6 +248,7 @@ export class InspectionAddressComponent implements OnInit {
248 248
       deptId: [null],
249 249
       buildId: [null, [Validators.required]],
250 250
       floorId: [null, [Validators.required]],
251
+      address: ['', [Validators.required]],
251 252
       tagIds: [[], [Validators.required]],
252 253
       signType: [null, [Validators.required]],
253 254
     });
@@ -514,6 +515,7 @@ export class InspectionAddressComponent implements OnInit {
514 515
           deptId: this.validateForm.value.deptId || undefined,
515 516
           buildId: this.validateForm.value.buildId,
516 517
           floorId: this.validateForm.value.floorId,
518
+          address: this.validateForm.value.address,
517 519
           tagIds: tagIds.toString(),
518 520
           signType: this.dispatchMethods.find(v => v.value === this.validateForm.value.signType),
519 521
           hosId: this.currentHospital.id,
@@ -529,6 +531,7 @@ export class InspectionAddressComponent implements OnInit {
529 531
             deptId: this.validateForm.value.deptId || undefined,
530 532
             buildId: this.validateForm.value.buildId,
531 533
             floorId: this.validateForm.value.floorId,
534
+            address: this.validateForm.value.address,
532 535
             tagIds: tagIds.toString(),
533 536
             signType: this.dispatchMethods.find(v => v.value === this.validateForm.value.signType),
534 537
           }
@@ -569,6 +572,7 @@ export class InspectionAddressComponent implements OnInit {
569 572
     this.validateForm.controls.deptId.setValue(data.deptId);
570 573
     this.validateForm.controls.tagIds.setValue(data.tagIdsList.map(v => v.name));
571 574
     this.validateForm.controls.signType.setValue(data.signType.value);
575
+    this.validateForm.controls.address.setValue(data.address);
572 576
 
573 577
     if(data.deptId){
574 578
       this.getDeparts('add', '', true);

+ 93 - 12
src/app/views/inspection-configuration/inspection-configuration.component.html

@@ -11,11 +11,14 @@
11 11
         [nzLoading]="loading1">
12 12
         <thead>
13 13
           <tr class="thead">
14
-            <th nzWidth="20%">表单名称</th>
15
-            <th nzWidth="20%">是否显示生成汇总单</th>
16
-            <th nzWidth="20%">是否自动生成汇总单</th>
17
-            <th nzWidth="20%">状态</th>
18
-            <th nzWidth="20%">操作</th>
14
+            <th nzWidth="12%">表单名称</th>
15
+            <th nzWidth="12%">是否允许生成维修单</th>
16
+            <th nzWidth="12%">是否自动生成维修单</th>
17
+            <th nzWidth="12%">报修科室</th>
18
+            <th nzWidth="12%">故障现象</th>
19
+            <th nzWidth="12%">优先级</th>
20
+            <th nzWidth="12%">状态</th>
21
+            <th nzWidth="16%">操作</th>
19 22
           </tr>
20 23
         </thead>
21 24
         <tbody>
@@ -23,6 +26,9 @@
23 26
             <td>{{data.name}}</td>
24 27
             <td>{{data.showOrder ? '是' : '否'}}</td>
25 28
             <td>{{data.createOrder ? '是' : '否'}}</td>
29
+            <td>{{data.repairDeptDTO?.dept}}</td>
30
+            <td>{{data.categoryDTO?.mutiCategory}}</td>
31
+            <td>{{data.priorityDTO?.name}}</td>
26 32
             <td>{{data.status.name}}</td>
27 33
             <td>
28 34
               <div class="coop">
@@ -59,23 +65,98 @@
59 65
             </nz-form-control>
60 66
           </nz-form-item>
61 67
           <nz-form-item>
62
-            <nz-form-label [nzSpan]="9" nzRequired nzFor="showOrder">是否显示生成汇总单</nz-form-label>
63
-            <nz-form-control [nzSpan]="15" nzErrorTip="请选择是否显示生成汇总单!">
64
-              <nz-radio-group formControlName="showOrder">
68
+            <nz-form-label [nzSpan]="9" nzRequired nzFor="showOrder">是否允许生成维修单</nz-form-label>
69
+            <nz-form-control [nzSpan]="15" nzErrorTip="请选择是否允许生成维修单!">
70
+              <nz-radio-group formControlName="showOrder" (ngModelChange)="changeShowOrder($event)">
65 71
                 <label nz-radio [nzValue]="1">是</label>
66 72
                 <label nz-radio [nzValue]="0">否</label>
67 73
               </nz-radio-group>
68 74
             </nz-form-control>
69 75
           </nz-form-item>
70
-          <nz-form-item>
71
-            <nz-form-label [nzSpan]="9" nzRequired nzFor="createOrder">是否自动生成汇总单</nz-form-label>
72
-            <nz-form-control [nzSpan]="15" nzErrorTip="请选择是否自动生成汇总单!">
73
-              <nz-radio-group formControlName="createOrder">
76
+          <nz-form-item *ngIf="validateForm.value.showOrder == 1">
77
+            <nz-form-label [nzSpan]="9" nzRequired nzFor="createOrder">是否自动生成维修单</nz-form-label>
78
+            <nz-form-control [nzSpan]="15" nzErrorTip="请选择是否自动生成维修单!">
79
+              <nz-radio-group formControlName="createOrder" (ngModelChange)="changeCreateOrder($event)">
74 80
                 <label nz-radio [nzValue]="1">是</label>
75 81
                 <label nz-radio [nzValue]="0">否</label>
76 82
               </nz-radio-group>
77 83
             </nz-form-control>
78 84
           </nz-form-item>
85
+          <nz-form-item *ngIf="validateForm.value.showOrder == 1">
86
+            <nz-form-label [nzSpan]="5" [nzRequired]="validateForm.value.createOrder == 1" nzFor="repairDeptId">报修科室</nz-form-label>
87
+            <nz-form-control [nzSpan]="19" nzErrorTip="请选择报修科室!">
88
+              <nz-select (nzOnSearch)="changeInp('repairDept', $event)" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzAllowClear formControlName="repairDeptId" nzPlaceHolder="请选择报修科室" (nzOpenChange)="changeInp('repairDept', '')">
89
+                <ng-container *ngFor="let option of repairDeptList">
90
+                  <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
91
+                </ng-container>
92
+                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
93
+                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
94
+                </nz-option>
95
+              </nz-select>
96
+            </nz-form-control>
97
+          </nz-form-item>
98
+          <nz-form-item *ngIf="validateForm.value.showOrder == 1">
99
+            <nz-form-label [nzSpan]="5" [nzRequired]="validateForm.value.createOrder == 1" nzFor="categoryId">故障现象</nz-form-label>
100
+            <nz-form-control [nzSpan]="19" nzErrorTip="请选择故障现象!">
101
+              <nz-select (nzOnSearch)="changeInp('category', $event)" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzAllowClear formControlName="categoryId" nzPlaceHolder="请选择故障现象" (nzOpenChange)="changeInp('category', '')">
102
+                <ng-container *ngFor="let option of categoryList">
103
+                  <nz-option *ngIf="!isLoading" [nzLabel]="option.mutiCategory" [nzValue]="option.id"></nz-option>
104
+                </ng-container>
105
+                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
106
+                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
107
+                </nz-option>
108
+              </nz-select>
109
+            </nz-form-control>
110
+          </nz-form-item>
111
+          <nz-form-item *ngIf="validateForm.value.showOrder == 1">
112
+            <nz-form-label [nzSpan]="5" nzFor="priorityId">优&nbsp;&nbsp;先&nbsp;&nbsp;级</nz-form-label>
113
+            <nz-form-control [nzSpan]="19" nzErrorTip="请选择优先级!">
114
+              <nz-select [nzDropdownMatchSelectWidth]="false" nzAllowClear formControlName="priorityId" nzPlaceHolder="请选择优先级" (nzOpenChange)="changeInp('priority', '')">
115
+                <ng-container *ngFor="let option of priorityList">
116
+                  <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
117
+                </ng-container>
118
+                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
119
+                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
120
+                </nz-option>
121
+              </nz-select>
122
+            </nz-form-control>
123
+          </nz-form-item>
124
+          <nz-form-item *ngIf="validateForm.value.createOrder == 1">
125
+            <nz-form-label [nzSpan]="5" nzRequired nzFor="userGroup">自动派单</nz-form-label>
126
+            <nz-form-control [nzSpan]="19" nzErrorTip="请选择自动派单!">
127
+              <nz-radio-group formControlName="userGroup" (ngModelChange)="changeUserGroup($event)">
128
+                <label nz-radio [nzValue]="1">当前人</label>
129
+                <label nz-radio [nzValue]="2">派单给组</label>
130
+                <label nz-radio [nzValue]="3">派单给人</label>
131
+              </nz-radio-group>
132
+            </nz-form-control>
133
+          </nz-form-item>
134
+          <nz-form-item *ngIf="validateForm.value.userGroup == 2 || validateForm.value.userGroup == 3">
135
+            <nz-form-label [nzSpan]="5" nzRequired nzFor="groupId">维&nbsp;&nbsp;修&nbsp;&nbsp;组</nz-form-label>
136
+            <nz-form-control [nzSpan]="19" nzErrorTip="请选择维修组!">
137
+              <nz-select (nzOnSearch)="changeInp('group', $event)" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzAllowClear formControlName="groupId" nzPlaceHolder="请选择维修组" (nzOpenChange)="changeInp('group', '')">
138
+                <ng-container *ngFor="let option of groupList">
139
+                  <nz-option *ngIf="!isLoading" [nzLabel]="option.groupName" [nzValue]="option.id"></nz-option>
140
+                </ng-container>
141
+                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
142
+                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
143
+                </nz-option>
144
+              </nz-select>
145
+            </nz-form-control>
146
+          </nz-form-item>
147
+          <nz-form-item *ngIf="validateForm.value.userGroup == 3">
148
+            <nz-form-label [nzSpan]="5" nzRequired nzFor="userId">维&nbsp;&nbsp;修&nbsp;&nbsp;人</nz-form-label>
149
+            <nz-form-control [nzSpan]="19" nzErrorTip="请选择维修人!">
150
+              <nz-select (nzOnSearch)="changeInp('user', $event)" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzAllowClear formControlName="userId" nzPlaceHolder="请选择维修人" (nzOpenChange)="changeInp('user', '')">
151
+                <ng-container *ngFor="let option of userList">
152
+                  <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
153
+                </ng-container>
154
+                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
155
+                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
156
+                </nz-option>
157
+              </nz-select>
158
+            </nz-form-control>
159
+          </nz-form-item>
79 160
         </form>
80 161
       </div>
81 162
       <div class=" display_flex justify-content_flex-center">

+ 248 - 2
src/app/views/inspection-configuration/inspection-configuration.component.ts

@@ -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; //操作后信息