|
|
|
@ -510,229 +510,234 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
//保存平面图
|
|
|
|
|
saveNum :any = [] |
|
|
|
|
saveSite(){ |
|
|
|
|
this.saveNum = [] |
|
|
|
|
let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData)); |
|
|
|
|
SitePlanData.data = JSON.stringify(SitePlanData.data) |
|
|
|
|
let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData)); |
|
|
|
|
CompanyData.data = JSON.stringify(CompanyData.data) |
|
|
|
|
if (this.selectingSitePlan && this.selectingSitePlan.id) { |
|
|
|
|
|
|
|
|
|
let object = this.canvasData.originalcompanyBuildingData.data |
|
|
|
|
let adjoinArr = [] //毗邻数组
|
|
|
|
|
|
|
|
|
|
for (const key in object) { |
|
|
|
|
if (object[key].Name == "毗邻") {//如果是相同楼层,则筛选出毗邻
|
|
|
|
|
|
|
|
|
|
object[key].PropertyInfos.forEach(element => { |
|
|
|
|
if(element.PropertyName == "方向"){ |
|
|
|
|
adjoinArr.push(element.PropertyValue) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.saveNum = [] |
|
|
|
|
let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData)); |
|
|
|
|
SitePlanData.data = JSON.stringify(SitePlanData.data) |
|
|
|
|
let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData)); |
|
|
|
|
CompanyData.data = JSON.stringify(CompanyData.data) |
|
|
|
|
|
|
|
|
|
let object = this.canvasData.originalcompanyBuildingData.data |
|
|
|
|
let adjoinArr = [] //毗邻数组
|
|
|
|
|
|
|
|
|
|
for (const key in object) { |
|
|
|
|
if (object[key].Name == "毗邻") {//如果是相同楼层,则筛选出毗邻
|
|
|
|
|
|
|
|
|
|
object[key].PropertyInfos.forEach(element => { |
|
|
|
|
if(element.PropertyName == "方向"){ |
|
|
|
|
adjoinArr.push(element.PropertyValue) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if((new Set(adjoinArr)).size != adjoinArr.length){ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存失败,毗邻存在相同方向','确定',config); |
|
|
|
|
return false |
|
|
|
|
}else{ |
|
|
|
|
//如果是单位 总平面图
|
|
|
|
|
if(this.checkedBuildingIndex==-1){ |
|
|
|
|
//保存平面图数据
|
|
|
|
|
this.http.post("/api/CompanyAccount/SitePlanData",SitePlanData).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
|
|
|
|
|
if((new Set(adjoinArr)).size != adjoinArr.length){ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存失败,毗邻存在相同方向','确定',config); |
|
|
|
|
return false |
|
|
|
|
}else{ |
|
|
|
|
//如果是单位 总平面图
|
|
|
|
|
if(this.checkedBuildingIndex==-1){ |
|
|
|
|
//保存平面图数据
|
|
|
|
|
this.http.post("/api/CompanyAccount/SitePlanData",SitePlanData).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('平面图数据保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//保存建筑数据
|
|
|
|
|
this.http.post("/api/CompanyAccount/CompanyData",CompanyData).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('平面图数据保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//保存建筑数据
|
|
|
|
|
this.http.post("/api/CompanyAccount/CompanyData",CompanyData).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('单位数据保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//批量保存单位毗邻
|
|
|
|
|
let CompanyAdjoins = this.canvasData.getCompanyAdjoinInfo() |
|
|
|
|
this.http.post("/api/CompanyAccount/CompanyAdjoins/Batch",CompanyAdjoins).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('单位数据保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//批量保存单位毗邻
|
|
|
|
|
let CompanyAdjoins = this.canvasData.getCompanyAdjoinInfo() |
|
|
|
|
this.http.post("/api/CompanyAccount/CompanyAdjoins/Batch",CompanyAdjoins).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('单位毗邻保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//批量保存单位重点部位
|
|
|
|
|
let CompanyImportantLocations = this.canvasData.getCompanyImportantLocations() |
|
|
|
|
this.http.post("/api/CompanyAccount/CompanyImportantLocations/Batch",CompanyImportantLocations).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('单位毗邻保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//批量保存单位重点部位
|
|
|
|
|
let CompanyImportantLocations = this.canvasData.getCompanyImportantLocations() |
|
|
|
|
this.http.post("/api/CompanyAccount/CompanyImportantLocations/Batch",CompanyImportantLocations).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('单位重点部位保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//批量保存单位消防设施素材
|
|
|
|
|
let CompanyFacilityAssets = this.canvasData.getAllCompanyFacilityAssetInfo() |
|
|
|
|
this.http.post("/api/CompanyAccount/CompanyFacilityAssets/Batch",CompanyFacilityAssets).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('单位重点部位保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//批量保存单位消防设施素材
|
|
|
|
|
let CompanyFacilityAssets = this.canvasData.getAllCompanyFacilityAssetInfo() |
|
|
|
|
this.http.post("/api/CompanyAccount/CompanyFacilityAssets/Batch",CompanyFacilityAssets).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('单位消防设施素材保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}else{ //如果是建筑
|
|
|
|
|
|
|
|
|
|
//建筑平面图数据
|
|
|
|
|
this.http.post("/api/CompanyAccount/BuildingAreaData",SitePlanData).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('单位消防设施素材保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}else{ //如果是建筑
|
|
|
|
|
|
|
|
|
|
//建筑平面图数据
|
|
|
|
|
this.http.post("/api/CompanyAccount/BuildingAreaData",SitePlanData).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('平面图数据保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//建筑数据
|
|
|
|
|
this.http.post("/api/CompanyAccount/BuildingData",CompanyData).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('平面图数据保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//建筑数据
|
|
|
|
|
this.http.post("/api/CompanyAccount/BuildingData",CompanyData).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('单位数据保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//批量保存建筑毗邻
|
|
|
|
|
let buildingAdjoins = this.canvasData.getBuildingAdjoinInfo() |
|
|
|
|
this.http.post(`/api/CompanyAccount/BuildingAdjoins/Batch?buildingId=${this.canvasData.selectStorey.buildingId}`,buildingAdjoins).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('单位数据保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//批量保存建筑毗邻
|
|
|
|
|
let buildingAdjoins = this.canvasData.getBuildingAdjoinInfo() |
|
|
|
|
this.http.post(`/api/CompanyAccount/BuildingAdjoins/Batch?buildingId=${this.canvasData.selectStorey.buildingId}`,buildingAdjoins).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('建筑毗邻保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//批量保存建筑重点部位
|
|
|
|
|
let buildingImportantLocations = this.canvasData.getBuildingImportantLocations() |
|
|
|
|
this.http.post(`/api/CompanyAccount/BuildingImportantLocations/Batch?buildingId=${this.canvasData.selectStorey.buildingId}`,buildingImportantLocations).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('建筑毗邻保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//批量保存建筑重点部位
|
|
|
|
|
let buildingImportantLocations = this.canvasData.getBuildingImportantLocations() |
|
|
|
|
this.http.post(`/api/CompanyAccount/BuildingImportantLocations/Batch?buildingId=${this.canvasData.selectStorey.buildingId}`,buildingImportantLocations).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('建筑重点部位保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//批量保存建筑消防设施素材
|
|
|
|
|
let buildingFacilityAssets = this.canvasData.getAllBuildingFacilityAssetInfo() |
|
|
|
|
this.http.post(`/api/CompanyAccount/BuildingFacilityAssets/Batch?buildingId=${this.canvasData.selectStorey.buildingId}`,buildingFacilityAssets).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('建筑重点部位保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//批量保存建筑消防设施素材
|
|
|
|
|
let buildingFacilityAssets = this.canvasData.getAllBuildingFacilityAssetInfo() |
|
|
|
|
this.http.post(`/api/CompanyAccount/BuildingFacilityAssets/Batch?buildingId=${this.canvasData.selectStorey.buildingId}`,buildingFacilityAssets).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if(this.saveNum.length == 5){ |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
},err=>{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('建筑消防设施素材保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('建筑消防设施素材保存失败','确定',config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { //if
|
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('暂无楼层数据','确定',config); |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获得所有的建筑物
|
|
|
|
|