diff --git a/src/app/canvas-share-data.service.ts b/src/app/canvas-share-data.service.ts index 4540e24..12e034a 100644 --- a/src/app/canvas-share-data.service.ts +++ b/src/app/canvas-share-data.service.ts @@ -26,7 +26,7 @@ export class CanvasShareDataService { examOriginaleveryStoreyData: any; // 考生答卷 总平面图/楼层/区域 楼层数据 - hiddenBasicInfoFacilities: any; // 考生答卷 当前楼层需要隐藏的基本信息素材 + hiddenBasicInfoFacilities: any = []// 考生答卷 当前楼层需要隐藏的基本信息素材 // 总平面图/建筑 楼层 // 处置 节点 diff --git a/src/app/ui/collection-tools-examinee/collection-tools.component.ts b/src/app/ui/collection-tools-examinee/collection-tools.component.ts index 203885b..bbd5273 100644 --- a/src/app/ui/collection-tools-examinee/collection-tools.component.ts +++ b/src/app/ui/collection-tools-examinee/collection-tools.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Inject, ViewChild,ElementRef,Renderer2, ViewContainerRef, ɵConsole } from '@angular/core'; +import { Component, OnInit, Inject, ViewChild,ElementRef,Renderer2, ViewContainerRef } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; @@ -423,13 +423,13 @@ export class CollectionToolsExamineeComponent implements OnInit { keynote: '', //考试要点 } - ngOnInit(): void { + async ngOnInit(): Promise { this.getAllLibrary('plan') //获取素材库 this.getAllBuildings() //获取所有建筑 this.getAllFirePlan() //获取当前单位灾情 - this.getPaperPlanData()//获得当前考题题目 + await this.getPaperPlanData()//获得当前考题题目 let that = this window.setTimeout(()=>{ document.getElementById("functionalDomainContent").oncontextmenu = function (event) { @@ -449,21 +449,23 @@ export class CollectionToolsExamineeComponent implements OnInit { planData:any //当前考题题目 Facilities:any //当前预案考题所有楼层要考的基本信息素材 //获得单位预案设定 - getPaperPlanData(){ + async getPaperPlanData(){ let params = { paperId : this.paperId } - this.http.get(`/api/PaperPlans`,{params:params}).subscribe((data:any) => { - console.log(456,data) - data.forEach(item => { - item.id == this.route.snapshot.queryParams.paperplanId ? - this.planData = item : null + await new Promise((resolve,reject)=>{ + this.http.get(`/api/PaperPlans`,{params:params}).subscribe((data:any) => { + data.forEach(item => { + item.id == this.route.snapshot.queryParams.paperplanId ? + this.planData = item : null + }) + + let questions = JSON.parse(this.planData.examDisposalNodesData) + this.handleHybridTree(questions,'题目') + this.Facilities = JSON.parse(this.planData.examFacilityAssetsData) + console.log('当前预案设定需要隐藏的基本信息图标',this.Facilities) + resolve(1) }) - - let questions = JSON.parse(this.planData.examDisposalNodesData) - this.handleHybridTree(questions,'题目') - this.Facilities = JSON.parse(this.planData.examFacilityAssetsData) - console.log('预案设定',this.Facilities) }) } @@ -471,18 +473,16 @@ export class CollectionToolsExamineeComponent implements OnInit { basicAssetLibraries:any = []//基本信息素材库 getAllAssetLibraries(Facilitiesitem){ + console.log('具体到当前楼层需要隐藏的基本信息图标',Facilitiesitem.children) let arr = [] Facilitiesitem.children.forEach(item => { arr.push(item.Id) }) this.canvasData.hiddenBasicInfoFacilities = arr - this.canvas.loadExamineeData() - console.log(1314,this.canvasData.hiddenBasicInfoFacilities) this.basicAssetLibraries = [] this.http.get('/api/AssetLibraries').subscribe(async(data:any) => { - console.log('素材库',data) for (let index = 0; index < data.length; index++) { const element = data[index]; let params = { @@ -492,7 +492,6 @@ export class CollectionToolsExamineeComponent implements OnInit { await new Promise ((resolve,reject)=>{ this.http.get('/api/Assets',{params:params}) .subscribe((data:any) => { - console.log(index,data) if(data && data.length != 0){ data.forEach(item => { item.tag = 1 @@ -502,11 +501,10 @@ export class CollectionToolsExamineeComponent implements OnInit { element ) } - resolve() + resolve(1) }) }) } - // console.log(55555,this.basicAssetLibraries) this.allLibrary = [...this.originalallLibrary,...this.basicAssetLibraries] }) @@ -598,10 +596,10 @@ export class CollectionToolsExamineeComponent implements OnInit { } }).subscribe(data => { console.log('保存基本素材成功') - resolve() + resolve(1) },err=>{ console.log('保存基本素材失败') - resolve() + resolve(1) }) }) @@ -616,16 +614,14 @@ export class CollectionToolsExamineeComponent implements OnInit { } }).subscribe(data => { console.log('保存基本素材成功') - resolve() + resolve(1) },err=>{ console.log('保存基本素材失败') - resolve() + resolve(1) }) }) } - console.log(this.canvasData.examOriginaleveryStoreyData) - console.log(this.canvasData.originalcompanyBuildingData) const dialogRef = this.dialog.open(saveOneDialogExaminee, { data: { allDisposalNode: this.canvasData.allDisposalNode, @@ -758,8 +754,6 @@ export class CollectionToolsExamineeComponent implements OnInit { this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[node.id]) } - // console.log(node) - // canvas上的素材高亮 let iconHighLightArr:any = [] if(node.isTemplate){//如果是模板,则开始向下找 @@ -775,7 +769,6 @@ export class CollectionToolsExamineeComponent implements OnInit { }else{ iconHighLightArr.push(node.id) } - // console.log(456,iconHighLightArr) this.canvas.setHighlight(iconHighLightArr) } @@ -894,11 +887,13 @@ export class CollectionToolsExamineeComponent implements OnInit { let beforeOneId = this.selectingSitePlan.id || '' //当前 选中 平面图 楼层/区域 id let companyBuildingData = JSON.parse(JSON.stringify( this.canvasData.originalcompanyBuildingData || {} )) // 当前 单位/建筑 数据 let storeyData = JSON.parse(JSON.stringify( this.canvasData.originaleveryStoreyData || {} )) //当前 楼层 数据 - this.Facilities.forEach(item => { + // console.log('看看这是啥',this.Facilities) + this.Facilities ? this.Facilities.forEach(item => { item.key == this.selectingSitePlan.id ? this.getAllAssetLibraries(item) : - null - }) + this.canvas.loadExamineeData() + }) : this.canvas.loadExamineeData() + for(let key in storeyData.data){ //筛选数据 storeyData.data[key].key = storeyData.data[key].Id let noMatch = this.allFireElements.find( every=> every.id===storeyData.data[key].FireElementId ) @@ -907,6 +902,7 @@ export class CollectionToolsExamineeComponent implements OnInit { this.allFireElements[this.allFireElements.length-1].children.push(storeyData.data[key]) } } + this.handleTreeData(storeyData) //处理tree数据结构 } @@ -956,16 +952,16 @@ export class CollectionToolsExamineeComponent implements OnInit { let fireData = this.getFireElements(sessionStorage.getItem('buildingTypeId')) //获取单位下 消防要素 let planData = this.getSitePlanCompanyData() //获取 单位 数据 this.http.get('/api/SitePlans',{params:this.params}).subscribe(data=>{ - this.sitePlanData = data - console.log('楼层数据',this.sitePlanData) - this.sitePlanData.forEach(item => { + console.log('建筑楼层数据',this.sitePlanData) + console.log('看看什么万一',this.Facilities) + this.Facilities ? this.sitePlanData.forEach(item => { this.Facilities.forEach(i =>{ if(item.id == i.key){ item.isLabel = true } }) - }) + }) : null this.selectingSitePlan = this.sitePlanData[0] || {} this.canvasData.selectStorey = this.sitePlanData[0] || {} //服务中 存一份数据 this.selectSitePlanIndex = 0 @@ -983,9 +979,8 @@ export class CollectionToolsExamineeComponent implements OnInit { let fireData = this.getFireElements(item.buildingTypes[0].id || '') //获取建筑下 消防要素 let planData = this.getBuildingData(params) //获取 建筑 数据 this.http.get('/api/BuildingAreas',{params}).subscribe(data=>{ - this.sitePlanData = data - console.log('楼层数据',this.sitePlanData) + console.log('预案平台当前有哪些楼层',this.sitePlanData) this.selectingSitePlan = this.sitePlanData[0] || {} this.canvasData.selectStorey = this.sitePlanData[0] || {} //服务中 存一份数据 this.selectSitePlanIndex = 0 @@ -1036,19 +1031,18 @@ export class CollectionToolsExamineeComponent implements OnInit { getSitePlanStorey (e) { let params = {sitePlanId: e.id} this.http.get(`/api/SitePlanData`,{params}).subscribe((data:any)=>{ + console.log('预案平台楼层原始素材',data) this.canvasData.originaleveryStoreyData = data || {} // 楼层原数据 this.canvasData.originaleveryStoreyData.data? this.canvasData.originaleveryStoreyData.data = JSON.parse(this.canvasData.originaleveryStoreyData.data) : this.canvasData.originaleveryStoreyData.data = {} this.canvasData.originaleveryStoreyData.version? null : this.canvasData.originaleveryStoreyData.version = "2.0" this.canvasData.originaleveryStoreyData.sitePlanId? null : this.canvasData.originaleveryStoreyData.sitePlanId = e.id || null - - let examParams = { sitePlanId : e.id, examinationId : this.route.snapshot.queryParams.examId, planComponentId : this.route.snapshot.queryParams.planComponentId } this.http.get('/api/ExamSitePlanData',{params:examParams}).subscribe((data2:any)=>{ - console.log('cnm',data2) + console.log('考生新添加的基本信息素材数据',data2) this.canvasData.examOriginaleveryStoreyData = data2 || {} // 楼层原数据 this.canvasData.examOriginaleveryStoreyData.data? this.canvasData.examOriginaleveryStoreyData.data = JSON.parse(this.canvasData.examOriginaleveryStoreyData.data) : this.canvasData.examOriginaleveryStoreyData.data = {} this.canvasData.examOriginaleveryStoreyData.version? null : this.canvasData.examOriginaleveryStoreyData.version = "2.0" @@ -1061,6 +1055,7 @@ export class CollectionToolsExamineeComponent implements OnInit { getBuildingStorey (e) { let params = {buildingAreaId: e.id} this.http.get(`/api/BuildingAreaData`,{params}).subscribe((data:any)=>{ + this.canvasData.originaleveryStoreyData = data || {} // 楼层原数据 this.canvasData.originaleveryStoreyData.data? this.canvasData.originaleveryStoreyData.data = JSON.parse(this.canvasData.originaleveryStoreyData.data) : this.canvasData.originaleveryStoreyData.data = {} this.canvasData.originaleveryStoreyData.version? null : this.canvasData.originaleveryStoreyData.version = "2.0" @@ -1383,8 +1378,6 @@ export class CollectionToolsExamineeComponent implements OnInit { this.originalallLibrary = data this.allLibrary = data this.selectImageIndex = -1 - console.log(654,this.allLibrary) - // this.canvas.cancelPaint() }) } @@ -1399,7 +1392,6 @@ export class CollectionToolsExamineeComponent implements OnInit { //点击选中素材库图片时 selectImg (item,items,index) { - console.log(66666666,items) this.selectLibrary = item.name this.selectImage = items this.selectImageIndex = index @@ -1440,7 +1432,6 @@ export class CollectionToolsExamineeComponent implements OnInit { //获取所有处置节点 getDisposalNode () { let api - console.log(4444,this.examType) api='/api/ExamDisposalNodes' this.selectDisposalNode = '' let params @@ -1495,8 +1486,6 @@ export class CollectionToolsExamineeComponent implements OnInit { oldTreeData.forEach(item=>{ this.defaultExpandedKeys.push(item.key) }) - console.log(1,oldTreeData) - console.log(2,this.defaultExpandedKeys) let treeData = [] let data = JSON.parse(JSON.stringify( this.canvasData.allDisposalNode || [] )) data.forEach(element => { @@ -1647,8 +1636,8 @@ export class CollectionToolsExamineeComponent implements OnInit { //点击 处置Tree节点 selectanelPoint (e) { - console.log(12111,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 //选中 节点 @@ -1657,7 +1646,13 @@ export class CollectionToolsExamineeComponent implements OnInit { let msg = this.canvasData.findDisposalNode(e.parentId) this.canvasData.selectPanelPointBaseData = msg this.selectDisposalNode = e.parentId //选中 节点 - + this.Facilities ? this.sitePlanData.forEach(item => { + this.Facilities.forEach(i =>{ + if(item.id == i.key){ + item.isLabel = true + } + }) + }) : null if (this.canvasData.selectPanelPoint.DisposalNodeId != e.id) { //选择节点 不是当前节点时 let api api='/api/ExamDisposalNodeData' @@ -1690,10 +1685,18 @@ export class CollectionToolsExamineeComponent implements OnInit { this.canvasData.selectStorey = this.sitePlanData[index] || {} //服务中 存一份数据 this.selectSitePlanIndex = index + this.Facilities ? this.sitePlanData.forEach(item => { + this.Facilities.forEach(i =>{ + if(item.id == i.key){ + item.isLabel = true + } + }) + }) : null Promise.all([fireData,planData]).then((res)=>{ this.getSitePlanStorey(this.selectingSitePlan) //获取 平面图 楼层数据 }) }) //get + } else { //建筑时 this.beforeOneCheckedBuilding=this.allBuildings[paramsData.buildingIndex] let params = { buildingId: this.beforeOneCheckedBuilding.id } @@ -1705,7 +1708,13 @@ export class CollectionToolsExamineeComponent implements OnInit { this.selectingSitePlan = this.sitePlanData[index] || {} this.canvasData.selectStorey = this.sitePlanData[index] || {} //服务中 存一份数据 this.selectSitePlanIndex = index - + this.Facilities ? this.sitePlanData.forEach(item => { + this.Facilities.forEach(i =>{ + if(item.id == i.key){ + item.isLabel = true + } + }) + }) : null Promise.all([fireData,planData]).then((res)=>{ this.getBuildingStorey(this.selectingSitePlan) //获取 建筑 楼层数据 }) diff --git a/src/app/ui/collection-tools/collection-tools.component.ts b/src/app/ui/collection-tools/collection-tools.component.ts index 779de4d..b20c52e 100644 --- a/src/app/ui/collection-tools/collection-tools.component.ts +++ b/src/app/ui/collection-tools/collection-tools.component.ts @@ -1134,6 +1134,7 @@ export class CollectionToolsComponent implements OnInit { } } this.handleTreeData(storeyData) //处理tree数据结构 + this.canvas.loadExamineeData(false) } diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 18a35f5..82f101b 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -520,6 +520,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 处理隐藏数据 */ public processinghiddenData() { + console.log(1,this.canvasData.originaleveryStoreyData.data) + console.log(2,this.canvasData.hiddenBasicInfoFacilities) for (let key in this.canvasData.originaleveryStoreyData.data){ if (this.canvasData.hiddenBasicInfoFacilities.indexOf(key)!==-1) { delete this.canvasData.originaleveryStoreyData.data[key];