@ -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
]
}).subscribe(data=>{
this.dialogRef.close(data);
order: order,
@ -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 @@
<mat-select required name="unittype" [(ngModel)]="item.buildtype">