|
@@ -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
|
}
|