From 8ca9d1b50ec6c7ffdfdf6524b298a119196475b9 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Mon, 4 Jan 2021 13:44:58 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E5=AE=8C=E5=96=84=E8=80=83?= =?UTF-8?q?=E5=AE=98=E5=88=9B=E5=BB=BA=E8=80=83=E9=A2=98=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collection-tools.component.html | 4 +- .../collection-tools.component.ts | 59 +++++++-- .../collection-tools.component.ts | 122 +++++++++++------- .../collection-tools.component.ts | 10 +- .../working-area/working-area.component.ts | 2 + 5 files changed, 132 insertions(+), 65 deletions(-) diff --git a/src/app/ui/collection-tools-examinee/collection-tools.component.html b/src/app/ui/collection-tools-examinee/collection-tools.component.html index cf56d2e..cc093da 100644 --- a/src/app/ui/collection-tools-examinee/collection-tools.component.html +++ b/src/app/ui/collection-tools-examinee/collection-tools.component.html @@ -61,7 +61,7 @@

考试题目

-
+
@@ -71,7 +71,7 @@

考生答案

-
+
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 ae341bb..395bdfc 100644 --- a/src/app/ui/collection-tools-examinee/collection-tools.component.ts +++ b/src/app/ui/collection-tools-examinee/collection-tools.component.ts @@ -883,12 +883,44 @@ export class CollectionToolsExamineeComponent implements OnInit { let companyBuildingData = JSON.parse(JSON.stringify( this.canvasData.originalcompanyBuildingData || {} )) // 当前 单位/建筑 数据 let storeyData = JSON.parse(JSON.stringify( this.canvasData.originaleveryStoreyData || {} )) //当前 楼层 数据 // console.log('看看这是啥',this.Facilities) - this.Facilities ? this.Facilities.forEach(item => { - item.key == this.selectingSitePlan.id ? - this.getAllAssetLibraries(item) : + + // this.Facilities ? this.Facilities.forEach(item => { + // item.key == this.selectingSitePlan.id ? + // this.getAllAssetLibraries(item) : + // this.canvas.loadExamineeData() + // }) : this.canvas.loadExamineeData();this.allLibrary = this.originalallLibrary + //如果有需要标注的平面图 + if(this.Facilities){ + this.Facilities.some((item,key)=>{ + if(item.key == this.selectingSitePlan.id){ + let arr = [] + item.children.forEach(i => { + arr.push(i.Id) + }) + this.canvasData.hiddenBasicInfoFacilities = JSON.parse(JSON.stringify(arr)) + console.log('这层有需要标注的基本信息素材',item) + let allFireElements = JSON.parse(JSON.stringify(this.allFireElements)) + + if(this.clickedNodeType == 0){ + this.canvas.loadExaminerData() + this.clickedNodeType = null + }else{ + this.canvas.loadExamineeData() + this.clickedNodeType = null + } + + return true + } else{ + if(key == this.Facilities.length - 1){ + this.canvas.loadExaminerData() + return false + } + } + }) + + }else{ this.canvas.loadExamineeData() - }) : this.canvas.loadExamineeData();this.allLibrary = this.originalallLibrary - + } 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 ) @@ -1636,35 +1668,44 @@ export class CollectionToolsExamineeComponent implements OnInit { } //点击 处置Tree节点 - selectanelPoint (e) { + clickedNodeType:any + selectanelPoint (e,type) { + this.clickedNodeType = type 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 //选中 节点 + this.Facilities ? this.sitePlanData.forEach(item => { this.Facilities.forEach(i =>{ if(item.id == i.key){ - item.isLabel = true + item.isLabel = true //标记当层需要标注基本信息素材 } }) }) : null + if (this.canvasData.selectPanelPoint.DisposalNodeId != e.id) { //选择节点 不是当前节点时 let api - api='/api/ExamDisposalNodeData' + type == 0 ? api='/api/DisposalNodeData' : api='/api/ExamDisposalNodeData' 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,{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) + // console.log(456,this.canvasData.selectPanelPoint.Data) this.seekPanelPoint(parameter) }) } //if diff --git a/src/app/ui/collection-tools-read/collection-tools.component.ts b/src/app/ui/collection-tools-read/collection-tools.component.ts index 45a4342..0706985 100644 --- a/src/app/ui/collection-tools-read/collection-tools.component.ts +++ b/src/app/ui/collection-tools-read/collection-tools.component.ts @@ -197,7 +197,7 @@ export class CollectionToolsReadComponent implements OnInit { this.getAllFirePlan() //获取当前单位灾情 await this.getPaperPlanData()//获得当前考题题目 - this.getExaminationQuestions() + let that = this window.setTimeout(()=>{ document.getElementById("functionalDomainContent").oncontextmenu = function (event) { @@ -398,7 +398,7 @@ export class CollectionToolsReadComponent implements OnInit { //点击树节点的显示隐藏icon clickLookItem(node){ - console.log(this.allFireElements) + // console.log(this.allFireElements) //子节点跟随父节点的islook变化   if(node.origin.children && node.origin.children.length != 0){ node.origin.isLook = !node.origin.isLook @@ -416,24 +416,56 @@ export class CollectionToolsReadComponent implements OnInit { //canvas上的素材显隐 let iconVisibleArr:any = [] - if(node.origin.children && node.origin.children.length != 0){//如果是模板,则开始向下找 - node.origin.children.forEach(item => { - if(item.children && item.children.length != 0){//如果子节点依旧是模板,则继续开始向下找 + // if(node.origin.children && node.origin.children.length != 0){//如果是模板,则开始向下找 + // node.origin.children.forEach(item => { + // if(item.children && item.children.length != 0){//如果子节点依旧是模板,则继续开始向下找 + // item.children.forEach(i => { + // if(i.isLook == false){ + // iconVisibleArr.push(i.Id) + // } + // }) + // }else{ + // if(item.isLook == false){ + // iconVisibleArr.push(item.Id) + // } + + // } + // }) + // }else{ + // if(node.origin.isLook == false){ + // iconVisibleArr.push(node.origin.Id) + // } + // } + console.log(this.renderData) + this.renderData.forEach(item =>{ + if(item.Id && item.isLook == false){ + iconVisibleArr.push(item.Id) + }else{ + if(item.children && item.children.length != 0){ item.children.forEach(i => { - iconVisibleArr.push(i.Id) + if(i.Id && i.isLook == false){ + iconVisibleArr.push(i.Id) + }else{ + if(i.children && i.children.length != 0){ + i.children.forEach(element => { + if(element.Id && element.isLook == false){ + iconVisibleArr.push(element.Id) + } + }) + } + } }) - }else{ - iconVisibleArr.push(item.Id) } - }) - }else{ - iconVisibleArr.push(node.origin.Id) - } + } + }) console.log(iconVisibleArr) - console.log(678,this.renderData) + this.canvasData.originaleveryStoreyData = JSON.parse(JSON.stringify(this.originaleveryStoreyData)) + 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.hiddenBasicInfoFacilities = iconVisibleArr + this.canvas.loadExamineeData() - } //打开消防设施考题设定 @@ -449,7 +481,7 @@ export class CollectionToolsReadComponent implements OnInit { answerDivDrag:boolean = false//查看答案窗口的显隐 - answertreeData:any + answertreeData:any = [] lookAnswerDiv(){ this.answerDivDrag = !this.answerDivDrag @@ -525,7 +557,7 @@ export class CollectionToolsReadComponent implements OnInit { arr.push(item.Id) }) this.canvasData.hiddenBasicInfoFacilities = arr - this.canvas.loadExamineeData() + // this.canvas.loadExamineeData() } @@ -539,6 +571,7 @@ export class CollectionToolsReadComponent implements OnInit { renderData:any = []//当前层默认隐藏的基本信息考试题目 + hiddenBasicInfoFacilities:any //封装 刷新 tree 数据 async renovateTreeData (isRefresh:boolean = true) { this.allFireElements[this.allFireElements.length-1].children = [] @@ -551,7 +584,9 @@ export class CollectionToolsReadComponent 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 || {} )) //当前 楼层 数据 + console.log('this.Facilities',this.Facilities) + //如果有需要标注的平面图 if(this.Facilities){ this.Facilities.some((item,key)=>{ if(item.key == this.selectingSitePlan.id){ @@ -559,40 +594,32 @@ export class CollectionToolsReadComponent implements OnInit { item.children.forEach(i => { arr.push(i.Id) }) - this.canvasData.hiddenBasicInfoFacilities = arr - console.log('这层有',item) + this.hiddenBasicInfoFacilities = arr + this.canvasData.hiddenBasicInfoFacilities = JSON.parse(JSON.stringify(arr)) + console.log('这层有需要标注的基本信息素材',item) let allFireElements = JSON.parse(JSON.stringify(this.allFireElements)) this.renderData = [] setTimeout(() => { this.renderData = [...this.processingData(allFireElements,item.children)] }, 0); - - this.canvas.loadExamineeData() - // this.canvas.createBackground(this.canvasData.selectStorey.imageUrl, this.canvasData.selectStorey.imageAngle); - // this.canvas.createFloorShape(this.canvasData.examOriginaleveryStoreyData.data); - // this.canvas.processinghiddenData(); - // this.canvas.createNodeShape(this.canvasData.selectPanelPoint.Data); - // this.canvas.setNameVisible(false, 0); - // this.canvas.setNameVisible(false, 1); + + if(this.clickedNodeType == 0){ + this.canvas.loadExaminerData() + this.clickedNodeType = null + }else{ + this.canvas.loadExamineeData() + this.clickedNodeType = null + } + return true } else{ - console.log('这层没有tree') - this.renderData = [] - this.canvas.loadExamineeData(false) - return false + if(key == this.Facilities.length - 1){ + this.renderData = [] + this.canvas.loadExaminerData() + return false + } } }) - console.log("llllllll") - - - - // if(this.clickedNodeType == 0){ - // this.canvas.loadExamineeData(false) - // }else{ - // this.canvas.loadExamineeData() - // } - - }else{ this.canvas.loadExamineeData() @@ -605,7 +632,6 @@ export class CollectionToolsReadComponent implements OnInit { this.allFireElements[this.allFireElements.length-1].children.push(storeyData.data[key]) } } - this.handleTreeData(storeyData) //处理tree数据结构 } //处理数据 将消防要素模板与真实素材结合 @@ -795,11 +821,13 @@ export class CollectionToolsReadComponent implements OnInit { } //获取 平面图 楼层数据 + originaleveryStoreyData:any getSitePlanStorey (e) { let params = {sitePlanId: e.id} this.http.get(`/api/SitePlanData`,{params}).subscribe((data:any)=>{ console.log('预案平台楼层原始素材',data) - this.canvasData.originaleveryStoreyData = data || {} // 楼层原数据 + this.originaleveryStoreyData = data + this.canvasData.originaleveryStoreyData = JSON.parse(JSON.stringify(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 @@ -826,8 +854,8 @@ export class CollectionToolsReadComponent implements OnInit { getBuildingStorey (e) { let params = {buildingAreaId: e.id} this.http.get(`/api/BuildingAreaData`,{params}).subscribe((data:any)=>{ - - this.canvasData.originaleveryStoreyData = data || {} // 楼层原数据 + this.originaleveryStoreyData = data + this.canvasData.originaleveryStoreyData = JSON.parse(JSON.stringify(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.buildingAreaId? null : this.canvasData.originaleveryStoreyData.buildingAreaId = e.id || null @@ -947,6 +975,7 @@ export class CollectionToolsReadComponent implements OnInit { params = {examDisasterId: this.allFirePlan[0].id || '',disposalNodeType:1,examinationId:this.route.snapshot.queryParams.examId} this.http.get(api,{params:params}).subscribe(data=>{ //处置节点 this.canvasData.allDisposalNode = data + this.getExaminationQuestions() this.handleHybridTree(this.canvasData.allDisposalNode,'答案') }) } @@ -1097,8 +1126,7 @@ export class CollectionToolsReadComponent implements OnInit { this.canvasData.selectPanelPoint = this.canvasData.deserialize(JSON.stringify(data || new DisposalNodeData())) //选择 当前 节点 this.canvasData.selectPanelPoint.Data = this.canvasData.deserialize(this.canvasData.selectPanelPoint.Data) - console.log(456,this.canvasData.selectPanelPoint.Data) - // this.canvasData.selectPanelPoint.Data.DefinedIncrement == null ? this.canvasData.selectPanelPoint.Data.DefinedIncrement = {} : null + // console.log(456,this.canvasData.selectPanelPoint.Data) this.seekPanelPoint(parameter) }) } //if diff --git a/src/app/ui/collection-tools/collection-tools.component.ts b/src/app/ui/collection-tools/collection-tools.component.ts index b20c52e..1a1a15d 100644 --- a/src/app/ui/collection-tools/collection-tools.component.ts +++ b/src/app/ui/collection-tools/collection-tools.component.ts @@ -1119,12 +1119,6 @@ export class CollectionToolsComponent implements OnInit { let companyBuildingData = JSON.parse(JSON.stringify( this.canvasData.originalcompanyBuildingData || {} )) // 当前 单位/建筑 数据 let storeyData = JSON.parse(JSON.stringify( this.canvasData.originaleveryStoreyData || {} )) //当前 楼层 数据 - // for(let key in companyBuildingData.data){ - // if (companyBuildingData.data[key].FloorId === beforeOneId) { //处理 单位/建筑 数据是否归于当前楼层下 - // storeyData.data[key] = companyBuildingData.data[key] - // } - // } - console.log(566,storeyData.data) 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 ) @@ -1134,7 +1128,9 @@ export class CollectionToolsComponent implements OnInit { } } this.handleTreeData(storeyData) //处理tree数据结构 - this.canvas.loadExamineeData(false) + this.canvas.loadExaminerData() + // 隐藏基本信息图形 + this.canvas.setNameVisible(false, 0); } diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 4259f0c..6f3ea02 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -1272,6 +1272,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 加载考生数据 */ public loadExamineeData() { + console.log('加载考生') // 创建背景图 this.createBackground(this.canvasData.selectStorey.imageUrl, this.canvasData.selectStorey.imageAngle); // 创建楼层图形 @@ -1292,6 +1293,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 加载考官数据 */ public loadExaminerData() { + console.log('加载考官') // 创建背景图 this.createBackground(this.canvasData.selectStorey.imageUrl, this.canvasData.selectStorey.imageAngle); // 创建楼层图形