Browse Source

[完善]完善新建建筑order赋值问题

develop
邵佳豪 5 years ago
parent
commit
74fd86ebc4
  1. 50
      src/app/ui/basicinfo/addhouseinfo.component.ts
  2. 4
      src/app/ui/basicinfo/basicinfo.component.html
  3. 1658
      src/app/ui/basicinfo/basicinfo.component.ts

50
src/app/ui/basicinfo/addhouseinfo.component.ts

@ -29,27 +29,41 @@ import { MatSnackBar } from '@angular/material/snack-bar';
})
}
onSubmit(value){
let buildingTypename = ""
this.allunittype.forEach(item => {
if(item.id == value.unittype){
buildingTypename = item.name
this.http.get("/api/CompanyAccount/Buildings").subscribe((data:any)=>{
let allBuildings = data
let order
if(allBuildings.length == 0){
order = 0
}else{
order = allBuildings[allBuildings.length-1].order + 1
}
});
this.http.post("/api/CompanyAccount/Buildings",{
id: "",
name: value.name,
order: 0,
enabled: true,
companyId: this.data.unitinfo.id,
buildingTypes: [
{
id: value.unittype,
name: buildingTypename
let buildingTypename = ""
this.allunittype.forEach(item => {
if(item.id == value.unittype){
buildingTypename = item.name
}
]
}).subscribe(data=>{
this.dialogRef.close(data);
});
this.http.post("/api/CompanyAccount/Buildings",{
id: "",
name: value.name,
order: order,
enabled: true,
companyId: this.data.unitinfo.id,
buildingTypes: [
{
id: value.unittype,
name: buildingTypename
}
]
}).subscribe(data=>{
this.dialogRef.close(data);
})
})
}
}

4
src/app/ui/basicinfo/basicinfo.component.html

@ -151,7 +151,7 @@
<span>建筑类型:</span>
<mat-form-field>
<mat-select name="unittype" [(ngModel)]="item.buildtype">
<mat-option [value]="n.name" *ngFor="let n of allunittype" (click)="templatebuildtype(n,item)">{{n.name}}</mat-option>
<mat-option [value]="n.name" *ngFor="let n of allunittype" (click)="templatebuildtype(n,item,key)">{{n.name}}</mat-option>
</mat-select>
</mat-form-field>
<span style="color: red;">*</span>
@ -234,7 +234,7 @@
<span>建筑类型:</span>
<mat-form-field>
<mat-select required name="unittype" [(ngModel)]="item.buildtype">
<mat-option [value]="n.name" *ngFor="let n of allunittype" (click)="templatebuildtype(n,item)">{{n.name}}</mat-option>
<mat-option [value]="n.name" *ngFor="let n of allunittype" (click)="templatebuildtype(n,item,key)">{{n.name}}</mat-option>
</mat-select>
</mat-form-field>
<span style="color: red;">*</span>

1658
src/app/ui/basicinfo/basicinfo.component.ts

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save