浏览代码

院区部门修改

seimin 1 年之前
父节点
当前提交
fbccb8fa48

+ 2 - 2
src/app/share/dialog-delete/dialog-delete.component.html

@@ -6,10 +6,10 @@
6 6
       <div class="icon"><i class="icon_transport transport-wenhao"></i></div>
7 7
       <div class="defeat" [innerHTML]="content | htmlTransform"></div>
8 8
       <div class="tips red" *ngIf="tips">({{tips}})</div>
9
-      <div [hidden]="!isChecked">
9
+      <div *ngIf="isChecked">
10 10
         <label nz-checkbox [(ngModel)]="isRemandClean" [ngModelOptions]="{ standalone: true }">是否同步建立手术清洁任务工单</label>
11 11
       </div>
12
-      <div [hidden]="!isSelected" class="mt8 mb8 w100">
12
+      <div *ngIf="isSelected" class="mt8 mb8 w100">
13 13
         <nz-select class="w100" [nzDropdownMatchSelectWidth]="false" nzShowSearch nzPlaceHolder="请选择苏醒室" [(ngModel)]="recoveryRoom">
14 14
           <ng-container *ngFor="let option of isSelectedArr">
15 15
             <nz-option *ngIf="!isLoading" [nzLabel]="deptDisplay == 2 ? option.deptalias : option.dept" [nzValue]="option.id"></nz-option>

+ 5 - 0
src/app/share/dialog-delete/dialog-delete.component.ts

@@ -29,6 +29,11 @@ export class DialogDeleteComponent implements OnInit, OnChanges {
29 29
   ngOnInit() {}
30 30
 
31 31
   ngOnChanges(changes: SimpleChanges){
32
+    if(changes.delModal && changes.delModal.currentValue){
33
+      this.isRemandClean = true;
34
+      this.isLoading = false;
35
+      this.recoveryRoom = null;
36
+    }
32 37
     if(changes.isSelected && changes.isSelectedArr){
33 38
       if(changes.isSelectedArr.currentValue.length === 1){
34 39
         this.recoveryRoom = changes.isSelectedArr.currentValue[0].id;

+ 27 - 11
src/app/views/hospital-management/hospital-management.component.html

@@ -17,17 +17,19 @@
17 17
       >
18 18
         <thead>
19 19
           <tr class="thead">
20
-            <th nzWidth="20%">院区名称</th>
21
-            <th nzWidth="30%">父院区</th>
22
-            <th nzWidth="30%">院区编码</th>
20
+            <th nzWidth="20%">院区/部门名称</th>
21
+            <th nzWidth="20%">部门类型</th>
22
+            <th nzWidth="20%">父院区</th>
23
+            <th nzWidth="20%">院区编码</th>
23 24
             <th nzWidth="20%">操作</th>
24 25
           </tr>
25 26
         </thead>
26 27
         <tbody>
27 28
           <tr *ngFor="let data of listOfData">
28
-            <td>{{ data.hosName }}</td>
29
+            <td>{{ data.hosName || '无' }}</td>
30
+            <td>{{ data.type ? data.type.name : '无' }}</td>
29 31
             <td>{{ data.parent ? data.parent.hosName : '无' }}</td>
30
-            <td>{{ data.hosNo }}</td>
32
+            <td>{{ data.hosNo || '无' }}</td>
31 33
             <td>
32 34
               <div class="coop">
33 35
                 <span
@@ -65,7 +67,7 @@
65 67
   >
66 68
     <div class="modalBody">
67 69
       <div class="title">
68
-        {{ add ? "新增" : "编辑" }}院区信息<i
70
+        {{ add ? "新增" : "编辑" }}<i
69 71
           class="icon_transport transport-guanbi"
70 72
           (click)="hideAddModal()"
71 73
         ></i>
@@ -82,11 +84,11 @@
82 84
               [nzSm]="6"
83 85
               [nzXs]="24"
84 86
               nzFor="parentHospital"
85
-              >父院区</nz-form-label
87
+              >父院区</nz-form-label
86 88
             >
87
-            <nz-form-control nzErrorTip="请选择父院区!">
88
-              <nz-select formControlName="parentHospital" [nzDropdownMatchSelectWidth]="false" nzPlaceHolder="请选择父院区" nzShowSearch nzAllowClear nzServerSearch (nzOnSearch)="changeInp($event)"
89
-              (nzOpenChange)="openHospitalSelect($event)">
89
+            <nz-form-control nzErrorTip="请选择父院区!">
90
+              <nz-select formControlName="parentHospital" [nzDropdownMatchSelectWidth]="false" nzPlaceHolder="请选择父院区" nzShowSearch nzAllowClear nzServerSearch (nzOnSearch)="changeInp($event)"
91
+              (nzOpenChange)="openHospitalSelect($event)" (ngModelChange)="changeHospitalSelect($event)">
90 92
                 <ng-container *ngFor="let option of parentHospitals">
91 93
                   <nz-option *ngIf="!isLoading" [nzLabel]="option.hosName" [nzValue]="option.id"></nz-option>
92 94
                 </ng-container>
@@ -103,7 +105,7 @@
103 105
               [nzXs]="24"
104 106
               nzRequired
105 107
               nzFor="hospitalName"
106
-              >院区名称</nz-form-label
108
+              >{{validateForm.value.parentHospital ? '部门' : '院区'}}名称</nz-form-label
107 109
             >
108 110
             <nz-form-control nzErrorTip="请输入院区名称!">
109 111
               <nz-input-group>
@@ -116,6 +118,20 @@
116 118
               </nz-input-group>
117 119
             </nz-form-control>
118 120
           </nz-form-item>
121
+          <nz-form-item [hidden]="!validateForm.value.parentHospital">
122
+            <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="hospitalType" [nzRequired]="validateForm.value.parentHospital">部门类型</nz-form-label>
123
+            <nz-form-control nzErrorTip="请选择部门类型!">
124
+              <nz-select formControlName="hospitalType" [nzDropdownMatchSelectWidth]="false" nzPlaceHolder="请选择部门类型" nzShowSearch nzAllowClear (nzOpenChange)="openHospitalTypeSelect($event)">
125
+                <ng-container *ngFor="let option of hospitalTypes">
126
+                  <nz-option *ngIf="!isHospitalTypeLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
127
+                </ng-container>
128
+                <nz-option *ngIf="isHospitalTypeLoading" nzDisabled nzCustomContent>
129
+                  <i nz-icon nzType="loading" class="loading-icon"></i>
130
+                  搜索中...
131
+                </nz-option>
132
+              </nz-select>
133
+            </nz-form-control>
134
+          </nz-form-item>
119 135
           <nz-form-item>
120 136
             <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="hospitalNum"
121 137
               >院区编码</nz-form-label

+ 42 - 0
src/app/views/hospital-management/hospital-management.component.ts

@@ -82,6 +82,25 @@ export class HospitalManagementComponent implements OnInit {
82 82
       });
83 83
     }
84 84
   }
85
+  // 选择父级科室下拉框
86
+  changeHospitalSelect(e) {
87
+    if(!e){
88
+      this.validateForm.controls.hospitalType.setValue(null);
89
+    }
90
+    this.requiredChange(Boolean(e), 'hospitalType');
91
+  }
92
+  // 打开部门类型下拉框
93
+  isHospitalTypeLoading = false;
94
+  hospitalTypes: any = [];
95
+  openHospitalTypeSelect(flag) {
96
+    if (flag) {
97
+      this.isHospitalTypeLoading = true;
98
+      this.mainService.getDictionary("list", "hospital_type").subscribe((result) => {
99
+        this.isHospitalTypeLoading = false;
100
+        this.hospitalTypes = result;
101
+      });
102
+    }
103
+  }
85 104
   //获取所有的父级院区列表
86 105
   getAllParentHospital(keyWord = "") {
87 106
     let postData: any = {
@@ -115,6 +134,19 @@ export class HospitalManagementComponent implements OnInit {
115 134
       });
116 135
   }
117 136
 
137
+  // 修改验证规则-是否必选
138
+  requiredChange(required: boolean, field: string): void {
139
+    if (!required) {
140
+      this.validateForm.get(field)!.clearValidators();
141
+      this.validateForm.get(field)!.markAsPristine();
142
+    } else {
143
+      this.validateForm.get(field)!.setValidators(Validators.required);
144
+      this.validateForm.get(field)!.markAsDirty();
145
+    }
146
+    this.validateForm.get(field)!.updateValueAndValidity();
147
+  }
148
+
149
+
118 150
   addModal() {
119 151
     this.add = true;
120 152
     this.modal = true;
@@ -170,6 +202,7 @@ export class HospitalManagementComponent implements OnInit {
170 202
   // 初始化新增form表单
171 203
   initForm() {
172 204
     this.validateForm = this.fb.group({
205
+      hospitalType: [null],
173 206
       parentHospital: [null],
174 207
       hospitalName: [null, [Validators.required]],
175 208
       hospitalNum: [null, [Validators.required]],
@@ -194,6 +227,9 @@ export class HospitalManagementComponent implements OnInit {
194 227
     if (this.validateForm.value.parentHospital) {
195 228
       data.hospital.parent = { id: this.validateForm.value.parentHospital };
196 229
     }
230
+    if (this.validateForm.value.hospitalType) {
231
+      data.hospital.type = { id: this.validateForm.value.hospitalType };
232
+    }
197 233
     if (!that.add) {
198 234
       data.hospital["id"] = that.coopId;
199 235
     }
@@ -224,6 +260,12 @@ export class HospitalManagementComponent implements OnInit {
224 260
         }
225 261
       });
226 262
     }
263
+    if(data.type){
264
+      this.mainService.getDictionary("list", "hospital_type").subscribe((result) => {
265
+        this.hospitalTypes = result;
266
+        this.validateForm.controls.hospitalType.setValue(data.type.id);
267
+      });
268
+    }
227 269
     this.validateForm.controls.hospitalName.setValue(data.hosName);
228 270
     this.validateForm.controls.hospitalNum.setValue(data.hosNo);
229 271
   }