From b57647c789ea3b302cd058975a2f9f13b70ef847 Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Tue, 6 Jul 2021 15:56:32 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E6=AD=A3]=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=88=86=E5=8C=BA=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=9B=E5=BB=BABUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../function-division.component.ts | 14 +------- .../function-division.component.ts | 33 ++++++++++++------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/app/key-unit/function-division-look/function-division.component.ts b/src/app/key-unit/function-division-look/function-division.component.ts index 1828053..29488d4 100644 --- a/src/app/key-unit/function-division-look/function-division.component.ts +++ b/src/app/key-unit/function-division-look/function-division.component.ts @@ -153,19 +153,7 @@ export class FunctionDivisionLookComponent 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: "" - } - this.http.post('/api/BuildingFunctionalDivisions',data,{params:{companyId : this.route.snapshot.queryParams.id}}).subscribe(data=>{ - this.getAllBuilding() - }) - } //if + } //封装函数刷新当前建筑功能分区 diff --git a/src/app/key-unit/function-division/function-division.component.ts b/src/app/key-unit/function-division/function-division.component.ts index ddc4d43..0f75c4b 100644 --- a/src/app/key-unit/function-division/function-division.component.ts +++ b/src/app/key-unit/function-division/function-division.component.ts @@ -155,19 +155,30 @@ 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/BuildingFunctionalDivisions',data,{params:{companyId : this.route.snapshot.queryParams.id}}).subscribe(data=>{ - this.getAllBuilding() + }) + if (!isNotHave) { //所有建筑都没有 功能分区时 + let bodyData = [{ + buildingId: this.allBuilding[0].id, + region: "", + area: 0, + details: "" + }] + let params = {buildingId:this.allBuilding[0].id, companyId:this.companyId} + this.http.post('/api/BuildingFunctionalDivisions/Batch',bodyData,{params:params}).subscribe(datas=>{ + let newParams = {buildingId: this.allBuilding[0].id} + this.http.get(`/api/BuildingFunctionalDivisions`,{params:newParams}).subscribe((data:any)=>{ + this.allBuilding[0].functionalZoning = data + this.selectBuildingFunctionalZoning.push([]) //拥有建筑功能分区的提前push空数组 + this.allBuildingFunctionalZoning.push(this.allBuilding[0]) + }) }) - } //if + } } //封装函数刷新当前建筑功能分区