|
|
|
@ -175,35 +175,7 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
this.canvas.takeScreenshot(); |
|
|
|
|
} |
|
|
|
|
pattern: boolean = false//默认为基本信息编辑
|
|
|
|
|
//基本信息编辑模式
|
|
|
|
|
baseInfo() { |
|
|
|
|
if (!this.pattern) { |
|
|
|
|
this.basicInfo = false |
|
|
|
|
this.canvas.setNameVisible(this.basicInfo, 1) |
|
|
|
|
|
|
|
|
|
this.pattern = true |
|
|
|
|
this.canvasData.gameMode = GameMode.BasicInformation |
|
|
|
|
this.canvasData.selectPanelPoint = new DisposalNodeData(); |
|
|
|
|
this.mateDeleteCustomize() |
|
|
|
|
this.getAllLibrary() |
|
|
|
|
this.checkedBuildingIndex = -1 |
|
|
|
|
this.getSitePlan() //总平面图一层
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//想定作业编辑模式
|
|
|
|
|
wantWork() { |
|
|
|
|
if (this.pattern) { |
|
|
|
|
//让基本信息图标显示
|
|
|
|
|
this.basicInfo = false |
|
|
|
|
this.canvas.setNameVisible(this.basicInfo, 0) |
|
|
|
|
|
|
|
|
|
this.pattern = false |
|
|
|
|
this.canvasData.gameMode = GameMode.Assignment |
|
|
|
|
this.getAllLibrary('plan') |
|
|
|
|
this.getDisposalNode() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//适应缩放
|
|
|
|
|
adaptZoom() { |
|
|
|
|
this.canvas.zoomFit() |
|
|
|
@ -418,12 +390,6 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//放大图标
|
|
|
|
|
iconScale() { |
|
|
|
|
let number = Number(this.selected) |
|
|
|
|
this.canvas.setIconScale(number) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//素材宽度输入框改变
|
|
|
|
|
assetWidthIunput() { |
|
|
|
|
this.canvasAssetObj.Width = this.assetWidth |
|
|
|
@ -452,14 +418,11 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
this.canvas.refreshIcon(this.canvasAssetObj.Id) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//素材是否高亮改变----->本地操作行为
|
|
|
|
|
assetHighLightIunput() { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//判断是否是数字类型
|
|
|
|
|
myIsNaN(value) { |
|
|
|
|
return typeof value === 'number' && !isNaN(value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//动态属性素材input框值改变
|
|
|
|
|
assetInputChange(i, e) { |
|
|
|
|
let index = this.canvasAssetObj.PropertyInfos.findIndex((item) => { |
|
|
|
@ -892,23 +855,6 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
isEditPattern: boolean = true //是否为编辑模式
|
|
|
|
|
//进入编辑模式
|
|
|
|
|
editpat() { |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('进入编辑模式', '确定', config); |
|
|
|
|
this.isEditPattern = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//进入查看模式
|
|
|
|
|
lookpat() { |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('进入查看模式', '确定', config); |
|
|
|
|
this.isEditPattern = false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//保存平面图
|
|
|
|
|
saveNum: any = [] |
|
|
|
@ -920,10 +866,10 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
//遍历 建筑数据 删除多余数据
|
|
|
|
|
let object = this.canvasData.originalcompanyBuildingData.data |
|
|
|
|
let adjoinArr = [] //毗邻数组
|
|
|
|
|
Object.keys(object).forEach(key=>{ |
|
|
|
|
let isExist = this.sitePlanData.find(item=>{ return item.id === object[key].FloorId }) |
|
|
|
|
Object.keys(object).forEach(key => { |
|
|
|
|
let isExist = this.sitePlanData.find(item => { return item.id === object[key].FloorId }) |
|
|
|
|
if (isExist === undefined) { |
|
|
|
|
console.log(object[key],'当前楼层已被删除') |
|
|
|
|
console.log(object[key], '当前楼层已被删除') |
|
|
|
|
delete object[key] |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -935,272 +881,14 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
CompanyData.data = JSON.stringify(CompanyData.data) |
|
|
|
|
|
|
|
|
|
if (this.pattern) {//如果是基本信息编辑模式
|
|
|
|
|
this.maskLayerService.sendMessage(true) |
|
|
|
|
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); |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
return false |
|
|
|
|
} else { |
|
|
|
|
//如果是单位 总平面图
|
|
|
|
|
if (this.checkedBuildingIndex == -1) { |
|
|
|
|
//保存平面图数据
|
|
|
|
|
this.http.post("/api/SitePlanData", SitePlanData, { |
|
|
|
|
params: { |
|
|
|
|
companyId: this.params.companyId |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if (this.saveNum.length == 5) { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功', '确定', config); |
|
|
|
|
} |
|
|
|
|
}, err => { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('平面图数据保存失败', '确定', config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//保存建筑数据
|
|
|
|
|
this.http.post("/api/CompanyData", CompanyData, { |
|
|
|
|
params: { |
|
|
|
|
companyId: this.params.companyId |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if (this.saveNum.length == 5) { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功', '确定', config); |
|
|
|
|
} |
|
|
|
|
}, err => { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
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/CompanyAdjoins/Batch", CompanyAdjoins, { |
|
|
|
|
params: { |
|
|
|
|
companyId: this.params.companyId |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if (this.saveNum.length == 5) { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功', '确定', config); |
|
|
|
|
} |
|
|
|
|
}, err => { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
if (err == 'infos 有重复方向!') { |
|
|
|
|
this.snackBar.open('单位毗邻同步失败,存在相同方向', '确定', config); |
|
|
|
|
} else { |
|
|
|
|
this.snackBar.open('单位毗邻同步失败', '确定', config); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//批量保存单位重点部位
|
|
|
|
|
let CompanyImportantLocations = this.canvasData.getCompanyImportantLocations() |
|
|
|
|
this.http.post("/api/CompanyImportantLocations/Batch", CompanyImportantLocations, { |
|
|
|
|
params: { |
|
|
|
|
companyId: this.params.companyId |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if (this.saveNum.length == 5) { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功', '确定', config); |
|
|
|
|
} |
|
|
|
|
}, err => { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
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/CompanyFacilityAssets/Batch", CompanyFacilityAssets, { |
|
|
|
|
params: { |
|
|
|
|
companyId: this.params.companyId |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if (this.saveNum.length == 5) { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功', '确定', config); |
|
|
|
|
} |
|
|
|
|
}, err => { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('单位消防设施素材同步失败', '确定', config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} else { //如果是建筑
|
|
|
|
|
|
|
|
|
|
//建筑平面图数据
|
|
|
|
|
this.http.post("/api/BuildingAreaData", SitePlanData, { |
|
|
|
|
params: { |
|
|
|
|
companyId: this.params.companyId |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if (this.saveNum.length == 5) { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功', '确定', config); |
|
|
|
|
} |
|
|
|
|
}, err => { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('平面图数据保存失败', '确定', config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//建筑数据
|
|
|
|
|
this.http.post("/api/BuildingData", CompanyData, { |
|
|
|
|
params: { |
|
|
|
|
companyId: this.params.companyId |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if (this.saveNum.length == 5) { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功', '确定', config); |
|
|
|
|
} |
|
|
|
|
}, err => { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
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/BuildingAdjoins/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`, buildingAdjoins).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if (this.saveNum.length == 5) { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功', '确定', config); |
|
|
|
|
} |
|
|
|
|
}, err => { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
if (err == 'infos 有重复方向!') { |
|
|
|
|
this.snackBar.open('建筑毗邻同步失败,存在相同方向', '确定', config); |
|
|
|
|
} else { |
|
|
|
|
this.snackBar.open('建筑毗邻同步失败', '确定', config); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//批量保存建筑重点部位
|
|
|
|
|
let buildingImportantLocations = this.canvasData.getBuildingImportantLocations() |
|
|
|
|
this.http.post(`/api/BuildingImportantLocations/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`, buildingImportantLocations).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if (this.saveNum.length == 5) { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功', '确定', config); |
|
|
|
|
} |
|
|
|
|
}, err => { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
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/BuildingFacilityAssets/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`, buildingFacilityAssets).subscribe(data => { |
|
|
|
|
this.saveNum.push("1") |
|
|
|
|
if (this.saveNum.length == 5) { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
this.canvasData.isChange = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功', '确定', config); |
|
|
|
|
} |
|
|
|
|
}, err => { |
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.snackBar.open('建筑消防设施素材同步失败', '确定', config); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else {//如果是想定作业编辑模式
|
|
|
|
@ -1233,36 +921,6 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//拖拽tree
|
|
|
|
|
drop(e) { |
|
|
|
|
// console.log(1111,e)
|
|
|
|
|
} |
|
|
|
|
drop2(e) { |
|
|
|
|
// console.log(222,e)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//创建建筑
|
|
|
|
|
createBuilding() { |
|
|
|
|
let data = { |
|
|
|
|
allBuildings: this.allBuildings, |
|
|
|
|
companyId: this.params.companyId |
|
|
|
|
} |
|
|
|
|
let dialogRef = this.dialog.open(CreateBuilding, { data }); |
|
|
|
|
dialogRef.afterClosed().subscribe(data => { |
|
|
|
|
if (data == "创建成功") { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('创建成功', '确定', config); |
|
|
|
|
this.getAllBuildings() |
|
|
|
|
} else if (data == "创建失败") { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('创建失败', '确定', config); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//选择建筑
|
|
|
|
|
checkedBuilding(item, index) { |
|
|
|
@ -1303,63 +961,6 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
} //if
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//编辑建筑
|
|
|
|
|
editBuilding(e, item) { |
|
|
|
|
e.stopPropagation(); |
|
|
|
|
let dialogRef = this.dialog.open(EditBuilding, { data: { item: item } }); |
|
|
|
|
dialogRef.afterClosed().subscribe(data => { |
|
|
|
|
if (data == "修改成功") { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('修改成功', '确定', config); |
|
|
|
|
this.getAllBuildings() |
|
|
|
|
} else if (data == "修改失败") { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('修改失败', '确定', config); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//删除建筑
|
|
|
|
|
deleteBuilding(e, item) { |
|
|
|
|
e.stopPropagation(); |
|
|
|
|
if (confirm("是否删除该建筑") == true) { |
|
|
|
|
let isHave = this.canvasData.allDisposalNode.find(items => { return items.buildingId === item.id }) |
|
|
|
|
if (isHave == undefined) { |
|
|
|
|
this.http.delete(`/api/Buildings/${item.id}`).subscribe(data => { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('删除成功', '确定', config); |
|
|
|
|
this.http.get("/api/Buildings", { |
|
|
|
|
params: { |
|
|
|
|
companyId: this.params.companyId |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
this.allBuildings = data |
|
|
|
|
this.beforeOneCheckedBuilding = { name: "总平面图" } |
|
|
|
|
this.checkedBuildingIndex = -1 |
|
|
|
|
this.getSitePlan() |
|
|
|
|
}) |
|
|
|
|
}, err => { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('删除失败', '确定', config); |
|
|
|
|
this.getAllBuildings() |
|
|
|
|
}) |
|
|
|
|
} else { //建筑 含有数据节点时
|
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('含有数据节点的建筑不允许删除', '确定', config); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
storeyData //将建筑素材和当前楼层素材合二为一
|
|
|
|
|
selectPanelPoint //传过来的处置素材
|
|
|
|
|
//处理 tree 数据结构
|
|
|
|
@ -1546,32 +1147,6 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
this.canvas.setIconVisible(iconVisibleArr, !node.isLook) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//计算 可视区域内宽度, 是否缩放背景图
|
|
|
|
|
backGroundScale() { |
|
|
|
|
// let that = this
|
|
|
|
|
// let dad = this.element.nativeElement.querySelector('.functionalDomainContent').clientWidth
|
|
|
|
|
// let dadHeight = this.element.nativeElement.querySelector('.functionalDomainContent').clientHeight
|
|
|
|
|
// let left = this.element.nativeElement.querySelector('.functionalDomainLeft').clientWidth
|
|
|
|
|
// let right = this.element.nativeElement.querySelector('.functionalDomainRight').clientWidth
|
|
|
|
|
// let imgWidth = dad - left - right//可视区域内 宽度
|
|
|
|
|
// let img = new Image()
|
|
|
|
|
// img.src = this.selectingSitePlan.imageUrl;
|
|
|
|
|
// img.onload = function(){
|
|
|
|
|
// if (img.height > dadHeight && img.width > imgWidth) {
|
|
|
|
|
// let width = imgWidth/img.width
|
|
|
|
|
// let height = dadHeight/img.height
|
|
|
|
|
// that.canvas.setBackgroundScale((width>height? height : width)-0.005)
|
|
|
|
|
// return
|
|
|
|
|
// } else if (img.height > dadHeight) {
|
|
|
|
|
// that.canvas.setBackgroundScale((dadHeight/img.height)-0.005)
|
|
|
|
|
// return
|
|
|
|
|
// } else if (img.width > imgWidth) {
|
|
|
|
|
// that.canvas.setBackgroundScale((imgWidth/img.width)-0.005)
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//封装 刷新 tree 数据
|
|
|
|
|
async renovateTreeData(isRefresh: boolean = true) { |
|
|
|
|
this.allFireElements[this.allFireElements.length - 1].children = [] |
|
|
|
@ -2038,13 +1613,13 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
//保存建筑数据
|
|
|
|
|
let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData)); |
|
|
|
|
CompanyData.data = JSON.stringify(CompanyData.data) |
|
|
|
|
this.http.post("/api/CompanyData", CompanyData, {params: {companyId: this.params.companyId}}).subscribe(data => { |
|
|
|
|
this.http.post("/api/CompanyData", CompanyData, { params: { companyId: this.params.companyId } }).subscribe(data => { |
|
|
|
|
list.push(1) |
|
|
|
|
if (list.length === 4) { this.updateCurrentFloor() } |
|
|
|
|
}) |
|
|
|
|
//批量保存单位毗邻
|
|
|
|
|
let CompanyAdjoins = this.canvasData.getCompanyAdjoinInfo() |
|
|
|
|
this.http.post("/api/CompanyAdjoins/Batch", CompanyAdjoins, {params:{companyId: this.params.companyId}}).subscribe(data => { |
|
|
|
|
this.http.post("/api/CompanyAdjoins/Batch", CompanyAdjoins, { params: { companyId: this.params.companyId } }).subscribe(data => { |
|
|
|
|
list.push(1) |
|
|
|
|
if (list.length === 4) { this.updateCurrentFloor() } |
|
|
|
|
}, err => { |
|
|
|
@ -2059,13 +1634,13 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
//批量保存单位重点部位
|
|
|
|
|
let CompanyImportantLocations = this.canvasData.getCompanyImportantLocations() |
|
|
|
|
this.http.post("/api/CompanyImportantLocations/Batch", CompanyImportantLocations, {params:{companyId: this.params.companyId}}).subscribe(data => { |
|
|
|
|
this.http.post("/api/CompanyImportantLocations/Batch", CompanyImportantLocations, { params: { companyId: this.params.companyId } }).subscribe(data => { |
|
|
|
|
list.push(1) |
|
|
|
|
if (list.length === 4) { this.updateCurrentFloor() } |
|
|
|
|
}) |
|
|
|
|
//批量保存单位消防设施素材
|
|
|
|
|
let CompanyFacilityAssets = this.canvasData.getAllCompanyFacilityAssetInfo() |
|
|
|
|
this.http.post("/api/CompanyFacilityAssets/Batch", CompanyFacilityAssets, {params: {companyId: this.params.companyId}}).subscribe(data => { |
|
|
|
|
this.http.post("/api/CompanyFacilityAssets/Batch", CompanyFacilityAssets, { params: { companyId: this.params.companyId } }).subscribe(data => { |
|
|
|
|
list.push(1) |
|
|
|
|
if (list.length === 4) { this.updateCurrentFloor() } |
|
|
|
|
}) |
|
|
|
@ -2100,7 +1675,7 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
//建筑数据
|
|
|
|
|
let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData)); |
|
|
|
|
CompanyData.data = JSON.stringify(CompanyData.data) |
|
|
|
|
this.http.post("/api/BuildingData", CompanyData, {params: { companyId: this.params.companyId}}).subscribe(data => { |
|
|
|
|
this.http.post("/api/BuildingData", CompanyData, { params: { companyId: this.params.companyId } }).subscribe(data => { |
|
|
|
|
list.push(1) |
|
|
|
|
if (list.length === 4) { this.updateCurrentFloor() } |
|
|
|
|
}) |
|
|
|
@ -2144,15 +1719,15 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
let planData = this.getSitePlanCompanyData() //获取 单位 数据
|
|
|
|
|
this.http.get('/api/SitePlans', { params: this.params }).subscribe(data => { |
|
|
|
|
this.sitePlanData = data |
|
|
|
|
this.selectingSitePlan = this.sitePlanData[this.sitePlanData.length-1] || {} |
|
|
|
|
this.canvasData.selectStorey = this.sitePlanData[this.sitePlanData.length-1] || {} //服务中 存一份数据
|
|
|
|
|
this.selectSitePlanIndex = this.sitePlanData.length-1 |
|
|
|
|
|
|
|
|
|
this.selectingSitePlan = this.sitePlanData[this.sitePlanData.length - 1] || {} |
|
|
|
|
this.canvasData.selectStorey = this.sitePlanData[this.sitePlanData.length - 1] || {} //服务中 存一份数据
|
|
|
|
|
this.selectSitePlanIndex = this.sitePlanData.length - 1 |
|
|
|
|
|
|
|
|
|
Promise.all([fireData, planData]).then((res) => { |
|
|
|
|
this.getSitePlanStorey(this.selectingSitePlan) //获取 平面图 楼层数据
|
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) //重新加载 新楼层
|
|
|
|
|
} else { //楼层/区域
|
|
|
|
|
let params = { buildingId: this.beforeOneCheckedBuilding.id } |
|
|
|
@ -2160,10 +1735,10 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
let planData = this.getBuildingData(params) //获取 建筑 数据
|
|
|
|
|
this.http.get('/api/BuildingAreas', { params }).subscribe(data => { |
|
|
|
|
this.sitePlanData = data |
|
|
|
|
this.selectingSitePlan = this.sitePlanData[this.sitePlanData.length-1] || {} |
|
|
|
|
this.canvasData.selectStorey = this.sitePlanData[this.sitePlanData.length-1] || {} //服务中 存一份数据
|
|
|
|
|
this.selectSitePlanIndex = this.sitePlanData.length-1 |
|
|
|
|
|
|
|
|
|
this.selectingSitePlan = this.sitePlanData[this.sitePlanData.length - 1] || {} |
|
|
|
|
this.canvasData.selectStorey = this.sitePlanData[this.sitePlanData.length - 1] || {} //服务中 存一份数据
|
|
|
|
|
this.selectSitePlanIndex = this.sitePlanData.length - 1 |
|
|
|
|
|
|
|
|
|
Promise.all([fireData, planData]).then((res) => { |
|
|
|
|
this.getBuildingStorey(this.selectingSitePlan) //获取 建筑 楼层数据
|
|
|
|
|
this.maskLayerService.sendMessage(false) |
|
|
|
@ -2528,7 +2103,7 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
dialogRef.afterClosed().subscribe(data => { |
|
|
|
|
if (data) { |
|
|
|
|
this.canvasData.selectStorey.imageWidth = 0 //修正加载底图BUG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.canvasData.customizeDisposalNode = data //自定义数据节点
|
|
|
|
|
let imgURL = window.URL.createObjectURL(data.file) //将图片生成 url地址
|
|
|
|
|
// this.canvasData.selectPanelPointBaseData = {description: '', notes: '', weather: '', airTemperature: '', windDirection: '', windScale: ''} //更新 当前数据节点对应父级节点
|
|
|
|
@ -2736,113 +2311,6 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//创建建筑
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-createBuilding', |
|
|
|
|
templateUrl: './createBuilding.html', |
|
|
|
|
styleUrls: ['./collection-tools.component.scss'] |
|
|
|
|
}) |
|
|
|
|
export class CreateBuilding { |
|
|
|
|
|
|
|
|
|
constructor(private http: HttpClient, public dialog: MatDialog, public dialogRef: MatDialogRef<CreateBuilding>, @Inject(MAT_DIALOG_DATA) public data) { } |
|
|
|
|
|
|
|
|
|
allBuildingType: any//所有的建筑类型
|
|
|
|
|
selected: any; //选中的建筑
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.getAllBuildingType() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获得所有单位类型
|
|
|
|
|
getAllBuildingType() { |
|
|
|
|
this.http.get("/api/BuildingTypes/Simple").subscribe(data => { |
|
|
|
|
this.allBuildingType = data |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//创建建筑功能分区
|
|
|
|
|
onSubmit(e) { |
|
|
|
|
let companyId = sessionStorage.getItem("companyId") |
|
|
|
|
let lastBuildingOrder = this.data.allBuildings.length != 0 ? this.data.allBuildings[this.data.allBuildings.length - 1].order + 1 : 0 |
|
|
|
|
let data = |
|
|
|
|
{ |
|
|
|
|
id: "", |
|
|
|
|
name: e.propertyName, |
|
|
|
|
order: lastBuildingOrder, |
|
|
|
|
enabled: true, |
|
|
|
|
companyId: companyId, |
|
|
|
|
buildingTypes: [ |
|
|
|
|
{ |
|
|
|
|
id: e.buildingId, |
|
|
|
|
name: "" |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
this.http.post("/api/Buildings", data, { |
|
|
|
|
params: { |
|
|
|
|
companyId: this.data.companyId |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
this.dialogRef.close("创建成功"); |
|
|
|
|
}, err => { |
|
|
|
|
this.dialogRef.close("创建失败"); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//编辑建筑
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-editBuilding', |
|
|
|
|
templateUrl: './editBuilding.html', |
|
|
|
|
styleUrls: ['./collection-tools.component.scss'] |
|
|
|
|
}) |
|
|
|
|
export class EditBuilding { |
|
|
|
|
|
|
|
|
|
constructor(private http: HttpClient, public dialog: MatDialog, public dialogRef: MatDialogRef<EditBuilding>, @Inject(MAT_DIALOG_DATA) public data) { } |
|
|
|
|
|
|
|
|
|
defaultName: String = this.data.item.name//默认建筑名称
|
|
|
|
|
defaultBuildingType: String = this.data.item.buildingTypes[0].id//默认建筑类型
|
|
|
|
|
allBuildingType: any//所有的建筑类型
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.getAllBuildingType() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getAllBuildingType() { |
|
|
|
|
this.http.get("/api/BuildingTypes/Simple").subscribe(data => { |
|
|
|
|
this.allBuildingType = data |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//编辑建筑信息
|
|
|
|
|
onSubmit(e) { |
|
|
|
|
let companyId = sessionStorage.getItem("companyId") |
|
|
|
|
let data = |
|
|
|
|
{ |
|
|
|
|
id: this.data.item.id, |
|
|
|
|
name: e.propertyName, |
|
|
|
|
order: this.data.item.order, |
|
|
|
|
enabled: true, |
|
|
|
|
companyId: companyId, |
|
|
|
|
buildingTypes: [ |
|
|
|
|
{ |
|
|
|
|
id: e.buildingId, |
|
|
|
|
name: "" |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
this.http.put(`/api/Buildings/${this.data.item.id}`, data, { |
|
|
|
|
params: { |
|
|
|
|
id: this.data.item.id, |
|
|
|
|
companyId: companyId |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
this.dialogRef.close("修改成功"); |
|
|
|
|
}, err => { |
|
|
|
|
this.dialogRef.close("修改失败"); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//选择所属单位
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-organization', |
|
|
|
|