|
|
|
@ -86,7 +86,7 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
gallery//viewerJs实例
|
|
|
|
|
//设置属性框
|
|
|
|
|
setAssetsProperty(obj) { |
|
|
|
|
console.log('传进来的属性信息', obj) |
|
|
|
|
// console.log('传进来的属性信息', obj)
|
|
|
|
|
//初始化viewerJs实例
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
obj.PropertyInfos.forEach(item => { |
|
|
|
@ -165,7 +165,11 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
resetZoom() { |
|
|
|
|
this.canvas.resetCamera2D() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//放大图标
|
|
|
|
|
iconScale() { |
|
|
|
|
let number = Number(this.selected) |
|
|
|
|
this.canvas.setIconScale(number) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//消防要素div边框高度调节
|
|
|
|
|
firecategoriesDivMouseDown(e) { |
|
|
|
@ -185,7 +189,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
document.onmouseup = null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//左侧div边框宽度调节
|
|
|
|
|
leftDivMouseDown(e) { |
|
|
|
|
document.onmousemove = (ev) => { |
|
|
|
@ -202,8 +205,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
document.onmouseup = null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//右侧div边框宽度调节
|
|
|
|
|
rightDivMouseDown(e) { |
|
|
|
|
document.onmousemove = (ev) => { |
|
|
|
@ -221,12 +222,10 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//放大图标
|
|
|
|
|
iconScale() { |
|
|
|
|
let number = Number(this.selected) |
|
|
|
|
this.canvas.setIconScale(number) |
|
|
|
|
//判断是否是数字类型
|
|
|
|
|
myIsNaN(value) { |
|
|
|
|
return typeof value === 'number' && !isNaN(value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//素材宽度输入框改变
|
|
|
|
|
assetWidthIunput() { |
|
|
|
|
this.canvasAssetObj.Width = this.assetWidth |
|
|
|
@ -236,7 +235,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//素材高度输入框改变
|
|
|
|
|
assetHeightIunput() { |
|
|
|
|
this.canvasAssetObj.Height = this.assetHeight |
|
|
|
@ -245,7 +243,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
this.canvas.refreshIcon(this.canvasAssetObj.Id) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//素材角度输入框改变
|
|
|
|
|
assetAngleIunput() { |
|
|
|
|
this.canvasAssetObj.Angle = this.sliderValue |
|
|
|
@ -254,7 +251,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
this.canvas.refreshIcon(this.canvasAssetObj.Id) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//素材厚度输入框改变
|
|
|
|
|
assetThicknessIunput() { |
|
|
|
|
this.canvasAssetObj.Thickness = this.sliderValueThickness |
|
|
|
@ -263,7 +259,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
this.canvas.refreshIcon(this.canvasAssetObj.Id) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//素材是否高亮改变----->本地操作行为
|
|
|
|
|
assetHighLightIunput() { |
|
|
|
|
// console.log(this.isHighLight,this.canvasAssetObj)
|
|
|
|
@ -272,10 +267,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
// this.canvas.setHighlight(arr)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//判断是否是数字类型
|
|
|
|
|
myIsNaN(value) { |
|
|
|
|
return typeof value === 'number' && !isNaN(value); |
|
|
|
|
} |
|
|
|
|
//动态属性素材input框值改变
|
|
|
|
|
assetInputChange(i, e) { |
|
|
|
|
let index = this.canvasAssetObj.PropertyInfos.findIndex((item) => { |
|
|
|
@ -414,7 +405,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('图片数量已达上限', '确定', config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//删除素材属性图片
|
|
|
|
|
deleteImg() { |
|
|
|
|
if (this.imagesArr.length == 0) { |
|
|
|
@ -486,8 +476,110 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
}//多个素材共同属性
|
|
|
|
|
multipleAssetData: any//当前多选的素材
|
|
|
|
|
firstMultipleAssetData: any//当前多选的第一个素材
|
|
|
|
|
//多选宽度共同改变
|
|
|
|
|
multipleAssetWidthInput() { |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
item.assetData.Width = this.multipleAsset.Width |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//多选高度共同改变
|
|
|
|
|
multipleAssetHeightInput() { |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
item.assetData.Height = this.multipleAsset.Height |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//多选角度共同改变
|
|
|
|
|
multipleAssetAngleInput() { |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
item.assetData.Angle = this.multipleAsset.Angle |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//多选厚度共同改变
|
|
|
|
|
multipleAssetThicknessInput() { |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
item.assetData.Thickness = this.multipleAsset.Thickness |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//多选颜色共同改变
|
|
|
|
|
multipleSelectedcolor: any |
|
|
|
|
multipleAssetSelectcolor(item, key) { |
|
|
|
|
//在当前透明度基础上改变颜色
|
|
|
|
|
this.multipleSelectedcolor = item |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
item.assetData.Color = this.multipleSelectedcolor |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//多选颜色滑竿改变
|
|
|
|
|
multipleColorDivSliderChange() { |
|
|
|
|
let colorOpacity = Math.round(255 * this.colorDivSliderValue * 0.01) |
|
|
|
|
//根据滑竿值改变16进制颜色后两位
|
|
|
|
|
function replacepos(text, start, stop, replacetext) { |
|
|
|
|
let mystr = text.substring(0, stop - 1) + replacetext + text.substring(stop + 1); |
|
|
|
|
return mystr; |
|
|
|
|
} |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
this.multipleSelectedcolor = replacepos(this.multipleSelectedcolor, 7, 8, colorOpacity.toString(16)) |
|
|
|
|
item.assetData.Color = this.multipleSelectedcolor |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//多选状态动态属性素材input框值改变
|
|
|
|
|
multipleAssetInputChange(i, e) { |
|
|
|
|
e.stopPropagation() |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
item.assetData.PropertyInfos.forEach(element => { |
|
|
|
|
if (element.PropertyName == i.PropertyName) { |
|
|
|
|
if (this.myIsNaN(i.PropertyValue)) { |
|
|
|
|
i.PropertyValue = String(i.PropertyValue) |
|
|
|
|
} |
|
|
|
|
element.PropertyValue = i.PropertyValue |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, 0); |
|
|
|
|
} |
|
|
|
|
//多选状态动态属性素材radio框值改变
|
|
|
|
|
multipleAssetRadioChange(i, value) { |
|
|
|
|
// e.stopPropagation()
|
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
// console.log(item)
|
|
|
|
|
item.assetData.PropertyInfos.forEach(element => { |
|
|
|
|
if (element.PropertyName == i.PropertyName) { |
|
|
|
|
element.PropertyValue = value |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//多选状态动态属性素材下拉框值改变
|
|
|
|
|
multipleSupplyArea(i, e) { |
|
|
|
|
e.stopPropagation() |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
item.assetData.PropertyInfos.forEach(element => { |
|
|
|
|
if (element.PropertyName == i.PropertyName) { |
|
|
|
|
element.PropertyValue = i.PropertyValue |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
|
|
|
|
|
let _this = this |
|
|
|
|
AxMessageSystem.addListener('selectionChanged', () => { |
|
|
|
|
if (this.canvas.selection.size() == 1) {//如果是单选
|
|
|
|
@ -588,118 +680,16 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
// 删除建筑数据
|
|
|
|
|
delete this.canvasData.originalcompanyBuildingData.data[this.clickId]; |
|
|
|
|
|
|
|
|
|
console.log('originalcompanyBuildingData', this.canvasData.originalcompanyBuildingData) |
|
|
|
|
console.log('originaleveryStoreyData', this.canvasData.originaleveryStoreyData) |
|
|
|
|
// console.log('originalcompanyBuildingData', this.canvasData.originalcompanyBuildingData)
|
|
|
|
|
// console.log('originaleveryStoreyData', this.canvasData.originaleveryStoreyData)
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//多选宽度共同改变
|
|
|
|
|
multipleAssetWidthInput() { |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
item.assetData.Width = this.multipleAsset.Width |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//多选高度共同改变
|
|
|
|
|
multipleAssetHeightInput() { |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
item.assetData.Height = this.multipleAsset.Height |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//多选角度共同改变
|
|
|
|
|
multipleAssetAngleInput() { |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
item.assetData.Angle = this.multipleAsset.Angle |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//多选厚度共同改变
|
|
|
|
|
multipleAssetThicknessInput() { |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
item.assetData.Thickness = this.multipleAsset.Thickness |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//多选颜色共同改变
|
|
|
|
|
multipleSelectedcolor: any |
|
|
|
|
multipleAssetSelectcolor(item, key) { |
|
|
|
|
//在当前透明度基础上改变颜色
|
|
|
|
|
this.multipleSelectedcolor = item |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
item.assetData.Color = this.multipleSelectedcolor |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//多选颜色滑竿改变
|
|
|
|
|
multipleColorDivSliderChange() { |
|
|
|
|
let colorOpacity = Math.round(255 * this.colorDivSliderValue * 0.01) |
|
|
|
|
//根据滑竿值改变16进制颜色后两位
|
|
|
|
|
function replacepos(text, start, stop, replacetext) { |
|
|
|
|
let mystr = text.substring(0, stop - 1) + replacetext + text.substring(stop + 1); |
|
|
|
|
return mystr; |
|
|
|
|
} |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
this.multipleSelectedcolor = replacepos(this.multipleSelectedcolor, 7, 8, colorOpacity.toString(16)) |
|
|
|
|
item.assetData.Color = this.multipleSelectedcolor |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//多选状态动态属性素材input框值改变
|
|
|
|
|
multipleAssetInputChange(i, e) { |
|
|
|
|
e.stopPropagation() |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
item.assetData.PropertyInfos.forEach(element => { |
|
|
|
|
if (element.PropertyName == i.PropertyName) { |
|
|
|
|
if (this.myIsNaN(i.PropertyValue)) { |
|
|
|
|
i.PropertyValue = String(i.PropertyValue) |
|
|
|
|
} |
|
|
|
|
element.PropertyValue = i.PropertyValue |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, 0); |
|
|
|
|
} |
|
|
|
|
//多选状态动态属性素材radio框值改变
|
|
|
|
|
multipleAssetRadioChange(i, value) { |
|
|
|
|
// e.stopPropagation()
|
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
// console.log(item)
|
|
|
|
|
item.assetData.PropertyInfos.forEach(element => { |
|
|
|
|
if (element.PropertyName == i.PropertyName) { |
|
|
|
|
element.PropertyValue = value |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//多选状态动态属性素材下拉框值改变
|
|
|
|
|
multipleSupplyArea(i, e) { |
|
|
|
|
e.stopPropagation() |
|
|
|
|
this.multipleAssetData.forEach(item => { |
|
|
|
|
item.assetData.PropertyInfos.forEach(element => { |
|
|
|
|
if (element.PropertyName == i.PropertyName) { |
|
|
|
|
element.PropertyValue = i.PropertyValue |
|
|
|
|
this.canvas.refreshIcon(item.assetData.Id) |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ngAfterViewInit(): void { |
|
|
|
|
//不是gis模块平面图
|
|
|
|
|
if (this.router.url.indexOf("gis") == -1) { |
|
|
|
|
if (this.router.url.indexOf("gis") == -1 && this.router.url.indexOf("createplanonlinefive") == -1) { |
|
|
|
|
this.getSitePlan() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -719,7 +709,11 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
//截图
|
|
|
|
|
takeScreenshot() { |
|
|
|
|
if (!this.isGis) { |
|
|
|
|
this.canvas.takeScreenshot(); |
|
|
|
|
} else { |
|
|
|
|
this.takeScreenshotGis() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
canvasImg |
|
|
|
|
takeScreenshotGis() { |
|
|
|
@ -763,11 +757,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
this.canvas.setNameVisible(this.basicInfo, 0) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//点击想定作业名称
|
|
|
|
|
wantToWorkClick() { |
|
|
|
|
this.wantToWork = !this.wantToWork |
|
|
|
|
this.canvas.setNameVisible(this.wantToWork, 1) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
isEditPattern: boolean = true //是否为编辑模式
|
|
|
|
|
//进入编辑模式
|
|
|
|
@ -1129,7 +1118,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//创建建筑
|
|
|
|
|
createBuilding() { |
|
|
|
|
let data = { |
|
|
|
@ -1248,7 +1236,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
storeyData //将建筑素材和当前楼层素材合二为一
|
|
|
|
|
//处理 tree 数据结构
|
|
|
|
|
handleTreeData(storeyData) { |
|
|
|
@ -1294,7 +1281,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
this.treeControl.expandAll() |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//点击树节点
|
|
|
|
|
clickTreeNode(node) { |
|
|
|
|
if (this.canvasData.originalcompanyBuildingData.data[node.id]) { |
|
|
|
@ -1338,15 +1324,12 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
//点击数节点的显示隐藏icon
|
|
|
|
|
clickLookItem(node) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//修改真实素材islook属性
|
|
|
|
|
for (let key in this.storeyData.data) { |
|
|
|
|
if (key == node.id) { |
|
|
|
|
this.storeyData.data[key].isLook = !this.storeyData.data[key].isLook |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//所有消防要素模板变化islook值
|
|
|
|
|
if (node.isTemplate) { |
|
|
|
|
this.allFireElements.forEach(item => { |
|
|
|
@ -1355,7 +1338,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//子节点跟随父节点的islook变化
|
|
|
|
|
if (node.children && node.children.length != 0) { |
|
|
|
|
node.children.forEach(item => { |
|
|
|
@ -1368,7 +1350,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const nodes = this.treeControl.dataNodes; |
|
|
|
|
const expandNodes = []; |
|
|
|
|
nodes.forEach((item) => { |
|
|
|
@ -1376,9 +1357,7 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
expandNodes.push(item.id); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.dataSource.data = [...this.dataSource.data] |
|
|
|
|
|
|
|
|
|
let newNodes = this.treeControl.dataNodes; |
|
|
|
|
newNodes = newNodes.filter(n => { |
|
|
|
|
return expandNodes.indexOf(n.id) >= 0; |
|
|
|
@ -1409,6 +1388,7 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
//封装 刷新 tree 数据
|
|
|
|
|
async renovateTreeData(isRefresh: boolean = true) { |
|
|
|
|
// this.allFireElements[this.allFireElements.length-1].children = []
|
|
|
|
|
console.log(888, this.selectingSitePlan) |
|
|
|
|
if (!this.selectingSitePlan.isGis) { |
|
|
|
|
isRefresh ? await this.canvas.refresh() : null |
|
|
|
|
this.canvas.setNameVisible(this.basicInfo, 0) |
|
|
|
@ -1441,8 +1421,7 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
map: any |
|
|
|
|
toLoadGis() { |
|
|
|
|
// console.log(666666, this.selectingSitePlan)
|
|
|
|
|
|
|
|
|
|
console.log(666666, this.isGis) |
|
|
|
|
this.map = new AMap.Map('planContainer', { |
|
|
|
|
viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D',
|
|
|
|
|
zoom: 11, //初始化地图层级
|
|
|
|
@ -2308,260 +2287,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//处置预案
|
|
|
|
|
allFirePlan: any = []; //所有灾情
|
|
|
|
|
selectDisposalNode: string = ''; //当前点击tree节点 css选中样式
|
|
|
|
|
|
|
|
|
|
//获取所有灾情
|
|
|
|
|
getAllFirePlan() { |
|
|
|
|
let params = { componentId: sessionStorage.getItem('planId') } |
|
|
|
|
this.http.get('/api/Disasters', { params: params }).subscribe((data: any) => { |
|
|
|
|
if (!data.length) { //该 单位没有灾情时
|
|
|
|
|
let msg = { |
|
|
|
|
name: '灾情', |
|
|
|
|
modifiedTime: new Date(), |
|
|
|
|
planComponentId: sessionStorage.getItem('planId') |
|
|
|
|
} |
|
|
|
|
this.http.post('/api/Disasters', msg).subscribe(data => { |
|
|
|
|
this.allFirePlan.push(data) |
|
|
|
|
let params = { disasterId: this.allFirePlan[0].id || '' } |
|
|
|
|
this.http.get('/api/DisposalNodes', { params: params }).subscribe(data => { //所有处置节点
|
|
|
|
|
this.canvasData.allDisposalNode = data |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} else { //单位 有灾情时
|
|
|
|
|
this.allFirePlan = data |
|
|
|
|
let params = { disasterId: this.allFirePlan[0].id || '' } |
|
|
|
|
this.http.get('/api/DisposalNodes', { params: params }).subscribe(data => { //所有处置节点
|
|
|
|
|
this.canvasData.allDisposalNode = data |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获取所有处置节点
|
|
|
|
|
getDisposalNode() { |
|
|
|
|
this.selectDisposalNode = '' |
|
|
|
|
let params = { disasterId: this.allFirePlan[0].id || '' } |
|
|
|
|
this.http.get('/api/DisasterData/Markers', { params: params }).subscribe(data => { //灾情标签信息
|
|
|
|
|
this.canvasData.allNodeMarkers = data |
|
|
|
|
this.mateFireForce() |
|
|
|
|
}) |
|
|
|
|
this.http.get('/api/DisposalNodes', { params: params }).subscribe(data => { //处置节点
|
|
|
|
|
this.canvasData.allDisposalNode = data |
|
|
|
|
this.handleHybridTree() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
treeData: any = []; //渲染tree处理完成数据
|
|
|
|
|
defaultExpandedKeys: any = []; //首次渲染 tree展开状态
|
|
|
|
|
//处理 节点 Tree数据
|
|
|
|
|
handleHybridTree() { |
|
|
|
|
this.defaultExpandedKeys = [] |
|
|
|
|
let treeData = [] |
|
|
|
|
let data = JSON.parse(JSON.stringify(this.canvasData.allDisposalNode || [])) |
|
|
|
|
data.forEach(element => { |
|
|
|
|
this.defaultExpandedKeys.push(element.id) |
|
|
|
|
element.title = element.name //name
|
|
|
|
|
element.key = element.id //id
|
|
|
|
|
element.children = [] //children
|
|
|
|
|
if (element.sitePlanId || element.buildingAreaId) { //是数据节点
|
|
|
|
|
element.isLeaf = true |
|
|
|
|
element.isDataNode = true |
|
|
|
|
} else { //不是数据节点
|
|
|
|
|
element.isLeaf = false |
|
|
|
|
element.isDataNode = false |
|
|
|
|
} |
|
|
|
|
data.forEach(item => { |
|
|
|
|
item.parentId === element.id ? element.children.push(item) : null |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
data.forEach(element => { |
|
|
|
|
!element.parentId ? treeData.push(element) : null |
|
|
|
|
}) |
|
|
|
|
this.treeData = [...treeData] |
|
|
|
|
this.defaultExpandedKeys = [...this.defaultExpandedKeys] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//刷新 treeData 保存已展开节点
|
|
|
|
|
refurbishTreeData() { |
|
|
|
|
this.defaultExpandedKeys = [] |
|
|
|
|
let params = { disasterId: this.allFirePlan[0].id || '' } |
|
|
|
|
this.http.get('/api/DisposalNodes', { params: params }).subscribe(nodeData => { //处置节点
|
|
|
|
|
this.canvasData.allDisposalNode = nodeData |
|
|
|
|
let oldTreeData = this.nzTreeComponent.getExpandedNodeList() |
|
|
|
|
oldTreeData.forEach(item => { |
|
|
|
|
this.defaultExpandedKeys.push(item.key) |
|
|
|
|
}) |
|
|
|
|
let treeData = [] |
|
|
|
|
let data = JSON.parse(JSON.stringify(this.canvasData.allDisposalNode || [])) |
|
|
|
|
data.forEach(element => { |
|
|
|
|
element.title = element.name //name
|
|
|
|
|
element.key = element.id //id
|
|
|
|
|
element.children = [] //children
|
|
|
|
|
if (element.sitePlanId || element.buildingAreaId) { //是数据节点
|
|
|
|
|
element.isLeaf = true |
|
|
|
|
element.isDataNode = true |
|
|
|
|
} else { //不是数据节点
|
|
|
|
|
element.isLeaf = false |
|
|
|
|
element.isDataNode = false |
|
|
|
|
} |
|
|
|
|
data.forEach(item => { |
|
|
|
|
item.parentId === element.id ? element.children.push(item) : null |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
data.forEach(element => { |
|
|
|
|
!element.parentId ? treeData.push(element) : null |
|
|
|
|
}) |
|
|
|
|
this.treeData = [...treeData] |
|
|
|
|
this.defaultExpandedKeys = [...this.defaultExpandedKeys] |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sitePlanIcon = { fire: 0, force: 0 } // 总平面图 火源/力量 图标 是否展示
|
|
|
|
|
|
|
|
|
|
//刷新 建筑楼层 匹配 火源/力量 图标
|
|
|
|
|
mateFireForce() { |
|
|
|
|
let data = this.canvasData.allNodeMarkers.markers || {} |
|
|
|
|
for (let key in data) { //遍历 火/力量 图标
|
|
|
|
|
this.sitePlanData.forEach(element => { //楼层
|
|
|
|
|
if (element.id == key) { // 相匹配时
|
|
|
|
|
data[key].fireCount != 0 ? element.fire = 1 : element.fire = 0 |
|
|
|
|
data[key].forceCount != 0 ? element.force = 1 : element.force = 0 |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.allBuildings.forEach(element => { //建筑
|
|
|
|
|
if (element.id == key) { // 相匹配时
|
|
|
|
|
data[key].fireCount != 0 ? element.fire = 1 : element.fire = 0 |
|
|
|
|
data[key].forceCount != 0 ? element.force = 1 : element.force = 0 |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
if (this.params.companyId == key) { //总平面图时
|
|
|
|
|
data[key].fireCount != 0 ? this.sitePlanIcon.fire = 1 : this.sitePlanIcon.fire = 0 |
|
|
|
|
data[key].forceCount != 0 ? this.sitePlanIcon.force = 1 : this.sitePlanIcon.force = 0 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let buildingMSG = this.canvasData.allNodeMarkers.highlightMarkers || {} |
|
|
|
|
for (let key in buildingMSG) { |
|
|
|
|
if (key === this.canvasData.selectPanelPoint.DisposalNodeId) { |
|
|
|
|
for (let keys in buildingMSG[key]) { |
|
|
|
|
this.sitePlanData.forEach(element => { //楼层
|
|
|
|
|
if (element.id === keys) { |
|
|
|
|
buildingMSG[key][keys].fireCount != 0 ? element.fire = 2 : null |
|
|
|
|
buildingMSG[key][keys].forceCount != 0 ? element.force = 2 : null |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.allBuildings.forEach(element => { //建筑
|
|
|
|
|
if (element.id === keys) { // 相匹配时
|
|
|
|
|
buildingMSG[key][keys].fireCount != 0 ? element.fire = 2 : null |
|
|
|
|
buildingMSG[key][keys].forceCount != 0 ? element.force = 2 : null |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
if (this.params.companyId === keys) { //总平面图时
|
|
|
|
|
buildingMSG[key][keys].fireCount != 0 ? this.sitePlanIcon.fire = 2 : null |
|
|
|
|
buildingMSG[key][keys].forceCount != 0 ? this.sitePlanIcon.force = 2 : null |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 切换 基本信息时 刷新 删除 建筑楼层 自定义属性
|
|
|
|
|
mateDeleteCustomize() { |
|
|
|
|
this.canvasData.selectPanelPointBaseData = { description: '', notes: '', weather: '', airTemperature: '', windDirection: '', windScale: '' } |
|
|
|
|
this.defaultExpandedKeys = [] |
|
|
|
|
this.sitePlanIcon = { fire: 0, force: 0 } |
|
|
|
|
this.sitePlanData.forEach(element => { //楼层
|
|
|
|
|
delete element.fire |
|
|
|
|
delete element.force |
|
|
|
|
}); |
|
|
|
|
this.allBuildings.forEach(element => { //建筑
|
|
|
|
|
delete element.fire |
|
|
|
|
delete element.force |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//计算差异
|
|
|
|
|
countValue(e) { |
|
|
|
|
e.stopPropagation() |
|
|
|
|
let params = { disasterId: this.allFirePlan[0].id || '' } |
|
|
|
|
this.http.get('/api/DisasterData/Diffs', { params: params }).subscribe(data => { |
|
|
|
|
this.canvasData.allNodeMarkers = data |
|
|
|
|
this.mateFireForce() |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('计算差异完成', '确定', config); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//复制 处置预案 节点
|
|
|
|
|
copyPanelPoint(e, item, treeData) { |
|
|
|
|
e.stopPropagation() |
|
|
|
|
if (confirm(`确定要复制 ${item.title} ?`)) { |
|
|
|
|
let params = { id: item.origin.id } |
|
|
|
|
let order |
|
|
|
|
if (item.level == 0) { |
|
|
|
|
treeData.length ? order = treeData[treeData.length - 1].order + 1 : order = 0 |
|
|
|
|
} else { |
|
|
|
|
let parent = item.getParentNode() //获取父节点
|
|
|
|
|
parent.origin.children.length ? order = parent.origin.children[parent.origin.children.length - 1].order + 1 : order = 0 |
|
|
|
|
} |
|
|
|
|
let data = { |
|
|
|
|
name: item.title + '(副本)', |
|
|
|
|
level: item.level, |
|
|
|
|
order: order, |
|
|
|
|
description: '', |
|
|
|
|
disasterId: item.origin.disasterId || '', |
|
|
|
|
parentId: item.origin.parentId || null, |
|
|
|
|
planComponentId: item.origin.planComponentId || '', |
|
|
|
|
} |
|
|
|
|
this.http.post('/api/DisposalNodes/Clone', data, { params: params }).subscribe(data => { |
|
|
|
|
this.refurbishTreeData() |
|
|
|
|
}) |
|
|
|
|
} //isTrue
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//删除 处置预案 节点
|
|
|
|
|
deletePanelPoint(e, item) { |
|
|
|
|
e.stopPropagation() |
|
|
|
|
if (confirm(`确定要删除 ${item.name} ?`)) { |
|
|
|
|
this.http.delete(`/api/DisposalNodes/${item.id}`).subscribe(data => { |
|
|
|
|
this.refurbishTreeData() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//点击 处置Tree节点
|
|
|
|
|
selectanelPoint(e) { |
|
|
|
|
if (!e.buildingAreaId && !e.sitePlanId) { //当前节点 不是 数据节点 时
|
|
|
|
|
let msg = this.canvasData.findDisposalNode(e.id) |
|
|
|
|
this.canvasData.selectPanelPointBaseData = msg |
|
|
|
|
this.selectDisposalNode == msg.id ? this.selectDisposalNode = '' : this.selectDisposalNode = msg.id //选中 节点
|
|
|
|
|
|
|
|
|
|
} else if (e.buildingAreaId || e.sitePlanId) { //当前节点 是 数据节点 时
|
|
|
|
|
let msg = this.canvasData.findDisposalNode(e.parentId) |
|
|
|
|
this.canvasData.selectPanelPointBaseData = msg |
|
|
|
|
this.selectDisposalNode = e.parentId //选中 节点
|
|
|
|
|
|
|
|
|
|
if (this.canvasData.selectPanelPoint.DisposalNodeId != e.id) { //选择节点 不是当前节点时
|
|
|
|
|
let params = { nodeId: e.id } |
|
|
|
|
let parameter = { //查询 节点 对应 建筑/楼层 index,id
|
|
|
|
|
buildingIndex: e.sitePlanId ? -1 : this.allBuildings.findIndex(item => { return item.id === e.buildingId }), //总平面图/建筑 index
|
|
|
|
|
storeyId: e.sitePlanId ? e.sitePlanId : e.buildingAreaId, //楼层id
|
|
|
|
|
} |
|
|
|
|
this.http.get('/api/DisposalNodeData', { params: params }).subscribe(data => { |
|
|
|
|
this.canvasData.selectPanelPoint = this.canvasData.deserialize(JSON.stringify(data || new DisposalNodeData())) //选择 当前 节点
|
|
|
|
|
this.canvasData.selectPanelPoint.Data = this.canvasData.deserialize(this.canvasData.selectPanelPoint.Data) |
|
|
|
|
this.seekPanelPoint(parameter) |
|
|
|
|
}) |
|
|
|
|
} //if
|
|
|
|
|
|
|
|
|
|
} //else if
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//查找 数据节点 对应 建筑/楼层
|
|
|
|
|
seekPanelPoint(paramsData) { |
|
|
|
|
this.checkedBuildingIndex = paramsData.buildingIndex |
|
|
|
@ -2576,7 +2301,6 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
this.selectingSitePlan = this.sitePlanData[index] || {} |
|
|
|
|
this.canvasData.selectStorey = this.sitePlanData[index] || {} //服务中 存一份数据
|
|
|
|
|
this.selectSitePlanIndex = index |
|
|
|
|
|
|
|
|
|
Promise.all([fireData, planData]).then((res) => { |
|
|
|
|
this.getSitePlanStorey(this.selectingSitePlan) //获取 平面图 楼层数据
|
|
|
|
|
}) |
|
|
|
|