diff --git a/src/app/key-unit/key-unit-management/key-unit-management.component.html b/src/app/key-unit/key-unit-management/key-unit-management.component.html index ea625a8..3f25a16 100644 --- a/src/app/key-unit/key-unit-management/key-unit-management.component.html +++ b/src/app/key-unit/key-unit-management/key-unit-management.component.html @@ -75,11 +75,11 @@
- + 🠊 - +
diff --git a/src/app/key-unit/key-unit-management/key-unit-management.component.ts b/src/app/key-unit/key-unit-management/key-unit-management.component.ts index 03424f3..90b7e9a 100644 --- a/src/app/key-unit/key-unit-management/key-unit-management.component.ts +++ b/src/app/key-unit/key-unit-management/key-unit-management.component.ts @@ -548,6 +548,8 @@ export class KeyUnitManagementComponent implements OnInit { this.PageNumber = 1 this.pageEvent.pageIndex = 0 this.integritySort = '' + this.integrityScoreMax=undefined + this.integrityScoreMin=undefined this.getAllKeyUnit(); } //编辑单位名称 diff --git a/src/app/ui/collection-tools-building/collection-tools.component.html b/src/app/ui/collection-tools-building/collection-tools.component.html index 76bf745..99130e4 100644 --- a/src/app/ui/collection-tools-building/collection-tools.component.html +++ b/src/app/ui/collection-tools-building/collection-tools.component.html @@ -24,7 +24,7 @@ - + @@ -174,7 +174,7 @@ -
+

面积(平方米)

{{canvasData.selectStorey.area}}

详情

@@ -183,7 +183,7 @@
-
+

{{assetName}}

@@ -315,8 +315,112 @@
-
+ + +
+
+

宽度(像素)

+ +

高度(像素)

+ +

角度

+
+ + +
+
+ +
+

厚度

+
+ + +
+
+
+
+ 颜色 +
+ +
+
+
+
    +
  • +
+
+ 透明度 + + {{colorDivSliderValue}}% +
+
+ +
+

{{item.PropertyName}}({{item.PhysicalUnit}})

+ +
+ +
+

{{item.PropertyName}}({{item.PhysicalUnit}})

+ +
+ +
+

{{item.PropertyName}}({{item.PhysicalUnit}})

+ +
+ + + +
+

{{item.PropertyName}}

+ + +
+ +
+

{{item.PropertyName}}

+ +
+ +
+

{{item.PropertyName}}

+ +
+
+
diff --git a/src/app/ui/collection-tools-building/collection-tools.component.ts b/src/app/ui/collection-tools-building/collection-tools.component.ts index fb2e03b..4a50aa3 100644 --- a/src/app/ui/collection-tools-building/collection-tools.component.ts +++ b/src/app/ui/collection-tools-building/collection-tools.component.ts @@ -17,7 +17,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service'; import { MaskLayerService } from 'src/app/mask-layer.service'; import * as ObjectID from 'bson-objectid'; - +import { AxMessageSystem } from 'src/app/working-area/model/axMessageSystem'; @Component({ selector: 'app-collection-tools-building', templateUrl: './collection-tools.component.html', @@ -83,9 +83,11 @@ export class CollectionToolsBuildingComponent implements OnInit { setTimeout(() => { obj.PropertyInfos.forEach(item => { if(item.PropertyType == 4){ - this.gallery = new Viewer(document.getElementById('viewerjs'),{ - url: 'data-original' - }); + if(document.getElementById('viewerjs')){ + this.gallery = new Viewer(document.getElementById('viewerjs'),{ + url: 'data-original' + }); + } } }) }, 0); @@ -607,23 +609,79 @@ export class CollectionToolsBuildingComponent implements OnInit { this.canvasData.isChange = true } - - isSixShow = true - isSixbtn = true //控制想定作业编辑按钮 isediticon = true //控制查看编辑模式的编辑模式小笔按钮 - ngOnInit(): void { - if(this.router.url.indexOf("keyUnit/viewunitinfo") != -1 || this.router.url.indexOf("keyUnit/editplaninfo")!= -1){ - this.isSixbtn = false - } - if(!this.isSixbtn && sessionStorage.getItem("six") == "edit"){ - this.isSixShow = true - } - if(!this.isSixbtn && sessionStorage.getItem("six") == "look"){ + isMultipleAsset:boolean = false//框选多个素材属性显隐 + multipleAsset:any = { + Width:null, + Height:null, + Angle:null, + Thickness:null, + Color:null, + PropertyInfos:[] + }//多个素材共同属性 + multipleAssetData:any//当前多选的素材 + firstMultipleAssetData:any//当前多选的第一个素材 + ngOnInit(): void { + let _this = this + AxMessageSystem.addListener('selectionChanged', ()=>{ + if(this.canvas.selection.size() == 1){//如果是单选 + this.isMultipleAsset = false + // console.log('单选',this.canvas.selection.first().assetData) + this.setAssetsProperty(this.canvas.selection.first().assetData) + }else if(this.canvas.selection.size()){ + // console.log('多选') + this.isShowProperty = true + this.multipleAssetData = this.canvas.selection.all() + this.firstMultipleAssetData = this.canvas.selection.first() + this.multipleAsset = { + Width:null, + Height:null, + Angle:null, + Thickness:null, + Color:null, + PropertyInfos:[] + } + this.isMultipleAsset = true + let firstAssetData = this.canvas.selection.first().assetData;//拿出第一个素材作为例子与其他素材进行对比 + let InteractiveMode = firstAssetData.InteractiveMode //素材连接方式 + let isInteractiveMode = this.canvas.selection.all().every(item => item.assetData.InteractiveMode === InteractiveMode) + if(isInteractiveMode){ + this.multipleAsset.InteractiveMode = InteractiveMode + } + let isFillMode = this.canvas.selection.all().every(item => item.assetData.FillMode === 0) //素材填充方式都为0 + if(isFillMode){ + this.multipleAsset.FillMode = 0 + } + this.canvas.selection.first().assetData.PropertyInfos.forEach(i => { + let index = 0 + this.canvas.selection.all().forEach(item => { + item.assetData.PropertyInfos.forEach(element => { + if(element.PropertyName == i.PropertyName && element.PropertyType == i.PropertyType && element.PropertyType != 3 && element.PropertyType != 4){ + index++ + if(index == this.canvas.selection.size()){ + let newElement = JSON.parse(JSON.stringify(element)) + newElement.PropertyValue = '' + this.multipleAsset.PropertyInfos.push(newElement) + } + } + }); + }) + }) + }else if(this.canvas.selection.size() == 0){ + this.isShowProperty = false + } + }, this) + + if(this.router.url.indexOf("keyUnit/viewunitinfo") != -1){ //查看模式 this.isEditPattern = false this.isediticon = false + this.canvasData.gameMode = GameMode.Assignment + } else if (this.router.url.indexOf("keyUnit/editplaninfo")!= -1) { //编辑模式 + this.canvasData.gameMode = GameMode.BasicInformation } + //gis模块平面图 if(this.router.url.indexOf("gis") != -1 && sessionStorage.getItem("gisplan") == "look"){ this.isEditPattern = false @@ -641,30 +699,121 @@ export class CollectionToolsBuildingComponent implements OnInit { event.preventDefault(); }; }) - + this.canvasData.getMessage().subscribe((message: any)=>{ if(message == "send a message"){ this.refurbishTreeData() } }) } + //多选宽度共同改变 + multipleAssetWidthInput(){ + this.multipleAssetData.forEach(item=>{ + item.assetData.Width = this.multipleAsset.Width + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + }) + } + //多选高度共同改变 + multipleAssetHeightInput(){ + this.multipleAssetData.forEach(item=>{ + item.assetData.Height = this.multipleAsset.Height + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + }) + } + //多选角度共同改变 + multipleAssetAngleInput(){ + this.multipleAssetData.forEach(item=>{ + item.assetData.Angle = this.multipleAsset.Angle + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + }) + } + //多选厚度共同改变 + multipleAssetThicknessInput(){ + this.multipleAssetData.forEach(item=>{ + item.assetData.Thickness = this.multipleAsset.Thickness + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + }) + } + //多选颜色共同改变 + multipleSelectedcolor:any + multipleAssetSelectcolor(item,key){ + //在当前透明度基础上改变颜色 + this.multipleSelectedcolor = item + this.multipleAssetData.forEach(item=>{ + item.assetData.Color = this.multipleSelectedcolor + this.canvasData.isChange = true + this.canvas.refreshIcon(item.assetData.Id) + }) + } + //多选颜色滑竿改变 + multipleColorDivSliderChange(){ + let colorOpacity = Math.round(255 * this.colorDivSliderValue * 0.01) + //根据滑竿值改变16进制颜色后两位 + function replacepos(text,start,stop,replacetext){ + let mystr = text.substring(0,stop-1)+replacetext+text.substring(stop+1); + return mystr; + } + this.multipleAssetData.forEach(item=>{ + this.multipleSelectedcolor = replacepos(this.multipleSelectedcolor,7,8,colorOpacity.toString(16)) + item.assetData.Color = this.multipleSelectedcolor + this.canvasData.isChange = true + this.canvas.refreshIcon(item.assetData.Id) + }) + } + //多选状态动态属性素材input框值改变 + multipleAssetInputChange(i,e){ + e.stopPropagation() + this.multipleAssetData.forEach(item=>{ + // console.log(item) + item.assetData.PropertyInfos.forEach(element => { + if(element.PropertyName == i.PropertyName){ + element.PropertyValue = i.PropertyValue + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + } + }) + }) + } + //多选状态动态属性素材radio框值改变 + multipleAssetRadioChange(i,value){ + // e.stopPropagation() + this.multipleAssetData.forEach(item=>{ + // console.log(item) + item.assetData.PropertyInfos.forEach(element => { + if(element.PropertyName == i.PropertyName){ + element.PropertyValue = value + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + } + }) + }) + } + //多选状态动态属性素材下拉框值改变 + multipleSupplyArea(i,e){ + e.stopPropagation() + this.multipleAssetData.forEach(item=>{ + // console.log(item) + item.assetData.PropertyInfos.forEach(element => { + if(element.PropertyName == i.PropertyName){ + element.PropertyValue = i.PropertyValue + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + } + }) + }) + } ngAfterViewInit(): void { - //gis模块平面图 - if(this.router.url.indexOf("gis") == -1) { + //不是gis模块平面图 + if(this.router.url.indexOf("gis") == -1) { this.getAllBuildings(true) //获取所有建筑 - } - // 监听canvas组件选中素材事件 - this.canvas.on("select",obj=>{ - //选中素材属性注入函数 - this.setAssetsProperty(obj.assetData) - }) - // 监听canvas组件取消选中素材事件 - this.canvas.on("deselect",obj=>{ - this.isShowProperty = false - }) + } //监听数据变化后 this.canvas.on('canvasDataChanged',()=>{ // 收到数据表示共享数据发生变化 diff --git a/src/app/ui/collection-tools-plan/collection-tools.component.html b/src/app/ui/collection-tools-plan/collection-tools.component.html index ac69822..4d4abdd 100644 --- a/src/app/ui/collection-tools-plan/collection-tools.component.html +++ b/src/app/ui/collection-tools-plan/collection-tools.component.html @@ -24,7 +24,7 @@ - +
@@ -153,7 +153,7 @@
属性
-
+

面积(平方米)

{{canvasData.selectStorey.area}}

详情

@@ -162,14 +162,14 @@
-
+

{{assetName}}

宽度(像素)

- +

高度(像素)

- +

角度

是否高亮

- + 选中高亮
@@ -295,7 +295,110 @@
- + +
+
+

宽度(像素)

+ +

高度(像素)

+ +

角度

+
+ + +
+
+ +
+

厚度

+
+ + +
+
+
+
+ 颜色 +
+ +
+
+
+
    +
  • +
+
+ 透明度 + + {{colorDivSliderValue}}% +
+
+ +
+

{{item.PropertyName}}({{item.PhysicalUnit}})

+ +
+ +
+

{{item.PropertyName}}({{item.PhysicalUnit}})

+ +
+ +
+

{{item.PropertyName}}({{item.PhysicalUnit}})

+ +
+ + + +
+

{{item.PropertyName}}

+ + +
+ +
+

{{item.PropertyName}}

+ +
+ +
+

{{item.PropertyName}}

+ +
+
+
diff --git a/src/app/ui/collection-tools-plan/collection-tools.component.ts b/src/app/ui/collection-tools-plan/collection-tools.component.ts index d4b9d0b..dd5db9b 100644 --- a/src/app/ui/collection-tools-plan/collection-tools.component.ts +++ b/src/app/ui/collection-tools-plan/collection-tools.component.ts @@ -17,7 +17,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service'; import { MaskLayerService } from 'src/app/mask-layer.service'; import * as ObjectID from 'bson-objectid'; - +import { AxMessageSystem } from 'src/app/working-area/model/axMessageSystem'; @Component({ selector: 'app-collection-tools-plan', templateUrl: './collection-tools.component.html', @@ -83,9 +83,11 @@ export class CollectionToolsPlanComponent implements OnInit { setTimeout(() => { obj.PropertyInfos.forEach(item => { if(item.PropertyType == 4){ - this.gallery = new Viewer(document.getElementById('viewerjs'),{ - url: 'data-original' - }); + if(document.getElementById('viewerjs')){ + this.gallery = new Viewer(document.getElementById('viewerjs'),{ + url: 'data-original' + }); + } } }) }, 0); @@ -408,7 +410,10 @@ export class CollectionToolsPlanComponent implements OnInit { //素材是否高亮改变----->本地操作行为 assetHighLightIunput(){ - + // console.log(this.isHighLight,this.canvasAssetObj) + // let arr = [] + // arr.push(this.canvasAssetObj.Id) + // this.canvas.setHighlight(arr) } //动态属性素材input框值改变 @@ -607,22 +612,80 @@ export class CollectionToolsPlanComponent implements OnInit { this.canvasData.isChange = true } - isSixShow = true - isSixbtn = true //控制想定作业编辑按钮 isediticon = true //控制查看编辑模式的编辑模式小笔按钮 - ngOnInit(): void { - if(this.router.url.indexOf("keyUnit/viewunitinfo") != -1 || this.router.url.indexOf("keyUnit/editplaninfo")!= -1){ - this.isSixbtn = false - } + isMultipleAsset:boolean = false//框选多个素材属性显隐 + multipleAsset:any = { + Width:null, + Height:null, + Angle:null, + Thickness:null, + Color:null, + PropertyInfos:[] + }//多个素材共同属性 + multipleAssetData:any//当前多选的素材 + firstMultipleAssetData:any//当前多选的第一个素材 + ngOnInit(): void { + let _this = this + + AxMessageSystem.addListener('selectionChanged', ()=>{ + if(this.canvas.selection.size() == 1){//如果是单选 + this.isMultipleAsset = false + // console.log('单选',this.canvas.selection.first().assetData) + this.setAssetsProperty(this.canvas.selection.first().assetData) + }else if(this.canvas.selection.size()){ + // console.log('多选') + this.isShowProperty = true + this.multipleAssetData = this.canvas.selection.all() + this.firstMultipleAssetData = this.canvas.selection.first() + this.multipleAsset = { + Width:null, + Height:null, + Angle:null, + Thickness:null, + Color:null, + PropertyInfos:[] + } + this.isMultipleAsset = true + let firstAssetData = this.canvas.selection.first().assetData;//拿出第一个素材作为例子与其他素材进行对比 + let InteractiveMode = firstAssetData.InteractiveMode //素材连接方式 + let isInteractiveMode = this.canvas.selection.all().every(item => item.assetData.InteractiveMode === InteractiveMode) + if(isInteractiveMode){ + this.multipleAsset.InteractiveMode = InteractiveMode + } + let isFillMode = this.canvas.selection.all().every(item => item.assetData.FillMode === 0) //素材填充方式都为0 + if(isFillMode){ + this.multipleAsset.FillMode = 0 + } + this.canvas.selection.first().assetData.PropertyInfos.forEach(i => { + let index = 0 + this.canvas.selection.all().forEach(item => { + item.assetData.PropertyInfos.forEach(element => { + if(element.PropertyName == i.PropertyName && element.PropertyType == i.PropertyType && element.PropertyType != 3 && element.PropertyType != 4){ + index++ + if(index == this.canvas.selection.size()){ + let newElement = JSON.parse(JSON.stringify(element)) + newElement.PropertyValue = '' + this.multipleAsset.PropertyInfos.push(newElement) + } + } + }); + }) + }) + // console.log(666,_this.multipleAsset.PropertyInfos) + }else if(this.canvas.selection.size() == 0){ + this.isShowProperty = false + } + }, this) - if(!this.isSixbtn && sessionStorage.getItem("six") == "edit"){ - this.isSixShow = true - } - if(!this.isSixbtn && sessionStorage.getItem("six") == "look"){ + if(this.router.url.indexOf("keyUnit/viewunitinfo") != -1){ //查看模式 this.isEditPattern = false this.isediticon = false + this.canvasData.gameMode = GameMode.Assignment + } else if (this.router.url.indexOf("keyUnit/editplaninfo")!= -1) { //编辑模式 + this.canvasData.gameMode = GameMode.BasicInformation } + //gis模块平面图 if(this.router.url.indexOf("gis") != -1 && sessionStorage.getItem("gisplan") == "look"){ this.isEditPattern = false @@ -647,23 +710,114 @@ export class CollectionToolsPlanComponent implements OnInit { } }) } + //多选宽度共同改变 + multipleAssetWidthInput(){ + this.multipleAssetData.forEach(item=>{ + item.assetData.Width = this.multipleAsset.Width + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + }) + } + //多选高度共同改变 + multipleAssetHeightInput(){ + this.multipleAssetData.forEach(item=>{ + item.assetData.Height = this.multipleAsset.Height + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + }) + } + //多选角度共同改变 + multipleAssetAngleInput(){ + this.multipleAssetData.forEach(item=>{ + item.assetData.Angle = this.multipleAsset.Angle + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + }) + } + //多选厚度共同改变 + multipleAssetThicknessInput(){ + this.multipleAssetData.forEach(item=>{ + item.assetData.Thickness = this.multipleAsset.Thickness + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + }) + } + //多选颜色共同改变 + multipleSelectedcolor:any + multipleAssetSelectcolor(item,key){ + //在当前透明度基础上改变颜色 + this.multipleSelectedcolor = item + this.multipleAssetData.forEach(item=>{ + item.assetData.Color = this.multipleSelectedcolor + this.canvasData.isChange = true + this.canvas.refreshIcon(item.assetData.Id) + }) + } + //多选颜色滑竿改变 + multipleColorDivSliderChange(){ + let colorOpacity = Math.round(255 * this.colorDivSliderValue * 0.01) + //根据滑竿值改变16进制颜色后两位 + function replacepos(text,start,stop,replacetext){ + let mystr = text.substring(0,stop-1)+replacetext+text.substring(stop+1); + return mystr; + } + this.multipleAssetData.forEach(item=>{ + this.multipleSelectedcolor = replacepos(this.multipleSelectedcolor,7,8,colorOpacity.toString(16)) + item.assetData.Color = this.multipleSelectedcolor + this.canvasData.isChange = true + this.canvas.refreshIcon(item.assetData.Id) + }) + } + //多选状态动态属性素材input框值改变 + multipleAssetInputChange(i,e){ + e.stopPropagation() + this.multipleAssetData.forEach(item=>{ + // console.log(item) + item.assetData.PropertyInfos.forEach(element => { + if(element.PropertyName == i.PropertyName){ + element.PropertyValue = i.PropertyValue + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + } + }) + }) + } + //多选状态动态属性素材radio框值改变 + multipleAssetRadioChange(i,value){ + // e.stopPropagation() + this.multipleAssetData.forEach(item=>{ + // console.log(item) + item.assetData.PropertyInfos.forEach(element => { + if(element.PropertyName == i.PropertyName){ + element.PropertyValue = value + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + } + }) + }) + } + //多选状态动态属性素材下拉框值改变 + multipleSupplyArea(i,e){ + e.stopPropagation() + this.multipleAssetData.forEach(item=>{ + // console.log(item) + item.assetData.PropertyInfos.forEach(element => { + if(element.PropertyName == i.PropertyName){ + element.PropertyValue = i.PropertyValue + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + } + }) + }) + } ngAfterViewInit(): void { - //gis模块平面图 - if(this.router.url.indexOf("gis") == -1) { + //不是gis模块平面图 + if(this.router.url.indexOf("gis") == -1) { this.getSitePlan() - } - // 监听canvas组件选中素材事件 - this.canvas.on("select",obj=>{ - //选中素材属性注入函数 - this.setAssetsProperty(obj.assetData) - }) - // 监听canvas组件取消选中素材事件 - this.canvas.on("deselect",obj=>{ - this.isShowProperty = false - }) + } //监听数据变化后 this.canvas.on('canvasDataChanged',()=>{ // 收到数据表示共享数据发生变化 diff --git a/src/app/ui/collection-tools/collection-tools.component.html b/src/app/ui/collection-tools/collection-tools.component.html index be34123..09f418f 100644 --- a/src/app/ui/collection-tools/collection-tools.component.html +++ b/src/app/ui/collection-tools/collection-tools.component.html @@ -58,7 +58,7 @@ - +
@@ -227,7 +227,7 @@ -
+

面积(平方米)

{{canvasData.selectStorey.area}}

详情

@@ -236,14 +236,14 @@
-
+

{{assetName}}

宽度(像素)

- +

高度(像素)

- +

角度

- + +
+
+

宽度(像素)

+ +

高度(像素)

+ +

角度

+
+ + +
+
+ +
+

厚度

+
+ + +
+
+
+
+ 颜色 +
+ +
+
+
+
    +
  • +
+
+ 透明度 + + {{colorDivSliderValue}}% +
+
+ +
+

{{item.PropertyName}}({{item.PhysicalUnit}})

+ +
+ +
+

{{item.PropertyName}}({{item.PhysicalUnit}})

+ +
+ +
+

{{item.PropertyName}}({{item.PhysicalUnit}})

+ +
+ + + +
+

{{item.PropertyName}}

+ + +
+ +
+

{{item.PropertyName}}

+ +
+ +
+

{{item.PropertyName}}

+ +
+
+
diff --git a/src/app/ui/collection-tools/collection-tools.component.ts b/src/app/ui/collection-tools/collection-tools.component.ts index 9ac9bd6..400ca8b 100644 --- a/src/app/ui/collection-tools/collection-tools.component.ts +++ b/src/app/ui/collection-tools/collection-tools.component.ts @@ -16,7 +16,7 @@ import { GameMode } from 'src/app/working-area/model/gameMode'; import { ActivatedRoute, Router } from '@angular/router'; import { MaskLayerService } from 'src/app/mask-layer.service'; import * as ObjectID from 'bson-objectid'; - +import { AxMessageSystem } from 'src/app/working-area/model/axMessageSystem'; @Component({ selector: 'app-collection-tools', templateUrl: './collection-tools.component.html', @@ -82,9 +82,11 @@ export class CollectionToolsComponent implements OnInit { setTimeout(() => { obj.PropertyInfos.forEach(item => { if(item.PropertyType == 4){ - this.gallery = new Viewer(document.getElementById('viewerjs'),{ - url: 'data-original' - }); + if(document.getElementById('viewerjs')){ + this.gallery = new Viewer(document.getElementById('viewerjs'),{ + url: 'data-original' + }); + } } }) }, 0); @@ -619,28 +621,74 @@ export class CollectionToolsComponent implements OnInit { this.canvasData.isChange = true } + isMultipleAsset:boolean = false//框选多个素材属性显隐 + multipleAsset:any = { + Width:null, + Height:null, + Angle:null, + Thickness:null, + Color:null, + PropertyInfos:[] + }//多个素材共同属性 + multipleAssetData:any//当前多选的素材 + firstMultipleAssetData:any//当前多选的第一个素材 + ngOnInit(): void { - isSixShow = true - isSixbtn = true //控制想定作业编辑按钮 - isxxx = true //控制查看编辑模式的编辑模式按钮 + let _this = this + AxMessageSystem.addListener('selectionChanged', ()=>{ + if(this.canvas.selection.size() == 1){//如果是单选 + this.isMultipleAsset = false + // console.log('单选',this.canvas.selection.first().assetData) + this.setAssetsProperty(this.canvas.selection.first().assetData) + }else if(this.canvas.selection.size()){ + // console.log('多选') + this.isShowProperty = true + this.multipleAssetData = this.canvas.selection.all() + this.firstMultipleAssetData = this.canvas.selection.first() + this.multipleAsset = { + Width:null, + Height:null, + Angle:null, + Thickness:null, + Color:null, + PropertyInfos:[] + } + this.isMultipleAsset = true + let firstAssetData = this.canvas.selection.first().assetData;//拿出第一个素材作为例子与其他素材进行对比 + let InteractiveMode = firstAssetData.InteractiveMode //素材连接方式 + let isInteractiveMode = this.canvas.selection.all().every(item => item.assetData.InteractiveMode === InteractiveMode) + if(isInteractiveMode){ + this.multipleAsset.InteractiveMode = InteractiveMode + } + let isFillMode = this.canvas.selection.all().every(item => item.assetData.FillMode === 0) //素材填充方式都为0 + if(isFillMode){ + this.multipleAsset.FillMode = 0 + } + this.canvas.selection.first().assetData.PropertyInfos.forEach(i => { + let index = 0 + this.canvas.selection.all().forEach(item => { + item.assetData.PropertyInfos.forEach(element => { + if(element.PropertyName == i.PropertyName && element.PropertyType == i.PropertyType && element.PropertyType != 3 && element.PropertyType != 4){ + index++ + if(index == this.canvas.selection.size()){ + let newElement = JSON.parse(JSON.stringify(element)) + newElement.PropertyValue = '' + this.multipleAsset.PropertyInfos.push(newElement) + } + } + }); + }) + }) + }else if(this.canvas.selection.size() == 0){ + this.isShowProperty = false + } + }, this) - ngOnInit(): void { this.canvasData.gameMode = GameMode.Assignment - if(this.router.url.indexOf("keyUnit/viewunitinfoplan") == -1 && this.router.url.indexOf("keyUnit/viewunitinfo") != -1 || this.router.url.indexOf("keyUnit/editplaninfo")!= -1){ - this.isSixbtn = false - } - - if(!this.isSixbtn && sessionStorage.getItem("six") == "edit"){ - this.isSixShow = true - } - if(!this.isSixbtn && sessionStorage.getItem("six") == "look"){ + if (sessionStorage.getItem('editable') == "0") { //查看模式 this.isEditPattern = false - this.isxxx = false - } + } else { - if (sessionStorage.getItem('editable') == "0") { - this.isEditPattern = false - this.isxxx = false } this.getAllLibrary('plan') //获取素材库 @@ -655,28 +703,115 @@ export class CollectionToolsComponent implements OnInit { event.preventDefault(); }; }) - + this.canvasData.getMessage().subscribe((message: any)=>{ if(message == "send a message"){ this.refurbishTreeData() } }) - } + } + //多选宽度共同改变 + multipleAssetWidthInput(){ + this.multipleAssetData.forEach(item=>{ + item.assetData.Width = this.multipleAsset.Width + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + }) + } + //多选高度共同改变 + multipleAssetHeightInput(){ + this.multipleAssetData.forEach(item=>{ + item.assetData.Height = this.multipleAsset.Height + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + }) + } + //多选角度共同改变 + multipleAssetAngleInput(){ + this.multipleAssetData.forEach(item=>{ + item.assetData.Angle = this.multipleAsset.Angle + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + }) + } + //多选厚度共同改变 + multipleAssetThicknessInput(){ + this.multipleAssetData.forEach(item=>{ + item.assetData.Thickness = this.multipleAsset.Thickness + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + }) + } + //多选颜色共同改变 + multipleSelectedcolor:any + multipleAssetSelectcolor(item,key){ + //在当前透明度基础上改变颜色 + this.multipleSelectedcolor = item + this.multipleAssetData.forEach(item=>{ + item.assetData.Color = this.multipleSelectedcolor + this.canvasData.isChange = true + this.canvas.refreshIcon(item.assetData.Id) + }) + } + //多选颜色滑竿改变 + multipleColorDivSliderChange(){ + let colorOpacity = Math.round(255 * this.colorDivSliderValue * 0.01) + //根据滑竿值改变16进制颜色后两位 + function replacepos(text,start,stop,replacetext){ + let mystr = text.substring(0,stop-1)+replacetext+text.substring(stop+1); + return mystr; + } + this.multipleAssetData.forEach(item=>{ + this.multipleSelectedcolor = replacepos(this.multipleSelectedcolor,7,8,colorOpacity.toString(16)) + item.assetData.Color = this.multipleSelectedcolor + this.canvasData.isChange = true + this.canvas.refreshIcon(item.assetData.Id) + }) + } + //多选状态动态属性素材input框值改变 + multipleAssetInputChange(i,e){ + e.stopPropagation() + this.multipleAssetData.forEach(item=>{ + item.assetData.PropertyInfos.forEach(element => { + if(element.PropertyName == i.PropertyName){ + element.PropertyValue = i.PropertyValue + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + } + }) + }) + } + //多选状态动态属性素材radio框值改变 + multipleAssetRadioChange(i,value){ + // e.stopPropagation() + this.multipleAssetData.forEach(item=>{ + item.assetData.PropertyInfos.forEach(element => { + if(element.PropertyName == i.PropertyName){ + element.PropertyValue = value + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + } + }) + }) + } + //多选状态动态属性素材下拉框值改变 + multipleSupplyArea(i,e){ + e.stopPropagation() + this.multipleAssetData.forEach(item=>{ + item.assetData.PropertyInfos.forEach(element => { + if(element.PropertyName == i.PropertyName){ + element.PropertyValue = i.PropertyValue + this.canvas.refreshIcon(item.assetData.Id) + this.canvasData.isChange = true + } + }) + }) + } ngAfterViewInit(): void { - this.getSitePlan() - // 监听canvas组件选中素材事件 - this.canvas.on("select",obj=>{ - //选中素材属性注入函数 - this.setAssetsProperty(obj.assetData) - }) - // 监听canvas组件取消选中素材事件 - this.canvas.on("deselect",obj=>{ - this.isShowProperty = false - }) //监听数据变化后 this.canvas.on('canvasDataChanged',()=>{ // 收到数据表示共享数据发生变化 @@ -2280,7 +2415,7 @@ export class CollectionToolsComponent implements OnInit { if(selectPanelPoint.Data){ for(let key in selectPanelPoint.Data.Stock){ //筛选数据 没有匹配全部放入到 其他 数组 let noMatch = this.allFireElements.find( every=> every.id===selectPanelPoint.Data.Stock[key].FireElementId ) - if (!noMatch) { + if (!noMatch && selectPanelPoint.Data.Stock[key].Id != "图例") { this.allFireElements[this.allFireElements.length-1].children.push(selectPanelPoint.Data.Stock[key]) } } diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index a1acfec..d07f88e 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -453,7 +453,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV */ public refreshIcon(id: string): void { const icon = this.backgroundImage.children.find(item => item.name === id); - console.log(icon); + // console.log(icon); if (icon instanceof AxImageShape) { icon.refresh(); } else if (icon instanceof MultipointIcon) {