|
|
@ -29,10 +29,13 @@ export class FunctionPartitionComponent implements OnInit { |
|
|
|
//获得所有单位功能分区属性
|
|
|
|
//获得所有单位功能分区属性
|
|
|
|
getAllCompany() { |
|
|
|
getAllCompany() { |
|
|
|
let companyId = this.unitId |
|
|
|
let companyId = this.unitId |
|
|
|
this.http.get('/api/CompanyFunctionalDivisions',{params:{ |
|
|
|
this.http.get('/api/CompanyFunctionalDivisions', { |
|
|
|
|
|
|
|
params: { |
|
|
|
companyId: companyId |
|
|
|
companyId: companyId |
|
|
|
}}).subscribe((data:any)=>{ |
|
|
|
} |
|
|
|
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
this.companyFunctionalZoning = data |
|
|
|
this.companyFunctionalZoning = data |
|
|
|
|
|
|
|
console.log(this.companyFunctionalZoning) |
|
|
|
this.selectFunctionalZoning = [] |
|
|
|
this.selectFunctionalZoning = [] |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -49,9 +52,11 @@ export class FunctionPartitionComponent implements OnInit { |
|
|
|
preservation() { |
|
|
|
preservation() { |
|
|
|
let companyId = this.unitId |
|
|
|
let companyId = this.unitId |
|
|
|
if (this.companyFunctionalZoning.length) { |
|
|
|
if (this.companyFunctionalZoning.length) { |
|
|
|
this.http.post('/api/CompanyFunctionalDivisions/Batch',this.companyFunctionalZoning,{params:{ |
|
|
|
this.http.post('/api/CompanyFunctionalDivisions/Batch', this.companyFunctionalZoning, { |
|
|
|
|
|
|
|
params: { |
|
|
|
companyId: companyId |
|
|
|
companyId: companyId |
|
|
|
}}).subscribe(data=>{ |
|
|
|
} |
|
|
|
|
|
|
|
}).subscribe(data => { |
|
|
|
this.getAllCompany() |
|
|
|
this.getAllCompany() |
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
config.verticalPosition = 'top'; |
|
|
|
config.verticalPosition = 'top'; |
|
|
@ -76,12 +81,15 @@ export class FunctionPartitionComponent implements OnInit { |
|
|
|
if (this.selectFunctionalZoning.length) { |
|
|
|
if (this.selectFunctionalZoning.length) { |
|
|
|
let isDelete = confirm('您确定要删除吗') |
|
|
|
let isDelete = confirm('您确定要删除吗') |
|
|
|
if (isDelete) { |
|
|
|
if (isDelete) { |
|
|
|
this.http.post('/api/CompanyFunctionalDivisions/Batch',this.companyFunctionalZoning,{params:{ |
|
|
|
this.http.post('/api/CompanyFunctionalDivisions/Batch', this.companyFunctionalZoning, { |
|
|
|
|
|
|
|
params: { |
|
|
|
companyId: companyId |
|
|
|
companyId: companyId |
|
|
|
}}).subscribe(data=>{ |
|
|
|
} |
|
|
|
|
|
|
|
}).subscribe(data => { |
|
|
|
const options = { |
|
|
|
const options = { |
|
|
|
headers: new HttpHeaders({ 'Content-Type': 'application/json', }), |
|
|
|
headers: new HttpHeaders({ 'Content-Type': 'application/json', }), |
|
|
|
body:this.selectFunctionalZoning} |
|
|
|
body: this.selectFunctionalZoning |
|
|
|
|
|
|
|
} |
|
|
|
this.http.delete(`/api/CompanyFunctionalDivisions/Batch`, options).subscribe(data => { |
|
|
|
this.http.delete(`/api/CompanyFunctionalDivisions/Batch`, options).subscribe(data => { |
|
|
|
this.getAllCompany() |
|
|
|
this.getAllCompany() |
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
const config = new MatSnackBarConfig(); |
|
|
@ -111,9 +119,11 @@ export class FunctionPartitionComponent implements OnInit { |
|
|
|
//获得所有建筑
|
|
|
|
//获得所有建筑
|
|
|
|
getAllBuilding() { |
|
|
|
getAllBuilding() { |
|
|
|
let companyId = this.unitId |
|
|
|
let companyId = this.unitId |
|
|
|
this.http.get(`/api/Buildings`,{params:{ |
|
|
|
this.http.get(`/api/Buildings`, { |
|
|
|
|
|
|
|
params: { |
|
|
|
companyId: companyId |
|
|
|
companyId: companyId |
|
|
|
}}).subscribe((data:any)=>{ |
|
|
|
} |
|
|
|
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
if (data.length) { |
|
|
|
if (data.length) { |
|
|
|
this.allBuilding = data |
|
|
|
this.allBuilding = data |
|
|
|
this.allBuilding.forEach(element => { //为每个建筑添加一个 功能分区对象
|
|
|
|
this.allBuilding.forEach(element => { //为每个建筑添加一个 功能分区对象
|
|
|
@ -134,9 +144,11 @@ export class FunctionPartitionComponent implements OnInit { |
|
|
|
if (data.length) { |
|
|
|
if (data.length) { |
|
|
|
element.functionalZoning = data |
|
|
|
element.functionalZoning = data |
|
|
|
this.selectBuildingFunctionalZoning.push([]) //拥有建筑功能分区的提前push空数组
|
|
|
|
this.selectBuildingFunctionalZoning.push([]) //拥有建筑功能分区的提前push空数组
|
|
|
|
this.allBuildingFunctionalZoning.push(element) } |
|
|
|
this.allBuildingFunctionalZoning.push(element) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
console.log(this.allBuilding) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//封装函数刷新当前建筑功能分区
|
|
|
|
//封装函数刷新当前建筑功能分区
|
|
|
@ -191,7 +203,8 @@ export class FunctionPartitionComponent implements OnInit { |
|
|
|
const options = { |
|
|
|
const options = { |
|
|
|
headers: new HttpHeaders({ 'Content-Type': 'application/json', }), |
|
|
|
headers: new HttpHeaders({ 'Content-Type': 'application/json', }), |
|
|
|
body: this.selectBuildingFunctionalZoning[index], |
|
|
|
body: this.selectBuildingFunctionalZoning[index], |
|
|
|
params:{buildingId:e.id}} |
|
|
|
params: { buildingId: e.id } |
|
|
|
|
|
|
|
} |
|
|
|
this.http.delete(`/api/BuildingFunctionalDivisions/Batch`, options).subscribe(data => { |
|
|
|
this.http.delete(`/api/BuildingFunctionalDivisions/Batch`, options).subscribe(data => { |
|
|
|
this.selectBuildingFunctionalZoning[index].forEach((element, newIndex) => { |
|
|
|
this.selectBuildingFunctionalZoning[index].forEach((element, newIndex) => { |
|
|
|
this.allBuildingFunctionalZoning[index].functionalZoning.splice(this.allBuildingFunctionalZoning[index].functionalZoning.findIndex(item => item.id == element), 1) |
|
|
|
this.allBuildingFunctionalZoning[index].functionalZoning.splice(this.allBuildingFunctionalZoning[index].functionalZoning.findIndex(item => item.id == element), 1) |
|
|
@ -200,7 +213,8 @@ export class FunctionPartitionComponent implements OnInit { |
|
|
|
this.updateCurrent(e, index) |
|
|
|
this.updateCurrent(e, index) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.selectBuildingFunctionalZoning.splice(index, 1) |
|
|
|
this.selectBuildingFunctionalZoning.splice(index, 1) |
|
|
|
this.allBuildingFunctionalZoning.splice(index,1)} |
|
|
|
this.allBuildingFunctionalZoning.splice(index, 1) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|