Browse Source

区域地点回显第一个

seimin 3 years ago
parent
commit
b04224887d
1 changed files with 10 additions and 2 deletions
  1. 10 2
      src/app/views/hushijiandan/hushijiandan.component.ts

+ 10 - 2
src/app/views/hushijiandan/hushijiandan.component.ts

@@ -237,6 +237,11 @@ export class HushijiandanComponent implements OnInit {
237
     this.mainService.fetchListBx('area', { idx: 0, sum: 1000 }).subscribe((result: any) => {
237
     this.mainService.fetchListBx('area', { idx: 0, sum: 1000 }).subscribe((result: any) => {
238
       if (result.status == 200) {
238
       if (result.status == 200) {
239
         this.areas = result.list;
239
         this.areas = result.list;
240
+        if(this.areas.length){
241
+          this.bxForm.controls.hospital.setValue(this.areas[0].id);
242
+        }else{
243
+          this.bxForm.controls.hospital.setValue(null);
244
+        }
240
       }
245
       }
241
     });
246
     });
242
   }
247
   }
@@ -247,6 +252,11 @@ export class HushijiandanComponent implements OnInit {
247
     this.mainService.fetchListBx('place', { idx: 0, sum: 1000, place: { area: { id: buildingId } } }).subscribe((result: any) => {
252
     this.mainService.fetchListBx('place', { idx: 0, sum: 1000, place: { area: { id: buildingId } } }).subscribe((result: any) => {
248
       if (result.status == 200) {
253
       if (result.status == 200) {
249
         this.places = result.list;
254
         this.places = result.list;
255
+        if(this.places.length){
256
+          this.bxForm.controls.building.setValue(this.places[0].id);
257
+        }else{
258
+          this.bxForm.controls.building.setValue(null);
259
+        }
250
       }
260
       }
251
     });
261
     });
252
   }
262
   }
@@ -2281,8 +2291,6 @@ export class HushijiandanComponent implements OnInit {
2281
       this.getArea();
2291
       this.getArea();
2282
       this.bxForm.controls.name.setValue(this.loginUser.name);
2292
       this.bxForm.controls.name.setValue(this.loginUser.name);
2283
       this.bxForm.controls.phone.setValue(this.loginUser.phone);
2293
       this.bxForm.controls.phone.setValue(this.loginUser.phone);
2284
-      this.bxForm.controls.hospital.setValue(null);
2285
-      this.bxForm.controls.building.setValue(null);
2286
       this.bxForm.controls.address.setValue(null);
2294
       this.bxForm.controls.address.setValue(null);
2287
       this.bxForm.controls.content.setValue(null);
2295
       this.bxForm.controls.content.setValue(null);
2288
     }
2296
     }