From 988b872884bd44f628c29cd61c630e95e94a67d9 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Fri, 25 Dec 2020 10:52:13 +0800 Subject: [PATCH 01/22] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=80=83=E7=94=9F=E6=A0=87=E6=B3=A8=E7=9A=84?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF=E7=B4=A0=E6=9D=90=E7=9A=84?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/canvas-share-data.service.ts | 6 + .../collection-tools.component.ts | 168 +++++++++++++++--- 2 files changed, 148 insertions(+), 26 deletions(-) diff --git a/src/app/canvas-share-data.service.ts b/src/app/canvas-share-data.service.ts index ae0a38f..7b40b58 100644 --- a/src/app/canvas-share-data.service.ts +++ b/src/app/canvas-share-data.service.ts @@ -18,8 +18,14 @@ export class CanvasShareDataService { // 总平面图/建筑 楼层 selectStorey: any = {area: '', details: ''}; // 选择当前 楼层 数据 + originalcompanyBuildingData: any; // 单位/建筑 数据 + originaleveryStoreyData: any; // 总平面图/楼层/区域 楼层数据 + + + examOriginaleveryStoreyData: 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 ee09fcf..24bcc7e 100644 --- a/src/app/ui/collection-tools-examinee/collection-tools.component.ts +++ b/src/app/ui/collection-tools-examinee/collection-tools.component.ts @@ -565,7 +565,6 @@ export class CollectionToolsExamineeComponent implements OnInit { saveNum :any = [] saveSite(){ if (this.selectingSitePlan && this.selectingSitePlan.id) { - this.saveNum = [] let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData)); SitePlanData.data = JSON.stringify(SitePlanData.data) let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData)); @@ -575,21 +574,114 @@ export class CollectionToolsExamineeComponent implements OnInit { let adjoinArr = [] //毗邻数组 if(this.pattern){//如果是基本信息编辑模式 + //如果是单位 总平面图 + if(this.checkedBuildingIndex==-1){ + //保存平面图数据 + this.http.post("/api/SitePlanData",SitePlanData,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + if(this.saveNum.length == 5){ + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + },err=>{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('平面图数据保存失败','确定',config); + }) + + //保存建筑数据 + this.http.post("/api/CompanyData",CompanyData,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + if(this.saveNum.length == 5){ + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + },err=>{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('单位数据保存失败','确定',config); + }) + + }else{ //如果是建筑 + + //建筑平面图数据 + this.http.post("/api/BuildingAreaData",SitePlanData,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + if(this.saveNum.length == 5){ + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + },err=>{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('平面图数据保存失败','确定',config); + }) + + //建筑数据 + this.http.post("/api/BuildingData",CompanyData,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + if(this.saveNum.length == 5){ + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + },err=>{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('单位数据保存失败','确定',config); + }) + + + } + + return true }else{//如果是想定作业编辑模式 - const dialogRef = this.dialog.open(saveOneDialogExaminee, { - data: { - allDisposalNode: this.canvasData.allDisposalNode, - selectedBuildingData:this.beforeOneCheckedBuilding, - selectedSiteData:this.selectingSitePlan, - siteOrbuilding:this.checkedBuildingIndex, - disasterId: this.allFirePlan[0].id || '' - } - }); + console.log(SitePlanData) + // const dialogRef = this.dialog.open(saveOneDialogExaminee, { + // data: { + // allDisposalNode: this.canvasData.allDisposalNode, + // selectedBuildingData:this.beforeOneCheckedBuilding, + // selectedSiteData:this.selectingSitePlan, + // siteOrbuilding:this.checkedBuildingIndex, + // disasterId: this.allFirePlan[0].id || '' + // } + // }); - dialogRef.afterClosed().subscribe(result => { - console.log('The dialog was closed'); - }); + // dialogRef.afterClosed().subscribe(result => { + // console.log('The dialog was closed'); + // }); } } else { //if @@ -980,10 +1072,44 @@ export class CollectionToolsExamineeComponent implements OnInit { 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 - this.renovateTreeData() + + + let examParams = { + sitePlanId : e.id, + examinationId : this.route.snapshot.queryParams.examId + } + this.http.get('/api/ExamSitePlanData',{params:examParams}).subscribe((data:any)=>{ + console.log("cnm1",data) + this.canvasData.examOriginaleveryStoreyData = data || {} // 楼层原数据 + 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" + this.canvasData.examOriginaleveryStoreyData.buildingAreaId? null : this.canvasData.examOriginaleveryStoreyData.buildingAreaId = e.id || null + this.renovateTreeData() + }) + }) + } + //获取 建筑 楼层数据 + 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" + this.canvasData.originaleveryStoreyData.buildingAreaId? null : this.canvasData.originaleveryStoreyData.buildingAreaId = e.id || null + let examParams = { + buildingAreaId : e.id, + examinationId : this.route.snapshot.queryParams.examId + } + this.http.get('/api/ExamBuildingAreaData',{params:examParams}).subscribe((data:any)=>{ + console.log("cnm2",data) + this.canvasData.examOriginaleveryStoreyData = data || {} // 楼层原数据 + 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" + this.canvasData.examOriginaleveryStoreyData.buildingAreaId? null : this.canvasData.examOriginaleveryStoreyData.buildingAreaId = e.id || null + this.renovateTreeData() + }) }) } - //获取 建筑 数据 getBuildingData (e) { return new Promise ((resolve,reject)=>{ @@ -997,17 +1123,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" - this.canvasData.originaleveryStoreyData.buildingAreaId? null : this.canvasData.originaleveryStoreyData.buildingAreaId = e.id || null - this.renovateTreeData() - }) - } + //点击选中 平面图 楼层/区域 时 selectSitePlan (item,index) { From 989cce91ef2a8d680997c58cbfebefacf65e2bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Fri, 25 Dec 2020 10:53:53 +0800 Subject: [PATCH 02/22] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../working-area/model/axArrowConnector.ts | 128 +++++-- src/app/working-area/model/axImageShape.ts | 18 +- src/app/working-area/model/axShape.ts | 4 + src/app/working-area/model/multipointIcon.ts | 105 +++--- src/app/working-area/model/pipeline.ts | 328 ------------------ src/app/working-area/model/polygonIcon.ts | 119 +++---- .../working-area/working-area.component.ts | 102 ++++-- 7 files changed, 305 insertions(+), 499 deletions(-) delete mode 100644 src/app/working-area/model/pipeline.ts diff --git a/src/app/working-area/model/axArrowConnector.ts b/src/app/working-area/model/axArrowConnector.ts index f6e1c17..8b72b39 100644 --- a/src/app/working-area/model/axArrowConnector.ts +++ b/src/app/working-area/model/axArrowConnector.ts @@ -1,12 +1,15 @@ import { WorkingAreaComponent } from '../working-area.component'; import * as PIXI from 'pixi.js'; import { AxShape } from './axShape'; +import { Sprite } from 'pixi.js'; /** - * 墙面 + * 连接箭头 */ export class AxArrowConnector extends AxShape { + pointTexture: PIXI.Texture = PIXI.Texture.from('assets/images/handle-main.png') + pointSprites: Array = new Array(); line: PIXI.Graphics; text: PIXI.Text; style = new PIXI.TextStyle({ @@ -27,8 +30,14 @@ export class AxArrowConnector extends AxShape { }); pts: PIXI.Point[]; - constructor(assetData: any, workingArea: WorkingAreaComponent) { + markerStart = true;// 是否绘制起始箭头 + markerEnd = true;// 是否绘制结束箭头 + constructor(assetData: any, workingArea: WorkingAreaComponent,markerStart: boolean,markerEnd:boolean) { super(assetData, workingArea); + + this.markerStart = markerStart; + this.markerEnd = markerEnd; + this.name = assetData.Id; this.text = new PIXI.Text(this.assetData.Name + '\r\n' @@ -38,25 +47,91 @@ export class AxArrowConnector extends AxShape { this.addChild(this.text); this.addChild(this.line); this.workingArea.backgroundImage.addChild(this); - this.refresh(this.line, this.assetData.MultiPoint); + this.refresh(); + this.drawPoints(); + this.sortableChildren = true; + this.text.zIndex = this.children.length; + } + public drawPoints() { + this.assetData.MultiPoint.forEach(element => { + var point = new Sprite(this.pointTexture); + point.position = element; + point.anchor.set(0.5); + this.pointSprites.push(point); + this.addChild(point); + }); + this.pointSprites.forEach((value, index, array) => { + value.interactive = true; + value.on('mousedown', event => { + event.stopPropagation(); + if (this.workingArea.allowEdit && this.assetData.GameMode === this.workingArea.canvasData.gameMode) { + event.currentTarget.data = event.data; + event.currentTarget.alpha = 0.5; + event.currentTarget.dragging = true; + } + }) + .on('mouseup', event => { + if (event.currentTarget.dragging) { + event.currentTarget.alpha = 1; + event.currentTarget.dragging = false; + event.currentTarget.data = null; + } + }) + .on('mouseupoutside', event => { + if (event.currentTarget.dragging) { + event.currentTarget.alpha = 1; + event.currentTarget.dragging = false; + event.currentTarget.data = null; + } + }) + .on('mousemove', event => { + if (event.currentTarget.dragging) { + const newPosition = event.currentTarget.data.getLocalPosition(event.currentTarget.parent); + event.currentTarget.x = newPosition.x; + event.currentTarget.y = newPosition.y; + + this.assetData.MultiPoint[index].x = newPosition.x; + this.assetData.MultiPoint[index].y = newPosition.y; + this.workingArea.canvasData.isChange = true; + this.refresh(); + } + }) + .on('rightclick', event => { + }); + }) + this.setPointsVisible(false); } + /** + * 设置点显示状态 + * @param b true/false + */ + public setPointsVisible(b:boolean) { + this.pointSprites.forEach(item => { + item.visible = b; + }) + } /** * 刷新形状 */ - public refresh(c: PIXI.Graphics, pts: PIXI.Point[]): void { + public refresh(): void { + const c = this.line; + const pts = this.assetData.MultiPoint; if (pts.length < 2) { return; } this.text.position = pts[0]; + this.text.anchor.set(0.5, 1); + this.text.text = this.assetData.Name + + '\r\n' + + this.assetData.PropertyInfos?.find(item => item.PropertyName === '名称/编号')?.PropertyValue; const strokeWidth = 1; const startWidth = 30 + strokeWidth; const endWidth = 30 + strokeWidth; - const edgeWidth = this.assetData.Thickness === 0?10:this.assetData.Thickness; // 宽度 + const edgeWidth = this.assetData.Thickness === 0 ? 10 : this.assetData.Thickness; // 宽度 const openEnded = false; - const markerStart = false;// 起始箭头 - const markerEnd = false;// 结束箭头 + const spacing = (openEnded) ? 0 : 0 + strokeWidth / 2; const startSize = 30 + strokeWidth; const endSize = 30 + strokeWidth; @@ -101,11 +176,13 @@ export class AxArrowConnector extends AxShape { // c.lineStyle(1, 0x000000, 1); c.clear(); c.lineTextureStyle({ width: 1, color: lineColor, join: PIXI.LINE_JOIN.ROUND }); - c.beginFill(fillColor); + const startNx = nx; const startNy = ny; - - if (markerStart && !openEnded) { + if (!openEnded) { + c.beginFill(fillColor); + } + if (this.markerStart && !openEnded) { this.paintMarker(c, pts[0].x, pts[0].y, nx, ny, startSize, startWidth, edgeWidth, spacing, true); } else { const outStartX = pts[0].x + orthx / 2 + spacing * nx; @@ -213,7 +290,7 @@ export class AxArrowConnector extends AxShape { orthx = edgeWidth * ny1; orthy = - edgeWidth * nx1; - if (markerEnd && !openEnded) { + if (this.markerEnd && !openEnded) { this.paintMarker(c, pe.x, pe.y, -nx, -ny, endSize, endWidth, edgeWidth, spacing, false); } else { c.lineTo(pe.x - spacing * nx1 + orthx / 2, pe.y - spacing * ny1 + orthy / 2); @@ -235,18 +312,16 @@ export class AxArrowConnector extends AxShape { for (let i = fns.length - 1; i >= 0; i--) { fns[i](); } - c.closePath(); - c.endFill(); - // if (openEnded) - // { - // c.end(); - // c.stroke(); - // } - // else - // { - // c.close(); - // c.fillAndStroke(); - // } + + if (openEnded) + { + c.closePath(); + } + else + { + c.closePath(); + c.endFill(); + } // c.setShadow(false); @@ -320,6 +395,11 @@ export class AxArrowConnector extends AxShape { } redraw(): void{ - this.refresh(this.line, this.assetData.MultiPoint); + this.pointSprites.forEach(item => { + item.destroy(); + }) + this.pointSprites.splice(0, this.pointSprites.length); + this.refresh(); + this.drawPoints(); } } diff --git a/src/app/working-area/model/axImageShape.ts b/src/app/working-area/model/axImageShape.ts index e76728e..67466be 100644 --- a/src/app/working-area/model/axImageShape.ts +++ b/src/app/working-area/model/axImageShape.ts @@ -1,12 +1,12 @@ import { WorkingAreaComponent } from '../working-area.component'; import * as ObjectID from 'bson-objectid'; import { GameMode } from './gameMode'; -import { Pipeline } from './pipeline'; import { PaintMode } from './paintModel'; import * as PIXI from 'pixi.js'; import { PropertyInfo } from './PropertyInfo'; import { AxShape } from './axShape'; import { Sprite } from 'pixi.js'; +import { AxArrowConnector } from './axArrowConnector'; /** * 安信图片形状 @@ -370,7 +370,7 @@ export class AxImageShape extends AxShape { paintingPipeline(x: number, y: number) { if (this.assetData.CanConnect) { if (this.workingArea.getPaintMode() === PaintMode.Pipeline) { - if (this.workingArea.paintingPipeline === null) { + if (this.workingArea.paintingShape === null) { this.workingArea.previewLineSegment.visible = true; this.workingArea.currentClickPoint.position = new PIXI.Point(this.workingArea.circleShadow.x, this.workingArea.circleShadow.y); @@ -408,19 +408,19 @@ export class AxImageShape extends AxShape { GameMode: this.workingArea.canvasData.gameMode, LinkedObjects: new Array(this.assetData.Id), }; - this.workingArea.paintingPipeline = new Pipeline(tempData, this.workingArea); - this.assetData.Pipelines.push(this.workingArea.paintingPipeline.assetData.Id); - this.workingArea.emit('createIcon', this.workingArea.paintingPipeline); + this.workingArea.paintingShape = new AxArrowConnector(tempData, this.workingArea,false,true); + this.assetData.Pipelines.push(this.workingArea.paintingShape.assetData.Id); + this.workingArea.emit('createIcon', this.workingArea.paintingShape); } else { this.workingArea.previewLineSegment.visible = false; this.workingArea.currentClickPoint.position = new PIXI.Point(this.workingArea.circleShadow.x, this.workingArea.circleShadow.y); this.workingArea.paintPoints.push(new PIXI.Point(x, y)); - this.workingArea.paintingPipeline.assetData.MultiPoint = + this.workingArea.paintingShape.assetData.MultiPoint = JSON.parse(JSON.stringify(this.workingArea.paintPoints)); - this.workingArea.paintingPipeline.assetData.LinkedObjects.push(this.assetData.Id); - this.assetData.Pipelines.push(this.workingArea.paintingPipeline.assetData.Id); - this.workingArea.paintingPipeline.refresh(); + this.workingArea.paintingShape.assetData.LinkedObjects.push(this.assetData.Id); + this.assetData.Pipelines.push(this.workingArea.paintingShape.assetData.Id); + this.workingArea.paintingShape.redraw(); this.workingArea.initPipelineData(); } } diff --git a/src/app/working-area/model/axShape.ts b/src/app/working-area/model/axShape.ts index bd82842..9ff01a6 100644 --- a/src/app/working-area/model/axShape.ts +++ b/src/app/working-area/model/axShape.ts @@ -73,4 +73,8 @@ export class AxShape extends Container { redraw(): void { } + + refresh(): void{ + + } } diff --git a/src/app/working-area/model/multipointIcon.ts b/src/app/working-area/model/multipointIcon.ts index df2da6f..e60b148 100644 --- a/src/app/working-area/model/multipointIcon.ts +++ b/src/app/working-area/model/multipointIcon.ts @@ -1,11 +1,12 @@ import { WorkingAreaComponent } from '../working-area.component'; import { GameMode } from './gameMode'; import * as PIXI from 'pixi.js'; +import { AxShape } from './axShape'; /** * 多点连线 */ -export class MultipointIcon extends PIXI.Container { +export class MultipointIcon extends AxShape { public pointsData: PIXI.Point[]; public pointsGraphics: PIXI.Graphics[] = []; public iconsTilingSprite: PIXI.TilingSprite[] = []; @@ -34,8 +35,8 @@ export class MultipointIcon extends PIXI.Container { * @param texture 图片素材 * @param points 点集合 */ - constructor(public assetData: any, private workingArea: WorkingAreaComponent) { - super(); + constructor(assetData: any,workingArea: WorkingAreaComponent) { + super(assetData,workingArea); this.name = this.assetData.Id; this.pointsData = this.assetData.MultiPoint; this.x = this.assetData.Point.x; @@ -56,7 +57,7 @@ export class MultipointIcon extends PIXI.Container { icon.x = pointA.x; icon.y = pointA.y; icon.angle = angle; - icon.height = this.assetData.Thickness === 0 ? 32 : this.assetData.Thickness; + // icon.height = this.assetData.Thickness === 0 ? 32 : this.assetData.Thickness; this.iconsTilingSprite.push(icon); this.addChild(icon); if (i === 0) { @@ -173,50 +174,50 @@ export class MultipointIcon extends PIXI.Container { // this.text.scale.set(scale); // }); // 添加选中事件 - this.iconsTilingSprite.forEach((item, index, array) => { - item.interactive = true; - item.buttonMode = true; - item.on('mousedown', event => { - event.stopPropagation(); - this.workingArea.selection.selectOne(this); - if (this.workingArea.allowEdit && this.assetData.GameMode === this.workingArea.canvasData.gameMode) { - event.currentTarget.parent.data = event.data; - event.currentTarget.parent.alpha = 0.5; - event.currentTarget.parent.dragging = true; - - event.currentTarget.parent.dragPoint = event.data.getLocalPosition(event.currentTarget.parent.parent); - event.currentTarget.parent.dragPoint.x -= event.currentTarget.parent.x; - event.currentTarget.parent.dragPoint.y -= event.currentTarget.parent.y; - } - }) - .on('mouseup', event => { - if (event.currentTarget.parent.dragging) { - event.currentTarget.parent.alpha = 1; - event.currentTarget.parent.dragging = false; - event.currentTarget.parent.data = null; - } - }) - .on('mouseupoutside', event => { - if (event.currentTarget.parent.dragging) { - event.currentTarget.parent.alpha = 1; - event.currentTarget.parent.dragging = false; - event.currentTarget.parent.data = null; - } - }) - .on('mousemove', event => { - if (event.currentTarget.parent.dragging) { - const newPosition = event.currentTarget.parent.data.getLocalPosition(event.currentTarget.parent.parent); - event.currentTarget.parent.x = newPosition.x - event.currentTarget.parent.dragPoint.x; - event.currentTarget.parent.y = newPosition.y - event.currentTarget.parent.dragPoint.y; - - this.assetData.Point = new PIXI.Point(this.x, this.y); - this.workingArea.canvasData.isChange = true; - } - }) - .on('rightclick', event => { - - }); - }); + // this.iconsTilingSprite.forEach((item, index, array) => { + // item.interactive = true; + // item.buttonMode = true; + // item.on('mousedown', event => { + // event.stopPropagation(); + // this.workingArea.selection.selectOne(this); + // if (this.workingArea.allowEdit && this.assetData.GameMode === this.workingArea.canvasData.gameMode) { + // event.currentTarget.parent.data = event.data; + // event.currentTarget.parent.alpha = 0.5; + // event.currentTarget.parent.dragging = true; + + // event.currentTarget.parent.dragPoint = event.data.getLocalPosition(event.currentTarget.parent.parent); + // event.currentTarget.parent.dragPoint.x -= event.currentTarget.parent.x; + // event.currentTarget.parent.dragPoint.y -= event.currentTarget.parent.y; + // } + // }) + // .on('mouseup', event => { + // if (event.currentTarget.parent.dragging) { + // event.currentTarget.parent.alpha = 1; + // event.currentTarget.parent.dragging = false; + // event.currentTarget.parent.data = null; + // } + // }) + // .on('mouseupoutside', event => { + // if (event.currentTarget.parent.dragging) { + // event.currentTarget.parent.alpha = 1; + // event.currentTarget.parent.dragging = false; + // event.currentTarget.parent.data = null; + // } + // }) + // .on('mousemove', event => { + // if (event.currentTarget.parent.dragging) { + // const newPosition = event.currentTarget.parent.data.getLocalPosition(event.currentTarget.parent.parent); + // event.currentTarget.parent.x = newPosition.x - event.currentTarget.parent.dragPoint.x; + // event.currentTarget.parent.y = newPosition.y - event.currentTarget.parent.dragPoint.y; + + // this.assetData.Point = new PIXI.Point(this.x, this.y); + // this.workingArea.canvasData.isChange = true; + // } + // }) + // .on('rightclick', event => { + + // }); + // }); } /** * 设置点显示状态 @@ -235,10 +236,10 @@ export class MultipointIcon extends PIXI.Container { } // 刷新数据 public refresh() { - console.log(this.assetData); - this.iconsTilingSprite.forEach(element => { - element.height = this.assetData.Thickness === 0 ? 32 : this.assetData.Thickness; - }); + // console.log(this.assetData); + // this.iconsTilingSprite.forEach(element => { + // element.height = this.assetData.Thickness === 0 ? 32 : this.assetData.Thickness; + // }); this.text.text = this.assetData.Name + '\r\n' + this.assetData.PropertyInfos.find(item => item.PropertyName === '名称/编号')?.PropertyValue; diff --git a/src/app/working-area/model/pipeline.ts b/src/app/working-area/model/pipeline.ts deleted file mode 100644 index 74045ad..0000000 --- a/src/app/working-area/model/pipeline.ts +++ /dev/null @@ -1,328 +0,0 @@ -import { WorkingAreaComponent } from '../working-area.component'; -import * as PIXI from 'pixi.js'; -import { AxShape } from './axShape'; - -/** - * 管线 - */ -export class Pipeline extends AxShape { - public line: PIXI.Graphics = new PIXI.Graphics(); - constructor(assetData: any, workingArea: WorkingAreaComponent) { - super(assetData, workingArea); - this.name = this.assetData.Id; - this.moveable = false; - this.x = this.assetData.Point.x; - this.y = this.assetData.Point.y; - this.workingArea.backgroundImage.addChild(this); - this.addChild(this.line); - // 画线图标 - this.refresh(); - this.interactive = true; - this.on('mousedown', event => { - event.stopPropagation(); - this.workingArea.selection.selectOne(this); - }); - } - /** - * 刷新 - */ - public refresh() { - - const strokeWidth = 1; - const startWidth = 30 + strokeWidth; - const endWidth = 30 + strokeWidth; - const edgeWidth = 10; - const openEnded = false; - const markerStart = false; - const markerEnd = true; - const spacing = (openEnded) ? 0 : 0 + strokeWidth / 2; - const startSize = 30 + strokeWidth; - const endSize = 30 + strokeWidth; - const isRounded = true; - const pts = this.assetData.MultiPoint; - const c = this.line; - if (pts.length < 2) { return; } - // Base vector (between first points) - const pe = pts[pts.length - 1]; - - // Finds first non-overlapping point - let i0 = 1; - - while (i0 < pts.length - 1 && pts[i0].x === pts[0].x && pts[i0].y === pts[0].y) { - i0++; - } - - const dx = pts[i0].x - pts[0].x; - const dy = pts[i0].y - pts[0].y; - const dist = Math.sqrt(dx * dx + dy * dy); - - if (dist === 0) { - return; - } - - // Computes the norm and the inverse norm - let nx = dx / dist; - let nx1 = nx; - let nx2 = nx; - let ny = dy / dist; - let ny2 = ny; - let ny1 = ny; - let orthx = edgeWidth * ny; - let orthy = -edgeWidth * nx; - - // Stores the inbound function calls in reverse order in fns - const fns = []; - - // if (isRounded) { - // // c.setLineJoin('round'); - // c.lineTextureStyle({ join: PIXI.LINE_JOIN.ROUND }); - // } else if (pts.length > 2) { - // // Only mitre if there are waypoints - // // c.setMiterLimit(1.42); - // c.lineTextureStyle({ miterLimit: 1.42 }); - // } - // c.lineStyle(1, 0x000000, 1); - c.clear(); - c.lineTextureStyle({ width: 1, color: 0x00000, join: PIXI.LINE_JOIN.ROUND }); - // c.begin(); - c.beginFill(0xffffff); - const startNx = nx; - const startNy = ny; - - if (markerStart && !openEnded) { - this.paintMarker(c, pts[0].x, pts[0].y, nx, ny, startSize, startWidth, edgeWidth, spacing, true); - } else { - const outStartX = pts[0].x + orthx / 2 + spacing * nx; - const outStartY = pts[0].y + orthy / 2 + spacing * ny; - const inEndX = pts[0].x - orthx / 2 + spacing * nx; - const inEndY = pts[0].y - orthy / 2 + spacing * ny; - - if (openEnded) { - c.moveTo(outStartX, outStartY); - fns.push( () => { - c.lineTo(inEndX, inEndY); - }); - } else { - c.moveTo(inEndX, inEndY); - c.lineTo(outStartX, outStartY); - } - } - let dx1 = 0; - let dy1 = 0; - let dist1 = 0; - - for (let i = 0; i < pts.length - 2; i++) { - // Work out in which direction the line is bending - const pos = this.relativeCcw(pts[i].x, pts[i].y, pts[i + 1].x, pts[i + 1].y, pts[i + 2].x, pts[i + 2].y); - - dx1 = pts[i + 2].x - pts[i + 1].x; - dy1 = pts[i + 2].y - pts[i + 1].y; - - dist1 = Math.sqrt(dx1 * dx1 + dy1 * dy1); - - if (dist1 !== 0) { - nx1 = dx1 / dist1; - ny1 = dy1 / dist1; - - const tmp1 = nx * nx1 + ny * ny1; - const tmp = Math.max(Math.sqrt((tmp1 + 1) / 2), 0.04); - - // Work out the normal orthogonal to the line through the control point and the edge sides intersection - nx2 = (nx + nx1); - ny2 = (ny + ny1); - - const dist2 = Math.sqrt(nx2 * nx2 + ny2 * ny2); - - if (dist2 !== 0) { - nx2 = nx2 / dist2; - ny2 = ny2 / dist2; - - // Higher strokewidths require a larger minimum bend, 0.35 covers all but the most extreme cases - const strokeWidthFactor = Math.max(tmp, Math.min(1 / 200 + 0.04, 0.35)); - const angleFactor = (pos !== 0 && isRounded) ? Math.max(0.1, strokeWidthFactor) : Math.max(tmp, 0.06); - - const outX = pts[i + 1].x + ny2 * edgeWidth / 2 / angleFactor; - const outY = pts[i + 1].y - nx2 * edgeWidth / 2 / angleFactor; - const inX = pts[i + 1].x - ny2 * edgeWidth / 2 / angleFactor; - const inY = pts[i + 1].y + nx2 * edgeWidth / 2 / angleFactor; - - if (pos === 0 || !isRounded) { - // If the two segments are aligned, or if we're not drawing curved sections between segments - // just draw straight to the intersection point - c.lineTo(outX, outY); - - ((x, y) => { - fns.push(() => { - c.lineTo(x, y); - }); - })(inX, inY); - } else if (pos === -1) { - const c1x = inX + ny * edgeWidth; - const c1y = inY - nx * edgeWidth; - const c2x = inX + ny1 * edgeWidth; - const c2y = inY - nx1 * edgeWidth; - c.lineTo(c1x, c1y); - if (isRounded) { - c.quadraticCurveTo(outX, outY, c2x, c2y); // 圆角 - } else { - c.lineTo(outX, outY); - } - ((x, y) => { - fns.push(() => { - c.lineTo(x, y); - }); - })(inX, inY); - } else { - c.lineTo(outX, outY); - - ((x, y) => { - const c1x = outX - ny * edgeWidth; - const c1y = outY + nx * edgeWidth; - const c2x = outX - ny1 * edgeWidth; - const c2y = outY + nx1 * edgeWidth; - - fns.push(() => { - if (isRounded) { - c.quadraticCurveTo(x, y, c1x, c1y); - } else { - c.lineTo(x, y); - } - }); - fns.push(() => { - c.lineTo(c2x, c2y); - }); - })(inX, inY); - } - - nx = nx1; - ny = ny1; - } - } - } - orthx = edgeWidth * ny1; - orthy = - edgeWidth * nx1; - - if (markerEnd && !openEnded) { - this.paintMarker(c, pe.x, pe.y, -nx, -ny, endSize, endWidth, edgeWidth, spacing, false); - } else { - c.lineTo(pe.x - spacing * nx1 + orthx / 2, pe.y - spacing * ny1 + orthy / 2); - - const inStartX = pe.x - spacing * nx1 - orthx / 2; - const inStartY = pe.y - spacing * ny1 - orthy / 2; - - if (!openEnded) { - c.lineTo(inStartX, inStartY); - } else { - c.moveTo(inStartX, inStartY); - - fns.splice(0, 0, () => { - c.moveTo(inStartX, inStartY); - }); - } - } - - for (let i = fns.length - 1; i >= 0; i--) { - fns[i](); - } - c.closePath(); - c.endFill(); - // if (openEnded) - // { - // c.end(); - // c.stroke(); - // } - // else - // { - // c.close(); - // c.fillAndStroke(); - // } - - // Workaround for shadow on top of base arrow - // c.setShadow(false); - - // Need to redraw the markers without the low miter limit - // c.setMiterLimit(4); - - // if (isRounded) - // { - // c.setLineJoin('flat'); - // } - - // if (pts.length > 2) { - // // Only to repaint markers if no waypoints - // // Need to redraw the markers without the low miter limit - // // c.setMiterLimit(4); - // c.lineTextureStyle({ width: 1, color: 0x00000, miterLimit: 4 }); - // if (markerStart && !openEnded) { - // // c.begin(); - // this.paintMarker(c, pts[0].x, pts[0].y, startNx, startNy, startSize, startWidth, edgeWidth, spacing, true); - // // c.stroke(); - // // c.end(); - // // c.closePath(); - // } - - // if (markerEnd && !openEnded) { - // // c.begin(); - // this.paintMarker(c, pe.x, pe.y, -nx, -ny, endSize, endWidth, edgeWidth, spacing, true); - // // c.stroke(); - // // c.end(); - // // c.closePath(); - // } - // } - } - /** - * 画箭头 - * @param c - * @param ptX - * @param ptY - * @param nx - * @param ny - * @param size - * @param arrowWidth - * @param edgeWidth - * @param spacing - * @param initialMove - */ - paintMarker(c: PIXI.Graphics, ptX: number, ptY: number, nx: number, ny: number, - size: number, arrowWidth: number, edgeWidth: number, spacing: number, initialMove: boolean) { - const widthArrowRatio = edgeWidth / arrowWidth; - const orthx = edgeWidth * ny / 2; - const orthy = -edgeWidth * nx / 2; - - const spaceX = (spacing + size) * nx; - const spaceY = (spacing + size) * ny; - - if (initialMove) { - c.moveTo(ptX - orthx + spaceX, ptY - orthy + spaceY); - } else { - c.lineTo(ptX - orthx + spaceX, ptY - orthy + spaceY); - } - c.lineTo(ptX - orthx / widthArrowRatio + spaceX, ptY - orthy / widthArrowRatio + spaceY); - c.lineTo(ptX + spacing * nx, ptY + spacing * ny); - c.lineTo(ptX + orthx / widthArrowRatio + spaceX, ptY + orthy / widthArrowRatio + spaceY); - c.lineTo(ptX + orthx + spaceX, ptY + orthy + spaceY); - } - - relativeCcw(x1: number, y1: number, x2: number, y2: number, px: number, py: number) { - x2 -= x1; - y2 -= y1; - px -= x1; - py -= y1; - let ccw = px * y2 - py * x2; - - if (ccw === 0.0) { - ccw = px * x2 + py * y2; - - if (ccw > 0.0) { - px -= x2; - py -= y2; - ccw = px * x2 + py * y2; - - if (ccw < 0.0) { - ccw = 0.0; - } - } - } - return (ccw < 0.0) ? -1 : ((ccw > 0.0) ? 1 : 0); - } -} diff --git a/src/app/working-area/model/polygonIcon.ts b/src/app/working-area/model/polygonIcon.ts index a7d0eb9..20a4a5d 100644 --- a/src/app/working-area/model/polygonIcon.ts +++ b/src/app/working-area/model/polygonIcon.ts @@ -2,11 +2,12 @@ import { WorkingAreaComponent } from '../working-area.component'; import { GameMode } from './gameMode'; import * as PIXI from 'pixi.js'; import { PaintMode } from './paintModel'; +import { AxShape } from './axShape'; /** * 多边形 */ -export class PolygonIcon extends PIXI.Container { +export class PolygonIcon extends AxShape { public pointsData: PIXI.Point[]; public pointsGraphics: PIXI.Graphics[] = []; public polygonGraphics: PIXI.Graphics = new PIXI.Graphics(); @@ -35,8 +36,8 @@ export class PolygonIcon extends PIXI.Container { * * @param points 点集合 */ - constructor(public assetData: any, private workingArea: WorkingAreaComponent) { - super(); + constructor(assetData: any,workingArea: WorkingAreaComponent) { + super(assetData,workingArea); this.name = this.assetData.Id; this.x = this.assetData.Point.x; this.y = this.assetData.Point.y; @@ -140,64 +141,64 @@ export class PolygonIcon extends PIXI.Container { } }); }); - // 添加选中事件 - this.polygonGraphics.interactive = true; - this.polygonGraphics.buttonMode = true; - this.polygonGraphics - .on('mousedown', event => { - event.stopPropagation(); - this.workingArea.selection.selectOne(this); - if (this.workingArea.allowEdit && this.assetData.GameMode === this.workingArea.canvasData.gameMode) { - event.currentTarget.parent.data = event.data; - event.currentTarget.parent.alpha = 0.5; - event.currentTarget.parent.dragging = true; + // // 添加选中事件 + // this.polygonGraphics.interactive = true; + // this.polygonGraphics.buttonMode = true; + // this.polygonGraphics + // .on('mousedown', event => { + // event.stopPropagation(); + // this.workingArea.selection.selectOne(this); + // if (this.workingArea.allowEdit && this.assetData.GameMode === this.workingArea.canvasData.gameMode) { + // event.currentTarget.parent.data = event.data; + // event.currentTarget.parent.alpha = 0.5; + // event.currentTarget.parent.dragging = true; - event.currentTarget.parent.dragPoint = event.data.getLocalPosition(event.currentTarget.parent.parent); - event.currentTarget.parent.dragPoint.x -= event.currentTarget.parent.x; - event.currentTarget.parent.dragPoint.y -= event.currentTarget.parent.y; - } - }) - .on('mouseup', event => { - if (event.currentTarget.parent.dragging) { - event.currentTarget.parent.alpha = 1; - event.currentTarget.parent.dragging = false; - event.currentTarget.parent.data = null; - } - }) - .on('mouseupoutside', event => { - if (event.currentTarget.parent.dragging) { - event.currentTarget.parent.alpha = 1; - event.currentTarget.parent.dragging = false; - event.currentTarget.parent.data = null; - } - }) - .on('mousemove', event => { - if (event.currentTarget.parent.dragging) { - const newPosition = event.currentTarget.parent.data.getLocalPosition(event.currentTarget.parent.parent); - event.currentTarget.parent.x = newPosition.x - event.currentTarget.parent.dragPoint.x; - event.currentTarget.parent.y = newPosition.y - event.currentTarget.parent.dragPoint.y; + // event.currentTarget.parent.dragPoint = event.data.getLocalPosition(event.currentTarget.parent.parent); + // event.currentTarget.parent.dragPoint.x -= event.currentTarget.parent.x; + // event.currentTarget.parent.dragPoint.y -= event.currentTarget.parent.y; + // } + // }) + // .on('mouseup', event => { + // if (event.currentTarget.parent.dragging) { + // event.currentTarget.parent.alpha = 1; + // event.currentTarget.parent.dragging = false; + // event.currentTarget.parent.data = null; + // } + // }) + // .on('mouseupoutside', event => { + // if (event.currentTarget.parent.dragging) { + // event.currentTarget.parent.alpha = 1; + // event.currentTarget.parent.dragging = false; + // event.currentTarget.parent.data = null; + // } + // }) + // .on('mousemove', event => { + // if (event.currentTarget.parent.dragging) { + // const newPosition = event.currentTarget.parent.data.getLocalPosition(event.currentTarget.parent.parent); + // event.currentTarget.parent.x = newPosition.x - event.currentTarget.parent.dragPoint.x; + // event.currentTarget.parent.y = newPosition.y - event.currentTarget.parent.dragPoint.y; - this.assetData.Point = new PIXI.Point(this.x, this.y); - this.workingArea.canvasData.isChange = true; - } - }) - .on('rightclick', event => { - // this.workingArea.selection.deselectAll(); - }) - .on('mouseover', event => { - event.stopPropagation(); - if (this.workingArea.previewImage !== null - && this.workingArea.getPaintMode() === PaintMode.singlePointIcon) { - this.workingArea.previewImage.visible = false; - } - }) - .on('mouseout', event => { - event.stopPropagation(); - if (this.workingArea.previewImage !== null - && this.workingArea.getPaintMode() === PaintMode.singlePointIcon) { - this.workingArea.previewImage.visible = true; - } - }); + // this.assetData.Point = new PIXI.Point(this.x, this.y); + // this.workingArea.canvasData.isChange = true; + // } + // }) + // .on('rightclick', event => { + // // this.workingArea.selection.deselectAll(); + // }) + // .on('mouseover', event => { + // event.stopPropagation(); + // if (this.workingArea.previewImage !== null + // && this.workingArea.getPaintMode() === PaintMode.singlePointIcon) { + // this.workingArea.previewImage.visible = false; + // } + // }) + // .on('mouseout', event => { + // event.stopPropagation(); + // if (this.workingArea.previewImage !== null + // && this.workingArea.getPaintMode() === PaintMode.singlePointIcon) { + // this.workingArea.previewImage.visible = true; + // } + // }); } /** * 设置点显示状态 diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 688a14c..e211dce 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -10,12 +10,12 @@ import { AxImageShape } from './model/axImageShape'; import { GameMode } from './model/gameMode'; import { MultipointIcon } from './model/multipointIcon'; import { PolygonIcon } from './model/polygonIcon'; -import { Pipeline } from './model/pipeline'; import { PaintMode } from './model/paintModel'; import { AxShape } from './model/axShape'; import { PropertyInfo } from './model/PropertyInfo'; import { AxPreviewImageShape } from './model/axPreviewImageShape'; import { AxArrowConnector } from './model/axArrowConnector'; +import { Legend } from './model/legend'; @Component({ @@ -82,10 +82,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 绘制点集合 */ public paintPoints: PIXI.Point[] = []; - /** - * 绘制中的管线 - */ - public paintingPipeline: Pipeline = null; /** * 绘制中的多点图标 */ @@ -314,7 +310,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV */ this.on('select', obj => { if (this.allowEdit) { - if (obj instanceof MultipointIcon) { + if (obj instanceof AxArrowConnector) { + obj.setPointsVisible(true); + } + else if (obj instanceof MultipointIcon) { if (obj.assetData.GameMode === this.canvasData.gameMode) { obj.setPointVisiable(true); } else { @@ -338,7 +337,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV */ this.on('deselect', obj => { if (this.allowEdit) { - if (obj instanceof MultipointIcon) { + if (obj instanceof AxArrowConnector) { + obj.setPointsVisible(false); + } + else if (obj instanceof MultipointIcon) { obj.setPointVisiable(false); } else if (obj instanceof PolygonIcon) { obj.filters = []; @@ -375,6 +377,12 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV } else if (item instanceof AxPreviewImageShape) { const data = 1 / scale; item.scale.set(data); + }else if (item instanceof AxArrowConnector) { + const data = 1 / scale; + item.text.scale.set(data); + item.pointSprites.forEach(point => { + point.scale.set(data); + }); } }); @@ -479,6 +487,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV await this.createBackgroundImage(this.canvasData.selectStorey.imageUrl); this.createFloorShape(); + this.createBuildingShape(); if (this.canvasData.gameMode === GameMode.Assignment) { this.createWorkNode(); } @@ -503,15 +512,48 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV break; case 3: if (floorData[key].Name === '水带') { - const pipeline = new Pipeline(floorData[key], this); - } else { - const wall = new AxArrowConnector(floorData[key], this); + const distance = new AxArrowConnector(floorData[key], this,false,true); + } else if(floorData[key].Name === '距离'){ + const distance = new AxArrowConnector(floorData[key], this,true,true); + }else if(floorData[key].Name === '普通墙' || floorData[key].Name === '承重墙'){ + const wall = new AxArrowConnector(floorData[key], this,false,false); } break; } }); } - + /** + * 创建建筑图形 + */ + private createBuildingShape() { + const buildingData = this.canvasData.originalcompanyBuildingData.data; + const floor = this.canvasData.selectStorey; + Object.keys(buildingData).forEach((key) => { + if (buildingData[key].FloorId === floor.id) { + switch (buildingData[key].InteractiveMode) { + case 0: + const singleIcon = new AxImageShape(buildingData[key], this); + singleIcon.moveable = this.allowEdit && this.canvasData.gameMode === singleIcon.assetData.GameMode; + break; + case 1: + const icon = new MultipointIcon(buildingData[key], this); + break; + case 2: + const polygonIcon = new PolygonIcon(buildingData[key], this); + break; + case 3: + if (buildingData[key].Name === '水带') { + const distance = new AxArrowConnector(buildingData[key], this, false, true); + } else if (buildingData[key].Name === '距离') { + const distance = new AxArrowConnector(buildingData[key], this, true, true); + } else if (buildingData[key].Name === '普通墙' || buildingData[key].Name === '承重墙') { + const wall = new AxArrowConnector(buildingData[key], this, false, false); + } + break; + } + } + }); + } private createWorkNode() { // 加载处置节点数据 const nodeData = this.canvasData.selectPanelPoint.Data; @@ -530,7 +572,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV const polygonIcon = new PolygonIcon(nodeData[key][tempKey], this); break; case 3: - const pipeline = new Pipeline(nodeData[key][tempKey], this); + const pipeline = new AxArrowConnector(nodeData[key][tempKey], this,false,true); break; } }); @@ -763,20 +805,20 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV break; case PaintMode.Pipeline: if (this.canvasData.selectTemplateData.name === '水带') { - if (this.paintingPipeline !== null) { + if (this.paintingShape !== null) { this.currentClickPoint.position = new PIXI.Point(this.circleShadow.x, this.circleShadow.y); this.paintPoints.push(new PIXI.Point(this.circleShadow.x, this.circleShadow.y)); - this.paintingPipeline.assetData.MultiPoint = JSON.parse(JSON.stringify(this.paintPoints)); - this.paintingPipeline.refresh(); + this.paintingShape.assetData.MultiPoint = JSON.parse(JSON.stringify(this.paintPoints)); + this.paintingShape.refresh(); } } else { this.previewLineSegment.visible = true; + this.enterPaintEndButton.position = this.circleShadow.position; + this.enterPaintEndButton.visible = true; this.currentClickPoint.position = new PIXI.Point(this.circleShadow.x, this.circleShadow.y); this.paintPoints.push(new PIXI.Point(this.circleShadow.x, this.circleShadow.y)); - - if (this.paintPoints.length >= 2) { - this.enterPaintEndButton.position = this.circleShadow.position; - this.enterPaintEndButton.visible = true; + if (this.paintPoints.length < 2) { + return; } if (this.paintingShape === null) { const jsonObject = JSON.parse(JSON.stringify(this.canvasData.selectTemplateData.propertyInfos)); @@ -809,7 +851,11 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV IsFromBuilding: this.canvasData.selectTemplateData.isFromBuilding, GameMode: this.canvasData.gameMode }; - this.paintingShape = new AxArrowConnector(assetData2, this); + if (this.canvasData.selectTemplateData.name === '距离') { + this.paintingShape = new AxArrowConnector(assetData2, this,true,true); + } else if (this.canvasData.selectTemplateData.name === '普通墙' || this.canvasData.selectTemplateData.name === '承重墙') { + this.paintingShape = new AxArrowConnector(assetData2, this,false,false); + } } else { this.paintingShape.assetData.MultiPoint = JSON.parse(JSON.stringify(this.paintPoints)); this.paintingShape.redraw(); @@ -1009,7 +1055,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV */ public initPipelineData(): void { this.paintPoints = []; - this.paintingPipeline = null; + this.paintingShape = null; } public beginPaintingArrows(): void { this.paintMode = PaintMode.Arrows; @@ -1064,10 +1110,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.backgroundImage.removeChild(this.paintingIcon); } - if (this.paintingPipeline !== undefined - && this.paintingPipeline !== null) { - this.backgroundImage.removeChild(this.paintingPipeline); - } + // if (this.paintingShape !== undefined + // && this.paintingShape !== null) { + // this.backgroundImage.removeChild(this.paintingShape); + // } if (this.paintingShape !== null) { this.backgroundImage.removeChild(this.paintingShape); this.paintingShape = null; @@ -1196,8 +1242,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV const polygonIcon = new PolygonIcon(newData, this); break; case PaintMode.Pipeline: - if (item.Name !== '水带') { - const wall = new AxArrowConnector(newData, this); + if (item.Name === '距离') { + const wall = new AxArrowConnector(newData, this,true,true); + } else if (item.Name === '普通墙' || item.Name === '承重墙') { + const wall = new AxArrowConnector(newData, this,false,false); } break; } From de1886a68be846feacd00ad20e2a2c15f3d5bfad Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Fri, 25 Dec 2020 11:03:06 +0800 Subject: [PATCH 03/22] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=B4=A0=E6=9D=90=E4=B8=8D=E6=9B=B4=E6=96=B0=E6=B6=88=E9=98=B2?= =?UTF-8?q?=E8=A6=81=E7=B4=A0tree?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collection-tools-examinee/collection-tools.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 24bcc7e..0549d99 100644 --- a/src/app/ui/collection-tools-examinee/collection-tools.component.ts +++ b/src/app/ui/collection-tools-examinee/collection-tools.component.ts @@ -515,11 +515,11 @@ export class CollectionToolsExamineeComponent implements OnInit { }) // 监听canvas组件新增素材事件 this.canvas.on("createIcon",obj=>{ - this.renovateTreeData(false) + // this.renovateTreeData(false) }) // 监听canvas组件删除素材事件 this.canvas.on("deleteIcon",obj=>{ - this.renovateTreeData(false) + // this.renovateTreeData(false) }) From 6b90c51ae3be5ab4fcf52bc688ba1a86ab3bd4b2 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Fri, 25 Dec 2020 11:43:15 +0800 Subject: [PATCH 04/22] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=B4=A0=E6=9D=90tag=E4=B8=BA1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collection-tools.component.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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 0549d99..8acac5c 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 } from '@angular/core'; +import { Component, OnInit, Inject, ViewChild,ElementRef,Renderer2, ViewContainerRef, ɵConsole } 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'; @@ -483,6 +483,9 @@ export class CollectionToolsExamineeComponent implements OnInit { .subscribe((data:any) => { console.log(index,data) if(data && data.length != 0){ + data.forEach(item => { + item.tag = 1 + }) element.images = data this.basicAssetLibraries.push( element @@ -492,7 +495,7 @@ export class CollectionToolsExamineeComponent implements OnInit { }) }) } - console.log(55555,this.basicAssetLibraries) + // console.log(55555,this.basicAssetLibraries) this.allLibrary = [...this.originalallLibrary,...this.basicAssetLibraries] }) @@ -508,6 +511,7 @@ export class CollectionToolsExamineeComponent implements OnInit { this.canvas.on("select",obj=>{ //选中素材属性注入函数 this.setAssetsProperty(obj.assetData) + }) // 监听canvas组件取消选中素材事件 this.canvas.on("deselect",obj=>{ @@ -515,6 +519,7 @@ export class CollectionToolsExamineeComponent implements OnInit { }) // 监听canvas组件新增素材事件 this.canvas.on("createIcon",obj=>{ + console.log(obj.assetData) // this.renovateTreeData(false) }) // 监听canvas组件删除素材事件 @@ -1076,7 +1081,8 @@ export class CollectionToolsExamineeComponent implements OnInit { let examParams = { sitePlanId : e.id, - examinationId : this.route.snapshot.queryParams.examId + examinationId : this.route.snapshot.queryParams.examId, + planComponentId : this.route.snapshot.queryParams.planComponentId } this.http.get('/api/ExamSitePlanData',{params:examParams}).subscribe((data:any)=>{ console.log("cnm1",data) @@ -1098,7 +1104,8 @@ export class CollectionToolsExamineeComponent implements OnInit { this.canvasData.originaleveryStoreyData.buildingAreaId? null : this.canvasData.originaleveryStoreyData.buildingAreaId = e.id || null let examParams = { buildingAreaId : e.id, - examinationId : this.route.snapshot.queryParams.examId + examinationId : this.route.snapshot.queryParams.examId, + planComponentId : this.route.snapshot.queryParams.planComponentId } this.http.get('/api/ExamBuildingAreaData',{params:examParams}).subscribe((data:any)=>{ console.log("cnm2",data) @@ -1430,6 +1437,7 @@ export class CollectionToolsExamineeComponent implements OnInit { //点击选中素材库图片时 selectImg (item,items,index) { + console.log(66666666,items) this.selectLibrary = item.name this.selectImage = items this.selectImageIndex = index From fd5d8e0604ffde30a085db4a87f9c52b203a3eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Fri, 25 Dec 2020 12:21:12 +0800 Subject: [PATCH 05/22] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debug.log | 1 + src/app/working-area/model/gameMode.ts | 3 +- .../working-area/working-area.component.ts | 85 ++++++++----------- 3 files changed, 37 insertions(+), 52 deletions(-) create mode 100644 debug.log diff --git a/debug.log b/debug.log new file mode 100644 index 0000000..012261b --- /dev/null +++ b/debug.log @@ -0,0 +1 @@ +[1225/112746.821:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) diff --git a/src/app/working-area/model/gameMode.ts b/src/app/working-area/model/gameMode.ts index feabdbb..d656a7f 100644 --- a/src/app/working-area/model/gameMode.ts +++ b/src/app/working-area/model/gameMode.ts @@ -3,5 +3,6 @@ */ export enum GameMode { BasicInformation, - Assignment + Assignment, + Examinee } \ No newline at end of file diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index e211dce..1ce8484 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -15,7 +15,6 @@ import { AxShape } from './model/axShape'; import { PropertyInfo } from './model/PropertyInfo'; import { AxPreviewImageShape } from './model/axPreviewImageShape'; import { AxArrowConnector } from './model/axArrowConnector'; -import { Legend } from './model/legend'; @Component({ @@ -274,7 +273,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.animator.update(); this.mousePosition = this.app.renderer.plugins.interaction.mouse.global; // 预览图片 - if (this.previewImage !== null) { + if (this.previewImage !== null && this.backgroundImage !== null) { this.previewImage.position = this.backgroundImage.toLocal(this.mousePosition); } @@ -391,17 +390,19 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 创建图标事件 */ this.on('createIcon', obj => { - if (obj.assetData.GameMode === GameMode.BasicInformation) { + if (obj.assetData.GameMode === GameMode.BasicInformation) { // 基本信息 // 添加楼层数据 this.canvasData.originaleveryStoreyData.data[obj.assetData.Id] = obj.assetData; // 添加建筑数据 this.canvasData.originalcompanyBuildingData.data[obj.assetData.Id] = obj.assetData; - } else { + } else if(obj.assetData.GameMode === GameMode.Assignment){ // 处置预案 if (this.canvasData.selectPanelPoint.Data === undefined || this.canvasData.selectPanelPoint.Data === null) { this.canvasData.selectPanelPoint.Data = new FloorNodeData(); } this.canvasData.selectPanelPoint.Data.Stock[obj.assetData.Id] = obj.assetData; + } else if (obj.assetData.GameMode === GameMode.Examinee) { // 考生考试 + // this.canvasData.examOriginaleveryStoreyData.data[obj.assetData.Id] = obj.assetData; } this.canvasData.isChange = true; }); @@ -474,30 +475,39 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.selection.select(obj); }); } - /** - * 刷新工作区 - */ + // /** + // * 刷新工作区 + // */ public async refresh() { this.setPaintMode(PaintMode.endPaint); this.resetCanvas(); this.destroyBackgroundImage(); if (!this.canvasData.selectStorey.imageUrl) { + return; } await this.createBackgroundImage(this.canvasData.selectStorey.imageUrl); - this.createFloorShape(); - this.createBuildingShape(); + this.createFloorShape(this.canvasData.originaleveryStoreyData.data); if (this.canvasData.gameMode === GameMode.Assignment) { - this.createWorkNode(); + this.createNodeShape(this.canvasData.selectPanelPoint.Data); } - this.emit('backgroundScale', this.backgroundImage.scale.x); + // await this.createBackground(this.canvasData.selectStorey.imageUrl); + + } + /** + * 异步创建背景图 + */ + public async createBackground(imageUrl:string) { + if (this.backgroundImage !== null) { + this.destroyBackgroundImage(); + } + await this.createBackgroundImage(imageUrl) } /** * 创建楼层图形 */ - private createFloorShape() { - const floorData = this.canvasData.originaleveryStoreyData.data; + public createFloorShape(floorData: any) { Object.keys(floorData).forEach((key) => { switch (floorData[key].InteractiveMode) { case 0: @@ -521,42 +531,12 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV break; } }); + this.emit('backgroundScale', this.backgroundImage.scale.x); } /** - * 创建建筑图形 + * 创建节点图形 */ - private createBuildingShape() { - const buildingData = this.canvasData.originalcompanyBuildingData.data; - const floor = this.canvasData.selectStorey; - Object.keys(buildingData).forEach((key) => { - if (buildingData[key].FloorId === floor.id) { - switch (buildingData[key].InteractiveMode) { - case 0: - const singleIcon = new AxImageShape(buildingData[key], this); - singleIcon.moveable = this.allowEdit && this.canvasData.gameMode === singleIcon.assetData.GameMode; - break; - case 1: - const icon = new MultipointIcon(buildingData[key], this); - break; - case 2: - const polygonIcon = new PolygonIcon(buildingData[key], this); - break; - case 3: - if (buildingData[key].Name === '水带') { - const distance = new AxArrowConnector(buildingData[key], this, false, true); - } else if (buildingData[key].Name === '距离') { - const distance = new AxArrowConnector(buildingData[key], this, true, true); - } else if (buildingData[key].Name === '普通墙' || buildingData[key].Name === '承重墙') { - const wall = new AxArrowConnector(buildingData[key], this, false, false); - } - break; - } - } - }); - } - private createWorkNode() { - // 加载处置节点数据 - const nodeData = this.canvasData.selectPanelPoint.Data; + public createNodeShape(nodeData: any) { if (nodeData !== undefined && nodeData !== null) { Object.keys(nodeData).forEach((key) => { Object.keys(nodeData[key]).forEach((tempKey) => { @@ -578,6 +558,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV }); }); } + this.emit('backgroundScale', this.backgroundImage.scale.x); } /** * @@ -649,7 +630,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV /** * 创建背景图 */ - private async createBackgroundImage(imageUrl: string): Promise { + public async createBackgroundImage(imageUrl: string): Promise { const image = await PIXI.Texture.fromURL(imageUrl); this.backgroundImage = new PIXI.Sprite(image); this.backgroundImage.anchor.set(0.5); @@ -957,10 +938,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV if (!this.canvasData.selectStorey.imageUrl) { this.backgroundImage.visible = false; } else { - // this.backgroundImage.texture = PIXI.Texture.from(this.canvasData.selectStorey.imageUrl); - // this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle; - // this.backgroundImage.visible = true; - this.refresh(); + this.backgroundImage.texture = PIXI.Texture.from(this.canvasData.selectStorey.imageUrl); + this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle; + this.backgroundImage.visible = true; + // this.refresh(); } } /** @@ -968,6 +949,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV */ public destroyBackgroundImage(): void { this.app.stage.removeChild(this.backgroundImage); + this.backgroundImage = null; } /** * 设置背景图缩放 @@ -1046,6 +1028,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 开始绘制 */ public beginPaint() { + console.log(this.canvasData.selectTemplateData); this.selection.deselectAll(); this.setPaintMode(PaintMode.endPaint); this.setPaintMode(this.canvasData.selectTemplateData.interactiveMode); From 4bc09be25b88f3b00be1a3907a9b39db95a84478 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Fri, 25 Dec 2020 13:10:42 +0800 Subject: [PATCH 06/22] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A2=9E=E5=8A=A0=E5=BD=93=E5=89=8D=E6=A5=BC?= =?UTF-8?q?=E5=B1=82=E9=9C=80=E8=A6=81=E9=9C=80=E8=A6=81=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E6=A0=87=E9=9B=86=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/canvas-share-data.service.ts | 3 ++- .../collection-tools.component.ts | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/canvas-share-data.service.ts b/src/app/canvas-share-data.service.ts index 7b40b58..fa70878 100644 --- a/src/app/canvas-share-data.service.ts +++ b/src/app/canvas-share-data.service.ts @@ -25,7 +25,8 @@ export class CanvasShareDataService { examOriginaleveryStoreyData: 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 8acac5c..7bf0e5e 100644 --- a/src/app/ui/collection-tools-examinee/collection-tools.component.ts +++ b/src/app/ui/collection-tools-examinee/collection-tools.component.ts @@ -469,6 +469,9 @@ export class CollectionToolsExamineeComponent implements OnInit { //获得所有素材库 basicAssetLibraries:any = []//基本信息素材库 getAllAssetLibraries(Facilitiesitem){ + + this.canvasData.hiddenBasicInfoFacilities = Facilitiesitem.children + console.log(1314,this.canvasData.hiddenBasicInfoFacilities) this.basicAssetLibraries = [] this.http.get('/api/AssetLibraries').subscribe(async(data:any) => { console.log('素材库',data) @@ -941,7 +944,6 @@ 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 || {} )) //当前 楼层 数据 - console.log(566,storeyData.data) this.Facilities.forEach(item => { item.key == this.selectingSitePlan.id ? this.getAllAssetLibraries(item) : @@ -1085,7 +1087,6 @@ export class CollectionToolsExamineeComponent implements OnInit { planComponentId : this.route.snapshot.queryParams.planComponentId } this.http.get('/api/ExamSitePlanData',{params:examParams}).subscribe((data:any)=>{ - console.log("cnm1",data) this.canvasData.examOriginaleveryStoreyData = data || {} // 楼层原数据 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" @@ -1108,7 +1109,6 @@ export class CollectionToolsExamineeComponent implements OnInit { planComponentId : this.route.snapshot.queryParams.planComponentId } this.http.get('/api/ExamBuildingAreaData',{params:examParams}).subscribe((data:any)=>{ - console.log("cnm2",data) this.canvasData.examOriginaleveryStoreyData = data || {} // 楼层原数据 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" @@ -1498,7 +1498,7 @@ export class CollectionToolsExamineeComponent implements OnInit { let treeData = [] let data = JSON.parse(JSON.stringify( disposalNodedata || [] )) data.forEach(element => { - // this.defaultExpandedKeys.push(element.id) + element.title = element.name //name element.key = element.id //id element.children = [] //children @@ -1518,7 +1518,6 @@ export class CollectionToolsExamineeComponent implements OnInit { }) type == '题目' ? this.questionstreeData = [...treeData] : this.treeData = [...treeData] - // this.defaultExpandedKeys = [...this.defaultExpandedKeys] } //刷新 treeData 保存已展开节点 From 1ab99f9000d2d7ba77fc1bd904669e9cd6640b09 Mon Sep 17 00:00:00 2001 From: chenjingyu Date: Fri, 25 Dec 2020 13:50:00 +0800 Subject: [PATCH 07/22] =?UTF-8?q?[=E4=BF=AE=E6=94=B9]=E8=80=83=E5=AE=98?= =?UTF-8?q?=E9=98=85=E5=8D=B7=E9=A6=96=E9=A1=B5=E9=9D=A2=E7=9C=9F=E5=AE=9E?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mark-papers-index.component.html | 21 +++++----- .../mark-papers-index.component.ts | 36 +++++++++++++++-- .../mark-papers-two.component.html | 19 ++++----- .../mark-papers-two.component.ts | 40 +++++++++++++++---- 4 files changed, 86 insertions(+), 30 deletions(-) diff --git a/src/app/examiner/mark-papers-index/mark-papers-index.component.html b/src/app/examiner/mark-papers-index/mark-papers-index.component.html index 679b091..8489564 100644 --- a/src/app/examiner/mark-papers-index/mark-papers-index.component.html +++ b/src/app/examiner/mark-papers-index/mark-papers-index.component.html @@ -4,7 +4,7 @@ * @Author: sueRimn * @Date: 2020-12-14 16:30:31 * @LastEditors: sueRimn - * @LastEditTime: 2020-12-14 17:39:30 + * @LastEditTime: 2020-12-25 08:59:47 -->
@@ -35,21 +35,22 @@ - {{item.name}} - {{item.organization}} - {{item.startTime}} - {{item.overTime}} + {{item.title}} + 广西总队 + {{item.startTime|date:'yyyy-MM-dd HH:mm'}} + {{item.endTime|date:'yyyy-MM-dd HH:mm'}} - 阅卷 + 阅卷 - - + +
diff --git a/src/app/examiner/mark-papers-index/mark-papers-index.component.ts b/src/app/examiner/mark-papers-index/mark-papers-index.component.ts index c734389..62e2ce5 100644 --- a/src/app/examiner/mark-papers-index/mark-papers-index.component.ts +++ b/src/app/examiner/mark-papers-index/mark-papers-index.component.ts @@ -4,7 +4,7 @@ * @Author: sueRimn * @Date: 2020-12-14 16:30:31 * @LastEditors: sueRimn - * @LastEditTime: 2020-12-15 08:53:09 + * @LastEditTime: 2020-12-25 09:00:41 */ import { Component, OnInit, ViewChild, Inject } from '@angular/core'; import {HttpClient} from '@angular/common/http' @@ -36,19 +36,47 @@ export class MarkPapersIndexComponent implements OnInit { constructor(private router: Router,private activatedRoute: ActivatedRoute,public http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar) { } ngOnInit(): void { + this.getAlltabledate() } - dataSource = ELEMENT_DATA; + dataSource markName//试卷名称 markDate//考试日期 + //分页 + @ViewChild(MatPaginator, {static: true}) + pageEvent: PageEvent; + paginator: MatPaginator; + length:any; //共多少条数据 + pageSize:any; //每页条数 + pageSizeOptions: number[] = [10] //设置每页条数 + PageNumber:any //第几页 //重置功能 resert(){ this.markName=undefined this.markDate=undefined } //点击阅卷跳转 - markTwo(e){ + markTwo(e,id){ console.log(e) - this.router.navigate(['/home/mark-papers-index/mark-papers-two'],{queryParams:{'level':e}}) + this.router.navigate(['/home/mark-papers-index/mark-papers-two'],{queryParams:{'level':e,'id':id}}) + } + //获取表格信息 + getAlltabledate(){ + let paramsdata:any = { + PageNumber: this.PageNumber || '1', + PageSize: this.pageSizeOptions[0], + Sort: null, + SortType: null, + } + this.http.get("/api/Papers",{params:paramsdata}).subscribe((data:any)=>{ + this.dataSource=data.items + this.length=data.totalCount + console.log(this.dataSource) + }) + } + //分页事件 + chagePage(e){ + this.PageNumber = e.pageIndex+1 + this.getAlltabledate() } } diff --git a/src/app/examiner/mark-papers-two/mark-papers-two.component.html b/src/app/examiner/mark-papers-two/mark-papers-two.component.html index bef077e..d3e0535 100644 --- a/src/app/examiner/mark-papers-two/mark-papers-two.component.html +++ b/src/app/examiner/mark-papers-two/mark-papers-two.component.html @@ -4,7 +4,7 @@ * @Author: sueRimn * @Date: 2020-12-14 17:21:02 * @LastEditors: sueRimn - * @LastEditTime: 2020-12-15 09:21:32 + * @LastEditTime: 2020-12-25 11:26:01 -->
@@ -30,10 +30,10 @@ {{item.name}} - {{item.organization}} - {{item.startTime}} - {{item.testState}} - {{item.mark}} + 广西总队 + {{item.endTime|date:'yyyy-MM-dd HH:mm'}} + {{item.isMarked== true?"已阅卷":"未阅卷"}} + 90 阅卷 @@ -41,10 +41,11 @@ - - + +
diff --git a/src/app/examiner/mark-papers-two/mark-papers-two.component.ts b/src/app/examiner/mark-papers-two/mark-papers-two.component.ts index cd6cb36..b940f09 100644 --- a/src/app/examiner/mark-papers-two/mark-papers-two.component.ts +++ b/src/app/examiner/mark-papers-two/mark-papers-two.component.ts @@ -4,7 +4,7 @@ * @Author: sueRimn * @Date: 2020-12-14 17:21:02 * @LastEditors: sueRimn - * @LastEditTime: 2020-12-15 09:16:29 + * @LastEditTime: 2020-12-25 09:15:42 */ import { Component, OnInit, ViewChild, Inject } from '@angular/core'; import {HttpClient} from '@angular/common/http' @@ -19,11 +19,6 @@ const ELEMENT_DATA = [ {name: "张三三", organization: '浦东支队', startTime: "2020-09-19 10:00", mark: '120',testState:'未阅卷'}, {name: "提亚马特", organization: '黄埔支队', startTime: "2020-09-19 10:00", mark: '100',testState:'已阅卷'}, {name: "艾泽拉斯", organization: '徐汇支队', startTime: "2020-09-19 10:00", mark: '90',testState:'已阅卷'}, - /* {name: "富华酒店", organization: '普陀支队', startTime: "2020-09-19 10:00", overTime: '2020-09-19 12:00',testState:'开考中'}, - {name: "立新加油站", organization: '浦东支队', startTime: "2020-09-19 10:00", overTime: '2020-09-19 12:00',testState:'开考中'}, - {name: "富华酒店", organization: '宝山支队', startTime: "2020-07-19 10:00", overTime: '2020-07-19 12:00',testState:'已结束'}, - {name: "裕达国际酒店", organization: '浦东支队', startTime: "2020-08-19 10:00", overTime: '2020-08-19 12:00',testState:'已结束'}, - {name: "锦德大酒店", organization: '长宁支队', startTime: "2019-09-19 10:00", overTime: '2019-09-19 12:00',testState:'已结束'}, */ ]; @Component({ @@ -38,12 +33,43 @@ export class MarkPapersTwoComponent implements OnInit { ngOnInit(): void { this.activatedRoute.queryParams.subscribe(param=>{ this.headtext=param.level + this.getid=param.id //console.log(headName) }); + this.getAlltabledate() } headtext - dataSource = ELEMENT_DATA; + getid//试卷id + dataSource markName//试卷名称 markDate//考试日期 + //分页 + @ViewChild(MatPaginator, {static: true}) + pageEvent: PageEvent; + paginator: MatPaginator; + length:any; //共多少条数据 + pageSize:any; //每页条数 + pageSizeOptions: number[] = [10] //设置每页条数 + PageNumber:any //第几页 + //获取表格信息 + getAlltabledate(){ + let paramsdata:any = { + PaperId:this.getid, + PageNumber: this.PageNumber || '1', + PageSize: this.pageSizeOptions[0], + Sort: null, + SortType: null, + } + this.http.get("/api/Examinations",{params:paramsdata}).subscribe((data:any)=>{ + this.dataSource=data.items + this.length=data.totalCount + console.log(this.dataSource) + }) + } + //分页事件 + chagePage(e){ + this.PageNumber = e.pageIndex+1 + this.getAlltabledate() + } } From fe6f1a468599bd0e0f67f6d04e28e97ee8b50023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Fri, 25 Dec 2020 14:17:30 +0800 Subject: [PATCH 08/22] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E8=80=83=E7=94=9F=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../working-area/working-area.component.ts | 79 +++++++++++++------ 1 file changed, 53 insertions(+), 26 deletions(-) diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 1ce8484..2373856 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -277,7 +277,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.previewImage.position = this.backgroundImage.toLocal(this.mousePosition); } - if (this.backgroundImage !== null) { + if (this.circleShadow !== null && this.backgroundImage !== null) { this.circleShadow.position = this.backgroundImage.toLocal(this.mousePosition); this.refreshPreviewLineSegment(this.currentClickPoint.position, this.circleShadow.position); } @@ -479,30 +479,51 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV // * 刷新工作区 // */ public async refresh() { - this.setPaintMode(PaintMode.endPaint); - this.resetCanvas(); - this.destroyBackgroundImage(); - if (!this.canvasData.selectStorey.imageUrl) { + this.loadExamineeData(); + // this.setPaintMode(PaintMode.endPaint); + // this.resetCanvas(); + // this.destroyBackgroundImage(); + // if (!this.canvasData.selectStorey.imageUrl) { - return; - } + // return; + // } - await this.createBackgroundImage(this.canvasData.selectStorey.imageUrl); - this.createFloorShape(this.canvasData.originaleveryStoreyData.data); - if (this.canvasData.gameMode === GameMode.Assignment) { - this.createNodeShape(this.canvasData.selectPanelPoint.Data); + // await this.createBackgroundImage(this.canvasData.selectStorey.imageUrl); + // this.createFloorShape(this.canvasData.originaleveryStoreyData.data); + // if (this.canvasData.gameMode === GameMode.Assignment) { + // this.createNodeShape(this.canvasData.selectPanelPoint.Data); + // } + } + /** + * 加载考生数据 + */ + public loadExamineeData() { + // 等待背景图下载完成并自动设置背景图缩放比例 + this.createBackground(); + this.refreshBackgroundImage(); + // 创建楼层数据图形(基本信息) + for (let key1 in this.canvasData.originaleveryStoreyData.data){ + for (let key2 in this.canvasData.hiddenBasicInfoFacilities){ + if (this.canvasData.originaleveryStoreyData.data[key1].Id==this.canvasData.hiddenBasicInfoFacilities[key2].Id) { + delete this.canvasData.originaleveryStoreyData.data[key1]; + } + } } - // await this.createBackground(this.canvasData.selectStorey.imageUrl); - + this.createFloorShape(this.canvasData.originaleveryStoreyData.data); + // 创建楼层数据图形(考生信息) + this.createFloorShape(this.canvasData.examOriginaleveryStoreyData.data); + // 创建节点数据图形(处置节点) + this.createNodeShape(this.canvasData.selectPanelPoint.Data); } /** * 异步创建背景图 */ - public async createBackground(imageUrl:string) { + public createBackground() { if (this.backgroundImage !== null) { - this.destroyBackgroundImage(); + this.backgroundImage.destroy(); + this.backgroundImage = null; } - await this.createBackgroundImage(imageUrl) + this.createBackgroundImage() } /** * 创建楼层图形 @@ -630,19 +651,16 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV /** * 创建背景图 */ - public async createBackgroundImage(imageUrl: string): Promise { - const image = await PIXI.Texture.fromURL(imageUrl); - this.backgroundImage = new PIXI.Sprite(image); + public createBackgroundImage(){ + this.backgroundImage = PIXI.Sprite.from('assets/images/noImg.png') this.backgroundImage.anchor.set(0.5); this.backgroundImage.x = this.app.view.width / 2; this.backgroundImage.y = this.app.view.height / 2; this.backgroundImage.interactive = true; this.backgroundImage.name = 'background'; this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle; - // const left = this.init.element.nativeElement.querySelector('.functionalDomainLeft').clientWidth; - // const right = this.init.element.nativeElement.querySelector('.functionalDomainRight').clientWidth; - const imageWidth = this.backgroundImage.texture.width; - const imageHeight = this.backgroundImage.texture.height; + const imageWidth = 665; + const imageHeight = 530; const appWidth = this.app.view.width - 470; const appHeight = this.app.view.height; @@ -934,14 +952,23 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV /** * 刷新背景图 */ - public refreshBackgroundImage(): void { + public async refreshBackgroundImage(): Promise { if (!this.canvasData.selectStorey.imageUrl) { this.backgroundImage.visible = false; } else { - this.backgroundImage.texture = PIXI.Texture.from(this.canvasData.selectStorey.imageUrl); + this.backgroundImage.texture = await PIXI.Texture.fromURL(this.canvasData.selectStorey.imageUrl); + const imageWidth = this.backgroundImage.texture.width; + const imageHeight = this.backgroundImage.texture.height; + const appWidth = this.app.view.width - 470; + const appHeight = this.app.view.height; + + const wScale = appWidth / imageWidth; + const hScale = appHeight / imageHeight; + + const scale = wScale < hScale? wScale: hScale; + this.backgroundImage.scale.set(scale); this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle; this.backgroundImage.visible = true; - // this.refresh(); } } /** From bcde2fd9b878e0149e6a57466e6b0f39f45a3499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Fri, 25 Dec 2020 14:22:20 +0800 Subject: [PATCH 09/22] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=80=83=E7=94=9F?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../working-area/working-area.component.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 2373856..7a4dbeb 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -498,10 +498,17 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 加载考生数据 */ public loadExamineeData() { - // 等待背景图下载完成并自动设置背景图缩放比例 - this.createBackground(); - this.refreshBackgroundImage(); - // 创建楼层数据图形(基本信息) + this.createBackground();// 创建背景图 + this.refreshBackgroundImage();// 刷新背景图 + this.processinghiddenData();// 处理数据 + this.createFloorShape(this.canvasData.originaleveryStoreyData.data);// 基本信息 + this.createFloorShape(this.canvasData.examOriginaleveryStoreyData.data);// 考生信息 + this.createNodeShape(this.canvasData.selectPanelPoint.Data);// 处置节点 + } + /** + * 处理隐藏数据 + */ + public processinghiddenData() { for (let key1 in this.canvasData.originaleveryStoreyData.data){ for (let key2 in this.canvasData.hiddenBasicInfoFacilities){ if (this.canvasData.originaleveryStoreyData.data[key1].Id==this.canvasData.hiddenBasicInfoFacilities[key2].Id) { @@ -509,11 +516,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV } } } - this.createFloorShape(this.canvasData.originaleveryStoreyData.data); - // 创建楼层数据图形(考生信息) - this.createFloorShape(this.canvasData.examOriginaleveryStoreyData.data); - // 创建节点数据图形(处置节点) - this.createNodeShape(this.canvasData.selectPanelPoint.Data); } /** * 异步创建背景图 From 96cef1385b075ff0eaf94260ad19d2eb4a80315e Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Fri, 25 Dec 2020 14:50:18 +0800 Subject: [PATCH 10/22] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=A5=BC=E5=B1=82=E9=A2=9C=E8=89=B2=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collection-tools.component.html | 10 ++++-- .../collection-tools.component.ts | 36 ++++++++++++------- .../ui/collection-tools-examinee/panel.scss | 3 ++ 3 files changed, 35 insertions(+), 14 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 1ebe622..42461f7 100644 --- a/src/app/ui/collection-tools-examinee/collection-tools.component.html +++ b/src/app/ui/collection-tools-examinee/collection-tools.component.html @@ -20,6 +20,9 @@ + + +
@@ -27,7 +30,7 @@
+ [ngClass]="{'selectSitePlan': selectSitePlanIndex==key,'selectSitePlanColor':item.isLabel}" (click)='selectSitePlan(item,key)'> {{item.name}}
@@ -39,6 +42,9 @@
+ + +
@@ -101,7 +107,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 0d7652a..203885b 100644 --- a/src/app/ui/collection-tools-examinee/collection-tools.component.ts +++ b/src/app/ui/collection-tools-examinee/collection-tools.component.ts @@ -855,6 +855,7 @@ export class CollectionToolsExamineeComponent implements OnInit { //打开消防设施考题设定 openFireExamination () { + console.log(this.selectingSitePlan) let treeData = JSON.parse( JSON.stringify(this.dataSource.data) ) let buildFloorData = { buildingData:this.beforeOneCheckedBuilding, From d373284c0fb1b8b8edc0565bbdecdf79e4658184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Fri, 25 Dec 2020 17:11:35 +0800 Subject: [PATCH 18/22] =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/working-area/working-area.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 7aff1b1..a43f6ef 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -967,7 +967,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV /** * 刷新背景图 */ - public async refreshBackgroundImage(imageUrl:string,imageAngle:number): Promise { + public async refreshBackgroundImage(imageUrl:string = this.canvasData.selectStorey.imageUrl,imageAngle:number = this.canvasData.selectStorey.imageAngle): Promise { if (!imageUrl) { this.backgroundImage.visible = false; } else { From 55ae1cebb94eaa3a3b41622aa4d529c1166a877b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Fri, 25 Dec 2020 17:24:35 +0800 Subject: [PATCH 19/22] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=A3=80=E7=B4=A2?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/working-area/working-area.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index a43f6ef..18a35f5 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -513,6 +513,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.processinghiddenData(); } this.createFloorShape(this.canvasData.originaleveryStoreyData.data); + console.log(this.canvasData.selectStorey); this.createNodeShape(this.canvasData.selectPanelPoint.Data); } /** @@ -520,7 +521,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV */ public processinghiddenData() { for (let key in this.canvasData.originaleveryStoreyData.data){ - if (this.canvasData.hiddenBasicInfoFacilities.indexOf(key)) { + if (this.canvasData.hiddenBasicInfoFacilities.indexOf(key)!==-1) { delete this.canvasData.originaleveryStoreyData.data[key]; } } From b34d3b2c6a9125ed9951cb535892a2dcefb711a3 Mon Sep 17 00:00:00 2001 From: qq55341701 <55341701@qq.com> Date: Fri, 25 Dec 2020 19:40:30 +0800 Subject: [PATCH 20/22] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/canvas-share-data.service.ts | 2 +- .../collection-tools.component.ts | 109 ++++++++++-------- .../collection-tools.component.ts | 1 + .../working-area/working-area.component.ts | 2 + 4 files changed, 63 insertions(+), 51 deletions(-) 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 0d7652a..4e11db3 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) } @@ -893,11 +886,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 ) @@ -906,6 +901,7 @@ export class CollectionToolsExamineeComponent implements OnInit { this.allFireElements[this.allFireElements.length-1].children.push(storeyData.data[key]) } } + this.handleTreeData(storeyData) //处理tree数据结构 } @@ -955,16 +951,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 @@ -982,9 +978,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 @@ -1035,19 +1030,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" @@ -1060,6 +1054,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" @@ -1382,8 +1377,6 @@ export class CollectionToolsExamineeComponent implements OnInit { this.originalallLibrary = data this.allLibrary = data this.selectImageIndex = -1 - console.log(654,this.allLibrary) - // this.canvas.cancelPaint() }) } @@ -1398,7 +1391,6 @@ export class CollectionToolsExamineeComponent implements OnInit { //点击选中素材库图片时 selectImg (item,items,index) { - console.log(66666666,items) this.selectLibrary = item.name this.selectImage = items this.selectImageIndex = index @@ -1439,7 +1431,6 @@ export class CollectionToolsExamineeComponent implements OnInit { //获取所有处置节点 getDisposalNode () { let api - console.log(4444,this.examType) api='/api/ExamDisposalNodes' this.selectDisposalNode = '' let params @@ -1494,8 +1485,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 => { @@ -1646,8 +1635,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 //选中 节点 @@ -1656,7 +1645,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' @@ -1689,10 +1684,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 } @@ -1704,7 +1707,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]; From 92564aedeffdf2294002e66160ff0570bf731565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Sat, 26 Dec 2020 08:53:13 +0800 Subject: [PATCH 21/22] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF=EF=BC=8C=E5=A4=84=E7=BD=AE?= =?UTF-8?q?=E9=A2=84=E6=A1=88=E5=9B=BE=E6=A0=87=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debug.log | 1 + src/app/working-area/model/axArrowConnector.ts | 1 + src/app/working-area/model/axImageShape.ts | 5 +---- src/app/working-area/model/axShape.ts | 2 ++ src/app/working-area/model/multipointIcon.ts | 1 + src/app/working-area/model/polygonIcon.ts | 1 + src/app/working-area/working-area.component.ts | 9 +++++---- 7 files changed, 12 insertions(+), 8 deletions(-) diff --git a/debug.log b/debug.log index 65a34a7..01d4421 100644 --- a/debug.log +++ b/debug.log @@ -1,2 +1,3 @@ [1225/112746.821:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) [1225/152100.333:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) +[1226/082525.401:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) diff --git a/src/app/working-area/model/axArrowConnector.ts b/src/app/working-area/model/axArrowConnector.ts index 8b72b39..e334a69 100644 --- a/src/app/working-area/model/axArrowConnector.ts +++ b/src/app/working-area/model/axArrowConnector.ts @@ -51,6 +51,7 @@ export class AxArrowConnector extends AxShape { this.drawPoints(); this.sortableChildren = true; this.text.zIndex = this.children.length; + this.text.visible = this.showName; } public drawPoints() { diff --git a/src/app/working-area/model/axImageShape.ts b/src/app/working-area/model/axImageShape.ts index b59bd9d..9654fca 100644 --- a/src/app/working-area/model/axImageShape.ts +++ b/src/app/working-area/model/axImageShape.ts @@ -139,10 +139,7 @@ export class AxImageShape extends AxShape { this.text.x = this.image.x; this.text.y = this.image.y - this.image.height / 2; this.text.anchor.set(0.5, 1); - - if (this.assetData.GameMode === 2) { - this.text.visible = false; - } + this.text.visible = this.showName; this.addChild(this.text); this.addChild(this.image); this.addChild(this.selectionBox); diff --git a/src/app/working-area/model/axShape.ts b/src/app/working-area/model/axShape.ts index 9ff01a6..14f1359 100644 --- a/src/app/working-area/model/axShape.ts +++ b/src/app/working-area/model/axShape.ts @@ -13,6 +13,8 @@ export class AxShape extends Container { moveable = true; // 可以被选中的 selectable = true; + // 是否显示名称 + showName = true; constructor(assetData: any, workingArea: WorkingAreaComponent) { super(); diff --git a/src/app/working-area/model/multipointIcon.ts b/src/app/working-area/model/multipointIcon.ts index e60b148..8be055f 100644 --- a/src/app/working-area/model/multipointIcon.ts +++ b/src/app/working-area/model/multipointIcon.ts @@ -64,6 +64,7 @@ export class MultipointIcon extends AxShape { this.text.anchor.set(0.5); this.text.position = icon.position; this.text.y -= this.assetData.Height; + this.text.visible = this.showName; this.addChild(this.text); } } diff --git a/src/app/working-area/model/polygonIcon.ts b/src/app/working-area/model/polygonIcon.ts index 20a4a5d..056cb42 100644 --- a/src/app/working-area/model/polygonIcon.ts +++ b/src/app/working-area/model/polygonIcon.ts @@ -73,6 +73,7 @@ export class PolygonIcon extends AxShape { this.text.anchor.set(0.5); this.text.position = this.calculatePolygonGravityCenter(this.pointsData); + this.text.visible = this.showName; // console.log(this.calculatePolygonGravityCenter(this.pointsData)); this.polygonGraphics.addChild(this.text); // 添加圆点事件 diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 18a35f5..90f51ee 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -513,8 +513,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.processinghiddenData(); } this.createFloorShape(this.canvasData.originaleveryStoreyData.data); - console.log(this.canvasData.selectStorey); this.createNodeShape(this.canvasData.selectPanelPoint.Data); + this.setNameVisible(false, 0); + this.setNameVisible(false, 1); } /** * 处理隐藏数据 @@ -555,11 +556,11 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV break; case 3: if (floorData[key].Name === '水带') { - const distance = new AxArrowConnector(floorData[key], this,false,true); + const distance = new AxArrowConnector(floorData[key], this, false, true); } else if(floorData[key].Name === '距离'){ - const distance = new AxArrowConnector(floorData[key], this,true,true); + const distance = new AxArrowConnector(floorData[key], this, true, true); }else if(floorData[key].Name === '普通墙' || floorData[key].Name === '承重墙'){ - const wall = new AxArrowConnector(floorData[key], this,false,false); + const wall = new AxArrowConnector(floorData[key], this, false, false); } break; } From 6189beb8157b9e6ab61464968c150844d5869026 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Sat, 26 Dec 2020 16:05:47 +0800 Subject: [PATCH 22/22] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=B6=88=E9=98=B2=E8=A6=81=E7=B4=A0=E5=92=8C?= =?UTF-8?q?=E5=B7=B2=E6=A0=87=E6=B3=A8=E6=B6=88=E9=98=B2=E8=A6=81=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collection-tools.component.html | 2 +- .../collection-tools.component.ts | 128 +++---- .../examinationQuestions.html | 8 +- .../examinationQuestions.ts | 343 +++++++----------- .../uploadQuestions.html | 36 +- .../collection-tools/examinationQuestions.ts | 3 +- .../working-area/working-area.component.ts | 2 - 7 files changed, 218 insertions(+), 304 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 4d4bab3..65f45c2 100644 --- a/src/app/ui/collection-tools-examinee/collection-tools.component.html +++ b/src/app/ui/collection-tools-examinee/collection-tools.component.html @@ -12,7 +12,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 bbd5273..a96284d 100644 --- a/src/app/ui/collection-tools-examinee/collection-tools.component.ts +++ b/src/app/ui/collection-tools-examinee/collection-tools.component.ts @@ -469,7 +469,10 @@ export class CollectionToolsExamineeComponent implements OnInit { }) } - //获得所有素材库 + // + /** + * 获得所有素材库 + */ basicAssetLibraries:any = []//基本信息素材库 getAllAssetLibraries(Facilitiesitem){ @@ -492,6 +495,7 @@ export class CollectionToolsExamineeComponent implements OnInit { await new Promise ((resolve,reject)=>{ this.http.get('/api/Assets',{params:params}) .subscribe((data:any) => { + if(data && data.length != 0){ data.forEach(item => { item.tag = 1 @@ -504,6 +508,7 @@ export class CollectionToolsExamineeComponent implements OnInit { resolve(1) }) }) + } this.allLibrary = [...this.originalallLibrary,...this.basicAssetLibraries] }) @@ -585,56 +590,54 @@ export class CollectionToolsExamineeComponent implements OnInit { SitePlanData.examinationId = this.route.snapshot.queryParams.examId SitePlanData.planComponentId = this.route.snapshot.queryParams.planComponentId - //如果是单位 总平面图 - if(this.checkedBuildingIndex==-1){ - //保存平面图数据 - SitePlanData.sitePlanId = this.selectingSitePlan.id - await new Promise((resolve,reject)=>{ - this.http.post("/api/ExamSitePlanData",SitePlanData,{ - params:{ - companyId:this.params.companyId - } - }).subscribe(data => { - console.log('保存基本素材成功') - resolve(1) - },err=>{ - console.log('保存基本素材失败') - resolve(1) - }) - }) - - - }else{ //如果是建筑 - SitePlanData.buildingAreaId = this.selectingSitePlan.id - //建筑平面图数据 - await new Promise((resolve,reject)=>{ - this.http.post("/api/ExamBuildingAreaData",SitePlanData,{ - params:{ - companyId:this.params.companyId - } - }).subscribe(data => { + //如果是单位 总平面图 + if(this.checkedBuildingIndex==-1){ + //保存平面图数据 + SitePlanData.sitePlanId = this.selectingSitePlan.id + await new Promise((resolve,reject)=>{ + this.http.post("/api/ExamSitePlanData",SitePlanData,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { console.log('保存基本素材成功') resolve(1) - },err=>{ - console.log('保存基本素材失败') - resolve(1) - }) + },err=>{ + console.log('保存基本素材失败') + resolve(1) }) - - } - const dialogRef = this.dialog.open(saveOneDialogExaminee, { - data: { - allDisposalNode: this.canvasData.allDisposalNode, - selectedBuildingData:this.beforeOneCheckedBuilding, - selectedSiteData:this.selectingSitePlan, - siteOrbuilding:this.checkedBuildingIndex, - disasterId: this.allFirePlan[0].id || '' - } - }); - - dialogRef.afterClosed().subscribe(result => { - console.log('The dialog was closed'); - }); + }) + }else{ //如果是建筑 + SitePlanData.buildingAreaId = this.selectingSitePlan.id + //建筑平面图数据 + await new Promise((resolve,reject)=>{ + this.http.post("/api/ExamBuildingAreaData",SitePlanData,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + console.log('保存基本素材成功') + resolve(1) + },err=>{ + console.log('保存基本素材失败') + resolve(1) + }) + }) + + } + const dialogRef = this.dialog.open(saveOneDialogExaminee, { + data: { + allDisposalNode: this.canvasData.allDisposalNode, + selectedBuildingData:this.beforeOneCheckedBuilding, + selectedSiteData:this.selectingSitePlan, + siteOrbuilding:this.checkedBuildingIndex, + disasterId: this.allFirePlan[0].id || '' + } + }); + + dialogRef.afterClosed().subscribe(result => { + console.log('The dialog was closed'); + }); } else { //if @@ -848,29 +851,20 @@ export class CollectionToolsExamineeComponent implements OnInit { //打开消防设施考题设定 openFireExamination () { - console.log(this.selectingSitePlan) - let treeData = JSON.parse( JSON.stringify(this.dataSource.data) ) + let buildFloorData = { buildingData:this.beforeOneCheckedBuilding, floorData:this.selectingSitePlan } - let data = { treeData: treeData,oldRealData:this.storeyData ,buildFloorData:buildFloorData} + let data = { oldRealData:this.storeyData ,buildFloorData:buildFloorData,Facilities:this.Facilities,allFireElements:this.allFireElements} let dialogRef = this.dialog.open(examinationQuestionsExaminee,{data}); } //上传考题 openUploadQuestions () { - let treeData = JSON.parse( JSON.stringify(this.dataSource.data) ) - let nodes = JSON.parse( JSON.stringify( JSON.parse(sessionStorage.getItem('examNodeList')) ) ) - if (nodes) { - let data = { treeData: treeData, question: JSON.parse( JSON.stringify(this.examMsg) ), node: nodes ,allFireElements:this.allFireElements} - let dialogRef = this.dialog.open(uploadQuestionsExaminee,{data}); - } else { - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('未选择考核处置节点','确定',config); - } + + let data = {allFireElements:this.allFireElements,Facilities:this.Facilities} + let dialogRef = this.dialog.open(uploadQuestionsExaminee,{data}); } //封装 刷新 tree 数据 @@ -892,7 +886,7 @@ export class CollectionToolsExamineeComponent implements OnInit { item.key == this.selectingSitePlan.id ? this.getAllAssetLibraries(item) : this.canvas.loadExamineeData() - }) : this.canvas.loadExamineeData() + }) : this.canvas.loadExamineeData();this.allLibrary = this.originalallLibrary for(let key in storeyData.data){ //筛选数据 storeyData.data[key].key = storeyData.data[key].Id @@ -954,7 +948,6 @@ export class CollectionToolsExamineeComponent implements OnInit { this.http.get('/api/SitePlans',{params:this.params}).subscribe(data=>{ this.sitePlanData = data console.log('建筑楼层数据',this.sitePlanData) - console.log('看看什么万一',this.Facilities) this.Facilities ? this.sitePlanData.forEach(item => { this.Facilities.forEach(i =>{ if(item.id == i.key){ @@ -981,6 +974,13 @@ export class CollectionToolsExamineeComponent implements OnInit { this.http.get('/api/BuildingAreas',{params}).subscribe(data=>{ this.sitePlanData = data console.log('预案平台当前有哪些楼层',this.sitePlanData) + 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 diff --git a/src/app/ui/collection-tools-examinee/examinationQuestions.html b/src/app/ui/collection-tools-examinee/examinationQuestions.html index 8bbd8fd..d92a7ee 100644 --- a/src/app/ui/collection-tools-examinee/examinationQuestions.html +++ b/src/app/ui/collection-tools-examinee/examinationQuestions.html @@ -1,15 +1,12 @@
-
消防设施考题设定
+
需要标记的消防设施
-
\ No newline at end of file diff --git a/src/app/ui/collection-tools-examinee/examinationQuestions.ts b/src/app/ui/collection-tools-examinee/examinationQuestions.ts index e79c55b..f03439f 100644 --- a/src/app/ui/collection-tools-examinee/examinationQuestions.ts +++ b/src/app/ui/collection-tools-examinee/examinationQuestions.ts @@ -7,7 +7,7 @@ import { FlatTreeControl } from '@angular/cdk/tree'; import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree'; import { NzFormatBeforeDropEvent, NzFormatEmitEvent,NzTreeComponent } from 'ng-zorro-antd/tree'; import { ActivatedRoute } from '@angular/router'; - +//查看需要标记的消防设施按钮 @Component({ selector: 'dialog-examination-questions', templateUrl: './examinationQuestions.html', @@ -20,40 +20,69 @@ export class examinationQuestionsExaminee { @ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent; - defaultCheckedKeys = []; //指定选中复选框的树节点 key值 - defaultExpandedKeys = []; //展开指定的树节点 key值 - defaultSelectedKeys = []; //指定选中的树节点 key值 renderData:any ngOnInit(): void { - this.renderData = this.data.treeData - if(JSON.parse(sessionStorage.getItem('tree型数据')) && JSON.parse(sessionStorage.getItem('tree型数据'))[this.data.buildFloorData.floorData.id]){ - this.defaultCheckedKeys = JSON.parse(sessionStorage.getItem('tree型数据'))[this.data.buildFloorData.floorData.id] - } - this.data.treeData.forEach(element => { - if(element.isTemplate){ - element.isLeaf = false - }else{ - element.isLeaf = true + let data = JSON.parse(JSON.stringify(this.data.Facilities)) + data ? data.forEach(item => { + let realData = item.children + let allFireElements = JSON.parse(JSON.stringify(this.data.allFireElements)) + item.children = this.processingData(allFireElements,realData) + }) :null + this.renderData = data + } + //处理数据 将消防要素模板与真实素材结合 + processingData(allFireElements,realData){ + allFireElements[allFireElements.length-1].children = [] + + realData.forEach(item => { + item.isLeaf = true + let noMatch = allFireElements.find( every=> every.id === item.FireElementId) + if (!noMatch) { + allFireElements[allFireElements.length-1].children.push(item) } - if(element.children && element.children.length != 0){ - element.children.forEach(ele => { - if(ele.isTemplate){ - ele.isLeaf = false - }else{ - ele.isLeaf = true + }) + let treeData = [] //tree型 处理完成后的数据 + allFireElements.forEach(element => { + element.key = element.id + element.name != '其他' ? element.children = [] : null + if(realData && realData.length != 0){ + realData.forEach(item => { + if(element.id == item.FireElementId){ + element.children.push(item) } - if(ele.children && ele.children.length != 0){ - ele.children.forEach(item => { - if(item.isTemplate){ - item.isLeaf = false - }else{ - item.isLeaf = true - } - - }); - }}) + }) } - }) + allFireElements.forEach(item => { if (item.parentId == element.id) {element.children.push(item)} }); + }); + allFireElements.forEach(element => { + if (!element.parentId) { treeData.push(element) } + }); + function recursionFilterEmpty(originalList, result) { +       for(let i = 0, length = originalList.length; i < length; i++) { +           const item = originalList[i]; +           if (item.PropertyInfos) { +               // 最内层 +               result.push(item); +           } else if (item.children && item.children.length) { +               const newChildren = []; +               // 递归调用,底层的真实数据会全部 push 进 newChildren 中 +               recursionFilterEmpty(item.children, newChildren); +               if (newChildren.length) { +                   // 替换原始数据 +                   item.children = newChildren; +                   // 子项有真实的数据,就保留这一项 +                   result.push(item); +               } // 如果没有这一项就会被删除 +           } +       } +   } +   function filterEmpty(listData) { +       const result = []; +       recursionFilterEmpty(listData, result); +       return result; +   } + return filterEmpty(treeData) + } @@ -63,87 +92,6 @@ export class examinationQuestionsExaminee { - //提交 - submit () { - - let oldTreeData = this.nzTreeComponent.getCheckedNodeList() - - let alltreedata = JSON.parse(sessionStorage.getItem("tree型数据")) - let keyArr = [] - oldTreeData.forEach(element => { - keyArr.push(element.origin.key) - }) - if(alltreedata){ - //如果已经保存过当前楼层则替换 - alltreedata[this.data.buildFloorData.floorData.id] = keyArr - sessionStorage.setItem('tree型数据',JSON.stringify(alltreedata)) - }else{ - alltreedata = {} - alltreedata[this.data.buildFloorData.floorData.id] = keyArr - sessionStorage.setItem('tree型数据',JSON.stringify(alltreedata)) - } - - - let checkList = [] //只存真实素材 - for (const key in this.data.oldRealData.data) { - let element = this.data.oldRealData.data[key] - let isChecked = (this.nzTreeComponent.getTreeNodeByKey(key)).isChecked - isChecked? checkList.push(element) : null - } - //存储真实素材数据 - let basicAssetsId = [] - if(checkList && checkList.length != 0){ - checkList.forEach(item => { - basicAssetsId.push(item.TemplateId) - }) - } - basicAssetsId = Array.from(new Set(basicAssetsId)) - console.log(123,this.data.buildFloorData) - let obj = { - name:this.data.buildFloorData.buildingData.name + '-' + this.data.buildFloorData.floorData.name, - key:this.data.buildFloorData.floorData.id, - buildingId:this.data.buildFloorData.buildingData.id, - children:checkList, - basicAssetsId:basicAssetsId - } - - let data = JSON.parse(sessionStorage.getItem("消防设施"+sessionStorage.getItem('paperId'))) - - if(data && data.length != 0){ - console.log(1) - let ind = null - data.forEach((item,index) => { - if(item.key == obj.key){ - ind = index + 1 - } - }) - if(ind){ - if(checkList.length != 0){ - data[ind - 1].children = checkList - }else{ - data.splice(ind - 1,1) - } - - }else{ - data.push(obj) - } - sessionStorage.setItem("消防设施"+sessionStorage.getItem('paperId'),JSON.stringify(data)) - - }else{ - console.log(2) - data = [] - data[0] = obj - sessionStorage.setItem("消防设施"+sessionStorage.getItem('paperId'),JSON.stringify(data)) - } - - - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('当层消防设施考题设置完成','确定',config); - this.dialogRef.close() - } - } @@ -157,29 +105,81 @@ export class uploadQuestionsExaminee { constructor(private http:HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data,private route:ActivatedRoute) {} - - defaultCheckedKeys = []; //指定选中复选框的树节点 key值 - defaultExpandedKeys = []; //展开指定的树节点 key值 - defaultSelectedKeys = []; //指定选中的树节点 key值 + + + + renderData:any + labeledOfBasicIcon:any //当前页面各建筑各楼层已标注的基本信息集合 + async ngOnInit(): Promise { + let params = { + examinationId : this.route.snapshot.queryParams.examId, + planComponentId : this.route.snapshot.queryParams.planComponentId + } + let SitePlanData + let BuildingPlanData + await new Promise((resolve,reject) => { + this.http.get('/api/ExamSitePlanData/ExamData',{params}).subscribe(data => { + SitePlanData = data + resolve(1) + }) + }) + await new Promise((resolve,reject) => { + this.http.get('/api/ExamBuildingAreaData/ExamData',{params}).subscribe(data => { + BuildingPlanData = data + resolve(2) + }) + }) + this.labeledOfBasicIcon = [...SitePlanData,...BuildingPlanData] - ngOnInit(): void { - let data = JSON.parse(sessionStorage.getItem("消防设施"+sessionStorage.getItem('paperId'))) + + let data = JSON.parse(JSON.stringify(this.data.Facilities)) + console.log('一共有哪几层需要标注',data) data ? data.forEach(item => { let realData = item.children - item.children = this.processingData(this.data.allFireElements,realData) + let allFireElements = JSON.parse(JSON.stringify(this.data.allFireElements)) + item.children = this.processingData(allFireElements,realData,item.key) }) :null + this.renderData = data - this.getProfiles() - this.nodeInit() } + + //处理数据 将消防要素模板与真实素材结合 - processingData(allFireElements,realData){ + processingData(allFireElements,realData,key){ + + //key为当前处理数据的层id + + allFireElements[allFireElements.length-1].children = [] + + //数组根据某个属性去重 (一类素材只保留一个) + const res = new Map(); + realData = realData.filter((a) => !res.has(a.TemplateId) && res.set(a.TemplateId, 1)) + console.log('当层需要标记的',realData) + this.labeledOfBasicIcon.forEach(item => { + if(item.sitePlanId == key || item.buildingAreaId == key ){ + let data = JSON.parse(item.data) + console.log('当层已经标记的',data) + let arr = [] + for (const key in data) { + arr.push(data[key]) + } + realData.forEach(i => { + let isexist = arr.some((ele)=>{ + return ele.TemplateId == i.TemplateId + }) + isexist ? i.xxx = true : null + console.log(666,isexist) + }) + } + }) + + realData.forEach(item => { item.isLeaf = true - let noMatch = allFireElements.find( every=> every.id === item.FireElementId ) + let noMatch = allFireElements.find( every=> every.id === item.FireElementId) if (!noMatch) { allFireElements[allFireElements.length-1].children.push(item) } @@ -188,7 +188,7 @@ export class uploadQuestionsExaminee { allFireElements.forEach(element => { element.key = element.id element.name != '其他' ? element.children = [] : null - if(realData){ + if(realData && realData.length != 0){ realData.forEach(item => { if(element.id == item.FireElementId){ element.children.push(item) @@ -201,23 +201,23 @@ export class uploadQuestionsExaminee { if (!element.parentId) { treeData.push(element) } }); function recursionFilterEmpty(originalList, result) { -       for(let i = 0, length = originalList.length; i < length; i++) { -           const item = originalList[i]; -           if (item.PropertyInfos) { -               // 最内层 -               result.push(item); -           } else if (item.children && item.children.length) { -               const newChildren = []; -               // 递归调用,底层的真实数据会全部 push 进 newChildren 中 -               recursionFilterEmpty(item.children, newChildren); -               if (newChildren.length) { -                   // 替换原始数据 -                   item.children = newChildren; -                   // 子项有真实的数据,就保留这一项 -                   result.push(item); -               } // 如果没有这一项就会被删除 -           } -       } +       for(let i = 0, length = originalList.length; i < length; i++) { +           const item = originalList[i]; +           if (item.PropertyInfos) { +               // 最内层 +               result.push(item); +           } else if (item.children && item.children.length) { +               const newChildren = []; +               // 递归调用,底层的真实数据会全部 push 进 newChildren 中 +               recursionFilterEmpty(item.children, newChildren); +               if (newChildren.length) { +                   // 替换原始数据 +                   item.children = newChildren; +                   // 子项有真实的数据,就保留这一项 +                   result.push(item); +               } // 如果没有这一项就会被删除 +           } +       }   }   function filterEmpty(listData) {       const result = []; @@ -225,40 +225,7 @@ export class uploadQuestionsExaminee {       return result;   } return filterEmpty(treeData) - } - - //获取登录账号的个人资料 - Profiles:any - getProfiles(){ - this.http.get('/api/ExamAccounts/Profiles').subscribe(data => { - this.Profiles = data - }) - } - - nodeTreeData:any = []; //处置节点tree - //节点初始化 - nodeInit () { - let treeData = [] - this.data.node.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 - } - this.data.node.forEach(item=>{ - item.parentId === element.id? element.children.push(item) : null - }) - }); - this.data.node.forEach(element=>{ - !element.parentId? treeData.push(element) : null - }) - this.nodeTreeData = [...treeData] } nzEvent($event){ @@ -266,35 +233,7 @@ export class uploadQuestionsExaminee { } //上传 submit () { - console.log(this.data.question) - let body:any = { - id: this.route.snapshot.queryParams.paperplanId, - paperId: sessionStorage.getItem('paperId'), - planComponentId: sessionStorage.getItem('planId'), - examPlanType: this.route.snapshot.queryParams.openType == 1 ? 0 : 1, - creatorId: this.Profiles.id, - modifiedTime: new Date(), - isPublic: true, - title: this.route.snapshot.queryParams.planName, - mainPoint: this.data.question.keynote, - score: 0, - examFacilityAssetsData: sessionStorage.getItem('消防设施' + sessionStorage.getItem('paperId')) ? sessionStorage.getItem('消防设施' + sessionStorage.getItem('paperId')) : null, - examDisposalNodesData: sessionStorage.getItem('examNodeList') ? sessionStorage.getItem('examNodeList') : null, - companyId:sessionStorage.getItem('companyId') - } - - - this.http.put(`/api/PaperPlans/${this.route.snapshot.queryParams.paperplanId}`,body).subscribe(data => { - - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('设置完成,页面将于一秒后关闭','确定',config); - setTimeout(() => { - window.close() - }, 1000); - - }) + } diff --git a/src/app/ui/collection-tools-examinee/uploadQuestions.html b/src/app/ui/collection-tools-examinee/uploadQuestions.html index a891755..3178ae0 100644 --- a/src/app/ui/collection-tools-examinee/uploadQuestions.html +++ b/src/app/ui/collection-tools-examinee/uploadQuestions.html @@ -1,19 +1,14 @@
-
上传
-
考试要点
-
- -
-
考核消防设施
+
提交
+
考核消防设施:
+
- -
-
- -
-
考核处置节点
-
- - - - -
- +
diff --git a/src/app/ui/collection-tools/examinationQuestions.ts b/src/app/ui/collection-tools/examinationQuestions.ts index 8f1f1dc..bedf5f0 100644 --- a/src/app/ui/collection-tools/examinationQuestions.ts +++ b/src/app/ui/collection-tools/examinationQuestions.ts @@ -169,7 +169,8 @@ export class uploadQuestions { let data = JSON.parse(sessionStorage.getItem("消防设施"+sessionStorage.getItem('paperId'))) data ? data.forEach(item => { let realData = item.children - item.children = this.processingData(this.data.allFireElements,realData) + let allFireElements = JSON.parse(JSON.stringify(this.data.allFireElements)) + item.children = this.processingData(allFireElements,realData) }) :null this.renderData = data this.getProfiles() diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 26cd70a..90f51ee 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -521,8 +521,6 @@ 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];