From 3803494a9197235b3252baad45d94acdd6f35838 Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Tue, 25 Aug 2020 15:33:41 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=20=E6=B6=88=E9=98=B2?= =?UTF-8?q?=E8=A6=81=E7=B4=A0=E7=BB=9F=E8=AE=A1=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collection-tools.component.ts | 71 +++++++++++++------ 1 file changed, 49 insertions(+), 22 deletions(-) diff --git a/src/app/ui/collection-tools/collection-tools.component.ts b/src/app/ui/collection-tools/collection-tools.component.ts index e41923b..91013f3 100644 --- a/src/app/ui/collection-tools/collection-tools.component.ts +++ b/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 + } }