Sfoglia il codice sorgente

区域地点回显第一个

seimin 3 anni fa
parent
commit
b04224887d
1 ha cambiato i file con 10 aggiunte e 2 eliminazioni
  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 237
     this.mainService.fetchListBx('area', { idx: 0, sum: 1000 }).subscribe((result: any) => {
238 238
       if (result.status == 200) {
239 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 252
     this.mainService.fetchListBx('place', { idx: 0, sum: 1000, place: { area: { id: buildingId } } }).subscribe((result: any) => {
248 253
       if (result.status == 200) {
249 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 2291
       this.getArea();
2282 2292
       this.bxForm.controls.name.setValue(this.loginUser.name);
2283 2293
       this.bxForm.controls.phone.setValue(this.loginUser.phone);
2284
-      this.bxForm.controls.hospital.setValue(null);
2285
-      this.bxForm.controls.building.setValue(null);
2286 2294
       this.bxForm.controls.address.setValue(null);
2287 2295
       this.bxForm.controls.content.setValue(null);
2288 2296
     }