浏览代码

院区部门修改

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

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

@@ -6,10 +6,10 @@
6
       <div class="icon"><i class="icon_transport transport-wenhao"></i></div>
6
       <div class="icon"><i class="icon_transport transport-wenhao"></i></div>
7
       <div class="defeat" [innerHTML]="content | htmlTransform"></div>
7
       <div class="defeat" [innerHTML]="content | htmlTransform"></div>
8
       <div class="tips red" *ngIf="tips">({{tips}})</div>
8
       <div class="tips red" *ngIf="tips">({{tips}})</div>
9
-      <div [hidden]="!isChecked">
9
+      <div *ngIf="isChecked">
10
         <label nz-checkbox [(ngModel)]="isRemandClean" [ngModelOptions]="{ standalone: true }">是否同步建立手术清洁任务工单</label>
10
         <label nz-checkbox [(ngModel)]="isRemandClean" [ngModelOptions]="{ standalone: true }">是否同步建立手术清洁任务工单</label>
11
       </div>
11
       </div>
12
-      <div [hidden]="!isSelected" class="mt8 mb8 w100">
12
+      <div *ngIf="isSelected" class="mt8 mb8 w100">
13
         <nz-select class="w100" [nzDropdownMatchSelectWidth]="false" nzShowSearch nzPlaceHolder="请选择苏醒室" [(ngModel)]="recoveryRoom">
13
         <nz-select class="w100" [nzDropdownMatchSelectWidth]="false" nzShowSearch nzPlaceHolder="请选择苏醒室" [(ngModel)]="recoveryRoom">
14
           <ng-container *ngFor="let option of isSelectedArr">
14
           <ng-container *ngFor="let option of isSelectedArr">
15
             <nz-option *ngIf="!isLoading" [nzLabel]="deptDisplay == 2 ? option.deptalias : option.dept" [nzValue]="option.id"></nz-option>
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
   ngOnInit() {}
29
   ngOnInit() {}
30
 
30
 
31
   ngOnChanges(changes: SimpleChanges){
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
     if(changes.isSelected && changes.isSelectedArr){
37
     if(changes.isSelected && changes.isSelectedArr){
33
       if(changes.isSelectedArr.currentValue.length === 1){
38
       if(changes.isSelectedArr.currentValue.length === 1){
34
         this.recoveryRoom = changes.isSelectedArr.currentValue[0].id;
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
         <thead>
18
         <thead>
19
           <tr class="thead">
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
             <th nzWidth="20%">操作</th>
24
             <th nzWidth="20%">操作</th>
24
           </tr>
25
           </tr>
25
         </thead>
26
         </thead>
26
         <tbody>
27
         <tbody>
27
           <tr *ngFor="let data of listOfData">
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
             <td>{{ data.parent ? data.parent.hosName : '无' }}</td>
31
             <td>{{ data.parent ? data.parent.hosName : '无' }}</td>
30
-            <td>{{ data.hosNo }}</td>
32
+            <td>{{ data.hosNo || '无' }}</td>
31
             <td>
33
             <td>
32
               <div class="coop">
34
               <div class="coop">
33
                 <span
35
                 <span
@@ -65,7 +67,7 @@
65
   >
67
   >
66
     <div class="modalBody">
68
     <div class="modalBody">
67
       <div class="title">
69
       <div class="title">
68
-        {{ add ? "新增" : "编辑" }}院区信息<i
70
+        {{ add ? "新增" : "编辑" }}<i
69
           class="icon_transport transport-guanbi"
71
           class="icon_transport transport-guanbi"
70
           (click)="hideAddModal()"
72
           (click)="hideAddModal()"
71
         ></i>
73
         ></i>
@@ -82,11 +84,11 @@
82
               [nzSm]="6"
84
               [nzSm]="6"
83
               [nzXs]="24"
85
               [nzXs]="24"
84
               nzFor="parentHospital"
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
                 <ng-container *ngFor="let option of parentHospitals">
92
                 <ng-container *ngFor="let option of parentHospitals">
91
                   <nz-option *ngIf="!isLoading" [nzLabel]="option.hosName" [nzValue]="option.id"></nz-option>
93
                   <nz-option *ngIf="!isLoading" [nzLabel]="option.hosName" [nzValue]="option.id"></nz-option>
92
                 </ng-container>
94
                 </ng-container>
@@ -103,7 +105,7 @@
103
               [nzXs]="24"
105
               [nzXs]="24"
104
               nzRequired
106
               nzRequired
105
               nzFor="hospitalName"
107
               nzFor="hospitalName"
106
-              >院区名称</nz-form-label
108
+              >{{validateForm.value.parentHospital ? '部门' : '院区'}}名称</nz-form-label
107
             >
109
             >
108
             <nz-form-control nzErrorTip="请输入院区名称!">
110
             <nz-form-control nzErrorTip="请输入院区名称!">
109
               <nz-input-group>
111
               <nz-input-group>
@@ -116,6 +118,20 @@
116
               </nz-input-group>
118
               </nz-input-group>
117
             </nz-form-control>
119
             </nz-form-control>
118
           </nz-form-item>
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
           <nz-form-item>
135
           <nz-form-item>
120
             <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="hospitalNum"
136
             <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="hospitalNum"
121
               >院区编码</nz-form-label
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
   getAllParentHospital(keyWord = "") {
105
   getAllParentHospital(keyWord = "") {
87
     let postData: any = {
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
   addModal() {
150
   addModal() {
119
     this.add = true;
151
     this.add = true;
120
     this.modal = true;
152
     this.modal = true;
@@ -170,6 +202,7 @@ export class HospitalManagementComponent implements OnInit {
170
   // 初始化新增form表单
202
   // 初始化新增form表单
171
   initForm() {
203
   initForm() {
172
     this.validateForm = this.fb.group({
204
     this.validateForm = this.fb.group({
205
+      hospitalType: [null],
173
       parentHospital: [null],
206
       parentHospital: [null],
174
       hospitalName: [null, [Validators.required]],
207
       hospitalName: [null, [Validators.required]],
175
       hospitalNum: [null, [Validators.required]],
208
       hospitalNum: [null, [Validators.required]],
@@ -194,6 +227,9 @@ export class HospitalManagementComponent implements OnInit {
194
     if (this.validateForm.value.parentHospital) {
227
     if (this.validateForm.value.parentHospital) {
195
       data.hospital.parent = { id: this.validateForm.value.parentHospital };
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
     if (!that.add) {
233
     if (!that.add) {
198
       data.hospital["id"] = that.coopId;
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
     this.validateForm.controls.hospitalName.setValue(data.hosName);
269
     this.validateForm.controls.hospitalName.setValue(data.hosName);
228
     this.validateForm.controls.hospitalNum.setValue(data.hosNo);
270
     this.validateForm.controls.hospitalNum.setValue(data.hosNo);
229
   }
271
   }