Browse Source

[完善] 消防要素统计完善

develop
陈鹏飞 4 years ago
parent
commit
3803494a91
  1. 71
      src/app/ui/collection-tools/collection-tools.component.ts

71
src/app/ui/collection-tools/collection-tools.component.ts

@ -366,11 +366,6 @@ export class CollectionToolsComponent implements OnInit {
this.getAllLibrary()
this.getSitePlan()
this.getAllBuildings()
setTimeout(() => {
// console.log(1,this.canvasData.selectStorey)
// console.log(2,this.canvasData.originalcompanyBuildingData)
// console.log(3,this.canvasData.originaleveryStoreyData)
}, 3000);
}
@ -574,15 +569,13 @@ export class CollectionToolsComponent implements OnInit {
data.forEach(element => {
element.isTemplate = true //添加模板标识
element.isLook = true //添加是否可见标识
element.children = []
if(storeyData){
for(let key in storeyData.data){
if(element.id == storeyData.data[key].FireElementId){
storeyData.data[key].isTemplate = false
storeyData.data[key].isLook = true
element.isNewElement = true
element.children.push(storeyData.data[key])
}
element.children? element.children : element.children = []
for(let key in storeyData.data){
if(element.id == storeyData.data[key].FireElementId){
storeyData.data[key].isTemplate = false
storeyData.data[key].isLook = true
element.isNewElement = true
element.children.push(storeyData.data[key])
}
}
data.forEach(item => { if (item.parentId == element.id) {element.children.push(item)} });
@ -653,6 +646,12 @@ export class CollectionToolsComponent implements OnInit {
storeyData.data[key] = companyBuildingData.data[key]
}
}
for(let key in storeyData.data){ //筛选数据 没有匹配全部放入到 其他 数组
let noMatch = this.allFireElements.find( every=> every.id===storeyData.data[key].FireElementId )
if (!noMatch) {
this.allFireElements[this.allFireElements.length-1].children.push(storeyData.data[key])
}
}
this.handleTreeData(storeyData) //处理tree数据结构
}
@ -726,6 +725,16 @@ export class CollectionToolsComponent implements OnInit {
let params = {ids:e}
let isTrue = this.http.get('/api/Companies/FireElements',{params}).subscribe((data:any)=>{
this.allFireElements = data //所有消防要素
let other = {
children: [],
computed: true,
id: '',
name: '其他',
order: 999,
parentId: null,
tag: "INPUT",
}
this.allFireElements.push(other)
return true
})
if (isTrue) { return 'success' }
@ -782,14 +791,32 @@ export class CollectionToolsComponent implements OnInit {
//点击选中 平面图 楼层/区域 时
selectSitePlan (item,index) {
if (this.selectSitePlanIndex != index) {
this.selectingSitePlan = item
this.selectSitePlanIndex = index
this.canvasData.selectStorey = item //服务中 存一份数据
if (this.checkedBuildingIndex==-1) { //总平面图时
this.getSitePlanStorey(item) //获取 平面图 楼层数据
} else { //楼层/区域时
this.getBuildingStorey(item) //获取 建筑 楼层数据
}
if (this.canvasData.isChange) { //true 数据被改动
let isTrue = confirm('是否保存当前编辑数据')
if (isTrue) { //保存一遍数据, 再刷新数据
} else {
this.selectingSitePlan = item
this.selectSitePlanIndex = index
this.canvasData.selectStorey = item //服务中 存一份数据
if (this.checkedBuildingIndex==-1) { //总平面图时
this.getSitePlanStorey(item) //获取 平面图 楼层数据
} else { //楼层/区域时
this.getBuildingStorey(item) //获取 建筑 楼层数据
}
}
} else { //false 数据没被改动
this.selectingSitePlan = item
this.selectSitePlanIndex = index
this.canvasData.selectStorey = item //服务中 存一份数据
if (this.checkedBuildingIndex==-1) { //总平面图时
this.getSitePlanStorey(item) //获取 平面图 楼层数据
} else { //楼层/区域时
this.getBuildingStorey(item) //获取 建筑 楼层数据
}
} //if
}
}

Loading…
Cancel
Save