邵佳豪 3 years ago
parent
commit
ae28e58cd6
  1. 32
      src/app/ui/function-division/function-division.component.ts

32
src/app/ui/function-division/function-division.component.ts

@ -139,19 +139,29 @@ export class FunctionDivisionComponent implements OnInit {
// 没有 创建 建筑功能分区时 自动创建
addVoluntarilyPartition () {
let isFalse = []
this.noDataList.forEach(item=> { item===false? isFalse.push(1) : null })
if (isFalse.length === this.allBuilding.length) { //没有 建筑功能分区时
let data = {
buildingId: this.allBuilding[0].id,
region: "",
area: 0,
details: ""
let isNotHave:boolean = false
this.noDataList.forEach(item=> {
if (item === true) {
isNotHave = true
return
}
this.http.post('/api/CompanyAccount/BuildingFunctionalDivisions',data).subscribe(data=>{
this.getAllBuilding()
})
if (!isNotHave) { //所有建筑都没有 功能分区时
let bodyData = [{
buildingId: this.allBuilding[0].id,
region: "",
area: 0,
details: ""
}]
let params = {buildingId:this.allBuilding[0].id}
this.http.post('/api/CompanyAccount/BuildingFunctionalDivisions/Batch',bodyData,{params:params}).subscribe(datas=>{
this.http.get(`/api/CompanyAccount/BuildingFunctionalDivisions`,{params:params}).subscribe((data:any)=>{
this.allBuilding[0].functionalZoning = data
this.selectBuildingFunctionalZoning.push([]) //拥有建筑功能分区的提前push空数组
this.allBuildingFunctionalZoning.push(this.allBuilding[0])
})
})
} //if
}
}
//封装函数刷新当前建筑功能分区

Loading…
Cancel
Save