瀏覽代碼

BUG修改

seimin 5 月之前
父節點
當前提交
2707e3f2e5

+ 3 - 3
src/app/components/configurationCenter/configuration-category/configuration-category.component.html

@@ -194,7 +194,7 @@
194
           <nz-form-label nzFor="category1" nzRequired [nzSpan]="6">一级故障现象</nz-form-label>
194
           <nz-form-label nzFor="category1" nzRequired [nzSpan]="6">一级故障现象</nz-form-label>
195
           <nz-form-control [nzSpan]="24" nzErrorTip="请选择一级故障现象!">
195
           <nz-form-control [nzSpan]="24" nzErrorTip="请选择一级故障现象!">
196
 						<nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzPlaceHolder="请选择一级故障现象" formControlName="category1" (ngModelChange)="changeOneCategory($event)">
196
 						<nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzPlaceHolder="请选择一级故障现象" formControlName="category1" (ngModelChange)="changeOneCategory($event)">
197
-						  <ng-container *ngFor="let option of categoryList1">
197
+						  <ng-container *ngFor="let option of categoryListP1">
198
 						    <nz-option *ngIf="!isLoading" [nzLabel]="option.category" [nzValue]="option.id"></nz-option>
198
 						    <nz-option *ngIf="!isLoading" [nzLabel]="option.category" [nzValue]="option.id"></nz-option>
199
 						  </ng-container>
199
 						  </ng-container>
200
 						  <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
200
 						  <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
@@ -204,10 +204,10 @@
204
           </nz-form-control>
204
           </nz-form-control>
205
         </nz-form-item>
205
         </nz-form-item>
206
         <nz-form-item *ngIf="!add && coopType === 3">
206
         <nz-form-item *ngIf="!add && coopType === 3">
207
-          <nz-form-label nzFor="category2" nzRequired [nzSpan]="6">二级故障现象</nz-form-label>
207
+          <nz-form-label nzFor="category2" nzRequired [nzSpan]="6">{{activeCategory2.id}}二级故障现象</nz-form-label>
208
           <nz-form-control [nzSpan]="24" nzErrorTip="请选择二级故障现象!">
208
           <nz-form-control [nzSpan]="24" nzErrorTip="请选择二级故障现象!">
209
 						<nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzPlaceHolder="请选择二级故障现象" formControlName="category2">
209
 						<nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzPlaceHolder="请选择二级故障现象" formControlName="category2">
210
-						  <ng-container *ngFor="let option of categoryList2">
210
+						  <ng-container *ngFor="let option of categoryListP2">
211
 						    <nz-option *ngIf="!isLoading" [nzLabel]="option.category" [nzValue]="option.id"></nz-option>
211
 						    <nz-option *ngIf="!isLoading" [nzLabel]="option.category" [nzValue]="option.id"></nz-option>
212
 						  </ng-container>
212
 						  </ng-container>
213
 						  <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
213
 						  <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>

+ 31 - 5
src/app/components/configurationCenter/configuration-category/configuration-category.component.ts

@@ -6,6 +6,7 @@ import { MainService } from "../../../services/main.service";
6
 import { Validators, FormGroup, FormBuilder } from '@angular/forms';
6
 import { Validators, FormGroup, FormBuilder } from '@angular/forms';
7
 import { ToolService } from 'src/app/services/tool.service';
7
 import { ToolService } from 'src/app/services/tool.service';
8
 import { OverlayScrollbarsComponent } from 'overlayscrollbars-ngx';
8
 import { OverlayScrollbarsComponent } from 'overlayscrollbars-ngx';
9
+import cloneDeep from 'lodash-es/cloneDeep'
9
 
10
 
10
 @Component({
11
 @Component({
11
   selector: "app-configuration-category",
12
   selector: "app-configuration-category",
@@ -363,6 +364,7 @@ export class ConfigurationCategoryComponent implements OnInit {
363
     this.mainService.incidentPost("listIncidentCategory", postData).subscribe(res => {
364
     this.mainService.incidentPost("listIncidentCategory", postData).subscribe(res => {
364
       this['categoryLoading' + type] = false;
365
       this['categoryLoading' + type] = false;
365
       this['categoryList' + type] = res.data || [];
366
       this['categoryList' + type] = res.data || [];
367
+      this['categoryListP' + type] = cloneDeep(this['categoryList' + type]);
366
       if(isEdit){
368
       if(isEdit){
367
         this['activeCategory' + type] = this['categoryList' + type].find(v => v.id == this['activeCategory' + type].id);
369
         this['activeCategory' + type] = this['categoryList' + type].find(v => v.id == this['activeCategory' + type].id);
368
       }
370
       }
@@ -373,6 +375,25 @@ export class ConfigurationCategoryComponent implements OnInit {
373
     })
375
     })
374
   }
376
   }
375
 
377
 
378
+  // 弹窗-故障现象查询
379
+  categoryListP1: any[] = [];
380
+  categoryListP2: any[] = [];
381
+  categoryListP3: any[] = [];
382
+  getCategoryListP(type:number, parentId = 0) {
383
+    this.isLoading = true;
384
+    let postData = {
385
+      category: {
386
+        hierarchy: type === 1 ? 1 : undefined,
387
+        dutyIds: this.hospitalConfig === 1 ? this.currentHospital.id.toString()  : undefined,
388
+        parent: type === 1 ? undefined : { id: parentId },
389
+      },
390
+    };
391
+    this.mainService.incidentPost("listIncidentCategory", postData).subscribe(res => {
392
+      this.isLoading = false;
393
+      this['categoryListP' + type] = res.data || [];
394
+    })
395
+  }
396
+
376
   // 新增故障现象弹框
397
   // 新增故障现象弹框
377
   modelName = ""; //模态框名称
398
   modelName = ""; //模态框名称
378
   add: boolean; //true:新增;false:编辑
399
   add: boolean; //true:新增;false:编辑
@@ -431,8 +452,11 @@ export class ConfigurationCategoryComponent implements OnInit {
431
 
452
 
432
     this.validateCategoryForm.controls.name.setValue(data.category);
453
     this.validateCategoryForm.controls.name.setValue(data.category);
433
     if(type === 2){
454
     if(type === 2){
455
+      this.categoryListP1 = cloneDeep(this.categoryList1);
434
       this.validateCategoryForm.controls.category1.setValue(this.activeCategory1.id);
456
       this.validateCategoryForm.controls.category1.setValue(this.activeCategory1.id);
435
     }else if(type === 3){
457
     }else if(type === 3){
458
+      this.categoryListP1 = cloneDeep(this.categoryList1);
459
+      this.categoryListP2 = cloneDeep(this.categoryList2);
436
       this.validateCategoryForm.controls.category1.setValue(this.activeCategory1.id);
460
       this.validateCategoryForm.controls.category1.setValue(this.activeCategory1.id);
437
       this.validateCategoryForm.controls.category2.setValue(this.activeCategory2.id);
461
       this.validateCategoryForm.controls.category2.setValue(this.activeCategory2.id);
438
     }
462
     }
@@ -480,13 +504,15 @@ export class ConfigurationCategoryComponent implements OnInit {
480
       console.log(this['activeCategory' + this.coopType])
504
       console.log(this['activeCategory' + this.coopType])
481
       //编辑
505
       //编辑
482
       let postData = {
506
       let postData = {
483
-        ...this.coopData,
484
-        parent: this.coopType === 1 ? undefined : (this.coopType === 2 ? { id: this.validateCategoryForm.value.category1 } : { id: this.validateCategoryForm.value.category2 }),
485
-        category: this.validateCategoryForm.value.name,
507
+        incidentCategory: {
508
+          ...this.coopData,
509
+          parent: this.coopType === 1 ? undefined : (this.coopType === 2 ? { id: this.validateCategoryForm.value.category1 } : { id: this.validateCategoryForm.value.category2 }),
510
+          category: this.validateCategoryForm.value.name,
511
+        }
486
       };
512
       };
487
       console.log(postData);
513
       console.log(postData);
488
       this.mainService
514
       this.mainService
489
-        .simplePost("addData", "incidentCategory", postData)
515
+        .coopData("updData", "incidentCategory", postData)
490
         .subscribe((result) => {
516
         .subscribe((result) => {
491
           this.btnLoading = false;
517
           this.btnLoading = false;
492
           this.hideCategoryModal();
518
           this.hideCategoryModal();
@@ -760,7 +786,7 @@ export class ConfigurationCategoryComponent implements OnInit {
760
   // 修改故障现象
786
   // 修改故障现象
761
   changeOneCategory(id){
787
   changeOneCategory(id){
762
     this.validateCategoryForm.controls.category2.setValue(null);
788
     this.validateCategoryForm.controls.category2.setValue(null);
763
-    this.getCategoryList(2, id);
789
+    this.getCategoryListP(2, id);
764
   }
790
   }
765
 
791
 
766
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
792
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)