diff --git a/.gitignore b/.gitignore index 86d943a..a80a6b3 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,4 @@ testem.log # System Files .DS_Store Thumbs.db +debug.log diff --git a/debug.log b/debug.log deleted file mode 100644 index c4638ef..0000000 --- a/debug.log +++ /dev/null @@ -1,3 +0,0 @@ -[1229/141605.754:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3) -[0104/100053.968:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3) -[0122/085819.900:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3) diff --git a/src/app/canvas-share-data.service.ts b/src/app/canvas-share-data.service.ts index 753ce9a..56daf18 100644 --- a/src/app/canvas-share-data.service.ts +++ b/src/app/canvas-share-data.service.ts @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core'; import {ReplaySubject} from 'rxjs'; import { Observable } from 'rxjs'; import { GameMode } from './working-area/model/gameMode'; + @Injectable({ providedIn: 'root' }) @@ -10,33 +11,30 @@ export class CanvasShareDataService { private _sendMessage: ReplaySubject = new ReplaySubject(1); examDisposalNodesData; // 鑰冪敓杩涘叆鏃惰幏鍙栧綋鍓嶈瘯鍗风殑澶勭疆鑺傜偣 - examFacilityAssetsData; // 鑰冪敓杩涘叆鏃惰幏鍙栧綋鍓嶈瘯鍗疯鑰冨療鐨勬秷闃茶鏂 + examFacilityAssetsData; // 鑰冪敓杩涘叆鏃惰幏鍙栧綋鍓嶈瘯鍗疯鑰冨療鐨勬秷闃茶鏂 + examOriginaleveryStoreyData: any; // 鑰冪敓绛斿嵎 鎬诲钩闈㈠浘/妤煎眰/鍖哄煙 妤煎眰鏁版嵁 + hiddenBasicInfoFacilities: any = []; // 鑰冪敓绛斿嵎 褰撳墠妤煎眰闇瑕侀殣钘忕殑鍩烘湰淇℃伅绱犳潗 + - isChange = false; // 鏁版嵁 鏄惁鏀瑰姩 - selectTemplateData: any; // 閫夋嫨褰撳墠 妯℃澘鏁版嵁 + isChange:boolean = false; // 鏁版嵁 鏄惁鏀瑰姩 + + selectTemplateData:any; // 閫夋嫨褰撳墠 妯℃澘鏁版嵁 // 鎬诲钩闈㈠浘/寤虹瓚 妤煎眰 selectStorey: any = {area: '', details: ''}; // 閫夋嫨褰撳墠 妤煎眰 鏁版嵁 - originalcompanyBuildingData: any; // 鍗曚綅/寤虹瓚 鏁版嵁 - originaleveryStoreyData: any; // 鎬诲钩闈㈠浘/妤煎眰/鍖哄煙 妤煎眰鏁版嵁 - - - examOriginaleveryStoreyData: any; // 鑰冪敓绛斿嵎 鎬诲钩闈㈠浘/妤煎眰/鍖哄煙 妤煎眰鏁版嵁 - - hiddenBasicInfoFacilities: any = []; // 鑰冪敓绛斿嵎 褰撳墠妤煎眰闇瑕侀殣钘忕殑鍩烘湰淇℃伅绱犳潗 // 鎬诲钩闈㈠浘/寤虹瓚 妤煎眰 // 澶勭疆 鑺傜偣 allDisposalNode: any = []; // 鎵鏈 澶勭疆鑺傜偣 allNodeMarkers: any; // 鐏炬儏 鏍囩淇℃伅 - - selectPanelPoint: DisposalNodeData = new DisposalNodeData(); - - selectPanelPointBaseData: any = {description: '', notes: '', weather: '', airTemperature: '', windDirection: '', windScale: ''}; // 褰撳墠 鏁版嵁鑺傜偣 鎵瀵瑰簲鐨 澶╂皵,璇︽儏 鏁版嵁鑺傜偣 + selectPanelPoint: DisposalNodeData = new DisposalNodeData(); // 褰撳墠鏁版嵁鑺傜偣 + selectPanelPointBaseData: any = {description: '', notes: '', weather: '', airTemperature: '', windDirection: '', windScale: ''}; // 褰撳墠 鏁版嵁鑺傜偣 瀵瑰簲 鐖剁骇鑺傜偣 + customizeDisposalNode:any; // 鏂板缓 鑷畾涔夋暟鎹妭鐐 搴曞浘+鍚嶇О // 澶勭疆 鑺傜偣 + /** * 娓告垙妯″紡 */ diff --git a/src/app/key-unit/edit-plan-info/edit-plan-info.component.html b/src/app/key-unit/edit-plan-info/edit-plan-info.component.html index c46fef7..cc729aa 100644 --- a/src/app/key-unit/edit-plan-info/edit-plan-info.component.html +++ b/src/app/key-unit/edit-plan-info/edit-plan-info.component.html @@ -7,52 +7,57 @@ - + - + - - - - + + + + - - - - + + + + + + + + + - + - + - + - + - + - + - +
+ + + + + 鍩烘湰淇℃伅鍚嶇О + visibility + + + + + + + + + + +
+ + +
+ + +
+ + +
+
+ + + + +
+
+ +
+
+ keyboard_arrow_up + keyboard_arrow_down + + +
+
+
+ + + + + + + + + + photo_size_select_actual + + + + + + +
+

+ keyboard_arrow_up +

+

+ edit + delete +

+

+ cached + library_books +

+

+ keyboard_arrow_down +

+
+ +
+
+
+ + +
+
+ keyboard_arrow_up + keyboard_arrow_down + +
+
+ + + + + + +
+
+ +

{{items.name}}

+
+
+ +
+
+
+
+ + +
+
+ keyboard_arrow_up + keyboard_arrow_down + + +
+
+ + + +
+ +
+ edit + add + library_books + delete_forever +
+
+
+ +
+
+ + +
+ +
+ +
+ +
+
+
+ 灞炴 +
+
+ +
+

闈㈢Н(骞虫柟绫)

+
{{canvasData.selectStorey.area}}
+

璇︽儏

+
+ {{canvasData.selectStorey.details}} +
+
+ +
+

{{assetName}}

+ +
+

瀹藉害(鍍忕礌)

+ +

楂樺害(鍍忕礌)

+ +

瑙掑害

+
+ + +
+
+ +
+

鍘氬害

+
+ + +
+
+ +

鏄惁楂樹寒

+
+ + 閫変腑楂樹寒 +
+
+
+ 棰滆壊 +
+ +
+
+
+
    +
  • +
+
+ 閫忔槑搴 + + {{colorDivSliderValue}}% +
+
+ +
+

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

+ +
+ +
+

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

+ +
+ +
+

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

+ +
+ +
+
+

{{item.PropertyName}}

+ {{imagesArr.length ? imagesArr.length : 0}} / {{item.PropertyValue}} + +
娣诲姞
+ + +
+
+
+
+ +
+
+ + delete + +
+
+
+ +
+

{{item.PropertyName}}

+ +
+ +
+

{{item.PropertyName}}

+ + +
+ +
+

{{item.PropertyName}}

+ +
+ +
+

{{item.PropertyName}}

+ +
+
+
+ +
+ +
+ +
+ +
+
+ 娑堥槻瑕佺礌 +
+
+ +
+ + + + + + + {{node.name}} + + ({{node.children.length}}) + visibility + + + + + + + {{node.name}} + + ({{node.children.length}}) + visibility + + + +
+
+
+ +
+
+
+
+ 鑺傜偣璇︽儏 +
+
+ 娉ㄦ剰浜嬮」 +
+
+
+ + +
+
+
+
+ + \ No newline at end of file diff --git a/src/app/ui/collection-tools-building/collection-tools.component.scss b/src/app/ui/collection-tools-building/collection-tools.component.scss new file mode 100644 index 0000000..02c4e97 --- /dev/null +++ b/src/app/ui/collection-tools-building/collection-tools.component.scss @@ -0,0 +1,450 @@ +@import './panel.scss'; +.icongray{ + color: #D9D0DC; +} +.content { + width: 100%; + height: 100%; + overflow: hidden; + box-sizing: border-box; + padding: 1px; + display: flex; + flex-direction: column; + + .buildingbtnchecked{ + background-color: #34A6FD; + color: white; + } +} + +//header澶撮儴 +.header { + position: relative; + flex: 5%; + display: flex; + align-items:center; + min-height: 40px; + background-color: #fff; + .marginLeftRight { + margin: 0 8px; + font-size: 16px; + user-select:聽none; + cursor: pointer; + .mat-icon { vertical-align: middle; font-size: 24px; } + } + .copytobutn{ + width: 60px; + min-width: 60px; + display: flex; + justify-content: center; + } + span{ + height: 24px; + line-height: 24px; + } + .patternSwitch{ + position: absolute; + right: 140px; + span{ + font-size: 18px; + cursor: pointer; + margin: 0 3px; + display: inline-block; + border: 1px solid gray; + border-radius: 3px; + padding: 0 5px; + } + .selectedPattern{ + background-color: #2196f3; + color: white; + } + } + .rightSave { + cursor: pointer; + position: absolute; + right: 60px; + label { vertical-align: middle; color: #279FFF; } + } +} + +//澶撮儴鎿嶄綔鏍 +.headerOperate { + img { + width: 24px; + height: 24px; + vertical-align: middle; + margin-left: 1px; + } + span{ + font-size: 18px; + } + flex: 5%; + display: flex; + align-items:center; + min-height: 40px; + box-sizing: border-box; + margin: 3px 0; + background-color: white; + button{ + border: 0.5px solid rgb(208, 211, 214); + margin: 0 2px; + } + .editdeletebtn{ + display: none; + } + .bigeditdeletebtn:hover{ + .editdeletebtn{ + display: inline-block; + } + } +} + +//鍔熻兘鍖 +// icon缁熶竴鏍峰紡 +.mat-icon { + cursor:pointer; + vertical-align: middle; +} +//宸﹀彸涓や晶鍔熻兘鏍 缁熶竴鏍峰紡 +.publicCss { + border-radius: 5px; + position: absolute; + height: 100%; + top: 0; +} +.functionalDomain { + flex: 90%; + overflow: hidden; + .functionalDomainContent { + position: relative; + width: 100%; + height: 100%; + } + .functionalDomainLeft { + background-color: #fff; + display: flex; + flex-direction: column; + margin-left: 0px; + transition: margin-left 0.5s; + min-width: 235px; + border: 1px solid #E6EAEE; + width: 235px; + left: 0; + z-index: 111; + .leftDragDiv{ + position: absolute; + right: 0; + height: 100%; + width: 3px; + z-index: 1000; + cursor: e-resize; + } + } + .functionalDomainRight { + z-index: 1001; + margin-right: 0px; + transition: margin-right 0.5s; + border: 1px solid #464646; + width: 235px; + right: 0; + + } + //鍙宠竟瀵艰埅鏍忔樉绀洪殣钘 + .togglePanel2 { + margin-right: -2000px; + transition: margin-right 1s; + } + //宸︿晶瀵艰埅鏍忔樉绀洪殣钘 + .togglePanel { + margin-left: -2000px; + transition: margin-left 1s; + } + +} + +//鍙宠竟鎿嶄綔鏍 +.title{ + width: 100%; + height: 35px; + background-color: #464646; + div{ + width: 50%; + height: 35px; + line-height: 35px; + background-color: #595959; + border-radius: 5px; + span{ + color: white; + font-size: 14px; + font-weight: 400; + padding-left: 5px; + } + } +} + + +//鍙充晶灞炴 +.property{ + display: flex; + flex-flow: column; + .siteproperty{ + height: 100%; + overflow-y: auto; + p{ + color: #9c9fa5; + padding-left: 5px; + } + .siteproperty_size{ + background-color: #e3e3e3; + width: 93%; + margin: 0 auto; + border-radius: 3px; + min-height: 21px; + } + .rightAttribute{ + width: 12%; + height: 99.5%; + position: absolute; + top: 0; + right: 0; + bottom: 0; + border: 2px solid #464646; + } + } + .assetsproperty{ + overflow-y: auto; + height: 100%; + p{ + color: #9c9fa5; + margin:1px 0 3px 8px; + font-size: 14px; + } + span{ + font-size: 15px; + } + input{ + height: 18px; + } + .biginput{ + display: block; + width: 88%; + margin: 0 auto; + } + .smallinput{ + display: block; + width: 19%; + margin-left: 8px; + } + .textarea{ + display: block; + width: 88%; + height: 50px; + margin: 0 auto; + } + .swiper-button-next{ + right: 6px; + } + .swiper-button-prev{ + left: 6px; + } + .swiper-container{ + // --swiper-theme-color: #ff6600;/* 璁剧疆Swiper椋庢牸 */ + // --swiper-navigation-color: #00ff33;/* 鍗曠嫭璁剧疆鎸夐挳棰滆壊 */ + --swiper-navigation-size:20px;/* 璁剧疆鎸夐挳澶у皬 */ + } + .hoverred:hover{ + color: rgb(187, 28, 28); + } + .selectDiv{ + height: 21px; + position: relative; + margin-bottom: 5px; + select{ + width: 98px; + height: 22px; + vertical-align: middle; + position: absolute; + right: 10px; + top: 1px; + border: 1px solid rgb(208, 211, 214); + border-radius: 2px; + } + } + .colorBigDiv{ + width: 88%; + margin-left: 8px; + .colorBigTemplateDiv{ + span{ + color: #9c9fa5; + font-size: 14px; + height: 26px; + line-height: 26px; + } + .colorTemplateDiv{ + width: 65%; + height: 22px; + display: inline-block; + vertical-align: middle; + margin-left: 26px; + } + } + + .colorDiv{ + .colorLi{ + width: 24px; + height: 24px; + list-style: none; + float: left; + border: 2px solid white; + } + .coloractive{ + border: 2px solid black; + } + } + } + + } +} +//鍙充晶娑堥槻瑕佺礌 +.firecategories{ + background-color: #fff; + position: relative; + display: flex; + flex-flow: column; + .firecategoriesTree{ + overflow-y: auto; + height: 100%; + mat-tree-node{ + position: relative; + } + .isLookCss{ + position: absolute; + right: 6px; + } + } +} + +// 瑙e喅杞挱鍥捐摑妗嗛棶棰 +div:focus { + outline: none; +} + +//娌℃湁鍥剧墖鏃舵樉绀烘棤鍥剧墖鑳屾櫙鍥 +.noImgCss{ + background: url(../../../assets/images/noImg.png) no-repeat center center; + background-size: 88% 100%;/*鎸夋瘮渚嬬缉鏀*/ +} +.input{ + width: 18px; + height: 18px; + vertical-align: middle; + margin-left: 9px; + margin-right: 3px; +} + + +// tree +.mat-tree-node{ + min-height: 0; + height: 32px; + line-height: 32px; + font-size: 13px; + cursor: pointer; +} +.treeNode:hover{ + background-color: #ccebf8; +} +.isLookPattern{ + display: none; +} +.treeText{ + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + display: inline-block; + width: 65px; +} + +.bigBox{ + width: 700px; + height: 40px; + position: absolute; + overflow: hidden; + right: 0; +} +.weatherBox{ + height: 40px; + width: 700px; + line-height: 40px; + position: absolute; + right: 0; + transition: right linear .5s; + .openbtn{ + font-size: 45px; + height: 45px; + width: 40px; + } + .name{ + font-size: 16px; + vertical-align: middle; + margin-left: 3px; + } + input{ + width: 140px; + height: 22px; + margin-left: 3px; + } + select{ + width: 96px; + height: 25px; + margin-left: 3px; + vertical-align: middle; + } +} +.open{ + right: 0px; +} +.close{ + right:-622px; +} +.bottomCss{ + position: absolute; + left: 232px; + right: 0px; + bottom: 0; + height: 158px; + width: auto; + z-index: 100; + background-color: white; + border: 1px solid #464646; + .dragDiv{ + width: 100%; + height: 3px; + position: absolute; + top: 0; + z-index: 1000; + cursor: n-resize; + } + .title{ + height: 35px; + background-color: #464646; + div{ + background-color: #464646; + float: left; + width: 80px; + color: white; + font-size: 13px; + padding-left: 5px; + cursor: pointer; + } + .detailsAndattentBtn{ + background-color: #595959; + } + } + .body{ + textarea{ + width: 100%; + border-radius: 0px; + } + } +} \ No newline at end of file diff --git a/src/app/ui/collection-tools-building/collection-tools.component.spec.ts b/src/app/ui/collection-tools-building/collection-tools.component.spec.ts new file mode 100644 index 0000000..acc7d5e --- /dev/null +++ b/src/app/ui/collection-tools-building/collection-tools.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CollectionToolsComponent } from './collection-tools.component'; + +describe('CollectionToolsComponent', () => { + let component: CollectionToolsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CollectionToolsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CollectionToolsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/ui/collection-tools-building/collection-tools.component.ts b/src/app/ui/collection-tools-building/collection-tools.component.ts new file mode 100644 index 0000000..fb2e03b --- /dev/null +++ b/src/app/ui/collection-tools-building/collection-tools.component.ts @@ -0,0 +1,2391 @@ +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'; +import {leftFunctionalDomainBuildingComponent,editPlaneFigureBuildingComponent,addDisposalNodeBuildingComponent,editDisposalNodeBuildingComponent} from './leftFunctionalDomain' +import {MatTreeFlatDataSource, MatTreeFlattener} from '@angular/material/tree'; +import {FlatTreeControl} from '@angular/cdk/tree'; +import {WorkingAreaComponent} from '../../working-area/working-area.component' +import {CanvasShareDataService, DisposalNodeData} from '../../canvas-share-data.service' //寮曞叆鏈嶅姟 +import Viewer from 'viewerjs'; +import Swiper from 'swiper'; +import { saveOneDialogBuilding } from './save'; +import { NzFormatBeforeDropEvent, NzFormatEmitEvent,NzTreeComponent } from 'ng-zorro-antd/tree'; +import { Observable, of } from 'rxjs'; +import { GameMode } from 'src/app/working-area/model/gameMode'; +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'; + +@Component({ + selector: 'app-collection-tools-building', + templateUrl: './collection-tools.component.html', + styleUrls: ['./collection-tools.component.scss'] +}) +export class CollectionToolsBuildingComponent implements OnInit { + + @ViewChild('canvas',{static: true}) canvas:WorkingAreaComponent; //鐖剁粍浠朵腑鑾峰緱瀛愮粍浠剁殑寮曠敤 + + constructor(private maskLayerService:MaskLayerService,private tabbarService: TabbarAndScoreService,private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,private element: ElementRef,public canvasData: CanvasShareDataService,private router:Router,private route:ActivatedRoute) { } + @ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent; + // tree閰嶇疆 + private _transformer = (node, level: number) => {//瑕佺粰娓叉煋鑺傜偣浼犻偅浜涘睘鎬у弬鏁 + return { + expandable: !!node.children && node.children.length > 0, + name: node.name || node.Name, + level: level, + id: node.id || node.Id, + children:node.children, + isTemplate:node.isTemplate, + isNewElement:node.isNewElement, + isLook:node.isLook, + isLookPattern:node.isLookPattern || null + }; + } + treeControl = new FlatTreeControl(node => node.level, node => node.expandable); + + treeFlattener = new MatTreeFlattener(this._transformer, node => node.level, node => node.expandable, node => node.children); + dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener); + hasChild = (_: number, node: any) => node.expandable; + + colors = ['#076eec','#4dd0e1','#00ee76','#ffff00','#eeb422', + '#FF6A6A','#ff0000','#ff6eb4','#00bfff','#54ff9f', + '#009688','#836fff','#ff8c00','#ee00ee','#ffa07a', + '#00C500','#00ffff','#6495ed','#ffdAb9','#AA00FF'] + selected = "1" //鍥炬爣澶у皬閫夋嫨妗 + + allBuildings //璇ュ崟浣嶆墍鏈夊缓绛 + beforeOneCheckedBuilding:any; //褰撳墠鐐瑰嚮閫夋嫨鐨勫缓绛 + checkedBuildingIndex:number = 0; //褰撳墠鐐瑰嚮閫夋嫨鐨勫缓绛慽ndex + isEditPat:boolean = true; //褰撳墠鏄惁鏄紪杈戞ā寮 + + assetName:String//绱犳潗鍚嶇О + assetWidth:number//绱犳潗瀹藉害 + assetHeight:number//绱犳潗楂樺害 + sliderValue:number = 0//瑙掑害婊戠鐨勫 + sliderValueThickness:number = 0//鍘氬害婊戠鐨勫 + isHighLight:boolean = false//鏄惁楂樹寒閫夋嫨妗 + PropertyInfos = [] //鍘婚櫎鍥剧墖閾炬帴鐪熸鐢ㄤ簬寰幆鐨勫唴瀹 + imagesArrNum //绱犳潗灞炴у浘鐗囨暟閲忎笂闄 + imagesArr = [] //灞炴т腑鐨勫浘鐗囬摼鎺ラ泦鍚 + clickedIndex //鐐瑰嚮鍥剧墖鏃剁殑绱㈠紩鍊 + + //浼犲叆绱犳潗瀵硅薄锛岃缃彸渚у睘鎬ф爮鍐呭 + canvasAssetObj //浼犲叆鐨勭礌鏉愬睘鎬у璞 + isImgNumCss = false //鎺у埗涓婁紶鏂囦欢input鏄鹃殣 + mySwiper:any //杞挱鍥惧疄渚 + + gallery//viewerJs瀹炰緥 + //璁剧疆灞炴ф + setAssetsProperty(obj){ + //鍒濆鍖杤iewerJs瀹炰緥 + setTimeout(() => { + obj.PropertyInfos.forEach(item => { + if(item.PropertyType == 4){ + this.gallery = new Viewer(document.getElementById('viewerjs'),{ + url: 'data-original' + }); + } + }) + }, 0); + + //浠庨鑹蹭腑鍙栧嚭閫忔槑搴 + let color = obj.Color + let strh = color.substring(color.length -2,color.length) + let opacity = Math.round(parseInt(strh,16)/255 * 100) + this.colorDivSliderValue = opacity + + this.isShowProperty = true + this.isShowAttribute = false + let _this = this + this.imagesArr = [] + this.imagesArrNum = "" + + this.canvasAssetObj = obj //灏嗛変腑绱犳潗瀵硅薄瀛樺埌鏈湴鍙橀噺 + + this.assetName = obj.Name + this.assetWidth = obj.Width + this.assetHeight = obj.Height + this.sliderValue = obj.Angle + this.selectedcolor = obj.Color + this.PropertyInfos = obj.PropertyInfos + this.sliderValueThickness = obj.Thickness + this.PropertyInfos.forEach(item => { + if(item.PropertyType == 3){ //濡傛灉鏄浘鐗囬摼鎺ョ被鍨 + this.imagesArr.push(item) + } + if(item.PropertyType == 4){//鍥剧墖鏁板间笂绾 + this.imagesArrNum = item.PropertyValue + } + }) + + //濡傛灉瀛樺湪鍥剧墖鍒欏姞杞借疆鎾浘 + if(this.imagesArr.length){ + setTimeout(() => { + this.mySwiper = new Swiper('.swiper-container',{ + loop: false, + // grabCursor: true, + // 濡傛灉闇瑕佸墠杩涘悗閫鎸夐挳 + navigation: { + nextEl: '.swiper-button-next', + prevEl: '.swiper-button-prev', + }, + on:{ + click: function(){ + _this.clickedIndex = this.clickedIndex + }, + } + }); + }, 0); + } + //鍒ゆ柇姝ゆ椂鍥剧墖鏁伴噺鏄惁杈惧埌涓婇檺 + if(this.imagesArr.length < this.imagesArrNum){//濡傛灉涓嶈秴鍑 + this.isImgNumCss = true + }else{ + this.isImgNumCss = false + } + } + pattern:boolean = true//榛樿涓哄熀鏈俊鎭紪杈 + + //鍩烘湰淇℃伅缂栬緫妯″紡 + baseInfo(){ + if (!this.pattern) { + this.pattern = true + this.canvasData.gameMode = GameMode.BasicInformation + this.canvasData.selectPanelPoint = new DisposalNodeData(); + this.mateDeleteCustomize() + this.getAllLibrary() + this.checkedBuildingIndex = -1 + this.getSitePlan() //鎬诲钩闈㈠浘涓灞 + } + } + + //鎯冲畾浣滀笟缂栬緫妯″紡 + wantWork(){ + if (this.pattern) { + this.pattern = false + this.canvasData.gameMode = GameMode.Assignment + this.getAllLibrary('plan') + this.getDisposalNode() + } + } + + //ngzorro tree 鎷栨嫿 + nzEvent(event: NzFormatEmitEvent): void { + if(this.isDrag){ + let parentId + if(this.pos == 0){ + parentId = event.node.key + }else{ + if(event.node.level == 0){ + parentId = null + }else{ + parentId = event.node.origin.parentId + } + } + + + let orders = {} + let originalData = JSON.parse(JSON.stringify( this.canvasData.allDisposalNode || [] )) //tree鍘熷鏁版嵁 + let targetNodeData = []//鎷栧姩绉诲叆鑺傜偣鐨勬暟鎹紝鐢ㄤ簬閬嶅巻姹傚嚭鏀惧湪璇ユ暟缁勭殑绗嚑浣 + + //鎵惧埌闇瑕侀噸鏂版帓搴忕殑鏁扮粍 + if(this.pos == 0){ + originalData.forEach(item => { + if(item.parentId == event.node.key){ + targetNodeData.push(item) + } + }) + }else{ + if(event.node.origin.parentId){//濡傛灉鎷栧姩鐩爣涓洪潪涓绾ц妭鐐 + originalData.forEach(item => { + if(item.parentId == event.node.origin.parentId){ + targetNodeData.push(item) + } + }) + }else{//濡傛灉鎷栧姩鐩爣涓轰竴绾ц妭鐐 + originalData.forEach(item => { + if(!item.parentId){ + targetNodeData.push(item) + } + }) + } + } + + + let idArr = [] + targetNodeData.forEach(i => { + idArr.push(i.id) + }) + if(this.pos == 0 && event.node.origin.children.length == 1){ + let key = event.dragNode.key + orders[key] = 0 + parentId = event.node.key + }else{ + let array = [] + targetNodeData.forEach(item => { + if(item.id != event.dragNode.key){ //灏嗘嫋鍔ㄩ」鍏堢Щ闄ゆ帀 + array.push(item) + } + }) + if(event.dragNode.isEnd[event.dragNode.isEnd.length - 1]){ //濡傛灉绉诲叆鍒版渶鍚庝竴涓 + array.push(event.dragNode.origin) + }else if(event.dragNode.isStart[event.dragNode.isStart.length - 1]){//濡傛灉绉诲叆鍒扮涓涓 + array.unshift(event.dragNode.origin) + }else{//濡傛灉绉诲叆涓棿浣嶇疆 + array.splice(event.node.origin.order, 0, event.dragNode.origin) + } + array.forEach((item,key) => { + orders[item.id] = key + }) + } + + let obj ={ + id : event.dragNode.origin.id, + parentId : parentId, + orders : orders + } + + this.http.put("/api/DisposalNodes/Sort",obj).subscribe(data => { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鎺掑簭鎴愬姛','纭畾',config) + this.refurbishTreeData() + }) + } + } + + isDrag //鏄惁鍙互鎷栧姩 + pos//鏀剧疆浣嶇疆 + beforeDrop = (arg: NzFormatBeforeDropEvent) => { + if(arg.dragNode.origin.isDataNode && arg.node.level === 0){//濡傛灉涓烘暟鎹妭鐐瑰垯涓嶅厑璁告嫋鍒颁竴绾ц妭鐐 + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鏁版嵁鑺傜偣涓嶅厑璁告嫋鎷藉埌涓绾ц妭鐐','纭畾',config) + this.isDrag = false + return of(false); + }else if(!arg.dragNode.origin.isDataNode && arg.node.level === 2){ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('澶勭疆鑺傜偣涓嶅厑璁告嫋鎷藉埌涓夌骇鑺傜偣','纭畾',config) + this.isDrag = false + return of(false); + }else{ + this.isDrag = true + this.pos = arg.pos + return of(true) + } + } + //ngzorro tree 鎷栨嫿 + + //澶╂皵鏍忕洰 + weatherBtn = true + weatherBtnShow(){ + this.weatherBtn = !this.weatherBtn + } + weatherBtnHidden(){ + this.weatherBtn = !this.weatherBtn + } + + //搴曢儴鍒囨崲鎸夐挳div + detailsAndattentBtn = true + //鑺傜偣璇︽儏 + details(){ + this.detailsAndattentBtn = true + } + //娉ㄦ剰浜嬮」 + attent(){ + this.detailsAndattentBtn = false + } + + //娑堥槻瑕佺礌div杈规楂樺害璋冭妭 + firecategoriesDivMouseDown(e){ + document.onmousemove = (ev) => { + let bodyHeight = document.body.clientHeight //缃戦〉瀹藉害 + let maxHeight = this.element.nativeElement.querySelector('#rightDiv').clientHeight - 35 //鏈澶у搴 + if(bodyHeight - ev.clientY >= maxHeight){ + this.element.nativeElement.querySelector('#firecategories').style.height = maxHeight+ 'px' + this.element.nativeElement.querySelector('#property').style.height = 35+ 'px' + }else{ + this.element.nativeElement.querySelector('#firecategories').style.height = (bodyHeight - ev.clientY) + 'px' ; + this.element.nativeElement.querySelector('#property').style.height = (this.element.nativeElement.querySelector('#rightDiv').clientHeight - this.element.nativeElement.querySelector('#firecategories').clientHeight) + 'px' + } + } + document.onmouseup = () => { + document.onmousemove = null; + document.onmouseup = null; + } + } + + //宸︿晶div杈规瀹藉害璋冭妭 + leftDivMouseDown(e){ + document.onmousemove = (ev) => { + let bodyWidth = document.body.clientWidth //缃戦〉瀹藉害 + let maxWidth = bodyWidth - 260 - this.element.nativeElement.querySelector('#rightDiv').clientWidth //鏈澶у搴 + if(ev.clientX - 240 >= maxWidth){ + this.element.nativeElement.querySelector('#leftDiv').style.width = maxWidth + 'px' + }else{ + this.element.nativeElement.querySelector('#leftDiv').style.width = ev.clientX - 260 + 'px'; + } + } + document.onmouseup = () => { + document.onmousemove = null; + document.onmouseup = null; + } + } + + //搴曢儴div楂樺害璋冭妭 + bottomDivMouseDown(e){ + document.onmousemove = (ev) => { + let bodyHeight = document.body.clientHeight //缃戦〉楂樺害 + let maxHeight = this.element.nativeElement.querySelector('#rightDiv').clientHeight //鏈澶ч珮搴 + if(bodyHeight - ev.clientY >= maxHeight){ + this.element.nativeElement.querySelector('#bottomDiv').style.height = maxHeight + 'px' + }else{ + this.element.nativeElement.querySelector('#bottomDiv').style.height = (bodyHeight - ev.clientY) + 'px' ; + } + } + document.onmouseup = () => { + document.onmousemove = null; + document.onmouseup = null; + } + } + + //鍙充晶div杈规瀹藉害璋冭妭 + rightDivMouseDown(e){ + document.onmousemove = (ev) => { + let bodyWidth = document.body.clientWidth //缃戦〉瀹藉害 + let maxWidth = bodyWidth - 240 - this.element.nativeElement.querySelector('#leftDiv').clientWidth //鏈澶у搴 + if(bodyWidth - ev.clientX >= maxWidth){ + this.element.nativeElement.querySelector('#rightDiv').style.width = maxWidth + 'px' + }else{ + this.element.nativeElement.querySelector('#rightDiv').style.width = bodyWidth - ev.clientX + 'px'; + } + } + document.onmouseup = () => { + document.onmousemove = null; + document.onmouseup = null; + } + } + + //鏀惧ぇ鍥炬爣 + iconScale(){ + let number = Number(this.selected) + this.canvas.setIconScale(number) + } + + //绱犳潗瀹藉害杈撳叆妗嗘敼鍙 + assetWidthIunput(){ + this.canvasAssetObj.Width = this.assetWidth + this.canvasData.isChange = true + this.canvas.refreshIcon(this.canvasAssetObj.Id) + } + + //绱犳潗楂樺害杈撳叆妗嗘敼鍙 + assetHeightIunput(){ + this.canvasAssetObj.Height = this.assetHeight + this.canvasData.isChange = true + this.canvas.refreshIcon(this.canvasAssetObj.Id) + } + + //绱犳潗瑙掑害杈撳叆妗嗘敼鍙 + assetAngleIunput(){ + this.canvasAssetObj.Angle = this.sliderValue + this.canvasData.isChange = true + this.canvas.refreshIcon(this.canvasAssetObj.Id) + } + + //绱犳潗鍘氬害杈撳叆妗嗘敼鍙 + assetThicknessIunput(){ + this.canvasAssetObj.Thickness = this.sliderValueThickness + this.canvasData.isChange = true + this.canvas.refreshIcon(this.canvasAssetObj.Id) + } + + //绱犳潗鏄惁楂樹寒鏀瑰彉----->鏈湴鎿嶄綔琛屼负 + assetHighLightIunput(){ + + } + + //鍔ㄦ佸睘鎬х礌鏉恑nput妗嗗兼敼鍙 + assetInputChange(i,e){ + let index = this.canvasAssetObj.PropertyInfos.findIndex((item)=>{ + return i.PropertyName == item.PropertyName + }) + this.canvasAssetObj.PropertyInfos[index].PropertyValue = e.target.value + this.canvasData.isChange = true + this.canvas.refreshIcon(this.canvasAssetObj.Id) + } + + //鍔ㄦ佸睘鎬х礌鏉愬竷灏斿兼鏀瑰彉radio + assetRadioChange(i,boolean){ + let index = this.canvasAssetObj.PropertyInfos.findIndex((item)=>{ + return i.PropertyName == item.PropertyName + }) + this.canvasAssetObj.PropertyInfos[index].PropertyValue = boolean + this.canvasData.isChange = true + } + + colorIndex//榛樿绱犳潗棰滆壊 + selectedcolor//鐐瑰嚮閫夋嫨鐨勯鑹 + //閫夋嫨绱犳潗棰滆壊 + selectcolor(item,key){ + //鍦ㄥ綋鍓嶉忔槑搴﹀熀纭涓婃敼鍙橀鑹 + this.selectedcolor = item + this.selectedcolor.substring(this.selectedcolor.length-2) + this.canvasAssetObj.Color = this.selectedcolor + this.canvasData.isChange = true + this.canvas.refreshIcon(this.canvasAssetObj.Id) + } + //棰滆壊閫夋嫨婊戠鐨勫 + colorDivSliderValue + colorDivSliderChange(){ + 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.selectedcolor = replacepos(this.selectedcolor,7,8,colorOpacity.toString(16)) + this.canvasAssetObj.Color = this.selectedcolor + this.canvasData.isChange = true + this.canvas.refreshIcon(this.canvasAssetObj.Id) + } + + //鏌ョ湅鍥剧墖璇︽儏 + lookImg(){ + const dialogRef = this.dialog.open(ViewDetailsBuilding, {//璋冪敤open鏂规硶鎵撳紑瀵硅瘽妗嗗苟涓旀惡甯﹀弬鏁拌繃鍘 + data: {imagesArr:this.imagesArr,index:this.clickedIndex} + }); + dialogRef.afterClosed().subscribe(data=>{ }); + } + + //涓婁紶绱犳潗鍥剧墖 + selectFile(e){ + let imgFile = e.target.files[0] || null //涓婁紶鐨勬枃浠 + this.startUploading(imgFile) + } + objectName:any //涓婁紶瀵硅薄鍚 + startUploading (imgFile) { + let _this = this + let file = imgFile || null //鑾峰彇涓婁紶鐨勬枃浠 + let fileSize = file.size || null //涓婁紶鏂囦欢鐨勬诲ぇ灏 + let shardSize = 5 * 1024 * 1024 //5MB涓涓垎鐗 + let companyId = sessionStorage.getItem("companyId") + if (file && fileSize <= shardSize) { //涓婁紶鏂囦欢<=5MB鏃 + let formData = new FormData() + formData.append("file",file) + this.http.post(`api/Objects/WebPlan2D/${companyId}`,formData).subscribe((data:any)=>{ + this.objectName = data.objectName + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('涓婁紶鎴愬姛','纭畾',config) + + //鍦ㄥ師濮嬬礌鏉愬璞″拰闇瑕佸惊鐜浘鐗囩殑瀵硅薄涓垎鍒玴ush鏈鏂颁笂浼犵殑鍥剧墖 + let imgObj = { + "Tag": null, + "Order": 0, + "Enabled": false, + "Visible": false, + "Required": false, + "RuleName": null, + "RuleValue": null, + "PhysicalUnit": null, + "PropertyName": "鍥剧墖", + "PropertyType": 3, + "PropertyValue": "/api/Objects/WebPlan2D/" + this.objectName + } + + this.imagesArr.push(imgObj) + this.canvasAssetObj.PropertyInfos.push(imgObj) + + setTimeout(() => { + this.mySwiper = new Swiper('.swiper-container',{ + loop: false, + // grabCursor: true, + // 濡傛灉闇瑕佸墠杩涘悗閫鎸夐挳 + navigation: { + nextEl: '.swiper-button-next', + prevEl: '.swiper-button-prev', + }, + on:{ + click: function(){ + _this.clickedIndex = this.clickedIndex + }, + } + }); + + this.mySwiper.slideTo(this.imagesArr.length - 1) + this.gallery.update() + }, 0); + + //鍒ゆ柇涓婁紶绱犳潗灞炴у浘鐗囨槸鍚﹁秴鍑烘暟閲 瓒呭嚭鏁伴噺鍒欓殣钘廼nput妗 + if(this.imagesArr.length < this.imagesArrNum){//涓嶈秴鍑篿nput鎵嶄細鏄剧ず + this.isImgNumCss = true + }else{ + this.isImgNumCss = false + } + + this.canvasData.isChange = true + }) + } else if (file && fileSize>shardSize) { //涓婁紶鏂囦欢>5MB鏃,鍒嗗潡涓婁紶 + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('涓婁紶鍥剧墖鏂囦欢涓嶅厑璁稿ぇ浜5mb','纭畾',config); + } + + } + + //涓嶈兘涓婁紶鍥剧墖鎻愮ず + imgNumBeyond(){ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鍥剧墖鏁伴噺宸茶揪涓婇檺','纭畾',config); + } + + //鍒犻櫎绱犳潗灞炴у浘鐗 + deleteImg(){ + if(this.imagesArr.length == 0){ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('娌℃湁鍙垹闄ょ殑鍥剧墖锛岃鍏堜笂浼','纭畾',config) + }else{ + // 鍦ㄧ礌鏉愬師濮嬪璞′腑灏嗗垹闄ょ殑鍥剧墖鍘绘帀 + this.canvasAssetObj.PropertyInfos = [...this.canvasAssetObj.PropertyInfos.filter((item)=>{ + return item.PropertyValue != this.imagesArr[this.mySwiper.activeIndex].PropertyValue + })] + //鍦ㄥ浘鐗囧惊鐜暟缁勪腑灏嗗浘鐗囧幓鎺 + this.imagesArr.splice(this.mySwiper.activeIndex, 1); + //鏇存柊swiper瑙嗗浘 + setTimeout(() => { + this.mySwiper.update(); + this.gallery.update() + }, 0); + + //灏嗕笂浼犵殑input妗嗘樉绀哄嚭鏉 + this.isImgNumCss = true; + //娓呴櫎鍥剧墖缂撳瓨 + if((document.getElementById('inputimg'))){ + (document.getElementById('inputimg')).value = null //娓呯┖input妗嗙紦瀛 + } + + this.canvasData.isChange = true + } + } + + //鍔ㄦ佸睘鎬ф柟鍚憇elect閫夋嫨妗 + direction(i,e){ + let index = this.canvasAssetObj.PropertyInfos.findIndex((item)=>{ + return i.PropertyName == item.PropertyName + }) + this.canvasAssetObj.PropertyInfos[index].PropertyValue = e.target.value + this.canvasData.isChange = true + } + + //鍔ㄦ佸睘鎬т緵缁欏尯鍩焥elect閫夋嫨妗 + supplyArea(i,e){ + let index = this.canvasAssetObj.PropertyInfos.findIndex((item)=>{ + return i.PropertyName == item.PropertyName + }) + this.canvasAssetObj.PropertyInfos[index].PropertyValue = e.target.value + this.canvasData.isChange = true + } + + //鍔ㄦ佸睘鎬т緵缁欑被鍨媠elect閫夋嫨妗 + supplyType(i,e){ + let index = this.canvasAssetObj.PropertyInfos.findIndex((item)=>{ + return i.PropertyName == item.PropertyName + }) + this.canvasAssetObj.PropertyInfos[index].PropertyValue = e.target.value + 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"){ + this.isEditPattern = false + this.isediticon = false + } + //gis妯″潡骞抽潰鍥 + if(this.router.url.indexOf("gis") != -1 && sessionStorage.getItem("gisplan") == "look"){ + this.isEditPattern = false + this.isediticon = false + this.canvasData.gameMode = GameMode.Assignment + } else { + this.getAllLibrary() //鑾峰彇绱犳潗搴 + } + + let that = this + window.setTimeout(()=>{ + document.getElementById("functionalDomainContent").oncontextmenu = function (event) { + // that.canvas.cancelPaint() + that.selectImageIndex = -1 + event.preventDefault(); + }; + }) + + this.canvasData.getMessage().subscribe((message: any)=>{ + if(message == "send a message"){ + this.refurbishTreeData() + } + }) + } + + + + ngAfterViewInit(): void { + //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',()=>{ + // 鏀跺埌鏁版嵁琛ㄧず鍏变韩鏁版嵁鍙戠敓鍙樺寲 + this.renovateTreeData(false) + }); + } + + copyAssetData:any //瀛樺偍鐢ㄤ簬澶嶅埗鐨勭礌鏉 + //澶嶅埗绱犳潗 + copyAsset(){ + this.canvas.copy() + } + //绮樿创绱犳潗 + pasteAsset(){ + let companyId = sessionStorage.getItem("companyId") + let buildingId = this.beforeOneCheckedBuilding.id + let floorId = this.selectingSitePlan.id + this.canvas.paste(companyId,buildingId,floorId) + this.renovateTreeData(false) + } + + basicInfo:boolean = true //鍩烘湰淇℃伅鍚嶇О鏄鹃殣 + wantToWork:boolean = true //鎯冲畾浣滀笟鍚嶇О鏄鹃殣 + //鐐瑰嚮鍩烘湰淇℃伅鍚嶇О + basicInfoClick(){ + this.basicInfo = !this.basicInfo + this.canvas.setNameVisible(this.basicInfo,0) + } + + //鐐瑰嚮鎯冲畾浣滀笟鍚嶇О + wantToWorkClick(){ + this.wantToWork = !this.wantToWork + this.canvas.setNameVisible(this.wantToWork,1) + } + + isEditPattern:boolean = true //鏄惁涓虹紪杈戞ā寮 + //杩涘叆缂栬緫妯″紡 + editpat(){ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('杩涘叆缂栬緫妯″紡','纭畾',config); + this.isEditPattern = true + } + + //杩涘叆鏌ョ湅妯″紡 + lookpat(){ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('杩涘叆鏌ョ湅妯″紡','纭畾',config); + this.isEditPattern = false + } + + //淇濆瓨骞抽潰鍥 + saveNum :any = [] + saveSite(){ + //鏇存柊鐢ㄤ簬缁熻鐨勬暟鎹 + this.canvasData.updateBuildingData() + + + if (this.selectingSitePlan && this.selectingSitePlan.id) { + //鎵撳紑閬僵灞 + this.maskLayerService.sendMessage(true) + 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)); + CompanyData.data = JSON.stringify(CompanyData.data) + + let object = this.canvasData.originalcompanyBuildingData.data + let adjoinArr = [] //姣楅偦鏁扮粍 + + if(this.pattern){//濡傛灉鏄熀鏈俊鎭紪杈戞ā寮 + for (const key in object) { + if (object[key].Name == "姣楅偦") {//濡傛灉鏄浉鍚屾ゼ灞傦紝鍒欑瓫閫夊嚭姣楅偦 + + object[key].PropertyInfos.forEach(element => { + if(element.PropertyName == "鏂瑰悜"){ + adjoinArr.push(element.PropertyValue) + } + }); + } + } + + if((new Set(adjoinArr)).size != adjoinArr.length){ + this.maskLayerService.sendMessage(false) + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨澶辫触锛屾瘲閭诲瓨鍦ㄧ浉鍚屾柟鍚','纭畾',config); + return false + }else{ + //濡傛灉鏄崟浣 鎬诲钩闈㈠浘 + if(this.checkedBuildingIndex==-1){ + // console.log(111,SitePlanData) + //淇濆瓨骞抽潰鍥炬暟鎹 + this.http.post("/api/SitePlanData",SitePlanData,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.maskLayerService.sendMessage(false) + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config); + this.tabbarService.sendMessage('changeScore'); + } + },err=>{ + this.maskLayerService.sendMessage(false) + 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 => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.maskLayerService.sendMessage(false) + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config); + this.tabbarService.sendMessage('changeScore'); + } + },err=>{ + this.maskLayerService.sendMessage(false) + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('鍗曚綅鏁版嵁淇濆瓨澶辫触','纭畾',config); + }) + + //鎵归噺淇濆瓨鍗曚綅姣楅偦 + let CompanyAdjoins = this.canvasData.getCompanyAdjoinInfo() + this.http.post("/api/CompanyAdjoins/Batch",CompanyAdjoins,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.maskLayerService.sendMessage(false) + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config); + this.tabbarService.sendMessage('changeScore'); + } + },err=>{ + this.maskLayerService.sendMessage(false) + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + if(err == 'infos 鏈夐噸澶嶆柟鍚戯紒'){ + this.snackBar.open('鍗曚綅姣楅偦鍚屾澶辫触,瀛樺湪鐩稿悓鏂瑰悜','纭畾',config); + }else{ + this.snackBar.open('鍗曚綅姣楅偦鍚屾澶辫触','纭畾',config); + } + }) + + //鎵归噺淇濆瓨鍗曚綅閲嶇偣閮ㄤ綅 + let CompanyImportantLocations = this.canvasData.getCompanyImportantLocations() + this.http.post("/api/CompanyImportantLocations/Batch",CompanyImportantLocations,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.maskLayerService.sendMessage(false) + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config); + this.tabbarService.sendMessage('changeScore'); + } + },err=>{ + this.maskLayerService.sendMessage(false) + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('鍗曚綅閲嶇偣閮ㄤ綅鍚屾澶辫触','纭畾',config); + }) + + //鎵归噺淇濆瓨鍗曚綅娑堥槻璁炬柦绱犳潗 + let CompanyFacilityAssets = this.canvasData.getAllCompanyFacilityAssetInfo() + this.http.post("/api/CompanyFacilityAssets/Batch",CompanyFacilityAssets,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.maskLayerService.sendMessage(false) + this.maskLayerService.sendMessage(false) + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config); + this.tabbarService.sendMessage('changeScore'); + } + },err=>{ + this.maskLayerService.sendMessage(false) + 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 => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.maskLayerService.sendMessage(false) + this.maskLayerService.sendMessage(false) + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config); + this.tabbarService.sendMessage('changeScore'); + } + },err=>{ + this.maskLayerService.sendMessage(false) + 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 => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.maskLayerService.sendMessage(false) + this.canvasData.isChange = false + this.maskLayerService.sendMessage(false) + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config); + this.tabbarService.sendMessage('changeScore'); + } + },err=>{ + this.maskLayerService.sendMessage(false) + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('鍗曚綅鏁版嵁淇濆瓨澶辫触','纭畾',config); + }) + + //鎵归噺淇濆瓨寤虹瓚姣楅偦 + let buildingAdjoins = this.canvasData.getBuildingAdjoinInfo() + this.http.post(`/api/BuildingAdjoins/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingAdjoins).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.maskLayerService.sendMessage(false) + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config); + this.tabbarService.sendMessage('changeScore'); + } + },err=>{ + this.maskLayerService.sendMessage(false) + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + if(err == 'infos 鏈夐噸澶嶆柟鍚戯紒'){ + this.snackBar.open('寤虹瓚姣楅偦鍚屾澶辫触,瀛樺湪鐩稿悓鏂瑰悜','纭畾',config); + }else{ + this.snackBar.open('寤虹瓚姣楅偦鍚屾澶辫触','纭畾',config); + } + }) + + //鎵归噺淇濆瓨寤虹瓚閲嶇偣閮ㄤ綅 + let buildingImportantLocations = this.canvasData.getBuildingImportantLocations() + this.http.post(`/api/BuildingImportantLocations/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingImportantLocations).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.maskLayerService.sendMessage(false) + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config); + this.tabbarService.sendMessage('changeScore'); + } + },err=>{ + this.maskLayerService.sendMessage(false) + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('寤虹瓚閲嶇偣閮ㄤ綅鍚屾澶辫触','纭畾',config); + }) + + //鎵归噺淇濆瓨寤虹瓚娑堥槻璁炬柦绱犳潗 + let buildingFacilityAssets = this.canvasData.getAllBuildingFacilityAssetInfo() + this.http.post(`/api/BuildingFacilityAssets/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingFacilityAssets).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.maskLayerService.sendMessage(false) + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config); + this.tabbarService.sendMessage('changeScore'); + } + },err=>{ + this.maskLayerService.sendMessage(false) + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('寤虹瓚娑堥槻璁炬柦绱犳潗鍚屾澶辫触','纭畾',config); + }) + + } + } + }else{//濡傛灉鏄兂瀹氫綔涓氱紪杈戞ā寮 + const dialogRef = this.dialog.open(saveOneDialogBuilding, { + 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 + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鏆傛棤妤煎眰鏁版嵁','纭畾',config); + } + } + + //鑾峰緱鎵鏈夌殑寤虹瓚鐗 + getAllBuildings(init:boolean = false){ + this.http.get("/api/Buildings",{ params:{companyId : this.params.companyId}}).subscribe((data:any)=>{ + this.allBuildings = data + if (init) { + this.checkedBuildingIndex = 0 + data && data.length? this.beforeOneCheckedBuilding = data[0] : this.beforeOneCheckedBuilding = {id:null, buildingTypes:[{id:null}]} + this.getBuildingSitePlan(this.beforeOneCheckedBuilding) + } //if + }) + } + + //鎷栨嫿tree + drop(e){ + // console.log(1111,e) + } + drop2(e){ + // console.log(222,e) + } + + //鍒涘缓寤虹瓚 + createBuilding(){ + let data = { + allBuildings:this.allBuildings, + companyId :this.params.companyId + } + let dialogRef = this.dialog.open(CreateBuildingBuilding,{data}); + dialogRef.afterClosed().subscribe(data=>{ + if (data == "鍒涘缓鎴愬姛") { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鍒涘缓鎴愬姛','纭畾',config); + this.allBuildings.length? this.getAllBuildings() : this.getAllBuildings(true) + }else if (data == "鍒涘缓澶辫触") { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鍒涘缓澶辫触','纭畾',config); + } + }); + } + + //閫夋嫨寤虹瓚 + checkedBuilding(item,index){ + if (this.checkedBuildingIndex!=index) { + + if (this.canvasData.isChange) { //true 鏁版嵁琚敼鍔 + let isTrue = confirm('鏄惁淇濆瓨褰撳墠缂栬緫鏁版嵁') + if (isTrue) { //鍏堜繚瀛樻暟鎹 鍦ㄥ垏鎹 + let isSuccess = this.saveSite()//true鐨勬椂鍊 鍏堜繚瀛樻暟鎹 + if (isSuccess != false) { + this.beforeOneCheckedBuilding = item + this.checkedBuildingIndex = index + if (index==-1) { //鎬诲钩闈㈠浘鏁版嵁 + this.getSitePlan() + } else { //寤虹瓚妤煎眰/鍖哄煙鏁版嵁 + this.getBuildingSitePlan(item) + } + } + } else { + this.beforeOneCheckedBuilding = item + this.checkedBuildingIndex = index + if (index==-1) { //鎬诲钩闈㈠浘鏁版嵁 + this.getSitePlan() + } else { //寤虹瓚妤煎眰/鍖哄煙鏁版嵁 + this.getBuildingSitePlan(item) + } + } + } else { //flase 鏁版嵁鏈鏀瑰姩 + this.beforeOneCheckedBuilding = item + this.checkedBuildingIndex = index + if (index==-1) { //鎬诲钩闈㈠浘鏁版嵁 + this.getSitePlan() + } else { //寤虹瓚妤煎眰/鍖哄煙鏁版嵁 + this.getBuildingSitePlan(item) + } + } //if + + } //if + } + + //缂栬緫寤虹瓚 + editBuilding(e,item){ + e.stopPropagation(); + let dialogRef = this.dialog.open(EditBuildingBuilding,{data: {item:item}}); + dialogRef.afterClosed().subscribe(data=>{ + if (data == "淇敼鎴愬姛") { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇敼鎴愬姛','纭畾',config); + this.getAllBuildings() + }else if (data == "淇敼澶辫触") { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇敼澶辫触','纭畾',config); + } + }); + } + + //鍒犻櫎寤虹瓚 + deleteBuilding(e,item){ + e.stopPropagation(); + if(confirm("鏄惁鍒犻櫎璇ュ缓绛") == true){ + let isHave = this.canvasData.allDisposalNode.find(items=>{ return items.buildingId === item.id }) + if (isHave == undefined) { + this.http.delete(`/api/Buildings/${item.id}`).subscribe(data=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鍒犻櫎鎴愬姛','纭畾',config); + this.getAllBuildings(true) + },err=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鍒犻櫎澶辫触','纭畾',config); + this.getAllBuildings(true) + }) + } else { //寤虹瓚 鍚湁鏁版嵁鑺傜偣鏃 + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鍚湁鏁版嵁鑺傜偣鐨勫缓绛戜笉鍏佽鍒犻櫎','纭畾',config); + } + } + } + + storeyData //灏嗗缓绛戠礌鏉愬拰褰撳墠妤煎眰绱犳潗鍚堜簩涓轰竴 + + //澶勭悊 tree 鏁版嵁缁撴瀯 + handleTreeData (storeyData) { + + this.storeyData = storeyData + let data = this.allFireElements //鎵鏈夋秷闃茶绱犳ā鏉 + let treeData = [] //tree鍨 澶勭悊瀹屾垚鍚庣殑鏁版嵁 + data.forEach(element => { + element.isTemplate = true //娣诲姞妯℃澘鏍囪瘑 + element.isLook = true //娣诲姞鏄惁鍙鏍囪瘑 + element.name!='鍏朵粬'? element.children = [] : null + + if(storeyData){ + for(let key in storeyData.data){ + storeyData.data[key].isLookPattern = true + if(element.id == storeyData.data[key].FireElementId){ + storeyData.data[key].isTemplate = false + storeyData.data[key].isLook = true + + element.isNewElement = true //璇ヨ妭鐐筩hildren鏄惁瀛樺湪鏂版坊鍔犵殑鐪熷疄绱犳潗 鏍囪瘑 + + //瀹氫箟鏌ョ湅妯″紡涓嬭兘鐪嬪埌鐨勫厓绱 + element.isLookPattern = true + if(element.parentId){ + data.forEach(i => { + if(i.id == element.parentId){ + i.isLookPattern = true + } + }) + } + // + + element.children.push(storeyData.data[key]) + } + } + } + data.forEach(item => { if (item.parentId == element.id) {element.children.push(item)} }); + }); + data.forEach(element => { + if (!element.parentId) { treeData.push(element) } + }); + this.dataSource.data = treeData + this.treeControl.expandAll() + + } + + //鐐瑰嚮鏍戣妭鐐 + clickTreeNode(node){ + if(this.canvasData.originalcompanyBuildingData.data[node.id]){ + this.setAssetsProperty(this.canvasData.originalcompanyBuildingData.data[node.id]) + }else if(this.canvasData.originaleveryStoreyData.data[node.id]){ + this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[node.id]) + } + + //canvas涓婄殑绱犳潗楂樹寒 + let iconHighLightArr:any = [] + if(node.isTemplate){//濡傛灉鏄ā鏉,鍒欏紑濮嬪悜涓嬫壘 + node.children.forEach(item => { + if(item.isTemplate){//濡傛灉瀛愯妭鐐逛緷鏃ф槸妯℃澘,鍒欑户缁紑濮嬪悜涓嬫壘 + item.children.forEach(i => { + iconHighLightArr.push(i.Id) + }) + }else{ + iconHighLightArr.push(item.Id) + } + }) + }else{ + iconHighLightArr.push(node.id) + } + this.canvas.setHighlight(iconHighLightArr) + } + + //鐐瑰嚮鏁拌妭鐐圭殑鏄剧ず闅愯棌icon + clickLookItem(node){ + + //淇敼鐪熷疄绱犳潗islook灞炴 + for(let key in this.storeyData.data){ + if(key == node.id){ + this.storeyData.data[key].isLook = !this.storeyData.data[key].isLook + } + } + + //鎵鏈夋秷闃茶绱犳ā鏉垮彉鍖杋slook鍊 + if(node.isTemplate){ + this.allFireElements.forEach(item=>{ + if(item.id == node.id || item.name == "鍏朵粬"){ + item.isLook = !item.isLook + } + }) + } + + + //瀛愯妭鐐硅窡闅忕埗鑺傜偣鐨刬slook鍙樺寲 + 聽 if(node.children聽&&聽node.children.length聽!=聽0){ +聽聽聽聽聽聽node.children.forEach(item=>{ +聽聽聽聽聽聽聽聽item.isLook聽=聽!node.isLook聽 +聽聽聽聽聽聽聽聽if(item.children聽&&聽item.children.length聽!=聽0){ +聽聽聽聽聽聽聽聽聽聽item.children.forEach(i=>{ +聽聽聽聽聽聽聽聽聽聽聽聽i.isLook聽=聽聽!node.isLook聽 +聽聽聽聽聽聽聽聽聽聽}) +聽聽聽聽聽聽聽聽} +聽聽聽聽聽聽}) +聽聽聽聽 } + + + const nodes = this.treeControl.dataNodes; + const expandNodes = []; + nodes.forEach((item) => { + if(item.expandable && this.treeControl.isExpanded(item)){ + expandNodes.push(item.id); + } + }); + + this.dataSource.data = [...this.dataSource.data] + + let newNodes = this.treeControl.dataNodes; + newNodes = newNodes.filter(n => { + return expandNodes.indexOf(n.id) >= 0; + }); + newNodes.forEach(item => { + this.treeControl.expand(item); + }); + + //canvas涓婄殑绱犳潗鏄鹃殣 + let iconVisibleArr:any = [] + if(node.isTemplate){//濡傛灉鏄ā鏉,鍒欏紑濮嬪悜涓嬫壘 + node.children.forEach(item => { + if(item.isTemplate){//濡傛灉瀛愯妭鐐逛緷鏃ф槸妯℃澘,鍒欑户缁紑濮嬪悜涓嬫壘 + item.children.forEach(i => { + iconVisibleArr.push(i.Id) + }) + }else{ + iconVisibleArr.push(item.Id) + } + }) + }else{ + iconVisibleArr.push(node.id) + } + this.canvas.setIconVisible(iconVisibleArr,!node.isLook) + } + + //璁$畻 鍙鍖哄煙鍐呭搴, 鏄惁缂╂斁鑳屾櫙鍥 + backGroundScale () { + // let that = this + // let dad = this.element.nativeElement.querySelector('.functionalDomainContent').clientWidth + // let dadHeight = this.element.nativeElement.querySelector('.functionalDomainContent').clientHeight + // let left = this.element.nativeElement.querySelector('.functionalDomainLeft').clientWidth + // let right = this.element.nativeElement.querySelector('.functionalDomainRight').clientWidth + // let imgWidth = dad - left - right//鍙鍖哄煙鍐 瀹藉害 + // let img = new Image() + // img.src = this.selectingSitePlan.imageUrl; + // img.onload = function(){ + // if (img.height > dadHeight && img.width > imgWidth) { + // let width = imgWidth/img.width + // let height = dadHeight/img.height + // that.canvas.setBackgroundScale((width>height? height : width)-0.005) + // return + // } else if (img.height > dadHeight) { + // that.canvas.setBackgroundScale((dadHeight/img.height)-0.005) + // return + // } else if (img.width > imgWidth) { + // that.canvas.setBackgroundScale((imgWidth/img.width)-0.005) + // return + // } + // }; + } + + //灏佽 鍒锋柊 tree 鏁版嵁 + async renovateTreeData (isRefresh:boolean = true) { + this.allFireElements[this.allFireElements.length-1].children = [] + isRefresh? await this.canvas.refresh() : null + this.canvas.setNameVisible(this.basicInfo,0) + this.canvas.setNameVisible(this.wantToWork,1) + isRefresh? this.canvasData.isChange = false : null //鏈嶅姟涓 鏁版嵁鏄惁鏀瑰姩 鏀逛负false + isRefresh? this.isShowProperty = true : null + isRefresh? this.isShowAttribute = true : null + !this.pattern? this.mateFireForce() : null //鍒锋柊 寤虹瓚妤煎眰 鐏簮/鍔涢噺鍥炬爣 + + let beforeOneId = this.selectingSitePlan.id || '' //褰撳墠 閫変腑 骞抽潰鍥 妤煎眰/鍖哄煙 id + let companyBuildingData = JSON.parse(JSON.stringify( this.canvasData.originalcompanyBuildingData || {} )) // 褰撳墠 鍗曚綅/寤虹瓚 鏁版嵁 + let storeyData = JSON.parse(JSON.stringify( this.canvasData.originaleveryStoreyData || {} )) //褰撳墠 妤煎眰 鏁版嵁 + + for(let key in companyBuildingData.data){ + if (companyBuildingData.data[key].FloorId === beforeOneId) { //澶勭悊 鍗曚綅/寤虹瓚 鏁版嵁鏄惁褰掍簬褰撳墠妤煎眰涓 + storeyData.data[key] = companyBuildingData.data[key] + } + } + for(let key in storeyData.data){ //绛涢夋暟鎹 娌℃湁鍖归厤鍏ㄩ儴鏀惧叆鍒 鍏朵粬 鏁扮粍 + let noMatch = this.allFireElements.find( every=> every.id===storeyData.data[key].FireElementId ) + if (!noMatch) { + this.allFireElements[this.allFireElements.length-1].children.push(storeyData.data[key]) + } + } + this.handleTreeData(storeyData) //澶勭悊tree鏁版嵁缁撴瀯 + } + + + + //闄堥箯椋炩啌鈫撯啌 + //闄堥箯椋炩啌鈫撯啌 + //闄堥箯椋炩啌鈫撯啌 + params = {companyId: sessionStorage.getItem('companyId')} + // params = {companyId: this.route.snapshot.queryParams.id} + allFireElements:any = []; //褰撳墠 鍗曚綅/寤虹瓚 涓嬬殑娑堥槻瑕佺礌 + + isShowAttribute:boolean = true; //灞炴ф爮 鏄惁鏄剧ず 榛樿鏁版嵁 + isShowProperty:boolean = false //灞炴ф爮 鏄惁鏈変笢瑗 + + toggleExpandPanel:boolean = false; //宸︿晶鍙睍寮闈㈡澘灞曞紑鎴栧叧闂 + toggleExpandPanelRight:boolean = false; //鍙充晶鍙睍寮闈㈡澘灞曞紑鎴栧叧闂 + togglePlane:boolean = true; //鍙睍寮闈㈡澘骞抽潰鍥 鏄鹃殣 + toggleMaterialBank:boolean = false; //鍙睍寮闈㈡澘绱犳潗搴 鏄鹃殣 + toggleHandlePlans:boolean = true; //鍙睍寮闈㈡澘澶勭疆棰勬 鏄鹃殣 + //鍙睍寮闈㈡澘灞曞紑鎴栧叧闂 + toggle () { + this.toggleExpandPanel = !this.toggleExpandPanel + } + //鍙睍寮闈㈡澘灞曞紑鎴栧叧闂 + toggle2 () { + this.toggleExpandPanelRight = !this.toggleExpandPanelRight + } + //鍙睍寮闈㈡澘 骞抽潰鍥 灞曞紑鎴栧叧闂 + togglePlanarGraph () { + this.togglePlane = !this.togglePlane + } + //鍙睍寮闈㈡澘 绱犳潗搴 灞曞紑鎴栧叧闂 + toggleMaterial () { + this.toggleMaterialBank = !this.toggleMaterialBank + } + //鍙睍寮闈㈡澘 澶勭疆棰勬 灞曞紑鎴栧叧闂 + toggleHandlePlan () { + this.toggleHandlePlans = !this.toggleHandlePlans + } + + sitePlanData:any = []; //鎬诲钩闈㈠浘 妤煎眰/鍖哄煙 鏁版嵁 + selectingSitePlan:any; //閫変腑鐨 骞抽潰鍥 妤煎眰/鍖哄煙 + selectSitePlanIndex:number; //閫変腑鐨 骞抽潰鍥 妤煎眰/鍖哄煙 index + + //鑾峰彇鎬诲钩闈㈠浘 + getSitePlan () { + let fireData = this.getFireElements(sessionStorage.getItem('buildingTypeId')) //鑾峰彇鍗曚綅涓 娑堥槻瑕佺礌 + let planData = this.getSitePlanCompanyData() //鑾峰彇 鍗曚綅 鏁版嵁 + this.http.get('/api/SitePlans',{params:this.params}).subscribe(data=>{ + this.sitePlanData = data + this.selectingSitePlan = this.sitePlanData[0] || {} + this.canvasData.selectStorey = this.sitePlanData[0] || {} //鏈嶅姟涓 瀛樹竴浠芥暟鎹 + this.selectSitePlanIndex = 0 + + Promise.all([fireData,planData]).then((res)=>{ + this.getSitePlanStorey(this.selectingSitePlan) //鑾峰彇 骞抽潰鍥 妤煎眰鏁版嵁 + }) + + }) + } + + //鑾峰彇寤虹瓚 妤煎眰/鍖哄煙 + getBuildingSitePlan (item) { + let params = { buildingId: item.id } + let fireData = this.getFireElements(item.buildingTypes[0].id || '') //鑾峰彇寤虹瓚涓 娑堥槻瑕佺礌 + let planData = this.getBuildingData(params) //鑾峰彇 寤虹瓚 鏁版嵁 + this.http.get('/api/BuildingAreas',{params}).subscribe(data=>{ + this.sitePlanData = data + this.selectingSitePlan = this.sitePlanData[0] || {} + this.canvasData.selectStorey = this.sitePlanData[0] || {} //鏈嶅姟涓 瀛樹竴浠芥暟鎹 + this.selectSitePlanIndex = 0 + + Promise.all([fireData,planData]).then((res)=>{ + this.getBuildingStorey(this.selectingSitePlan) //鑾峰彇 寤虹瓚 妤煎眰鏁版嵁 + }) + + }) + } + + //鏍规嵁鍗曚綅绫诲瀷鑾峰緱鎵鏈夌殑娑堥槻瑕佺礌 + getFireElements (e) { + let params = {ids:e} + return new Promise ((resolve,reject)=>{ + this.http.get('/api/Companies/FireElements',{params}).subscribe((data:any)=>{ + this.allFireElements = data //鎵鏈夋秷闃茶绱 + let other = { + children: [], + computed: true, + id: '', + name: '鍏朵粬', + order: 999, + parentId: null, + tag: "INPUT", + isLookPattern : true + } + this.allFireElements.push(other) + resolve('success') + }) + }) + } + + //鑾峰彇 鍗曚綅 鏁版嵁 + getSitePlanCompanyData () { + return new Promise ((resolve,reject)=>{ + this.http.get('/api/CompanyData',{params:this.params}).subscribe((data:any)=>{ + this.canvasData.originalcompanyBuildingData = data || {} // 鍗曚綅鍘熸暟鎹 + this.canvasData.originalcompanyBuildingData.data? this.canvasData.originalcompanyBuildingData.data = JSON.parse(this.canvasData.originalcompanyBuildingData.data) : this.canvasData.originalcompanyBuildingData.data = {} + this.canvasData.originalcompanyBuildingData.version = "2.0" + this.canvasData.originalcompanyBuildingData.companyId? null : this.canvasData.originalcompanyBuildingData.companyId = sessionStorage.getItem('companyId') + resolve('success') + }) + }) + } + + //鑾峰彇 骞抽潰鍥 妤煎眰鏁版嵁 + getSitePlanStorey (e) { + let params = {sitePlanId: e.id} + this.http.get(`/api/SitePlanData`,{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 = "2.0" + this.canvasData.originaleveryStoreyData.sitePlanId? null : this.canvasData.originaleveryStoreyData.sitePlanId = e.id || null + this.renovateTreeData() + }) + } + + //鑾峰彇 寤虹瓚 鏁版嵁 + getBuildingData (e) { + return new Promise ((resolve,reject)=>{ + this.http.get(`/api/BuildingData`,{params:e}).subscribe((data:any)=>{ + this.canvasData.originalcompanyBuildingData = data || {} // 寤虹瓚鍘熸暟鎹 + this.canvasData.originalcompanyBuildingData.data? this.canvasData.originalcompanyBuildingData.data = JSON.parse(this.canvasData.originalcompanyBuildingData.data) : this.canvasData.originalcompanyBuildingData.data = {} + this.canvasData.originalcompanyBuildingData.version = "2.0" + this.canvasData.originalcompanyBuildingData.buildingId? null : this.canvasData.originalcompanyBuildingData.buildingId = e.buildingId + resolve('success') + }) + }) + } + + //鑾峰彇 寤虹瓚 妤煎眰鏁版嵁 + 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 = "2.0" + this.canvasData.originaleveryStoreyData.buildingAreaId? null : this.canvasData.originaleveryStoreyData.buildingAreaId = e.id || null + this.renovateTreeData() + }) + } + + //鐐瑰嚮閫変腑 骞抽潰鍥 妤煎眰/鍖哄煙 鏃 + selectSitePlan (item,index) { + if (this.selectSitePlanIndex != index) { + this.canvasData.selectPanelPoint = new DisposalNodeData(); + if (this.canvasData.isChange) { //true 鏁版嵁琚敼鍔 + let isTrue = confirm('鏄惁淇濆瓨褰撳墠缂栬緫鏁版嵁') + if (isTrue) { //鍏堜繚瀛樻暟鎹 鍦ㄥ垏鎹 + let isSuccess = this.saveSite()//true鐨勬椂鍊 鍏堜繚瀛樻暟鎹 + if (isSuccess != false) { + this.selectingSitePlan = item + this.selectSitePlanIndex = index + this.canvasData.selectStorey = item //鏈嶅姟涓 瀛樹竴浠芥暟鎹 + if (this.checkedBuildingIndex==-1) { //鎬诲钩闈㈠浘鏃 + this.getSitePlanStorey(item) //鑾峰彇 骞抽潰鍥 妤煎眰鏁版嵁 + } else { //妤煎眰/鍖哄煙鏃 + this.getBuildingStorey(item) //鑾峰彇 寤虹瓚 妤煎眰鏁版嵁 + } + } + } else { //涓嶄繚瀛樻暟鎹 鐩存帴鍒囨崲 + this.selectingSitePlan = item + this.selectSitePlanIndex = index + this.canvasData.selectStorey = item //鏈嶅姟涓 瀛樹竴浠芥暟鎹 + if (this.checkedBuildingIndex==-1) { //鎬诲钩闈㈠浘鏃 + this.getSitePlanStorey(item) //鑾峰彇 骞抽潰鍥 妤煎眰鏁版嵁 + this.getSitePlanCompanyData() + } else { //妤煎眰/鍖哄煙鏃 + this.getBuildingStorey(item) //鑾峰彇 寤虹瓚 妤煎眰鏁版嵁 + let params = { buildingId: this.beforeOneCheckedBuilding.id } + this.getBuildingData(params) + } + } + + } else { //false 鏁版嵁娌¤鏀瑰姩 + this.selectingSitePlan = item + this.selectSitePlanIndex = index + this.canvasData.selectStorey = item //鏈嶅姟涓 瀛樹竴浠芥暟鎹 + if (this.checkedBuildingIndex==-1) { //鎬诲钩闈㈠浘鏃 + this.getSitePlanStorey(item) //鑾峰彇 骞抽潰鍥 妤煎眰鏁版嵁 + } else { //妤煎眰/鍖哄煙鏃 + this.getBuildingStorey(item) //鑾峰彇 寤虹瓚 妤煎眰鏁版嵁 + } + } //if + + } + } + + //鏂板骞抽潰鍥 妤煎眰/鍖哄煙 + foundPanel (e) { + e.stopPropagation() + let data = { + isBuilding: this.checkedBuildingIndex==-1? false:true, + Panel: this.beforeOneCheckedBuilding, + order: this.sitePlanData.length? this.sitePlanData[this.sitePlanData.length-1].order+1:0, + } + let dialogRef = this.dialog.open(leftFunctionalDomainBuildingComponent,{data}); + dialogRef.afterClosed().subscribe(data=>{ + if (data =='鎬诲钩闈㈠浘') { + this.renovateSitePlan() + } else if (data =='寤虹瓚') { + this.renovateBuilding() + } + }) + } + + //缂栬緫骞抽潰鍥 妤煎眰/鍖哄煙 + editPlaneData (e) { + let data = { + isBuilding: this.checkedBuildingIndex==-1? false:true, + Panel: this.beforeOneCheckedBuilding, + buildingData: e, + } + let dialogRef = this.dialog.open(editPlaneFigureBuildingComponent,{data}); + dialogRef.afterClosed().subscribe(data=>{ + if (data =='鎬诲钩闈㈠浘') { + this.renovateSitePlan() + } else if (data =='寤虹瓚') { + this.renovateBuilding() + } + }) + } + + //骞抽潰鍥 妤煎眰/鍖哄煙 涓婄Щ + moveUp (item,index) { + if (index != 0) { + let replaceIndex = this.sitePlanData[index].order + this.sitePlanData[index].order = this.sitePlanData[index-1].order + this.sitePlanData[index-1].order = replaceIndex + if (this.checkedBuildingIndex==-1) { //鎬诲钩闈㈠浘 + this.http.put(`/api/SitePlans/${this.sitePlanData[index-1].id}`,this.sitePlanData[index-1]).subscribe(data=>{ + this.http.put(`/api/SitePlans/${this.sitePlanData[index].id}`,this.sitePlanData[index]).subscribe(data=>{ + this.selectSitePlanIndex = this.selectSitePlanIndex-1 + this.renovateSitePlan() + }) + }) + } else { //妤煎眰/鍖哄煙 + this.http.put(`/api/BuildingAreas/${this.sitePlanData[index-1].id}`,this.sitePlanData[index-1],{params:this.params}).subscribe(data=>{ + this.http.put(`/api/BuildingAreas/${this.sitePlanData[index].id}`,this.sitePlanData[index],{params:this.params}).subscribe(data=>{ + this.selectSitePlanIndex = this.selectSitePlanIndex-1 + this.renovateBuilding() + }) + }) + } + + } //if index + } + + //骞抽潰鍥 妤煎眰/鍖哄煙 涓嬬Щ + moveDown (item,index) { + if (index != this.sitePlanData.length-1) { + let replaceIndex = this.sitePlanData[index].order + this.sitePlanData[index].order = this.sitePlanData[index+1].order + this.sitePlanData[index+1].order = replaceIndex + if (this.checkedBuildingIndex==-1) { //鎬诲钩闈㈠浘 + this.http.put(`/api/SitePlans/${this.sitePlanData[index+1].id}`,this.sitePlanData[index+1]).subscribe(data=>{ + this.http.put(`/api/SitePlans/${this.sitePlanData[index].id}`,this.sitePlanData[index]).subscribe(data=>{ + this.selectSitePlanIndex = this.selectSitePlanIndex+1 + this.renovateSitePlan() + }) + }) + } else { //妤煎眰/鍖哄煙 + this.http.put(`/api/BuildingAreas/${this.sitePlanData[index+1].id}`,this.sitePlanData[index+1],{params:this.params}).subscribe(data=>{ + this.http.put(`/api/BuildingAreas/${this.sitePlanData[index].id}`,this.sitePlanData[index],{params:this.params}).subscribe(data=>{ + this.selectSitePlanIndex = this.selectSitePlanIndex+1 + this.renovateBuilding() + }) + }) + } + + } //if index + } + + //鏃嬭浆搴曞浘 + revolveImg (item) { + item.imageAngle==270? item.imageAngle = 0 : item.imageAngle = item.imageAngle+90 + if (this.checkedBuildingIndex==-1) { //鎬诲钩闈㈠浘 + this.http.put(`/api/SitePlans/${item.id}`,item).subscribe(data=>{ + let isSuccess = this.renovateSitePlan() + isSuccess.then(res=>{ + this.canvas.refreshBackgroundImage() + }) + }) + } else { //妤煎眰/鍖哄煙 + this.http.put(`/api/BuildingAreas/${item.id}`,item,{params:this.params}).subscribe(data=>{ + let isSuccess = this.renovateBuilding() + isSuccess.then(res=>{ + this.canvas.refreshBackgroundImage() + }) + }) + } + + } + + //鍒犻櫎 骞抽潰鍥 妤煎眰/鍖哄煙 + deletePlaneData (item) { + const isDelete = confirm('鎮ㄧ‘瀹氳鍒犻櫎鍚'); + if (isDelete) { + if (this.checkedBuildingIndex==-1) { //鎬诲钩闈㈠浘 + let isHave = this.canvasData.allDisposalNode.find(items=>{ return items.sitePlanId === item.id }) + if (isHave == undefined) { + this.http.delete(`/api/SitePlans/${item.id}`).subscribe(data=>{ + this.deleteShareData(item,-1) + }) + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鍚湁鏁版嵁鑺傜偣鐨勬ゼ灞備笉鍏佽鍒犻櫎','纭畾',config); + } + } else { //妤煎眰/鍖哄煙 + let isHave = this.canvasData.allDisposalNode.find(items=>{ return items.buildingAreaId === item.id }) + if (isHave == undefined) { + this.http.delete(`/api/BuildingAreas/${item.id}`).subscribe(data=>{ + this.deleteShareData(item,1) + }) + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鍚湁鏁版嵁鑺傜偣鐨勬ゼ灞備笉鍏佽鍒犻櫎','纭畾',config); + } + } + } + } + + //鍒犻櫎褰撳墠 鍗曚綅/寤虹瓚鐨 鍏变韩鏁版嵁涓 宸插垹闄ata + deleteShareData (e,isCompany) { + this.sitePlanData.forEach((element,index) => { + if (element.id===e.id) { + this.sitePlanData.splice(index,1) + return + } + }); + let data = this.canvasData.originalcompanyBuildingData; + for(let key in data.data){ + if (data.data[key].FloorId === e.id) { //澶勭悊 鍗曚綅/寤虹瓚 鏁版嵁鏄惁褰掍簬褰撳墠妤煎眰涓 + delete data.data[key] + } + } + let newData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData)); + newData.data = JSON.stringify(newData.data) // 杞崲JSON 鏁版嵁鏍煎紡 + this.selectingSitePlan = this.sitePlanData[0] || {} + this.canvasData.selectStorey = this.sitePlanData[0] || {} //鏈嶅姟涓 瀛樹竴浠芥暟鎹 + this.selectSitePlanIndex = 0 + this.canvasData.isChange = false + if (isCompany===-1) { + this.http.post("/api/CompanyData",newData).subscribe(data => {}) + this.getSitePlanStorey(this.selectingSitePlan) //鑾峰彇 骞抽潰鍥 妤煎眰鏁版嵁 + } else { + this.http.post("/api/BuildingData",newData,{params:this.params}).subscribe(data => {}) + this.getBuildingStorey(this.selectingSitePlan) //鑾峰彇 寤虹瓚 妤煎眰鏁版嵁 + } + } + + //澶嶅埗鍥惧眰 骞抽潰鍥 妤煎眰/鍖哄煙 + duplicateLayer (item) { + let paramsData = JSON.parse(JSON.stringify( this.canvasData.originaleveryStoreyData.data || {} )) + Object.keys(paramsData).forEach((key)=>{ + if (key != '鍥句緥') { + let ID = ObjectID.default.generate() + paramsData[key].Id = ID + paramsData[ID] = paramsData[key] + delete paramsData[key] + } + }) //鍥炬爣Id閲嶆柊璧嬪 + if (this.checkedBuildingIndex==-1) { //鎬诲钩闈㈠浘 + item.id = "" + item.modifiedTime = new Date() + item.name = item.name + '(鍓湰)' + item.order = this.sitePlanData[this.sitePlanData.length-1].order+1 + this.http.post('/api/SitePlans',item).subscribe((data:any)=>{ + let newData = { + version: "2.0", + id: "", + data: JSON.stringify( paramsData ) || null, + sitePlanId: data.id + } + this.http.post('/api/SitePlanData',newData,{params:this.params}).subscribe(data=>{ + this.renovateSitePlan() + }) + + }) + } else { //妤煎眰/鍖哄煙 + item.id = "" + item.modifiedTime = new Date() + item.name = item.name + '(鍓湰)' + item.order = this.sitePlanData[this.sitePlanData.length-1].order+1 + this.http.post('/api/BuildingAreas',item,{params:this.params}).subscribe((data:any)=>{ + let newData = { + version: "2.0", + id: "", + data: JSON.stringify( paramsData ) || null, + buildingAreaId: data.id + } + this.http.post('/api/BuildingAreaData',newData,{params:this.params}).subscribe(data=>{ + this.renovateBuilding() + }) + + }) + } + } + + //骞抽潰鍥 妤煎眰/鍖哄煙 鏇挎崲搴曞浘 + replaceBaseMap (e,item) { + e.stopPropagation(); + let file = e.target.files[0] || null //鑾峰彇涓婁紶鐨勬枃浠 + let fileSize = file.size || null //涓婁紶鏂囦欢鐨勬诲ぇ灏 + let maxSize = 5 * 1024 * 1024 //5MB涓涓垎鐗 + + if (file && fileSize<=maxSize) { //涓婁紶鏂囦欢<=5MB鏃 + let formData = new FormData() + formData.append("file",file) + this.http.post(`/api/Objects/WebPlan2D/${sessionStorage.getItem('companyId')}`,formData).subscribe((data:any)=>{ + this.renovateBaseMap(data.objectName,item) + }) + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('涓婁紶搴曞浘闇灏忎簬5MB','纭畾',config); + } + } + + //灏佽 鏇挎崲搴曞浘 function + renovateBaseMap (e,item) { + item.imageUrl = '/api/Objects/WebPlan2D/' + e + if (this.checkedBuildingIndex ==-1) { //鎬诲钩闈㈠浘 + this.http.put(`/api/SitePlans/${item.id}`,item).subscribe(data=>{ + let isSuccess = this.renovateSitePlan() + isSuccess.then(res=>{ + this.canvas.refreshBackgroundImage() + }) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('涓婁紶搴曞浘鎴愬姛','纭畾',config); + }) + } else { //妤煎眰/鍖哄煙 + this.http.put(`/api/BuildingAreas/${item.id}`,item,{params:this.params}).subscribe(data=>{ + let isSuccess = this.renovateBuilding() + isSuccess.then(res=>{ + this.canvas.refreshBackgroundImage() + }) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('涓婁紶搴曞浘鎴愬姛','纭畾',config); + }) + } + } + + //灏佽 鍒锋柊鎬诲钩闈㈠浘 鏁版嵁 + renovateSitePlan () { + return new Promise ((resolve,reject)=>{ + this.http.get('/api/SitePlans',{params:this.params}).subscribe(data=>{ + this.sitePlanData = data + this.selectingSitePlan = this.sitePlanData[this.selectSitePlanIndex] + this.canvasData.selectStorey = this.sitePlanData[this.selectSitePlanIndex] //鏈嶅姟涓 瀛樹竴浠芥暟鎹 + this.canvasData.originaleveryStoreyData.sitePlanId? null : this.canvasData.originaleveryStoreyData.sitePlanId = this.selectingSitePlan.id || null + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鏁版嵁鏇存柊鎴愬姛','纭畾',config); + resolve('success') + }) + }) + } + + //灏佽 鍒锋柊 妤煎眰/鍖哄煙 鏁版嵁 + renovateBuilding () { + let params = { + buildingId: this.beforeOneCheckedBuilding.id + } + return new Promise ((resolve,reject)=>{ + this.http.get('/api/BuildingAreas',{params}).subscribe(data=>{ + this.sitePlanData = data + this.selectingSitePlan = this.sitePlanData[this.selectSitePlanIndex] + this.canvasData.selectStorey = this.sitePlanData[this.selectSitePlanIndex] //鏈嶅姟涓 瀛樹竴浠芥暟鎹 + this.canvasData.originaleveryStoreyData.buildingAreaId? null : this.canvasData.originaleveryStoreyData.buildingAreaId = this.selectingSitePlan.id || null + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鏁版嵁鏇存柊鎴愬姛','纭畾',config); + resolve('success') + }) + }) + } + + allLibrary:any = []; //鎵鏈夌礌鏉愬簱 + 绱犳潗 + selectLibrary:any; //閫変腑鐨勭礌鏉愬簱 + selectImage:any; //閫変腑鐨勭礌鏉愬簱鍥剧墖 + selectImageIndex:number; //閫変腑鐨勭礌鏉愬簱鍥剧墖index + + //鑾峰彇绱犳潗搴 + getAllLibrary (type:string='input') { + this.http.get(`/api/AssetLibraries?tag=${type}`).subscribe((data:any)=>{ + data.forEach(element => { + element.images = [] + }); + this.allLibrary = data + this.selectImageIndex = -1 + }) + } + + //绱犳潗搴撳睍寮闈㈡澘灞曞紑鏃 + opened (e) { + if (!e.images.length) { //褰撳墠绱犳潗搴撴病鍔犺浇绱犳潗鏃 + this.http.get(`/api/Assets?libraryId=${e.id}`).subscribe((data:any)=>{ + e.images = data + }) + } + } + + //鐐瑰嚮閫変腑绱犳潗搴撳浘鐗囨椂 + selectImg (item,items,index) { + this.selectLibrary = item.name + this.selectImage = items + this.selectImageIndex = index + this.canvasData.selectTemplateData = items + this.canvas.beginPaint() + } + + + + //澶勭疆棰勬 + allFirePlan:any = []; //鎵鏈夌伨鎯 + selectDisposalNode:string = ''; //褰撳墠鐐瑰嚮tree鑺傜偣 css閫変腑鏍峰紡 + + //鑾峰彇鎵鏈夌伨鎯 + getAllFirePlan () { + let params = {componentId: sessionStorage.getItem('planId')} + this.http.get('/api/Disasters',{params:params}).subscribe((data:any)=>{ + if (!data.length) { //璇 鍗曚綅娌℃湁鐏炬儏鏃 + let msg = { + name: '鐏炬儏', + modifiedTime: new Date(), + planComponentId: sessionStorage.getItem('planId') + } + this.http.post('/api/Disasters',msg).subscribe(data=>{ + this.allFirePlan.push(data) + let params = {disasterId: this.allFirePlan[0].id || ''} + this.http.get('/api/DisposalNodes',{params:params}).subscribe(data=>{ //鎵鏈夊缃妭鐐 + this.canvasData.allDisposalNode = data + }) + }) + } else { //鍗曚綅 鏈夌伨鎯呮椂 + this.allFirePlan = data + let params = {disasterId: this.allFirePlan[0].id || ''} + this.http.get('/api/DisposalNodes',{params:params}).subscribe(data=>{ //鎵鏈夊缃妭鐐 + this.canvasData.allDisposalNode = data + }) + } + }) + } + + //鑾峰彇鎵鏈夊缃妭鐐 + getDisposalNode () { + this.selectDisposalNode = '' + let params = {disasterId: this.allFirePlan[0].id || ''} + this.http.get('/api/DisasterData/Markers',{params:params}).subscribe(data=>{ //鐏炬儏鏍囩淇℃伅 + this.canvasData.allNodeMarkers = data + this.mateFireForce() + }) + this.http.get('/api/DisposalNodes',{params:params}).subscribe(data=>{ //澶勭疆鑺傜偣 + this.canvasData.allDisposalNode = data + this.handleHybridTree() + }) + } + + treeData:any = []; //娓叉煋tree澶勭悊瀹屾垚鏁版嵁 + defaultExpandedKeys:any = []; //棣栨娓叉煋 tree灞曞紑鐘舵 + //澶勭悊 鑺傜偣 Tree鏁版嵁 + handleHybridTree () { + this.defaultExpandedKeys = [] + let treeData = [] + let data = JSON.parse(JSON.stringify( this.canvasData.allDisposalNode || [] )) + data.forEach(element => { + this.defaultExpandedKeys.push(element.id) + 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 + } + data.forEach(item=>{ + item.parentId === element.id? element.children.push(item) : null + }) + }); + data.forEach(element=>{ + !element.parentId? treeData.push(element) : null + }) + this.treeData = [...treeData] + this.defaultExpandedKeys = [...this.defaultExpandedKeys] + } + + //鍒锋柊 treeData 淇濆瓨宸插睍寮鑺傜偣 + refurbishTreeData () { + this.defaultExpandedKeys = [] + let params = {disasterId: this.allFirePlan[0].id || ''} + this.http.get('/api/DisposalNodes',{params:params}).subscribe(nodeData=>{ //澶勭疆鑺傜偣 + this.canvasData.allDisposalNode = nodeData + let oldTreeData = this.nzTreeComponent.getExpandedNodeList() + oldTreeData.forEach(item=>{ + this.defaultExpandedKeys.push(item.key) + }) + let treeData = [] + let data = JSON.parse(JSON.stringify( this.canvasData.allDisposalNode || [] )) + data.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 + } + data.forEach(item=>{ + item.parentId === element.id? element.children.push(item) : null + }) + }); + data.forEach(element=>{ + !element.parentId? treeData.push(element) : null + }) + this.treeData = [...treeData] + this.defaultExpandedKeys = [...this.defaultExpandedKeys] + }) + } + + sitePlanIcon = {fire:0,force:0} // 鎬诲钩闈㈠浘 鐏簮/鍔涢噺 鍥炬爣 鏄惁灞曠ず + + //鍒锋柊 寤虹瓚妤煎眰 鍖归厤 鐏簮/鍔涢噺 鍥炬爣 + mateFireForce () { + let data = this.canvasData.allNodeMarkers.markers || {} + for(let key in data){ //閬嶅巻 鐏/鍔涢噺 鍥炬爣 + this.sitePlanData.forEach(element => { //妤煎眰 + if (element.id==key) { // 鐩稿尮閰嶆椂 + data[key].fireCount != 0? element.fire=1 : element.fire=0 + data[key].forceCount != 0? element.force=1 : element.force=0 + } + }); + this.allBuildings.forEach(element => { //寤虹瓚 + if (element.id==key) { // 鐩稿尮閰嶆椂 + data[key].fireCount != 0? element.fire=1 : element.fire=0 + data[key].forceCount != 0? element.force=1 : element.force=0 + } + }); + if (this.params.companyId==key) { //鎬诲钩闈㈠浘鏃 + data[key].fireCount != 0? this.sitePlanIcon.fire=1 : this.sitePlanIcon.fire=0 + data[key].forceCount != 0? this.sitePlanIcon.force=1 : this.sitePlanIcon.force=0 + } + } + + let buildingMSG = this.canvasData.allNodeMarkers.highlightMarkers || {} + for (let key in buildingMSG) { + if (key === this.canvasData.selectPanelPoint.DisposalNodeId) { + for (let keys in buildingMSG[key]) { + this.sitePlanData.forEach(element => { //妤煎眰 + if (element.id === keys) { + buildingMSG[key][keys].fireCount != 0? element.fire=2 : null + buildingMSG[key][keys].forceCount != 0? element.force=2 : null + } + }); + this.allBuildings.forEach(element => { //寤虹瓚 + if (element.id === keys) { // 鐩稿尮閰嶆椂 + buildingMSG[key][keys].fireCount != 0? element.fire=2 : null + buildingMSG[key][keys].forceCount != 0? element.force=2 : null + } + }); + if (this.params.companyId === keys) { //鎬诲钩闈㈠浘鏃 + buildingMSG[key][keys].fireCount != 0? this.sitePlanIcon.fire=2 : null + buildingMSG[key][keys].forceCount != 0? this.sitePlanIcon.force=2 : null + } + } + } + } + } + + // 鍒囨崲 鍩烘湰淇℃伅鏃 鍒锋柊 鍒犻櫎 寤虹瓚妤煎眰 鑷畾涔夊睘鎬 + mateDeleteCustomize () { + this.canvasData.selectPanelPointBaseData = {description: '', notes: '', weather: '', airTemperature: '', windDirection: '', windScale: ''} + this.defaultExpandedKeys = [] + this.sitePlanIcon = {fire:0,force:0} + this.sitePlanData.forEach(element => { //妤煎眰 + delete element.fire + delete element.force + }); + this.allBuildings.forEach(element => { //寤虹瓚 + delete element.fire + delete element.force + }); + } + + //璁$畻宸紓 + countValue (e) { + e.stopPropagation() + let params = {disasterId: this.allFirePlan[0].id || ''} + this.http.get('/api/DisasterData/Diffs',{params:params}).subscribe(data=>{ + this.canvasData.allNodeMarkers = data + this.mateFireForce() + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('璁$畻宸紓瀹屾垚','纭畾',config); + }) + } + + //鏂板缓 澶勭疆棰勬 鑺傜偣 + addPanelPoint (e,item,treeData) { + e.stopPropagation() + let order + if (item) { + item.children.length? order = item.children[item.children.length-1].order+1 : order = 0 + } else { + treeData.length? order = treeData[treeData.length-1].order+1 : order = 0 + } + let data = { + name: '', + level: item? 1 : 0, + order: order, + description: '', + disasterId: this.allFirePlan[0].id || '', + parentId: item? item.id : null, + planComponentId: sessionStorage.getItem('planId') || '', + } + let dialogRef = this.dialog.open(addDisposalNodeBuildingComponent,{data}); + dialogRef.afterClosed().subscribe(data=>{ + if (data) { this.refurbishTreeData() } + }) + } + + //缂栬緫 澶勭疆棰勬 鑺傜偣 + editPanelPoint (e,item) { + e.stopPropagation() + let data = item.origin + let dialogRef = this.dialog.open(editDisposalNodeBuildingComponent,{data}); + dialogRef.afterClosed().subscribe(data=>{ + if (data) { + item.title = data + this.canvasData.allDisposalNode.forEach(element => { element.id === item.key? element.name=data : null }); + } + }) + } + + //澶嶅埗 澶勭疆棰勬 鑺傜偣 + copyPanelPoint (e,item,treeData) { + e.stopPropagation() + if (confirm(`纭畾瑕佸鍒 ${item.title} ?`)) { + let params = {id: item.origin.id} + let order + if (item.level==0) { + treeData.length? order = treeData[treeData.length-1].order+1 : order = 0 + } else { + let parent = item.getParentNode() //鑾峰彇鐖惰妭鐐 + parent.origin.children.length? order = parent.origin.children[parent.origin.children.length-1].order+1 : order = 0 + } + let data = { + name: item.title + '(鍓湰)', + level: item.level, + order: order, + description: '', + disasterId: item.origin.disasterId || '', + parentId: item.origin.parentId || null, + planComponentId: item.origin.planComponentId || '', + } + this.http.post('/api/DisposalNodes/Clone',data,{params:params}).subscribe(data=>{ + this.refurbishTreeData() + }) + } //isTrue + } + + //鍒犻櫎 澶勭疆棰勬 鑺傜偣 + deletePanelPoint (e,item) { + e.stopPropagation() + if (confirm(`纭畾瑕佸垹闄 ${item.name} ?`)) { + this.http.delete(`/api/DisposalNodes/${item.id}`).subscribe(data=>{ + this.refurbishTreeData() + }) + } + } + + //鐐瑰嚮 澶勭疆Tree鑺傜偣 + selectanelPoint (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 //閫変腑 鑺傜偣 + + } else if (e.buildingAreaId || e.sitePlanId) { //褰撳墠鑺傜偣 鏄 鏁版嵁鑺傜偣 鏃 + let msg = this.canvasData.findDisposalNode(e.parentId) + this.canvasData.selectPanelPointBaseData = msg + this.selectDisposalNode = e.parentId //閫変腑 鑺傜偣 + + if (this.canvasData.selectPanelPoint.DisposalNodeId != e.id) { //閫夋嫨鑺傜偣 涓嶆槸褰撳墠鑺傜偣鏃 + let params = {nodeId: e.id} + let parameter = { //鏌ヨ 鑺傜偣 瀵瑰簲 寤虹瓚/妤煎眰 index,id + buildingIndex: e.sitePlanId? -1 : this.allBuildings.findIndex(item=>{ return item.id===e.buildingId }), //鎬诲钩闈㈠浘/寤虹瓚 index + storeyId: e.sitePlanId? e.sitePlanId : e.buildingAreaId, //妤煎眰id + } + this.http.get('/api/DisposalNodeData',{params:params}).subscribe(data=>{ + this.canvasData.selectPanelPoint = this.canvasData.deserialize(JSON.stringify(data || new DisposalNodeData())) //閫夋嫨 褰撳墠 鑺傜偣 + this.canvasData.selectPanelPoint.Data = this.canvasData.deserialize(this.canvasData.selectPanelPoint.Data) + this.seekPanelPoint(parameter) + }) + } //if + + } //else if + } + + //鏌ユ壘 鏁版嵁鑺傜偣 瀵瑰簲 寤虹瓚/妤煎眰 + seekPanelPoint (paramsData) { + this.checkedBuildingIndex = paramsData.buildingIndex + if (paramsData.buildingIndex ==-1) { //鎬诲钩闈㈠浘鏃 + this.beforeOneCheckedBuilding={name:"鎬诲钩闈㈠浘"} + let fireData = this.getFireElements(sessionStorage.getItem('buildingTypeId')) //鑾峰彇鍗曚綅涓 娑堥槻瑕佺礌 + let planData = this.getSitePlanCompanyData() //鑾峰彇 鍗曚綅 鏁版嵁 + this.http.get('/api/SitePlans',{params:this.params}).subscribe(data=>{ + this.sitePlanData = data + let index = this.sitePlanData.findIndex(item=>{ return item.id===paramsData.storeyId }) + this.selectingSitePlan = this.sitePlanData[index] || {} + this.canvasData.selectStorey = this.sitePlanData[index] || {} //鏈嶅姟涓 瀛樹竴浠芥暟鎹 + this.selectSitePlanIndex = index + + Promise.all([fireData,planData]).then((res)=>{ + this.getSitePlanStorey(this.selectingSitePlan) //鑾峰彇 骞抽潰鍥 妤煎眰鏁版嵁 + }) + }) //get + } else { //寤虹瓚鏃 + this.beforeOneCheckedBuilding=this.allBuildings[paramsData.buildingIndex] + let params = { buildingId: this.beforeOneCheckedBuilding.id } + let fireData = this.getFireElements(this.beforeOneCheckedBuilding.buildingTypes[0].id || '') //鑾峰彇寤虹瓚涓 娑堥槻瑕佺礌 + let planData = this.getBuildingData(params) //鑾峰彇 寤虹瓚 鏁版嵁 + this.http.get('/api/BuildingAreas',{params}).subscribe(data=>{ + this.sitePlanData = data + let index = this.sitePlanData.findIndex(item=>{ return item.id===paramsData.storeyId }) + this.selectingSitePlan = this.sitePlanData[index] || {} + this.canvasData.selectStorey = this.sitePlanData[index] || {} //鏈嶅姟涓 瀛樹竴浠芥暟鎹 + this.selectSitePlanIndex = index + + Promise.all([fireData,planData]).then((res)=>{ + this.getBuildingStorey(this.selectingSitePlan) //鑾峰彇 寤虹瓚 妤煎眰鏁版嵁 + }) + }) //get + } + } + + + +} + + + +//鍒涘缓寤虹瓚 +@Component({ + selector: 'app-createBuilding-building', + templateUrl: './createBuilding.html', + styleUrls: ['./collection-tools.component.scss'] +}) +export class CreateBuildingBuilding { + + constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data) { } + + allBuildingType:any//鎵鏈夌殑寤虹瓚绫诲瀷 + selected:any; //閫変腑鐨勫缓绛 + ngOnInit(): void { + this.getAllBuildingType() + } + + //鑾峰緱鎵鏈夊崟浣嶇被鍨 + getAllBuildingType(){ + this.http.get("/api/BuildingTypes/Simple").subscribe(data=>{ + this.allBuildingType = data + }) + } + + //鍒涘缓寤虹瓚鍔熻兘鍒嗗尯 + onSubmit (e) { + let companyId = sessionStorage.getItem("companyId") + let lastBuildingOrder = this.data.allBuildings.length != 0 ? this.data.allBuildings[this.data.allBuildings.length - 1].order + 1 : 0 + let data = + { + id: "", + name: e.propertyName, + order: lastBuildingOrder , + enabled: true, + companyId: companyId, + buildingTypes: [ + { + id: e.buildingId, + name: "" + } + ] + } + this.http.post("/api/Buildings",data,{ + params:{ + companyId : this.data.companyId + } + }).subscribe(data=>{ + this.dialogRef.close("鍒涘缓鎴愬姛"); + },err=>{ + this.dialogRef.close("鍒涘缓澶辫触"); + }) + } +} + +//缂栬緫寤虹瓚 +@Component({ + selector: 'app-editBuilding-building', + templateUrl: './editBuilding.html', + styleUrls: ['./collection-tools.component.scss'] +}) +export class EditBuildingBuilding { + + constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data) { } + + defaultName:String = this.data.item.name//榛樿寤虹瓚鍚嶇О + defaultBuildingType:String = this.data.item.buildingTypes[0].id//榛樿寤虹瓚绫诲瀷 + allBuildingType:any//鎵鏈夌殑寤虹瓚绫诲瀷 + + ngOnInit(): void { + this.getAllBuildingType() + } + + getAllBuildingType(){ + this.http.get("/api/BuildingTypes/Simple").subscribe(data=>{ + this.allBuildingType = data + }) + } + + //缂栬緫寤虹瓚淇℃伅 + onSubmit (e) { + let companyId = sessionStorage.getItem("companyId") + let data = + { + id: this.data.item.id, + name: e.propertyName, + order: this.data.item.order, + enabled: true, + companyId: companyId, + buildingTypes: [ + { + id: e.buildingId, + name: "" + } + ] + } + this.http.put(`/api/Buildings/${this.data.item.id}`,data,{ + params:{ + id:this.data.item.id, + companyId:companyId + } + }).subscribe(data=>{ + this.dialogRef.close("淇敼鎴愬姛"); + },err=>{ + this.dialogRef.close("淇敼澶辫触"); + }) + } +} + +//鏌ョ湅鍥剧墖澶у浘 +@Component({ + selector: 'viewdetails-building', + templateUrl: './viewdetails.html', + styleUrls: ['./collection-tools.component.scss'] +}) +export class ViewDetailsBuilding { + // myControl = new FormControl(); + //娉ㄥ叆MatDialogRef锛屽彲浠ョ敤鏉ュ叧闂璇濇 + //瑕佽闂璇濇缁勪欢涓殑鏁版嵁锛屽繀椤讳娇鐢∕AT_DIALOG_DATA娉ㄥ叆浠ょ墝 + constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,private element: ElementRef) {} + imagesArr = this.data.imagesArr + onNoClick(): void { + this.dialogRef.close(); + } + ngOnInit(): void { + setTimeout(() => { + var mySwiper = new Swiper('.swiper-container',{ + loop: false, + initialSlide :this.data.index,//榛樿绱㈠紩 + // 濡傛灉闇瑕佸墠杩涘悗閫鎸夐挳 + navigation: { + nextEl: '.swiper-button-next', + prevEl: '.swiper-button-prev', + } + //鍏朵粬璁剧疆 + }); + }, 0); + } + closeDialog(){ + this.dialogRef.close(); + } + count = 10 + zoomimg(e) { + if(this.count != 1 || e.wheelDelta >= 120){ + if(e.wheelDelta >= 120){ + this.count++ + }else{ + this.count-- + } + } + e.srcElement.style.zoom = this.count + '0%' + e.srcElement.style.maxWidth = null + e.srcElement.style.maxHeight = null + } + +} diff --git a/src/app/ui/collection-tools-building/createBuilding.html b/src/app/ui/collection-tools-building/createBuilding.html new file mode 100644 index 0000000..16fdd7b --- /dev/null +++ b/src/app/ui/collection-tools-building/createBuilding.html @@ -0,0 +1,28 @@ +
鏂板寤虹瓚
+
+
+ +
+ + + +
+
+ + + + {{item.name}} + + + +
+
+ + +
+
+
\ No newline at end of file diff --git a/src/app/ui/collection-tools-building/editBuilding.html b/src/app/ui/collection-tools-building/editBuilding.html new file mode 100644 index 0000000..433316d --- /dev/null +++ b/src/app/ui/collection-tools-building/editBuilding.html @@ -0,0 +1,23 @@ +
缂栬緫寤虹瓚
+
+
+
+ + + +
+
+ + + + {{item.name}} + + + +
+
+ + +
+
+
\ No newline at end of file diff --git a/src/app/ui/collection-tools-building/editDisposalNode.html b/src/app/ui/collection-tools-building/editDisposalNode.html new file mode 100644 index 0000000..40b2270 --- /dev/null +++ b/src/app/ui/collection-tools-building/editDisposalNode.html @@ -0,0 +1,23 @@ +
+
+ +
+ +
+ +
+ + + +
+ +
+ + +
+ +
+ +
\ No newline at end of file diff --git a/src/app/ui/collection-tools-building/editPlaneFigure.html b/src/app/ui/collection-tools-building/editPlaneFigure.html new file mode 100644 index 0000000..a0f8016 --- /dev/null +++ b/src/app/ui/collection-tools-building/editPlaneFigure.html @@ -0,0 +1,39 @@ +
+ +
+ + +
+ +
+ +
+ + + +
+ +
+ 鏄惁涓洪伩闅惧眰 +
+ +
+ + + +
+ +
+ +
+ +
+ + +
+ +
+ +
\ No newline at end of file diff --git a/src/app/ui/collection-tools-building/leftFunctionalDomain.ts b/src/app/ui/collection-tools-building/leftFunctionalDomain.ts new file mode 100644 index 0000000..e60ca32 --- /dev/null +++ b/src/app/ui/collection-tools-building/leftFunctionalDomain.ts @@ -0,0 +1,180 @@ +import { Component, OnInit, Inject } 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'; + +@Component({ + selector: 'app-leftFunctionalDomain-building', + templateUrl: './addPlaneFigure.html', + styleUrls: ['./panel.scss'] +}) +export class leftFunctionalDomainBuildingComponent implements OnInit { + + constructor( + private http:HttpClient, + public dialog: MatDialog, + public snackBar: MatSnackBar, + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data) { } + + ngOnInit(): void { + + } + + params = {companyId: sessionStorage.getItem('companyId')} + checked:boolean = false;//鏄惁涓洪伩闅惧眰 + + //鎻愪氦琛ㄥ崟鍒涘缓骞抽潰鍥 + onSubmit (e) { + if (!this.data.isBuilding) { //鎬诲钩闈㈠浘 鍒涘缓骞抽潰鍥 + let data = { + companyId: sessionStorage.getItem('companyId'), + name: e.name, + order: this.data.order, + area:e.area, + details:e.details, + enabled: true, + modifiedTime: new Date(), + } + this.http.post('/api/SitePlans',data).subscribe(data=>{ + this.dialogRef.close('鎬诲钩闈㈠浘'); + }) + } else { //寤虹瓚 鍒涘缓妤煎眰/鍖哄煙 + let data = { + isRefugeStorey: e.isRefugeStorey, + buildingId: this.data.Panel.id, + name: e.name, + order: this.data.order, + area:e.area, + details:e.details, + enabled: true, + modifiedTime: new Date(), + } + this.http.post('/api/BuildingAreas',data,{params:this.params}).subscribe(data=>{ + this.dialogRef.close('寤虹瓚'); + }) + } + } + + + +} + +//缂栬緫骞抽潰鍥 妤煎眰/鍖哄煙 +@Component({ + selector: 'app-editPlaneFigure-building', + templateUrl: './editPlaneFigure.html', + styleUrls: ['./panel.scss'] +}) +export class editPlaneFigureBuildingComponent implements OnInit { + + constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data) { } + + ngOnInit(): void { + this.name = this.data.buildingData.name || '' + this.checked = this.data.buildingData.isRefugeStorey || false + this.area = this.data.buildingData.area || 0 + this.details = this.data.buildingData.details || '' + } + + params = {companyId: sessionStorage.getItem('companyId')} + name:any; //name + checked:boolean = false;//鏄惁涓洪伩闅惧眰 + area:number; //闈㈢Н + details:string; //璇︽儏 + + //鎻愪氦琛ㄥ崟淇敼骞抽潰鍥 + onSubmit (e) { + if (!this.data.isBuilding) { //鎬诲钩闈㈠浘 淇敼骞抽潰鍥 + let data = { + companyId: sessionStorage.getItem('companyId'), + id: this.data.buildingData.id, + name: e.name, + cadUrl: this.data.buildingData.cadUrl, + imageUrl: this.data.buildingData.imageUrl, + imageAngle: this.data.buildingData.imageAngle, + order: this.data.buildingData.order, + area:e.area, + details:e.details, + enabled: this.data.buildingData.enabled, + modifiedTime: new Date(), + } + this.http.put(`/api/SitePlans/${this.data.buildingData.id}`,data).subscribe(data=>{ + this.dialogRef.close('鎬诲钩闈㈠浘'); + }) + } else { //寤虹瓚 淇敼妤煎眰/鍖哄煙 + let data = { + isRefugeStorey: e.isRefugeStorey, + buildingId: this.data.Panel.id, + id: this.data.buildingData.id, + name: e.name, + cadUrl: this.data.buildingData.cadUrl, + imageUrl: this.data.buildingData.imageUrl, + imageAngle: this.data.buildingData.imageAngle, + order: this.data.buildingData.order, + area:e.area, + details:e.details, + enabled: this.data.buildingData.enabled, + modifiedTime: new Date(), + } + this.http.put(`/api/BuildingAreas/${this.data.buildingData.id}`,data,{params:this.params}).subscribe(data=>{ + this.dialogRef.close('寤虹瓚'); + }) + } + } + + + +} + + + +//鍒涘缓 澶勭疆棰勬 鑺傜偣 +@Component({ + selector: 'app-addDisposalNode-building', + templateUrl: './addDisposalNode.html', + styleUrls: ['./panel.scss'] +}) +export class addDisposalNodeBuildingComponent implements OnInit { + + constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data) { } + + ngOnInit(): void { + } + + //鎻愪氦琛ㄥ崟 + onSubmit (e) { + this.data.name = e.name + this.http.post('/api/DisposalNodes',this.data).subscribe(data=>{ + this.dialogRef.close('success'); + }) + } + +} + + + +//缂栬緫 澶勭疆棰勬 鑺傜偣 +@Component({ + selector: 'app-editDisposalNode-building', + templateUrl: './editDisposalNode.html', + styleUrls: ['./panel.scss'] +}) +export class editDisposalNodeBuildingComponent implements OnInit { + + constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data) { } + + ngOnInit(): void { + this.nodeName = JSON.parse(JSON.stringify( this.data.name || '' )) + } + nodeName:string; + + //鎻愪氦琛ㄥ崟 + onSubmit (e) { + this.data.name = e.name + this.http.put(`/api/DisposalNodes/${this.data.id}`,this.data).subscribe(data=>{ + this.dialogRef.close(e.name); + }) + } + +} \ No newline at end of file diff --git a/src/app/ui/collection-tools-building/panel.scss b/src/app/ui/collection-tools-building/panel.scss new file mode 100644 index 0000000..f0ae073 --- /dev/null +++ b/src/app/ui/collection-tools-building/panel.scss @@ -0,0 +1,291 @@ +.matIcons { + color: #8E909F; +} + + + +//骞抽潰鍥 绱犳潗搴 鍏叡鏍峰紡 澶撮儴 +.planarGraphHeader{ + height: 35px; + min-height: 35px; + cursor: pointer; + display: flex; + flex-direction: row; + align-items: center; + padding: 0 24px; + border-radius: 5px; + font-family: Roboto, "Helvetica Neue", sans-serif; + font-size: 15px; + font-weight: 400; + color: #000; + background: linear-gradient(to top,#cdced1,#FFF); +} +//骞抽潰鍥惧ご閮ㄥ瓧浣撳浘鏍囨牱寮 +.hover { + width: 18px; + height: 18px; + margin-left: 90px; + border: 1px solid #999; + border-radius: 3px; + .mat-icon {font-size: 18px; color: #999;} +} +.hover:hover { + background-color: #4DA5FA; + .mat-icon {color: #fff;} +} + +//骞抽潰鍥 +.sitePlanContent { + position: relative; + width: 100%; + height: 35px; + line-height: 35px; + box-sizing: border-box; + padding: 0 10px 0 25px; + .mat-icon { + font-size: 20px; + } +} + +//鐏簮/鍔涢噺 鍥炬爣 +.fireForce { + display: block; + float: right; + margin: 8px 5px 0 0; + width: 40px; + height: 20px; + line-height: 20px; + text-align: center; + position: relative; + overflow: hidden; + img{ + width: 20px; + height: 20px; + } +} +//鏇挎崲搴曞浘 inputfile +.a-upload { + display: block; + float: right; + margin: 8px 18px 0 0; + width: 20px; + height: 20px; + line-height: 20px; + text-align: center; + position: relative; + overflow: hidden; + input { + position: absolute; + width: 20px; + height: 20px; + left: 0; + top: 0; + opacity: 0; + } +} +.a-upload:hover { + .mat-icon { + color: #fff; + } +} +//涓婁紶搴曞浘 inputfile +#a-uploadImg { + display: block; + width: 300px; + height: 170px; + position: fixed; + top: 40%; + left: 48%; + overflow: hidden; + border-radius: 5px; + border: 1px solid #999; + z-index: 999; + input { + position: absolute; + width: 300px; + height: 170px; + left: 0; + top: 0; + opacity: 0; + } + img { + width: 100%; + height: auto; + } +} +#a-uploadImg:hover { + border: 5px solid skyblue; +} + +//hover鏃舵樉绀哄彸杈规搷浣滄爮 +.sitePlanContent:hover { + #rightOperate { + display: block; + } +} +//鍙宠竟鎿嶄綔鏍 +#rightOperate{ + width: 50px; + height: 100px; + position: absolute; + top: -32px; + right: -48px; + z-index: 99999; + border-radius: 0 100px 100px 0; + background-color: #F0F4F7; + // #F0F4F7 cdced1 + display: none; + .functionButton { + height: 25%; + line-height: 25px; + } + .bigFunctionIcon { + font-size: 24px; + } + .functionIcon { + color: #999; + } + .functionIcon:hover { + color: #4DA5FA; + } +} + +//澶勭疆棰勬 绱犳潗搴 鍏敤div +.publiclBankPlan { + flex: 1; + display: flex; + flex-direction: column; + overflow: hidden; + padding-bottom: 10px; + // border-top: 1px dashed #999; +} + + + +// 鍩烘湰淇℃伅/鎯冲畾浣滀笟 鍒囨崲 +.scenarioAssignment { + overflow-y: auto; +} +.selectEditMode { + flex: 1; + display: flex; + flex-direction: column; + overflow: hidden; +} +.materialBankDIV{ + flex: 1; + overflow-x: hidden; + overflow-y: auto; +} +// 鍩烘湰淇℃伅/鎯冲畾浣滀笟 鍒囨崲 +//澶勭疆棰勬 +#terrNodePublic { + height: 35px; + line-height: 35px; + display: flex; + .textNode {flex: 1;} +} +//瀛椾綋鍥炬爣 +.planIconDiv { + display: inline-block; + .mat-icon{ + font-size: 20px; + width: 20px; + height: 20px; + color: #666; + margin-right: 3px; + } +} + + + +.mat-expansion-panel-header { + height: 40px !important; +} +//绱犳潗搴撴孩鍑洪殣钘 +#materialBank { + margin: 1px 0; +} +//绱犳潗搴撳浘鐗噁lex +#panelLibrary .text{ + box-sizing: border-box; + margin-left: 10px; +} +.panelLibraryFlex { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: space-between; /* 姘村钩灞呬腑 */ + .imgBox { + width: 70px; + height: 100px; + display: inline-block; + text-align: center; + border-radius: 3px; + margin: 5px 0; + img { + width: 70px; + height: auto; + max-height: 70px; + cursor:pointer; + } + p { + font-size: 12px; + cursor:pointer; + } + } +} + +//鏂囨湰婧㈠嚭 +.overflowText { + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; +} +// 妤煎眰/鍖哄煙 鏄伩闅惧眰鏃 +.isRefugeStorey { + color: #fff; + background-color: rgb(238, 186, 186); +} +//閫変腑骞抽潰鍥炬椂 +.selectSitePlan { + color: #fff; + background-color: #6BC2FF; +} +//閫変腑绱犳潗搴撳浘鐗囨椂 +.selectImg { + color: #fff; + background-color: #4DA5FA; +} +//閫変腑 澶勭疆鑺傜偣鏃 +.selectanelPoint { + background-color: #F4C235; +} + + + +//宸︿晶鍔熻兘鍖哄脊鍑烘鏍峰紡 +.keyMargin { + width: 100%; + margin: 5px 0; + .mat-form-field { + width: 100%; + } +} +.submitBottom { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: space-between; /* 姘村钩灞呬腑 */ +} +.functionalDomainContent { + width: 300px; + height: 100%; + textarea { + border-radius: 5px; + border: 1px solid #999; + width: 100%; + height: 120px; + resize:none; + } +} diff --git a/src/app/ui/collection-tools-building/save.ts b/src/app/ui/collection-tools-building/save.ts new file mode 100644 index 0000000..03b5abd --- /dev/null +++ b/src/app/ui/collection-tools-building/save.ts @@ -0,0 +1,300 @@ +import { Component, OnInit, Inject } 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'; +import {CanvasShareDataService,DisposalNodeData} from '../../canvas-share-data.service' //寮曞叆鏈嶅姟 +// 淇濆瓨鎯冲畾浣滀笟绗竴涓脊绐 +@Component({ + selector: 'dialog-overview-example-dialog-building', + templateUrl: 'saveOne.html', + styleUrls: ['./collection-tools.component.scss'] +}) +export class saveOneDialogBuilding { + + constructor( + private http:HttpClient, + public dialog: MatDialog, + public snackBar: MatSnackBar, + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data) {} + + onNoClick(): void { + this.dialogRef.close() + } + allDisposalNode = this.data.allDisposalNode + + saveType(type){ + this.dialogRef.close() + const dialogRef = this.dialog.open(saveTwoDialogBuilding, { + data: {type: type, + allDisposalNode: this.data.allDisposalNode, + selectedBuildingData:this.data.selectedBuildingData, + selectedSiteData:this.data.selectedSiteData, + siteOrbuilding:this.data.siteOrbuilding, + disasterId:this.data.disasterId} + }); + dialogRef.afterClosed().subscribe(result => { + }); + } + +} + + // 淇濆瓨鎯冲畾浣滀笟绗簩涓脊绐 +@Component({ + selector: 'dialog-overview-example-dialog-building', + templateUrl: 'saveTwo.html', + styleUrls: ['./collection-tools.component.scss'] +}) +export class saveTwoDialogBuilding { + + constructor( + private http:HttpClient, + public dialogRef: MatDialogRef, + public canvasData: CanvasShareDataService, + public snackBar: MatSnackBar, + @Inject(MAT_DIALOG_DATA) public data) {} + + type = this.data.type + allDisposalNode = this.data.allDisposalNode + allPlanDisposalNode = [] + allRootDisposalNode = [{name:"鏍硅妭鐐",id:null}] + allDisposalNodeChild = [] + ngOnInit(): void { + //鎵鏈夐潪鏁版嵁鑺傜偣 + this.allDisposalNode.forEach(item => { + if(!item.sitePlanId && !item.buildingAreaId){ + this.allPlanDisposalNode.push(item) + } + }) + + //鎵鏈変竴绾ц妭鐐 + this.allDisposalNode.forEach(item => { + if(!item.parentId){ + this.allRootDisposalNode.push(item) + } + }) + this.allDisposalNodeChild = JSON.parse(JSON.stringify(this.allDisposalNode)) + this.allDisposalNodeChild.forEach(item => { + item.children = [] + this.allDisposalNodeChild.forEach(i => { + if(i.parentId == item.id){ + item.children.push(i) + } + }) + }) + // console.log(this.nodeItem.id) + } + onNoClick(): void { + this.dialogRef.close(); + } + nodeItem + itemChildNum = 0 //鐐瑰嚮澶勭疆鑺傜偣瀛愭暟鎹妭鐐圭殑鏁伴噺 + clickNode(item){ + // console.log(item) + this.nodeItem = item + this.allDisposalNodeChild.forEach(item => { + if(item.id == this.nodeItem.id){ + this.itemChildNum = item.children.length + } + }) + } + + selectedBuildingData = this.data.selectedBuildingData + selectedSiteData = this.data.selectedSiteData + onSubmit(value,type){ + // console.log(type) + let name = this.selectedBuildingData.name + '-' + this.selectedSiteData.name + //濡傛灉淇濆瓨鍒板凡鏈夎妭鐐 + var postdata = { + id: "", + name: name, + level: 0, + order: this.itemChildNum, + description: "", + notes: "", + weather: null, + airTemperature: null, + windDirection: null, + windScale: null, + imageNames: null, + imageUrls: null, + parentId: this.nodeItem ? this.nodeItem.id : null, + disasterId: this.data.disasterId, + planComponentId: sessionStorage.getItem('planId') || '', + companyId: this.data.siteOrbuilding == -1 ? sessionStorage.getItem('companyId') : null, + sitePlanId: this.data.siteOrbuilding==-1 ? this.selectedSiteData.id : null, + buildingId: this.selectedBuildingData.id || null, + buildingAreaId: this.data.siteOrbuilding!=-1 ? this.selectedSiteData.id : null + } + if(type == 'old'){ + let istrue = this.canvasData.findDisposalNode(this.nodeItem.id,name) + let putdata = this.nodeItem + putdata.weather = this.canvasData.selectPanelPointBaseData.weather + putdata.airTemperature = Number(this.canvasData.selectPanelPointBaseData.airTemperature) + putdata.windScale = Number(this.canvasData.selectPanelPointBaseData.windScale) + putdata.windDirection = Number(this.canvasData.selectPanelPointBaseData.windDirection) + putdata.description = this.canvasData.selectPanelPointBaseData.description + putdata.notes = this.canvasData.selectPanelPointBaseData.notes + + + if(istrue){//濡傛灉璇ュ缃妭鐐逛笅宸叉湁鍚屽悕鏁版嵁鑺傜偣 鍒欏彧淇敼 2涓帴鍙 + new Promise((resolve,reject)=>{ + this.http.put(`/api/DisposalNodes/${value.nodeId}`,putdata).subscribe(data => { + resolve("鏇存柊澶勭疆鑺傜偣鎴愬姛,灏嗗ぉ姘 鑺傜偣璇︽儏绛変俊鎭繚瀛樺埌鐐瑰嚮鐨勮妭鐐") + }) + }).then((values)=>{ + this.canvasData.sendMessage('send a message');//鍙戝竷涓鏉℃秷鎭 + // 淇濆瓨骞抽潰鍥炬暟鎹埌褰撳墠鑺傜偣 + let postdata =JSON.parse(JSON.stringify(this.canvasData.selectPanelPoint)) + postdata.Data = JSON.stringify(postdata.Data) + this.http.post(`/api/DisposalNodeData`,postdata).subscribe(data => { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config) + },err=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨澶辫触','纭畾',config) + }) + this.dialogRef.close(); + this.canvasData.sendMessage('send a message');//鍙戝竷涓鏉℃秷鎭 + }) + + }else{//闇瑕3涓帴鍙 + new Promise((resolve,reject)=>{ + this.http.put(`/api/DisposalNodes/${value.nodeId}`,putdata).subscribe(data => { + resolve("鏇存柊澶勭疆鑺傜偣鎴愬姛,灏嗗ぉ姘 鑺傜偣璇︽儏绛変俊鎭繚瀛樺埌鐐瑰嚮鐨勮妭鐐") + }) + }).then((values)=>{ + // console.log(values) + postdata.level = putdata.level + 1 + new Promise((resolve,reject) => { + this.http.post(`/api/DisposalNodes`,postdata).subscribe(data => { + resolve(data) + }) + }).then((data:any)=>{ + // console.log(7788,data) + let objData = { + id: "", + data: JSON.stringify(this.canvasData.selectPanelPoint.Data) || null, + version: this.canvasData.selectPanelPoint.Version || "2.0", + disposalNodeId: data.id, + planComponentId: sessionStorage.getItem("planId"), + } + this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config) + },err=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨澶辫触','纭畾',config) + }) + this.dialogRef.close(); + this.canvasData.sendMessage('send a message');//鍙戝竷涓鏉℃秷鎭 + }) + }) + } + + }else{//濡傛灉淇濆瓨鍒版柊寤鸿妭鐐 + let dispositionNodeData //澶勭疆鑺傜偣data + let order + let oneLevelNum = [] + //灏唎rder璧嬪间负鎵鏈変竴绾ц妭鐐规渶鍚庝竴涓+1 + this.allDisposalNode.forEach(item => { + if(!item.parentId){ + oneLevelNum.push(item) + } + }) + if(oneLevelNum.length == 0){ + order = 0 + }else{ + order = oneLevelNum[oneLevelNum.length - 1].order + 1 + } + + if(this.nodeItem){//濡傛灉鐐瑰嚮浜嗕笅鎷夐夋嫨妗 + if(this.nodeItem.id != null){ + this.allDisposalNodeChild.forEach(item => { + if(item.id == this.nodeItem.id){ + order = item.children.length + } + }) + } + } + dispositionNodeData = { + id: "", + name: value.name, + level: this.nodeItem && this.nodeItem.id != null ? this.nodeItem.level + 1 : 0, + order: order, + description: "", + notes: "", + weather: null, + airTemperature: 0, + windDirection: 0, + windScale: 0, + imageNames: null, + imageUrls: null, + parentId: this.nodeItem ? this.nodeItem.id : null, + disasterId: this.data.disasterId, + planComponentId: sessionStorage.getItem('planId') || '', + companyId: null, + sitePlanId: null, + buildingId: null, + buildingAreaId: null + } + + dispositionNodeData.weather = this.canvasData.selectPanelPointBaseData.weather + dispositionNodeData.airTemperature = Number(this.canvasData.selectPanelPointBaseData.airTemperature) + dispositionNodeData.windScale = Number(this.canvasData.selectPanelPointBaseData.windScale) + dispositionNodeData.windDirection = Number(this.canvasData.selectPanelPointBaseData.windDirection) + dispositionNodeData.description = this.canvasData.selectPanelPointBaseData.description + dispositionNodeData.notes = this.canvasData.selectPanelPointBaseData.notes + //1.鍏堝垱寤轰竴涓缃妭鐐 鐒跺悗 .then 2.鍒涘缓鏁版嵁鑺傜偣鍒板垰鍒涘缓鐨勫缃妭鐐 3.鐒跺悗鎷跨潃鍒涘缓濂界殑鏁版嵁鑺傜偣鐨刬d 灏嗗钩闈㈠浘data淇濆瓨 + new Promise((resolve,reject) => { + this.http.post("/api/DisposalNodes",dispositionNodeData).subscribe((data:any) => { + resolve(data.id) + }) + }).then((id) => { + let dataNodeData + new Promise((resolve,reject) => { + postdata.parentId = id + postdata.level = dispositionNodeData.level + 1 + this.http.post("/api/DisposalNodes",postdata).subscribe((data:any) => { + resolve(data) + }) + }).then((data:any) => { + // 淇濆瓨骞抽潰鍥炬暟鎹埌褰撳墠鑺傜偣 + // console.log(6666,data) + // let postdata =JSON.parse(JSON.stringify(this.canvasData.selectPanelPoint)) + // postdata.Data = JSON.stringify(postdata.Data) + let objData = { + id: "", + data: JSON.stringify(this.canvasData.selectPanelPoint.Data) || null, + version: this.canvasData.selectPanelPoint.Version || "2.0", + disposalNodeId: data.id, + planComponentId: sessionStorage.getItem("planId"), + } + + this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config) + + },err=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨澶辫触','纭畾',config) + }) + this.dialogRef.close(); + this.canvasData.sendMessage("send a message") + }) + }) + } + } +} \ No newline at end of file diff --git a/src/app/ui/collection-tools-building/saveOne.html b/src/app/ui/collection-tools-building/saveOne.html new file mode 100644 index 0000000..a6b0b32 --- /dev/null +++ b/src/app/ui/collection-tools-building/saveOne.html @@ -0,0 +1,5 @@ +
澶勭疆鑺傜偣淇濆瓨
+
+ + +
\ No newline at end of file diff --git a/src/app/ui/collection-tools-building/saveTwo.html b/src/app/ui/collection-tools-building/saveTwo.html new file mode 100644 index 0000000..fec97ff --- /dev/null +++ b/src/app/ui/collection-tools-building/saveTwo.html @@ -0,0 +1,53 @@ +
+
鏂板鑺傜偣
+
+
+ +
+ + + +
+
+ + + + {{item.name}} + + + +
+
+ + +
+
+
+
+
+
淇濆瓨鍒板凡鏈夎妭鐐
+
+
+
+ + + + {{item.name}} + + + +
+
+ + +
+
+
+
\ No newline at end of file diff --git a/src/app/ui/collection-tools-building/viewdetails.html b/src/app/ui/collection-tools-building/viewdetails.html new file mode 100644 index 0000000..76638c2 --- /dev/null +++ b/src/app/ui/collection-tools-building/viewdetails.html @@ -0,0 +1,24 @@ +
+
+ clear +
+ +
+
+ +
+
+ +
+
+
\ No newline at end of file diff --git a/src/app/ui/collection-tools-plan/addPlaneFigure.html b/src/app/ui/collection-tools-plan/addPlaneFigure.html index 930bf81..605e5e5 100644 --- a/src/app/ui/collection-tools-plan/addPlaneFigure.html +++ b/src/app/ui/collection-tools-plan/addPlaneFigure.html @@ -12,6 +12,17 @@ + + +
+ + 涓婁紶鏈湴鍥剧墖 + +

閫夋嫨鏂囦欢: {{file.name}}

+
+
鏄惁涓洪伩闅惧眰
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 a574865..ac69822 100644 --- a/src/app/ui/collection-tools-plan/collection-tools.component.html +++ b/src/app/ui/collection-tools-plan/collection-tools.component.html @@ -2,105 +2,30 @@
- - - - + -
- - - - -
-
- keyboard_arrow_right - keyboard_arrow_left - 澶╂皵 - - 姘旀俯 -
- - -
- 椋庡姏 - - 椋庡悜 - -
-
+ + + + +
@@ -225,12 +150,8 @@
-
-
-
- 灞炴 -
-
+
+
灞炴

闈㈢Н(骞虫柟绫)

@@ -373,69 +294,11 @@
-
- -
- -
- -
- -
-
- 娑堥槻瑕佺礌 -
-
- -
- - - - - - - {{node.name}} - - ({{node.children.length}}) - visibility - - - - - - - {{node.name}} - - ({{node.children.length}}) - visibility - - -
+
-
-
-
-
- 鑺傜偣璇︽儏 -
-
- 娉ㄦ剰浜嬮」 -
-
-
- - -
-
diff --git a/src/app/ui/collection-tools-plan/collection-tools.component.scss b/src/app/ui/collection-tools-plan/collection-tools.component.scss index 1ec5d7d..acae429 100644 --- a/src/app/ui/collection-tools-plan/collection-tools.component.scss +++ b/src/app/ui/collection-tools-plan/collection-tools.component.scss @@ -25,21 +25,19 @@ align-items:center; min-height: 40px; background-color: #fff; - .nameShow{ - cursor: pointer; + .marginLeftRight { + margin: 0 8px; + font-size: 16px; user-select:聽none; + cursor: pointer; + .mat-icon { vertical-align: middle; font-size: 24px; } } .copytobutn{ - width: 33px; - min-width: 33px; + width: 60px; + min-width: 60px; display: flex; justify-content: center; } - font-size: 18px; - mat-icon{ - font-size: 26px; - vertical-align: text-top; - } span{ height: 24px; line-height: 24px; @@ -61,6 +59,12 @@ color: white; } } + .rightSave { + cursor: pointer; + position: absolute; + right: 60px; + label { vertical-align: middle; color: #279FFF; } + } } //澶撮儴鎿嶄綔鏍 @@ -109,7 +113,7 @@ top: 0; } .functionalDomain { - flex: 90%; + flex: 95%; overflow: hidden; .functionalDomainContent { position: relative; @@ -140,10 +144,9 @@ z-index: 1001; margin-right: 0px; transition: margin-right 0.5s; - border: 1px solid #464646; + border: 1px solid #E6EAEE; width: 235px; right: 0; - } //鍙宠竟瀵艰埅鏍忔樉绀洪殣钘 .togglePanel2 { @@ -155,27 +158,17 @@ margin-left: -2000px; transition: margin-left 1s; } - } //鍙宠竟鎿嶄綔鏍 -.title{ - width: 100%; - height: 35px; - background-color: #464646; - div{ - width: 50%; - height: 35px; - line-height: 35px; - background-color: #595959; - border-radius: 5px; - span{ - color: white; - font-size: 14px; - font-weight: 400; - padding-left: 5px; - } - } +.rightTitle{ + height: 35x; + line-height: 35px; + text-align: center; + border-top-left-radius: 10px; + border-top-right-radius: 10px; + background-color: #2196F3; + color: #fff; } 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 ba10c1b..d4b9d0b 100644 --- a/src/app/ui/collection-tools-plan/collection-tools.component.ts +++ b/src/app/ui/collection-tools-plan/collection-tools.component.ts @@ -607,7 +607,6 @@ export class CollectionToolsPlanComponent implements OnInit { this.canvasData.isChange = true } - isSixShow = true isSixbtn = true //鎺у埗鎯冲畾浣滀笟缂栬緫鎸夐挳 isediticon = true //鎺у埗鏌ョ湅缂栬緫妯″紡鐨勭紪杈戞ā寮忓皬绗旀寜閽 @@ -631,7 +630,6 @@ export class CollectionToolsPlanComponent implements OnInit { this.canvasData.gameMode = GameMode.Assignment } else { this.getAllLibrary() //鑾峰彇绱犳潗搴 - this.getAllBuildings() //鑾峰彇鎵鏈夊缓绛 } let that = this @@ -645,7 +643,7 @@ export class CollectionToolsPlanComponent implements OnInit { this.canvasData.getMessage().subscribe((message: any)=>{ if(message == "send a message"){ - this.refurbishTreeData() + // this.refurbishTreeData() } }) } @@ -661,7 +659,6 @@ export class CollectionToolsPlanComponent implements OnInit { this.canvas.on("select",obj=>{ //閫変腑绱犳潗灞炴ф敞鍏ュ嚱鏁 this.setAssetsProperty(obj.assetData) - console.log(obj.assetData) }) // 鐩戝惉canvas缁勪欢鍙栨秷閫変腑绱犳潗浜嬩欢 this.canvas.on("deselect",obj=>{ @@ -670,7 +667,7 @@ export class CollectionToolsPlanComponent implements OnInit { //鐩戝惉鏁版嵁鍙樺寲鍚 this.canvas.on('canvasDataChanged',()=>{ // 鏀跺埌鏁版嵁琛ㄧず鍏变韩鏁版嵁鍙戠敓鍙樺寲 - this.renovateTreeData(false) + // this.renovateTreeData(false) }); } @@ -685,7 +682,7 @@ export class CollectionToolsPlanComponent implements OnInit { let buildingId = this.beforeOneCheckedBuilding.id let floorId = this.selectingSitePlan.id this.canvas.paste(companyId,buildingId,floorId) - this.renovateTreeData(false) + // this.renovateTreeData(false) } basicInfo:boolean = true //鍩烘湰淇℃伅鍚嶇О鏄鹃殣 @@ -762,7 +759,6 @@ export class CollectionToolsPlanComponent implements OnInit { }else{ //濡傛灉鏄崟浣 鎬诲钩闈㈠浘 if(this.checkedBuildingIndex==-1){ - // console.log(111,SitePlanData) //淇濆瓨骞抽潰鍥炬暟鎹 this.http.post("/api/SitePlanData",SitePlanData,{ params:{ @@ -1354,31 +1350,30 @@ export class CollectionToolsPlanComponent implements OnInit { //灏佽 鍒锋柊 tree 鏁版嵁 async renovateTreeData (isRefresh:boolean = true) { - this.allFireElements[this.allFireElements.length-1].children = [] + // this.allFireElements[this.allFireElements.length-1].children = [] isRefresh? await this.canvas.refresh() : null this.canvas.setNameVisible(this.basicInfo,0) this.canvas.setNameVisible(this.wantToWork,1) isRefresh? this.canvasData.isChange = false : null //鏈嶅姟涓 鏁版嵁鏄惁鏀瑰姩 鏀逛负false isRefresh? this.isShowProperty = true : null isRefresh? this.isShowAttribute = true : null - !this.pattern? this.mateFireForce() : null //鍒锋柊 寤虹瓚妤煎眰 鐏簮/鍔涢噺鍥炬爣 - let beforeOneId = this.selectingSitePlan.id || '' //褰撳墠 閫変腑 骞抽潰鍥 妤煎眰/鍖哄煙 id - let companyBuildingData = JSON.parse(JSON.stringify( this.canvasData.originalcompanyBuildingData || {} )) // 褰撳墠 鍗曚綅/寤虹瓚 鏁版嵁 - let storeyData = JSON.parse(JSON.stringify( this.canvasData.originaleveryStoreyData || {} )) //褰撳墠 妤煎眰 鏁版嵁 + // let beforeOneId = this.selectingSitePlan.id || '' //褰撳墠 閫変腑 骞抽潰鍥 妤煎眰/鍖哄煙 id + // let companyBuildingData = JSON.parse(JSON.stringify( this.canvasData.originalcompanyBuildingData || {} )) // 褰撳墠 鍗曚綅/寤虹瓚 鏁版嵁 + // let storeyData = JSON.parse(JSON.stringify( this.canvasData.originaleveryStoreyData || {} )) //褰撳墠 妤煎眰 鏁版嵁 - for(let key in companyBuildingData.data){ - if (companyBuildingData.data[key].FloorId === beforeOneId) { //澶勭悊 鍗曚綅/寤虹瓚 鏁版嵁鏄惁褰掍簬褰撳墠妤煎眰涓 - storeyData.data[key] = companyBuildingData.data[key] - } - } - for(let key in storeyData.data){ //绛涢夋暟鎹 娌℃湁鍖归厤鍏ㄩ儴鏀惧叆鍒 鍏朵粬 鏁扮粍 - let noMatch = this.allFireElements.find( every=> every.id===storeyData.data[key].FireElementId ) - if (!noMatch) { - this.allFireElements[this.allFireElements.length-1].children.push(storeyData.data[key]) - } - } - this.handleTreeData(storeyData) //澶勭悊tree鏁版嵁缁撴瀯 + // for(let key in companyBuildingData.data){ + // if (companyBuildingData.data[key].FloorId === beforeOneId) { //澶勭悊 鍗曚綅/寤虹瓚 鏁版嵁鏄惁褰掍簬褰撳墠妤煎眰涓 + // storeyData.data[key] = companyBuildingData.data[key] + // } + // } + // for(let key in storeyData.data){ //绛涢夋暟鎹 娌℃湁鍖归厤鍏ㄩ儴鏀惧叆鍒 鍏朵粬 鏁扮粍 + // let noMatch = this.allFireElements.find( every=> every.id===storeyData.data[key].FireElementId ) + // if (!noMatch) { + // this.allFireElements[this.allFireElements.length-1].children.push(storeyData.data[key]) + // } + // } + // this.handleTreeData(storeyData) //澶勭悊tree鏁版嵁缁撴瀯 } @@ -1425,7 +1420,7 @@ export class CollectionToolsPlanComponent implements OnInit { //鑾峰彇鎬诲钩闈㈠浘 getSitePlan () { - let fireData = this.getFireElements(sessionStorage.getItem('buildingTypeId')) //鑾峰彇鍗曚綅涓 娑堥槻瑕佺礌 + // let fireData = this.getFireElements(sessionStorage.getItem('buildingTypeId')) //鑾峰彇鍗曚綅涓 娑堥槻瑕佺礌 let planData = this.getSitePlanCompanyData() //鑾峰彇 鍗曚綅 鏁版嵁 this.http.get('/api/SitePlans',{params:this.params}).subscribe(data=>{ this.sitePlanData = data @@ -1433,7 +1428,7 @@ export class CollectionToolsPlanComponent implements OnInit { this.canvasData.selectStorey = this.sitePlanData[0] || {} //鏈嶅姟涓 瀛樹竴浠芥暟鎹 this.selectSitePlanIndex = 0 - Promise.all([fireData,planData]).then((res)=>{ + Promise.all([planData]).then((res)=>{ this.getSitePlanStorey(this.selectingSitePlan) //鑾峰彇 骞抽潰鍥 妤煎眰鏁版嵁 }) @@ -1443,7 +1438,7 @@ export class CollectionToolsPlanComponent implements OnInit { //鑾峰彇寤虹瓚 妤煎眰/鍖哄煙 getBuildingSitePlan (item) { let params = { buildingId: item.id } - let fireData = this.getFireElements(item.buildingTypes[0].id || '') //鑾峰彇寤虹瓚涓 娑堥槻瑕佺礌 + // let fireData = this.getFireElements(item.buildingTypes[0].id || '') //鑾峰彇寤虹瓚涓 娑堥槻瑕佺礌 let planData = this.getBuildingData(params) //鑾峰彇 寤虹瓚 鏁版嵁 this.http.get('/api/BuildingAreas',{params}).subscribe(data=>{ this.sitePlanData = data @@ -1451,7 +1446,7 @@ export class CollectionToolsPlanComponent implements OnInit { this.canvasData.selectStorey = this.sitePlanData[0] || {} //鏈嶅姟涓 瀛樹竴浠芥暟鎹 this.selectSitePlanIndex = 0 - Promise.all([fireData,planData]).then((res)=>{ + Promise.all([planData]).then((res)=>{ this.getBuildingStorey(this.selectingSitePlan) //鑾峰彇 寤虹瓚 妤煎眰鏁版嵁 }) diff --git a/src/app/ui/collection-tools-plan/leftFunctionalDomain.ts b/src/app/ui/collection-tools-plan/leftFunctionalDomain.ts index 598e178..b010e94 100644 --- a/src/app/ui/collection-tools-plan/leftFunctionalDomain.ts +++ b/src/app/ui/collection-tools-plan/leftFunctionalDomain.ts @@ -23,36 +23,75 @@ export class leftFunctionalDomainComponentPlan implements OnInit { params = {companyId: sessionStorage.getItem('companyId')} checked:boolean = false;//鏄惁涓洪伩闅惧眰 - + file:any = null; //涓婁紶鐨勬枃浠 + + //閫夋嫨鏂囦欢 + selectFile (e) { + if (e.target.files.length) { + let maxSize = 5*1024*1024 + if (e.target.files[0].size <= maxSize) { + this.file = e.target.files[0] + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('涓婁紶鍥剧墖闇灏忎簬5MB','纭畾',config); + } + } + } + + //瀵煎叆GIS + toGIS () { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鍔熻兘寮鍙戞祴璇曚腑,鍗冲皢涓婄嚎','纭畾',config); + } + //鎻愪氦琛ㄥ崟鍒涘缓骞抽潰鍥 onSubmit (e) { - if (!this.data.isBuilding) { //鎬诲钩闈㈠浘 鍒涘缓骞抽潰鍥 - let data = { - companyId: sessionStorage.getItem('companyId'), - name: e.name, - order: this.data.order, - area:e.area, - details:e.details, - enabled: true, - modifiedTime: new Date(), - } - this.http.post('/api/SitePlans',data).subscribe(data=>{ - this.dialogRef.close('鎬诲钩闈㈠浘'); - }) - } else { //寤虹瓚 鍒涘缓妤煎眰/鍖哄煙 - let data = { - isRefugeStorey: e.isRefugeStorey, - buildingId: this.data.Panel.id, - name: e.name, - order: this.data.order, - area:e.area, - details:e.details, - enabled: true, - modifiedTime: new Date(), - } - this.http.post('/api/BuildingAreas',data,{params:this.params}).subscribe(data=>{ - this.dialogRef.close('寤虹瓚'); - }) + if (this.file) { + let formData = new FormData() + formData.append("file",this.file) + this.http.post(`/api/Objects/WebPlan2D/${sessionStorage.getItem('companyId')}`,formData).subscribe((data:any)=>{ + let imgURL = '/api/Objects/WebPlan2D/' + data.objectName + console.log(imgURL) + if (!this.data.isBuilding) { //鎬诲钩闈㈠浘 鍒涘缓骞抽潰鍥 + let data = { + companyId: sessionStorage.getItem('companyId'), + name: e.name, + order: this.data.order, + area:e.area, + details:e.details, + enabled: true, + modifiedTime: new Date(), + imageUrl: imgURL, + } + this.http.post('/api/SitePlans',data).subscribe(data=>{ + this.dialogRef.close('鎬诲钩闈㈠浘'); + }) + } else { //寤虹瓚 鍒涘缓妤煎眰/鍖哄煙 + let data = { + isRefugeStorey: e.isRefugeStorey, + buildingId: this.data.Panel.id, + name: e.name, + order: this.data.order, + area:e.area, + details:e.details, + enabled: true, + modifiedTime: new Date(), + imageUrl: imgURL, + } + this.http.post('/api/BuildingAreas',data,{params:this.params}).subscribe(data=>{ + this.dialogRef.close('寤虹瓚'); + }) + } + }) //post + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('璇蜂笂浼犲浘鐗','纭畾',config); } } diff --git a/src/app/ui/collection-tools-plan/panel.scss b/src/app/ui/collection-tools-plan/panel.scss index f0ae073..11200e8 100644 --- a/src/app/ui/collection-tools-plan/panel.scss +++ b/src/app/ui/collection-tools-plan/panel.scss @@ -268,9 +268,34 @@ .keyMargin { width: 100%; margin: 5px 0; + text-align: center; .mat-form-field { width: 100%; } + //涓婁紶CAD寮圭獥 inputfile + .uploadBackGround { + width: 80%; + padding: 0 25px; + height: 30px; + line-height: 30px; + position: relative; + cursor: pointer; + color: #000; + font-size: 14px; + background: #fafafa; + border: 1px solid #ddd; + border-radius: 5px; + overflow: hidden; + display: inline-block; + } + .uploadBackGround input { + position: absolute; + width: 100%; + right: 0; + top: 0; + opacity: 0; + cursor: pointer + } } .submitBottom { display: flex; diff --git a/src/app/ui/collection-tools/addBGCDisposalNode.html b/src/app/ui/collection-tools/addBGCDisposalNode.html new file mode 100644 index 0000000..f9f91af --- /dev/null +++ b/src/app/ui/collection-tools/addBGCDisposalNode.html @@ -0,0 +1,24 @@ +
+
+ +
+ +
+ +
+ + + +
+ + +
+ +
+ +
\ No newline at end of file diff --git a/src/app/ui/collection-tools/collection-tools.component.html b/src/app/ui/collection-tools/collection-tools.component.html index 04fe06a..be34123 100644 --- a/src/app/ui/collection-tools/collection-tools.component.html +++ b/src/app/ui/collection-tools/collection-tools.component.html @@ -2,83 +2,40 @@
- - - - - - 鍩烘湰淇℃伅鍚嶇О - visibility - - - 鎯冲畾浣滀笟鍚嶇О - visibility + + 鍩烘湰淇℃伅鍚嶇Оvisibility -
- - 鍩烘湰淇℃伅缂栬緫 - - - 鎯冲畾浣滀笟缂栬緫 - -
- - tv - create - description + + 鎯冲畾浣滀笟鍚嶇Оvisibility -
- -
- - - -
+ +
- keyboard_arrow_right - keyboard_arrow_left 澶╂皵 姘旀俯
- - + +
椋庡姏 +
+
@@ -112,10 +71,79 @@ + +
+
+
+ open_with + + + + + + + +
+
+ {{item.name}} + + + + + + +
+
+
+
+
鎬诲钩闈㈠浘
+
+ {{item.name}} +
+
+
+ +
+ +
+
+ keyboard_arrow_up + keyboard_arrow_down + + +
+
+ + + +
+ +
+ edit + add + library_books + delete_forever +
+
+
+ +
+
+ + -
+
+
@@ -379,7 +372,7 @@
-
+
diff --git a/src/app/ui/collection-tools/collection-tools.component.scss b/src/app/ui/collection-tools/collection-tools.component.scss index 0a5f53f..1d5a3de 100644 --- a/src/app/ui/collection-tools/collection-tools.component.scss +++ b/src/app/ui/collection-tools/collection-tools.component.scss @@ -25,21 +25,19 @@ align-items:center; min-height: 40px; background-color: #fff; - .nameShow{ - cursor: pointer; + .marginLeftRight { + margin: 0 8px; + font-size: 16px; user-select:聽none; + cursor: pointer; + .mat-icon { vertical-align: middle; font-size: 24px; } } .copytobutn{ - width: 33px; - min-width: 33px; + width: 60px; + min-width: 60px; display: flex; justify-content: center; } - font-size: 18px; - mat-icon{ - font-size: 26px; - vertical-align: text-top; - } span{ height: 24px; line-height: 24px; @@ -61,6 +59,12 @@ color: white; } } + .rightSave { + margin: 0 10px; + cursor: pointer; + vertical-align: middle; + color: #279FFF; + } } //澶撮儴鎿嶄綔鏍 @@ -109,13 +113,21 @@ top: 0; } .functionalDomain { - flex: 90%; + flex: 95%; overflow: hidden; .functionalDomainContent { position: relative; width: 100%; height: 100%; } + .centerBuildingDiv { + position: absolute; + max-width: 400px; + top: 40px; + left: 240px; + z-index: 150; + display: flex; + } .functionalDomainLeft { background-color: #fff; display: flex; @@ -137,7 +149,7 @@ } } .functionalDomainRight { - z-index: 1001; + z-index: 111; margin-right: 0px; transition: margin-right 0.5s; border: 1px solid #464646; @@ -158,6 +170,41 @@ } +//涓棿寤虹瓚/妤煎眰 +.centerTotal { + width: 197px; + background-color: #fff; + box-shadow: 0px 0px 5px 3px rgb(165, 163, 163); + border-radius: 5px; + box-sizing: border-box; + padding: 5px 0; + .centerTotalHeader { + height: 30px; + line-height: 30px; + box-sizing: border-box; + padding-right: 5px; + font-size: 14px; + .centerTotalTitle { >label{ display: inline-block; vertical-align: middle; max-width: 90px; } } + .move{margin: 0 5px;} + .move:hover {cursor: move;} + .mat-icon { + font-size: 24px; + color: rgb(175, 164, 164); + } + } + .everyTotal { + width: 100%; + height: 30px; + line-height: 30px; + box-sizing: border-box; + padding: 0 5px; + margin: 3px 0; + cursor:pointer; + font-size: 16px; + } +} +//涓棿寤虹瓚/妤煎眰 + //鍙宠竟鎿嶄綔鏍 .title{ width: 100%; @@ -362,19 +409,16 @@ div:focus { } .bigBox{ - width: 700px; + width: 650px; height: 40px; + line-height: 40px; position: absolute; overflow: hidden; right: 0; + top: 0; } .weatherBox{ - height: 40px; - width: 700px; - line-height: 40px; - position: absolute; - right: 0; - transition: right linear .5s; + width: 100%; .openbtn{ font-size: 45px; height: 45px; diff --git a/src/app/ui/collection-tools/collection-tools.component.ts b/src/app/ui/collection-tools/collection-tools.component.ts index b360f15..db6d785 100644 --- a/src/app/ui/collection-tools/collection-tools.component.ts +++ b/src/app/ui/collection-tools/collection-tools.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit, Inject, ViewChild,ElementRef,Renderer2, ViewContaine 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'; -import {leftFunctionalDomainComponent,editPlaneFigureComponent,editDisposalNodeComponent,addDisposalNodeComponent} from './leftFunctionalDomain' +import {leftFunctionalDomainComponent,editPlaneFigureComponent,editDisposalNodeComponent,addDisposalNodeComponent, addBGCDisposalNodeComponent} from './leftFunctionalDomain' import {MatTreeFlatDataSource, MatTreeFlattener} from '@angular/material/tree'; import {FlatTreeControl} from '@angular/cdk/tree'; import {WorkingAreaComponent} from '../../working-area/working-area.component' @@ -145,7 +145,7 @@ export class CollectionToolsComponent implements OnInit { this.isImgNumCss = false } } - pattern:boolean = true//榛樿涓哄熀鏈俊鎭紪杈 + pattern:boolean = false//榛樿涓哄熀鏈俊鎭紪杈 //鍩烘湰淇℃伅缂栬緫妯″紡 @@ -625,7 +625,7 @@ export class CollectionToolsComponent implements OnInit { isxxx = true //鎺у埗鏌ョ湅缂栬緫妯″紡鐨勭紪杈戞ā寮忔寜閽 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 } @@ -643,7 +643,7 @@ export class CollectionToolsComponent implements OnInit { this.isxxx = false } - this.getAllLibrary() //鑾峰彇绱犳潗搴 + this.getAllLibrary('plan') //鑾峰彇绱犳潗搴 this.getAllBuildings() //鑾峰彇鎵鏈夊缓绛 this.getAllFirePlan() //鑾峰彇褰撳墠鍗曚綅鐏炬儏 @@ -666,7 +666,7 @@ export class CollectionToolsComponent implements OnInit { ngAfterViewInit(): void { - + this.getSitePlan() // 鐩戝惉canvas缁勪欢閫変腑绱犳潗浜嬩欢 this.canvas.on("select",obj=>{ @@ -680,7 +680,7 @@ export class CollectionToolsComponent implements OnInit { //鐩戝惉鏁版嵁鍙樺寲鍚 this.canvas.on('canvasDataChanged',()=>{ // 鏀跺埌鏁版嵁琛ㄧず鍏变韩鏁版嵁鍙戠敓鍙樺寲 - this.renovateTreeData(false) + this.canvasData.selectPanelPoint.BackgroundImageUrl? this.customizeNodes() : this.renovateTreeData(false) }); } @@ -695,10 +695,10 @@ export class CollectionToolsComponent implements OnInit { let buildingId = this.beforeOneCheckedBuilding.id let floorId = this.selectingSitePlan.id this.canvas.paste(companyId,buildingId,floorId) - this.renovateTreeData(false) + this.canvasData.selectPanelPoint.BackgroundImageUrl? this.customizeNodes() : this.renovateTreeData(false) } - basicInfo:boolean = true //鍩烘湰淇℃伅鍚嶇О鏄鹃殣 + basicInfo:boolean = false //鍩烘湰淇℃伅鍚嶇О鏄鹃殣 wantToWork:boolean = true //鎯冲畾浣滀笟鍚嶇О鏄鹃殣 //鐐瑰嚮鍩烘湰淇℃伅鍚嶇О basicInfoClick(){ @@ -1025,12 +1025,7 @@ export class CollectionToolsComponent implements OnInit { disasterId: this.allFirePlan[0].id || '' } }); - - dialogRef.afterClosed().subscribe(result => { - // console.log('The dialog was closed'); - }); - } - + } //else } else { //if const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; @@ -1244,7 +1239,6 @@ export class CollectionToolsComponent implements OnInit { }); this.dataSource.data = treeData this.treeControl.expandAll() - } //鐐瑰嚮鏍戣妭鐐 @@ -1380,10 +1374,12 @@ export class CollectionToolsComponent implements OnInit { isRefresh? await this.canvas.refresh() : null this.canvas.setNameVisible(this.basicInfo,0) this.canvas.setNameVisible(this.wantToWork,1) + this.canvas.setLegendVisible(this.isShowLegend) //鍥句緥鏄鹃殣 isRefresh? this.canvasData.isChange = false : null //鏈嶅姟涓 鏁版嵁鏄惁鏀瑰姩 鏀逛负false isRefresh? this.isShowProperty = true : null isRefresh? this.isShowAttribute = true : null !this.pattern? this.mateFireForce() : null //鍒锋柊 寤虹瓚妤煎眰 鐏簮/鍔涢噺鍥炬爣 + this.beforeOneCheckedBuildingIsShow = false let beforeOneId = this.selectingSitePlan.id || '' //褰撳墠 閫変腑 骞抽潰鍥 妤煎眰/鍖哄煙 id let companyBuildingData = JSON.parse(JSON.stringify( this.canvasData.originalcompanyBuildingData || {} )) // 褰撳墠 鍗曚綅/寤虹瓚 鏁版嵁 @@ -1396,7 +1392,7 @@ export class CollectionToolsComponent implements OnInit { } for(let key in storeyData.data){ //绛涢夋暟鎹 娌℃湁鍖归厤鍏ㄩ儴鏀惧叆鍒 鍏朵粬 鏁扮粍 let noMatch = this.allFireElements.find( every=> every.id===storeyData.data[key].FireElementId ) - if (!noMatch) { + if (!noMatch && storeyData.data[key].Id != "鍥句緥") { this.allFireElements[this.allFireElements.length-1].children.push(storeyData.data[key]) } } @@ -1404,7 +1400,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]) } } @@ -1428,6 +1424,12 @@ export class CollectionToolsComponent implements OnInit { togglePlane:boolean = true; //鍙睍寮闈㈡澘骞抽潰鍥 鏄鹃殣 toggleMaterialBank:boolean = false; //鍙睍寮闈㈡澘绱犳潗搴 鏄鹃殣 toggleHandlePlans:boolean = true; //鍙睍寮闈㈡澘澶勭疆棰勬 鏄鹃殣 + + beforeOneCheckedBuildingIsShow:boolean = false; //鎯冲畾浣滀笟涓 寤虹瓚鏄惁鏄剧ず + togglebeforeOneCheckedBuilding () { this.beforeOneCheckedBuildingIsShow = !this.beforeOneCheckedBuildingIsShow } + isShowLegend:boolean = true; //鍥句緥鏄惁鏄剧ず + changeLegend (e) { this.canvasData.selectPanelPoint.BackgroundImageUrl? null : this.canvas.setLegendVisible(this.isShowLegend) } + //鍙睍寮闈㈡澘灞曞紑鎴栧叧闂 toggle () { this.toggleExpandPanel = !this.toggleExpandPanel @@ -1564,7 +1566,7 @@ export class CollectionToolsComponent implements OnInit { selectSitePlan (item,index) { if (this.selectSitePlanIndex != index) { this.canvasData.selectPanelPoint = new DisposalNodeData(); - if (this.canvasData.isChange) { //true 鏁版嵁琚敼鍔 + if (this.pattern && this.canvasData.isChange) { //true 鏁版嵁琚敼鍔 let isTrue = confirm('鏄惁淇濆瓨褰撳墠缂栬緫鏁版嵁') if (isTrue) { //鍏堜繚瀛樻暟鎹 鍦ㄥ垏鎹 let isSuccess = this.saveSite()//true鐨勬椂鍊 鍏堜繚瀛樻暟鎹 @@ -1962,6 +1964,7 @@ export class CollectionToolsComponent implements OnInit { let params = {disasterId: this.allFirePlan[0].id || ''} this.http.get('/api/DisposalNodes',{params:params}).subscribe(data=>{ //鎵鏈夊缃妭鐐 this.canvasData.allDisposalNode = data + this.getDisposalNode() }) }) } else { //鍗曚綅 鏈夌伨鎯呮椂 @@ -1969,6 +1972,7 @@ export class CollectionToolsComponent implements OnInit { let params = {disasterId: this.allFirePlan[0].id || ''} this.http.get('/api/DisposalNodes',{params:params}).subscribe(data=>{ //鎵鏈夊缃妭鐐 this.canvasData.allDisposalNode = data + this.getDisposalNode() }) } }) @@ -2131,6 +2135,23 @@ export class CollectionToolsComponent implements OnInit { }) } + //鏂板缓 搴曞浘鏁版嵁鑺傜偣 + addBGCPanelPoint (e) { + e.stopPropagation() + let dialogRef = this.dialog.open(addBGCDisposalNodeComponent); + dialogRef.afterClosed().subscribe(data=>{ + if (data) { + this.canvasData.customizeDisposalNode = data //鑷畾涔夋暟鎹妭鐐 + let imgURL = window.URL.createObjectURL(data.file) //灏嗗浘鐗囩敓鎴 url鍦板潃 + this.canvasData.selectPanelPointBaseData = {description: '', notes: '', weather: '', airTemperature: '', windDirection: '', windScale: ''} //鏇存柊 褰撳墠鏁版嵁鑺傜偣瀵瑰簲鐖剁骇鑺傜偣 + this.selectDisposalNode = '' + this.canvasData.selectPanelPoint = new DisposalNodeData() //鏇存柊 褰撳墠鏁版嵁鑺傜偣 + this.canvasData.selectPanelPoint.BackgroundImageUrl = imgURL + this.customizeNodes() + } + }) + } + //鏂板缓 澶勭疆棰勬 鑺傜偣 addPanelPoint (e,item,treeData) { e.stopPropagation() @@ -2223,16 +2244,47 @@ export class CollectionToolsComponent implements OnInit { buildingIndex: e.sitePlanId? -1 : this.allBuildings.findIndex(item=>{ return item.id===e.buildingId }), //鎬诲钩闈㈠浘/寤虹瓚 index storeyId: e.sitePlanId? e.sitePlanId : e.buildingAreaId, //妤煎眰id } - this.http.get('/api/DisposalNodeData',{params:params}).subscribe(data=>{ + this.http.get('/api/DisposalNodeData',{params:params}).subscribe((data:any)=>{ this.canvasData.selectPanelPoint = this.canvasData.deserialize(JSON.stringify(data || new DisposalNodeData())) //閫夋嫨 褰撳墠 鑺傜偣 this.canvasData.selectPanelPoint.Data = this.canvasData.deserialize(this.canvasData.selectPanelPoint.Data) - this.seekPanelPoint(parameter) + data.backgroundImageUrl? this.customizeNodes() : this.seekPanelPoint(parameter) }) } //if } //else if } + //鑷畾涔夋暟鎹妭鐐 鏃 + async customizeNodes() { + await this.canvas.loadNoRelevantInformationDisposalPlan(this.canvasData.selectPanelPoint) + let other = { + children: [], + computed: true, + id: '', + name: '鍏朵粬', + order: 999, + parentId: null, + tag: "INPUT", + isLookPattern : true + } + this.allFireElements = [other] + this.canvas.setNameVisible(this.basicInfo,0) + this.canvas.setNameVisible(this.wantToWork,1) + // this.canvas.setLegendVisible(this.isShowLegend) //鍥句緥鏄鹃殣 + this.beforeOneCheckedBuildingIsShow = false + + let selectPanelPoint = JSON.parse(JSON.stringify(this.canvasData.selectPanelPoint || {} )) //褰撳墠 鑺傜偣 鏁版嵁 + 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) { + this.allFireElements[this.allFireElements.length-1].children.push(selectPanelPoint.Data.Stock[key]) + } + } + } + this.handleTreeData({data:{}},selectPanelPoint) //澶勭悊tree鏁版嵁缁撴瀯 + } + //鏌ユ壘 鏁版嵁鑺傜偣 瀵瑰簲 寤虹瓚/妤煎眰 seekPanelPoint (paramsData) { this.checkedBuildingIndex = paramsData.buildingIndex diff --git a/src/app/ui/collection-tools/leftFunctionalDomain.ts b/src/app/ui/collection-tools/leftFunctionalDomain.ts index 519653d..9703cd8 100644 --- a/src/app/ui/collection-tools/leftFunctionalDomain.ts +++ b/src/app/ui/collection-tools/leftFunctionalDomain.ts @@ -129,6 +129,51 @@ export class editPlaneFigureComponent implements OnInit { +//鏂板缓 搴曞浘鏁版嵁鑺傜偣 +@Component({ + selector: 'app-addBGCDisposalNode', + templateUrl: './addBGCDisposalNode.html', + styleUrls: ['./panel.scss'] +}) +export class addBGCDisposalNodeComponent implements OnInit { + + constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data) { } + + ngOnInit(): void { } + + file:any = null; //鏂囦欢 + //涓婁紶鍥剧墖 + selectFile (e) { + if (e.target.files.length) { + let maxSize = 5*1024*1024 + if (e.target.files[0].size <= maxSize) { + this.file = e.target.files[0] + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('涓婁紶鍥剧墖闇灏忎簬5MB','纭畾',config); + } + } + } + + //鎻愪氦琛ㄥ崟 + onSubmit (e) { + if (e.name && this.file) { + e.file = this.file + this.dialogRef.close(e); + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('璇蜂笂浼犲浘鐗','纭畾',config); + } + } + +} + + + //鍒涘缓 澶勭疆棰勬 鑺傜偣 @Component({ selector: 'app-addDisposalNode', diff --git a/src/app/ui/collection-tools/panel.scss b/src/app/ui/collection-tools/panel.scss index f0ae073..a127a5b 100644 --- a/src/app/ui/collection-tools/panel.scss +++ b/src/app/ui/collection-tools/panel.scss @@ -50,8 +50,8 @@ //鐏簮/鍔涢噺 鍥炬爣 .fireForce { display: block; + margin-top: 5px; float: right; - margin: 8px 5px 0 0; width: 40px; height: 20px; line-height: 20px; @@ -261,6 +261,10 @@ .selectanelPoint { background-color: #F4C235; } +//閫変腑 鏁版嵁鑺傜偣鏃 +.selectanelPointData { + background-color: #f8da88; +} @@ -289,3 +293,39 @@ resize:none; } } + +.leftAddBGC { + div{ text-align: center; } + input { + width: 190px; + height: 30px; + padding-left: 5px; + outline: none; + border: none; + border-radius: 5px; + background: #EEF1F5; + } +} +//涓婁紶CAD寮圭獥 inputfile +.uploadFile { + padding: 3px 10px; + height: 20px; + line-height: 20px; + position: relative; + cursor: pointer; + color: #0080FF; + font-size: 14px; + background: #fafafa; + border: 1px solid #0080FF; + border-radius: 3px; + overflow: hidden; + display: inline-block; + input { + position: absolute; + width: 100%; + right: 0; + top: 0; + opacity: 0; + cursor: pointer + } +} diff --git a/src/app/ui/collection-tools/save.ts b/src/app/ui/collection-tools/save.ts index 0cd4303..8721c18 100644 --- a/src/app/ui/collection-tools/save.ts +++ b/src/app/ui/collection-tools/save.ts @@ -63,7 +63,6 @@ export class saveOneDialog { allDisposalNodeChild = [] defaultSelectedName = '鏍硅妭鐐' ngOnInit(): void { - console.log(111,this.allDisposalNode) //鎵鏈夐潪鏁版嵁鑺傜偣 this.allDisposalNode.forEach(item => { if(!item.sitePlanId && !item.buildingAreaId){ @@ -86,7 +85,6 @@ export class saveOneDialog { } }) }) - // console.log(this.nodeItem.id) } onNoClick(): void { this.dialogRef.close(); @@ -106,8 +104,17 @@ export class saveOneDialog { selectedSiteData = this.data.selectedSiteData onSubmit(value,type){ this.maskLayerService.sendMessage(true) - - let name = this.selectedBuildingData.name + '-' + this.selectedSiteData.name + let name + if (this.canvasData.selectPanelPoint.BackgroundImageUrl) { //褰撳墠 涓鸿嚜瀹氫箟澶勭疆鑺傜偣 + if (this.canvasData.selectPanelPoint.DisposalNodeId) { // 淇濆瓨閫昏緫 + let node = this.canvasData.findDisposalNode(this.canvasData.selectPanelPoint.DisposalNodeId,null) + node? name = node.name : null + } else { //鏂板缓閫昏緫 + name = this.canvasData.customizeDisposalNode.name + } + } else { + name = this.selectedBuildingData.name + '-' + this.selectedSiteData.name + } //濡傛灉淇濆瓨鍒板凡鏈夎妭鐐 var postdata = { id: "", @@ -139,8 +146,7 @@ export class saveOneDialog { putdata.windDirection = Number(this.canvasData.selectPanelPointBaseData.windDirection) putdata.description = this.canvasData.selectPanelPointBaseData.description putdata.notes = this.canvasData.selectPanelPointBaseData.notes - - + if(istrue){//濡傛灉璇ュ缃妭鐐逛笅宸叉湁鍚屽悕鏁版嵁鑺傜偣 鍒欏彧淇敼 2涓帴鍙 new Promise((resolve,reject)=>{ this.http.put(`/api/DisposalNodes/${value.nodeId}`,putdata).subscribe(data => { @@ -151,25 +157,30 @@ export class saveOneDialog { // 淇濆瓨骞抽潰鍥炬暟鎹埌褰撳墠鑺傜偣 let postdata =JSON.parse(JSON.stringify(this.canvasData.selectPanelPoint)) postdata.Data = JSON.stringify(postdata.Data) - postdata.Version ? null : postdata.Version = "2.0" + postdata.Version = "2.0" postdata.DisposalNodeId ? null : postdata.DisposalNodeId = istrue.id postdata.PlanComponentId ? null : postdata.PlanComponentId = sessionStorage.getItem("planId") postdata.Id ? null : postdata.Id = '' - this.http.post(`/api/DisposalNodeData`,postdata).subscribe(data => { - this.maskLayerService.sendMessage(false) - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config) - },err=>{ - this.maskLayerService.sendMessage(false) - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('淇濆瓨澶辫触','纭畾',config) - }) - this.dialogRef.close(); - this.canvasData.sendMessage('send a message');//鍙戝竷涓鏉℃秷鎭 + postdata.BackgroundImageUrl? null : postdata.BackgroundImageUrl = null + let imgURL = this.uploadBGC() //鏇存柊 鑳屾櫙鍥 + imgURL.then(url=>{ + url? postdata.BackgroundImageUrl = url.toString() : null + this.http.post(`/api/DisposalNodeData`,postdata).subscribe(data => { + this.maskLayerService.sendMessage(false) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config) + },err=>{ + this.maskLayerService.sendMessage(false) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨澶辫触','纭畾',config) + }) + this.dialogRef.close(); + this.canvasData.sendMessage('send a message');//鍙戝竷涓鏉℃秷鎭 + }) //imgURL }) }else{//闇瑕3涓帴鍙 @@ -190,22 +201,27 @@ export class saveOneDialog { version: this.canvasData.selectPanelPoint.Version || "2.0", disposalNodeId: data.id, planComponentId: sessionStorage.getItem("planId"), + backgroundImageUrl: this.canvasData.selectPanelPoint.BackgroundImageUrl, } - this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => { - this.maskLayerService.sendMessage(false) - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config) - },err=>{ - this.maskLayerService.sendMessage(false) - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('淇濆瓨澶辫触','纭畾',config) - }) - this.dialogRef.close(); - this.canvasData.sendMessage('send a message');//鍙戝竷涓鏉℃秷鎭 + let imgURL = this.uploadBGC() //鏇存柊 鑳屾櫙鍥 + imgURL.then(url=>{ + url? objData.backgroundImageUrl = url.toString() : null + this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => { + this.maskLayerService.sendMessage(false) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config) + },err=>{ + this.maskLayerService.sendMessage(false) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨澶辫触','纭畾',config) + }) + this.dialogRef.close(); + this.canvasData.sendMessage('send a message');//鍙戝竷涓鏉℃秷鎭 + }) //imgURL }) }) } @@ -284,26 +300,48 @@ export class saveOneDialog { version: this.canvasData.selectPanelPoint.Version || "2.0", disposalNodeId: data.id, planComponentId: sessionStorage.getItem("planId"), + backgroundImageUrl: this.canvasData.selectPanelPoint.BackgroundImageUrl, } - - this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => { - this.maskLayerService.sendMessage(false) - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config) - - },err=>{ - this.maskLayerService.sendMessage(false) - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('淇濆瓨澶辫触','纭畾',config) - }) - this.dialogRef.close(); - this.canvasData.sendMessage("send a message") + let imgURL = this.uploadBGC() //鏇存柊 鑳屾櫙鍥 + imgURL.then(url=>{ + url? objData.backgroundImageUrl = url.toString() : null + this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => { + this.maskLayerService.sendMessage(false) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config) + + },err=>{ + this.maskLayerService.sendMessage(false) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨澶辫触','纭畾',config) + }) + this.dialogRef.close(); + this.canvasData.sendMessage("send a message") + }) //imgURL }) }) } } + + //灏佽鏂规硶 涓婁紶 鑷畾涔夊簳鍥 + uploadBGC () { + return new Promise((resolve,reject)=>{ + if (this.canvasData.selectPanelPoint.BackgroundImageUrl && !this.canvasData.selectPanelPoint.DisposalNodeId) { //鏂板缓閫昏緫 + if (this.canvasData.customizeDisposalNode) { + let formData = new FormData() + formData.append("file",this.canvasData.customizeDisposalNode.file) + this.http.post(`/api/Objects/WebPlan2D/${sessionStorage.getItem('companyId')}/DisposalNode`,formData).subscribe((data:any)=>{ + resolve('/api/Objects/WebPlan2D/' + data.objectName) + }) + } + } else { + resolve(null) + } //else + }) + } + } \ No newline at end of file diff --git a/src/app/ui/ui.module.ts b/src/app/ui/ui.module.ts index eb9a555..81265f8 100644 --- a/src/app/ui/ui.module.ts +++ b/src/app/ui/ui.module.ts @@ -67,7 +67,6 @@ import { UnittypeComponent,DialogOverviewExampleDialog,editorialUnit } from './u import { AuthorityComponent, CreateAuthority } from './authority/authority.component'; import { RoleComponent, CreateRole, EditRole } from './role/role.component'; import { UsermanagementComponent,CreateNewUser,EditNewUser,allRoles,seeInformation } from './usermanagement/usermanagement.component'; - import { IsnoPipe } from '../pipes/boolean.pipe'; import {ConfirmpswDirective} from './changepassword/equal-validator.directive' import { TimePipe } from '../pipes/time.pipe'; @@ -90,16 +89,18 @@ import { EditGroup } from './unit-information/editgroup.component'; import { EnterpriseuserComponent,seeenterpriseuser,editenterpriseuser } from './enterpriseuser/enterpriseuser.component'; import { AddEnterpriserUser } from './enterpriseuser/addenterpriseuser.component'; import { FireFightingFacilitiesFormworkComponent,addFireFightingFacilitiesFormworkComponent,editFireFightingFacilitiesFormworkComponent,addBuiltInComponent,addBuiltInAttributeComponent,addOptionalComponent,addOptionalAttributeComponent,editBuiltInAttributeComponent,editOptionalAttributeComponent } from './fire-fighting-facilities-formwork/fire-fighting-facilities-formwork.component'; - import { CollectionToolsComponent, CreateBuilding, EditBuilding, ViewDetails } from './collection-tools/collection-tools.component'; import { WorkingAreaComponent } from '../working-area/working-area.component'; -import {leftFunctionalDomainComponent,editPlaneFigureComponent,addDisposalNodeComponent,editDisposalNodeComponent} from './collection-tools/leftFunctionalDomain' +import {leftFunctionalDomainComponent,editPlaneFigureComponent,addDisposalNodeComponent,editDisposalNodeComponent,addBGCDisposalNodeComponent} from './collection-tools/leftFunctionalDomain' import { saveOneDialog, saveTwoDialog } from './collection-tools/save'; import { CollectionToolsPlanComponent, CreateBuildingPlan, EditBuildingPlan, ViewDetailsPlan } from './collection-tools-plan/collection-tools.component'; import { addDisposalNodeComponentPlan, editDisposalNodeComponentPlan, editPlaneFigureComponentPlan, leftFunctionalDomainComponentPlan } from './collection-tools-plan/leftFunctionalDomain'; import { saveOneDialogPlan, saveTwoDialogPlan } from './collection-tools-plan/save'; +import {CollectionToolsBuildingComponent,CreateBuildingBuilding,EditBuildingBuilding,ViewDetailsBuilding} from './collection-tools-building/collection-tools.component' +import {leftFunctionalDomainBuildingComponent,editPlaneFigureBuildingComponent,addDisposalNodeBuildingComponent,editDisposalNodeBuildingComponent} from './collection-tools-building/leftFunctionalDomain' +import {saveOneDialogBuilding,saveTwoDialogBuilding} from './collection-tools-building/save' @NgModule({ - declarations: [UiComponent, DateselectComponent, MenuComponent, CardComponent, ListComponent, GridComponent, StepperComponent, TabgroupComponent, ButtonComponent, BadgeComponent, ProgressComponent, SnackbarComponent,PersonaldataComponent, FooterComponent, UserdataComponent, ChangepasswordComponent, OrganizationComponent, UnittypeComponent, AuthorityComponent, RoleComponent, UsermanagementComponent,IsnoPipe,ConfirmpswDirective,DialogOverviewExampleDialog,CreateAuthority,CreateRole,TimePipe,CreateNewUser,EditNewUser,allRoles,EditRole,CreateOrganization,EditOrganization,seeInformation,EditUser,editorialUnit,FireProtectionElementsComponent,Establish,EditingFireControl,FireFightingTemplateComponent, NavmenusComponent,CreateMenus,EditMenus,NewFireFighting,EditFireClassification, MaterialBankComponent, UnitInformationComponent,AddMatLibrary,EditMatLibrary,attributeComponent,AddOriginalCopy,addAttributeComponent,editAttribute,EditOriginalCopy,SelectOriginalCopy,EditUnitInfo,AddUnitInfo,AddGroups,EditGroup, EnterpriseuserComponent,AddEnterpriserUser,addUnitAttributeComponent,editUnitAttribute,seeenterpriseuser,editenterpriseuser, FireFightingFacilitiesFormworkComponent,addFireFightingFacilitiesFormworkComponent,editFireFightingFacilitiesFormworkComponent,addBuiltInComponent,addBuiltInAttributeComponent,addOptionalComponent,addOptionalAttributeComponent,editBuiltInAttributeComponent,editOptionalAttributeComponent, CollectionToolsComponent,WorkingAreaComponent,CreateBuilding,EditBuilding,leftFunctionalDomainComponent,editPlaneFigureComponent,ViewDetails,saveOneDialog,saveTwoDialog,addDisposalNodeComponent,editDisposalNodeComponent,CollectionToolsPlanComponent,CreateBuildingPlan,EditBuildingPlan,ViewDetailsPlan,leftFunctionalDomainComponentPlan,editPlaneFigureComponentPlan,addDisposalNodeComponentPlan,editDisposalNodeComponentPlan,saveOneDialogPlan,saveTwoDialogPlan,addOffices,editOffices], + declarations: [UiComponent, DateselectComponent, MenuComponent, CardComponent, ListComponent, GridComponent, StepperComponent, TabgroupComponent, ButtonComponent, BadgeComponent, ProgressComponent, SnackbarComponent,PersonaldataComponent, FooterComponent, UserdataComponent, ChangepasswordComponent, OrganizationComponent, UnittypeComponent, AuthorityComponent, RoleComponent, UsermanagementComponent,IsnoPipe,ConfirmpswDirective,DialogOverviewExampleDialog,CreateAuthority,CreateRole,TimePipe,CreateNewUser,EditNewUser,allRoles,EditRole,CreateOrganization,EditOrganization,seeInformation,EditUser,editorialUnit,FireProtectionElementsComponent,Establish,EditingFireControl,FireFightingTemplateComponent, NavmenusComponent,CreateMenus,EditMenus,NewFireFighting,EditFireClassification, MaterialBankComponent, UnitInformationComponent,AddMatLibrary,EditMatLibrary,attributeComponent,AddOriginalCopy,addAttributeComponent,editAttribute,EditOriginalCopy,SelectOriginalCopy,EditUnitInfo,AddUnitInfo,AddGroups,EditGroup, EnterpriseuserComponent,AddEnterpriserUser,addUnitAttributeComponent,editUnitAttribute,seeenterpriseuser,editenterpriseuser, FireFightingFacilitiesFormworkComponent,addFireFightingFacilitiesFormworkComponent,editFireFightingFacilitiesFormworkComponent,addBuiltInComponent,addBuiltInAttributeComponent,addOptionalComponent,addOptionalAttributeComponent,editBuiltInAttributeComponent,editOptionalAttributeComponent, CollectionToolsComponent,WorkingAreaComponent,CreateBuilding,EditBuilding,leftFunctionalDomainComponent,editPlaneFigureComponent,ViewDetails,saveOneDialog,saveTwoDialog,addDisposalNodeComponent,editDisposalNodeComponent,CollectionToolsPlanComponent,CreateBuildingPlan,EditBuildingPlan,ViewDetailsPlan,leftFunctionalDomainComponentPlan,editPlaneFigureComponentPlan,addDisposalNodeComponentPlan,editDisposalNodeComponentPlan,saveOneDialogPlan,saveTwoDialogPlan,addOffices,editOffices,addBGCDisposalNodeComponent,CollectionToolsBuildingComponent,CreateBuildingBuilding,EditBuildingBuilding,ViewDetailsBuilding,leftFunctionalDomainBuildingComponent,editPlaneFigureBuildingComponent,addDisposalNodeBuildingComponent,editDisposalNodeBuildingComponent,saveOneDialogBuilding,saveTwoDialogBuilding], imports: [ CommonModule, @@ -157,6 +158,7 @@ import { saveOneDialogPlan, saveTwoDialogPlan } from './collection-tools-plan/sa exports:[ FooterComponent, CollectionToolsComponent, + CollectionToolsBuildingComponent, CollectionToolsPlanComponent ] }) diff --git a/src/app/working-area/model/axImageShapeTest.ts b/src/app/working-area/model/axImageShapeTest.ts deleted file mode 100644 index 81c141c..0000000 --- a/src/app/working-area/model/axImageShapeTest.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { AxRectangleShape } from "./axRectangleShape"; - -export class AxImageShapeTest extends AxRectangleShape{ - /** - * - */ - constructor(x:number,y:number,width:number,height:number) { - super(x,y,width,height); - - } -} \ No newline at end of file diff --git a/src/app/working-area/model/axLegend.ts b/src/app/working-area/model/axLegend.ts index a886fd3..f2158ac 100644 --- a/src/app/working-area/model/axLegend.ts +++ b/src/app/working-area/model/axLegend.ts @@ -429,7 +429,6 @@ export class AxLegend extends AxShape { */ public drawBorder(scale: number) { const visible = this.upLeft.visible; - console.log(visible); this.setPointVisiable(false); super.drawBorder(scale); diff --git a/src/app/working-area/model/axMessageSystem.ts b/src/app/working-area/model/axMessageSystem.ts new file mode 100644 index 0000000..1451f9c --- /dev/null +++ b/src/app/working-area/model/axMessageSystem.ts @@ -0,0 +1,90 @@ +/** + * 浜嬩欢绯荤粺 + */ +export class AxMessageSystem { + /** 鐩戝惉鏁扮粍 */ + private static listeners = {}; + + /** + * 娉ㄥ唽浜嬩欢 + * @param name 浜嬩欢鍚嶇О + * @param callback 鍥炶皟鍑芥暟 + * @param context 涓婁笅鏂 + */ + public static addListener(name: string, callback: () => void, context: any) { + const observers: Observer[] = AxMessageSystem.listeners[name]; + if (!observers) { + AxMessageSystem.listeners[name] = []; + } + AxMessageSystem.listeners[name].push(new Observer(callback, context)); + } + + /** + * 绉婚櫎浜嬩欢 + * @param name 浜嬩欢鍚嶇О + * @param callback 鍥炶皟鍑芥暟 + * @param context 涓婁笅鏂 + */ + public static removeListener(name: string, callback: () => void, context: any) { + const observers: Observer[] = AxMessageSystem.listeners[name]; + if (!observers) { return; } + const length = observers.length; + for (let i = 0; i < length; i++) { + const observer = observers[i]; + if (observer.compar(context)) { + observers.splice(i, 1); + break; + } + } + if (observers.length === 0) { + delete AxMessageSystem.listeners[name]; + } + } + + /** + * 鍙戦佷簨浠 + * @param name 浜嬩欢鍚嶇О + */ + public static send(name: string, ...args: any[]) { + const observers: Observer[] = AxMessageSystem.listeners[name]; + if (!observers) { return; } + const length = observers.length; + for (let i = 0; i < length; i++) { + const observer = observers[i]; + observer.notify(name, ...args); + } + } +} + +/** + * 瑙傚療鑰 + */ +class Observer { + /** 鍥炶皟鍑芥暟 */ + private callback: () => void; + /** 涓婁笅鏂 */ + private context: any = null; + + constructor(callback: () => void, context: any) { + const self = this; + self.callback = callback; + self.context = context; + } + + /** + * 鍙戦侀氱煡 + * @param args 涓嶅畾鍙傛暟 + */ + notify(...args: any[]): void { + const self = this; + self.callback.call(self.context, ...args); + } + + /** + * 涓婁笅鏂囨瘮杈 + * @param context 涓婁笅鏂 + */ + compar(context: any): boolean { + return context === this.context; + } +} diff --git a/src/app/working-area/model/axRectangleShape.ts b/src/app/working-area/model/axRectangleShape.ts index 297ffdb..cf61f6c 100644 --- a/src/app/working-area/model/axRectangleShape.ts +++ b/src/app/working-area/model/axRectangleShape.ts @@ -1,21 +1,21 @@ -import { Sprite } from "pixi.js"; -import { Graphics } from "pixi.js"; -import { WorkingAreaComponent } from "../working-area.component"; -import { AxShape } from "./axShape"; +import { Sprite } from 'pixi.js'; +import { Graphics } from 'pixi.js'; +import { WorkingAreaComponent } from '../working-area.component'; +import { AxShape } from './axShape'; -export class AxRectangleShape extends AxShape{ +export class AxRectangleShape extends AxShape { /** * */ - constructor(x:number,y:number,width:number,height:number,assetData: any, workingArea: WorkingAreaComponent) { - super(assetData,workingArea); - this.beginFill(0x0000ff,1); - this.lineStyle(1, 0xff0000,1); + constructor(x: number, y: number, width: number, height: number, assetData: any, workingArea: WorkingAreaComponent) { + super(assetData, workingArea); + this.beginFill(0x0000ff, 1); + this.lineStyle(1, 0xff0000, 1); this.drawRect(x, y, width, height); this.endFill(); - - + + } - + } diff --git a/src/app/working-area/model/axSelection.ts b/src/app/working-area/model/axSelection.ts new file mode 100644 index 0000000..ce7a6e0 --- /dev/null +++ b/src/app/working-area/model/axSelection.ts @@ -0,0 +1,52 @@ +/** + * 閫夋嫨鍣 + */ +export class AxSelection { + constructor() { + } + private objects: Set = new Set(); + // 鑾峰緱绗竴涓璞 + public first(): any { + if (this.objects.size > 0) { + return this.objects[0]; + } else { + return null; + } + } + // 鏄惁宸茬粡閫夋嫨浜嗗璞 + public has(obj: any): boolean { + return this.objects.has(obj); + } + // 鑾峰緱鎵鏈夊璞 + public all() { + return this.objects; + } + // 鑾峰彇闆嗗悎闀垮害 + public size(): number { + return this.objects.size; + } + // 娣诲姞瀵硅薄 + public add(obj: any) { + this.objects.add(obj); + } + // 娣诲姞闆嗗悎 + public addArray(array: any[]) { + array.forEach(item => { + this.objects.add(item); + }); + } + // 绉婚櫎瀵硅薄 + public delete(obj: any) { + this.objects.delete(obj); + } + // 绉婚櫎闆嗗悎 + public deleteArray(array: any[]) { + array.forEach(item => { + this.objects.delete(item); + }); + } + // 娓呯┖鎵鏈夊璞 + public clear() { + this.objects.clear(); + } +} diff --git a/src/app/working-area/model/axShape.ts b/src/app/working-area/model/axShape.ts index 27c1773..3a5dae7 100644 --- a/src/app/working-area/model/axShape.ts +++ b/src/app/working-area/model/axShape.ts @@ -8,7 +8,7 @@ import { WorkingAreaComponent } from '../working-area.component'; */ export class AxShape extends Graphics { assetData: any; - pointTexture: PIXI.Texture = PIXI.Texture.from('assets/images/handle-main.png') + pointTexture: PIXI.Texture = PIXI.Texture.from('assets/images/handle-main.png'); workingArea: WorkingAreaComponent; // 鍙互琚Щ鍔ㄧ殑 moveable = true; @@ -20,7 +20,11 @@ export class AxShape extends Graphics { showName = true; // 杈规 border: PIXI.Graphics = new PIXI.Graphics(); - + // 榧犳爣浣嶇疆 + mousePosition: PIXI.Point; + // 榧犳爣鎷栧姩 + mouseDragging: boolean; + constructor(assetData: any, workingArea: WorkingAreaComponent) { super(); this.border.visible = false; @@ -35,50 +39,30 @@ export class AxShape extends Graphics { .on('pointerdown', event => { event.stopPropagation(); if (this.selectable) { - this.workingArea.selection.selectOne(this); + this.workingArea.select(this); } if (this.moveable) { - event.currentTarget.data = event.data; - event.currentTarget.alpha = 0.5; - event.currentTarget.dragging = true; - - event.currentTarget.dragPoint = event.data.getLocalPosition(event.currentTarget.parent); - event.currentTarget.dragPoint.x -= event.currentTarget.x; - event.currentTarget.dragPoint.y -= event.currentTarget.y; + this.mouseDragging = true; + this.mousePosition = new PIXI.Point(event.data.global.x, event.data.global.y); } }) .on('pointerup', event => { - if (event.currentTarget.dragging) { - event.currentTarget.alpha = 1; - event.currentTarget.dragging = false; - event.currentTarget.data = null; - } + this.mouseDragging = false; }) .on('pointerupoutside', event => { - if (event.currentTarget.dragging) { - event.currentTarget.alpha = 1; - event.currentTarget.dragging = false; - event.currentTarget.data = null; - } + this.mouseDragging = false; }) .on('pointermove', event => { - if (event.currentTarget.dragging) { - const newPosition = event.currentTarget.data.getLocalPosition(event.currentTarget.parent); - - // const offsetX = newPosition.x - event.currentTarget.dragPoint.x; - // const offsetY = newPosition.y - event.currentTarget.dragPoint.y; - // const offset = this.workingArea.backgroundImage.toLocal(new Point(offsetX, offsetY)); - // event.currentTarget.position += offset; - // // this.workingArea.selection.objects.forEach(shpae => { - // // shpae.x = newPosition.x - event.currentTarget.dragPoint.x; - // // shpae.y = newPosition.y - event.currentTarget.dragPoint.y; - // // shpae.assetData.Point = new PIXI.Point(this.x, this.y); - // // this.workingArea.canvasData.isChange = true; - // // }) - event.currentTarget.x = newPosition.x - event.currentTarget.dragPoint.x; - event.currentTarget.y = newPosition.y - event.currentTarget.dragPoint.y; - this.assetData.Point = new PIXI.Point(this.x, this.y); - this.workingArea.canvasData.isChange = true; + if (this.mouseDragging) { + this.workingArea.selection.all().forEach(item => { + const x = event.data.global.x - this.mousePosition.x; + const y = event.data.global.y - this.mousePosition.y; + item.x += x * (1 / this.workingArea.backgroundImage.scale.x); + item.y += y * (1 / this.workingArea.backgroundImage.scale.y); + item.assetData.Point = new PIXI.Point(item.x, item.y); + this.workingArea.canvasData.isChange = true; + }); + this.mousePosition = new PIXI.Point(event.data.global.x, event.data.global.y); } }) .on('rightclick', event => { @@ -86,14 +70,14 @@ export class AxShape extends Graphics { }); } redraw(): void { - + } - refresh(): void{ - + refresh(): void { + } public setItemScale(scale: number) { - + } public showBorder() { @@ -110,10 +94,10 @@ export class AxShape extends Graphics { * @param value 鏄剧ず鐘舵 */ public setPointVisiable(value: boolean) { - + } /** - * + * * @param rect 鐢昏竟妗 */ public drawBorder(scale: number) { @@ -127,14 +111,14 @@ export class AxShape extends Graphics { this.border.lineStyle(scale * 1, 0x00a8ff); - var spaceLength = scale * 1; - var lineLenght = rect.width + 0.5 + 0.5; - var dashLength = scale*( lineLenght +spaceLength - Math.floor((rect.width + rect.height)/2 / 4.1))/Math.floor((rect.width + rect.height)/2 / 4.1); - this.drawDash(this.border, p1.x -0.5*scale, p1.y, p2.x + 0.5*scale, p2.y,dashLength,spaceLength); - this.drawDash(this.border, p2.x, p2.y -0.5*scale, p3.x, p3.y + 0.5*scale, dashLength, spaceLength); - this.drawDash(this.border, p3.x+0.5*scale, p3.y, p4.x - 0.5*scale, p4.y, dashLength, spaceLength); - this.drawDash(this.border, p4.x, p4.y + 0.5*scale, p1.x, p1.y - 0.5*scale, dashLength, spaceLength); - + const spaceLength = scale * 1; + const lineLenght = rect.width + 0.5 + 0.5; + const dashLength = scale * ( lineLenght + spaceLength - Math.floor((rect.width + rect.height) / 2 / 4.1)) / Math.floor((rect.width + rect.height) / 2 / 4.1); + this.drawDash(this.border, p1.x - 0.5 * scale, p1.y, p2.x + 0.5 * scale, p2.y, dashLength, spaceLength); + this.drawDash(this.border, p2.x, p2.y - 0.5 * scale, p3.x, p3.y + 0.5 * scale, dashLength, spaceLength); + this.drawDash(this.border, p3.x + 0.5 * scale, p3.y, p4.x - 0.5 * scale, p4.y, dashLength, spaceLength); + this.drawDash(this.border, p4.x, p4.y + 0.5 * scale, p1.x, p1.y - 0.5 * scale, dashLength, spaceLength); + this.border.lineStyle(0, 0x0000ff); // this.border.beginFill(0x00ff00,0.1); this.border.moveTo(p1.x, p1.y); @@ -145,19 +129,19 @@ export class AxShape extends Graphics { // this.border.endFill(); } // 鐢昏櫄绾 - drawDash(target, x1, y1, x2, y2,dashLength = 5, spaceLength = 1) { - let x = x2 - x1; - let y = y2 - y1; + drawDash(target, x1, y1, x2, y2, dashLength = 5, spaceLength = 1) { + const x = x2 - x1; + const y = y2 - y1; let hyp = Math.sqrt((x) * (x) + (y) * (y)); - let units = hyp / (dashLength + spaceLength); - let dashSpaceRatio = dashLength / (dashLength + spaceLength); - let dashX = (x / units) * dashSpaceRatio; - let spaceX = (x / units) - dashX; - let dashY = (y / units) * dashSpaceRatio; - let spaceY = (y / units) - dashY; + const units = hyp / (dashLength + spaceLength); + const dashSpaceRatio = dashLength / (dashLength + spaceLength); + const dashX = (x / units) * dashSpaceRatio; + const spaceX = (x / units) - dashX; + const dashY = (y / units) * dashSpaceRatio; + const spaceY = (y / units) - dashY; target.moveTo(x1, y1); - + while (hyp > 0) { x1 += dashX; y1 += dashY; @@ -200,7 +184,7 @@ export class AxShape extends Graphics { return new PIXI.Point(gravityLat, gravityLng); } // 璁$畻绾挎涓偣鍧愭爣 - public getLineCenter(point1:PIXI.Point,point2:PIXI.Point) { - return new PIXI.Point((point1.x+point2.x)/2,(point1.y+point2.y)/2) + public getLineCenter(point1: PIXI.Point, point2: PIXI.Point) { + return new PIXI.Point((point1.x + point2.x) / 2, (point1.y + point2.y) / 2); } } diff --git a/src/app/working-area/model/messageSystem.ts b/src/app/working-area/model/messageSystem.ts deleted file mode 100644 index 322eef4..0000000 --- a/src/app/working-area/model/messageSystem.ts +++ /dev/null @@ -1,37 +0,0 @@ -class MyEvent extends CustomEvent { - public static readonly CMD: string = "EVENT_NAME"; - public constructor($type: string , $data: T ) { - super( $type , { detail: $data, bubbles: true, cancelable: true, composed: true }); - } -} - -class MyDispatch extends EventTarget { - private static _instance: MyDispatch; - public static get Instance(): MyDispatch { - if (!MyDispatch._instance) MyDispatch._instance = new MyDispatch(); - return MyDispatch._instance; - } - public send($data: T, $type: string = MyEvent.CMD): void { - const $event: CustomEvent = new MyEvent($type, $data); - this.dispatchEvent($event); - } -} - -class Test { - - public constructor() { - MyDispatch.Instance.addEventListener(MyEvent.CMD, this.onEvent as EventListener); - } - private onEvent($e: MyEvent): void { - console.log(`target ${$e.target}`); - console.log(`name: ${$e.detail._name} , occupation: ${$e.detail._occupation}`); - } -} - -interface ITest { - _name: string; - _occupation: string; -} - -let $test: Test = new Test(); -MyDispatch.Instance.send({ _name: `Aonaufly`, _occupation: `it` }); diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 2b9c93f..dd61efb 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -16,9 +16,9 @@ import { PropertyInfo } from './model/PropertyInfo'; import { AxPreviewImageShape } from './model/axPreviewImageShape'; import { AxArrowConnector } from './model/axArrowConnector'; import { AxLegend, Legend } from './model/axLegend'; -import { NullTemplateVisitor } from '@angular/compiler'; -import { AxRectangleShape } from './model/axRectangleShape'; import { AxGrid } from './model/axGrid'; +import { AxSelection } from './model/axSelection'; +import { AxMessageSystem } from './model/axMessageSystem'; @Component({ @@ -76,7 +76,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV /** * 閫夋嫨鍣 */ - public selection: Selection = new Selection(this); + public readonly selection: AxSelection = new AxSelection(); /** * 褰撳墠榧犳爣鐨勭偣 */ @@ -141,6 +141,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 缃戞牸 */ public grid: AxGrid = null; + // 鏄惁鎸変笅Ctrl閿 + isCtrlKeyClicked = false; + isMove = false; /** * 鏈蒋浠剁増鏈彿鐢卞洓閮ㄥ垎缁勬垚锛<涓荤増鏈彿><娆$増鏈彿><淇鐗堟湰鍙><鏃ユ湡鍔犲笇鑵婂瓧姣嶇増鏈彿> 渚嬪锛1.0.0.20210105_beta * Alpha鐗: 姝ょ増鏈〃绀鸿杞欢鍦ㄦ闃舵涓昏鏄互瀹炵幇杞欢鍔熻兘涓轰富锛岄氬父鍙湪杞欢寮鍙戣呭唴閮ㄤ氦娴侊紝涓鑸岃█锛岃鐗堟湰杞欢鐨凚ug杈冨锛岄渶瑕佺户缁慨鏀广 @@ -148,7 +151,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * RC鐗: 璇ョ増鏈凡缁忕浉褰撴垚鐔熶簡锛屽熀鏈笂涓嶅瓨鍦ㄥ鑷撮敊璇殑BUG锛屼笌鍗冲皢鍙戣鐨勬寮忕増鐩稿樊鏃犲嚑銆 * Release鐗: 璇ョ増鏈剰鍛斥滄渶缁堢増鏈濓紝鍦ㄥ墠闈㈢増鏈殑涓绯诲垪娴嬭瘯鐗堜箣鍚庯紝缁堝綊浼氭湁涓涓寮忕増鏈紝鏄渶缁堜氦浠樼敤鎴蜂娇鐢ㄧ殑涓涓増鏈傝鐗堟湰鏈夋椂涔熺О涓烘爣鍑嗙増銆備竴鑸儏鍐典笅锛孯elease涓嶄細浠ュ崟璇嶅舰寮忓嚭鐜板湪杞欢灏侀潰涓婏紝鍙栬屼唬涔嬬殑鏄鍙仿 */ - public VERSION = '1.0.11.20210122_beta'; + public VERSION = '1.0.12.20210125_beta'; /** * 鏁版嵁鍒濆鍖 */ @@ -157,12 +160,12 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.sayHello(); this.eventManager.addGlobalEventListener('window', 'keydown', (event: any) => { if (event.keyCode === 17) { - this.selection.isMultiselection = true; + this.isCtrlKeyClicked = true; } }); this.eventManager.addGlobalEventListener('window', 'keyup', (event: any) => { if (event.keyCode === 17) { - this.selection.isMultiselection = false; + this.isCtrlKeyClicked = false; this.rectToolGraphics.visible = false; this.rectToolGraphics.clear(); } @@ -176,18 +179,43 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 鍒犻櫎閫変腑鐨勫浘鏍 */ public deleteSelectedShape() { - this.selection.objects.forEach(item => { - this.deleteShape(item); - }); - this.selection.deselectAll(); - } - /** - * - * @param obj 鍒犻櫎涓涓舰鐘 - */ - public deleteShape(shape) { - if (this.allowEdit && this.canvasData.gameMode === shape.assetData.GameMode) { - this.emit('deleteIcon', shape); + if (this.selection.all().size > 0) { + this.selection.all().forEach(axShape => { + if (this.allowEdit && this.canvasData.gameMode === axShape.assetData.GameMode) { + // 鍒犻櫎鍥句緥瀵硅薄 + const temp = this.backgroundImage.getChildByName('鍥句緥') as AxLegend; + if ( temp !== undefined + && temp !== null + && axShape.assetData.Name !== '鍥句緥') { + const itemLegend = new Legend(axShape.assetData.Name, axShape.assetData.ImageUrl, 1); + temp.deleteItem(itemLegend); + } + if (axShape.assetData.GameMode === GameMode.BasicInformation) { // 鍩烘湰淇℃伅 + // 鍒犻櫎妤煎眰鏁版嵁 + delete this.canvasData.originaleveryStoreyData.data[axShape.assetData.Id]; + // 鍒犻櫎寤虹瓚鏁版嵁 + delete this.canvasData.originalcompanyBuildingData.data[axShape.assetData.Id]; + } else if (axShape.assetData.GameMode === GameMode.Assignment) { // 澶勭疆棰勬 + delete this.canvasData.selectPanelPoint.Data.DefinedIncrement[axShape.assetData.Id]; + delete this.canvasData.selectPanelPoint.Data.Increment[axShape.assetData.Id]; + delete this.canvasData.selectPanelPoint.Data.Stock[axShape.assetData.Id]; + } else if (axShape.assetData.GameMode === GameMode.Examinee) { // 鑰冪敓鑰冭瘯 + if (axShape.assetData.Tag === 1) { + // 鍒犻櫎妤煎眰鏁版嵁 + delete this.canvasData.examOriginaleveryStoreyData.data[axShape.assetData.Id]; + } else { + delete this.canvasData.selectPanelPoint.Data.DefinedIncrement[axShape.assetData.Id]; + delete this.canvasData.selectPanelPoint.Data.Increment[axShape.assetData.Id]; + delete this.canvasData.selectPanelPoint.Data.Stock[axShape.assetData.Id]; + } + } + this.backgroundImage.removeChild(axShape); + } + }); + this.selection.clear(); + this.emit('canvasDataChanged'); + this.canvasData.isChange = true; + AxMessageSystem.send(CanvasAction.selectionChanged); } } /** @@ -276,7 +304,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV icon.assetData.Type === 3 || icon.assetData.Type === 4 )) { - console.log(this.backgroundImage.position); this.backgroundImage.pivot.set(icon.x, icon.y); this.backgroundImage.position.set(771, 404); clearTimeout(this.animationTime); @@ -315,7 +342,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.app.stage.addChild(this.grid); this.grid.drawGrid(); this.grid.onMousemove = (evt, gridCoord) => { - // console.log(gridCoord); + }; this.createBackgroundImage(); @@ -355,28 +382,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.rectToolGraphics.endFill(); } }); - /** - * 閫変腑浜嬩欢 - */ - this.on('select', (axShape: AxShape) => { - // if (axShape instanceof AxRectangleShape) { - // let upLeft: PIXI.Sprite= new PIXI.Sprite(this.editorPointTexture); - // let upRight: PIXI.Sprite= new PIXI.Sprite(this.editorPointTexture); - // let downLeft: PIXI.Sprite= new PIXI.Sprite(this.editorPointTexture); - // let downRight: PIXI.Sprite = new PIXI.Sprite(this.editorPointTexture); - // } else { - axShape.showBorder(); - axShape.drawBorder(1 / this.backgroundImage.scale.x); - axShape.setPointVisiable(this.allowEdit); - // } - }); - /** - * 鍙栨秷閫変腑浜嬩欢 - */ - this.on('deselect', (axShape: AxShape) => { - axShape.hideBorder(); - axShape.setPointVisiable(false); - }); /** * 鍒涘缓鍥炬爣浜嬩欢锛堟暟鎹鐞嗭級 */ @@ -415,44 +420,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.emit('canvasDataChanged'); this.canvasData.isChange = true; }); - /** - * 鍒犻櫎鍥炬爣浜嬩欢(鏁版嵁澶勭悊) - */ - this.on('deleteIcon', (axShape: AxShape) => { - // 鍒犻櫎鍥句緥瀵硅薄 - const temp = this.backgroundImage.getChildByName('鍥句緥') as AxLegend; - if ( temp !== undefined - && temp !== null - && axShape.assetData.Name !== '鍥句緥') { - const itemLegend = new Legend(axShape.assetData.Name, axShape.assetData.ImageUrl, 1); - temp.deleteItem(itemLegend); - } - - - if (axShape.assetData.GameMode === GameMode.BasicInformation) { // 鍩烘湰淇℃伅 - // 鍒犻櫎妤煎眰鏁版嵁 - delete this.canvasData.originaleveryStoreyData.data[axShape.assetData.Id]; - // 鍒犻櫎寤虹瓚鏁版嵁 - delete this.canvasData.originalcompanyBuildingData.data[axShape.assetData.Id]; - } else if (axShape.assetData.GameMode === GameMode.Assignment) { // 澶勭疆棰勬 - delete this.canvasData.selectPanelPoint.Data.DefinedIncrement[axShape.assetData.Id]; - delete this.canvasData.selectPanelPoint.Data.Increment[axShape.assetData.Id]; - delete this.canvasData.selectPanelPoint.Data.Stock[axShape.assetData.Id]; - } else if (axShape.assetData.GameMode === GameMode.Examinee) { // 鑰冪敓鑰冭瘯 - if (axShape.assetData.Tag === 1) { - // 鍒犻櫎妤煎眰鏁版嵁 - delete this.canvasData.examOriginaleveryStoreyData.data[axShape.assetData.Id]; - } else { - delete this.canvasData.selectPanelPoint.Data.DefinedIncrement[axShape.assetData.Id]; - delete this.canvasData.selectPanelPoint.Data.Increment[axShape.assetData.Id]; - delete this.canvasData.selectPanelPoint.Data.Stock[axShape.assetData.Id]; - } - - } - this.backgroundImage.removeChild(axShape); - this.emit('canvasDataChanged'); - this.canvasData.isChange = true; - }); } /** * 閲嶇疆鐢诲竷 @@ -504,7 +471,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV public setIconScale(value: number): void { this.backgroundImage.children.forEach(item => { if (item instanceof AxImageShape) { - console.log(item.image.scale); item.image.scale.set(value); } else if (item instanceof MultipointIcon) { @@ -513,19 +479,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV } }); } - /** - * 璁剧疆楂樹寒 - */ - public setHighlight(ids: string[]): void { - this.selection.deselectAll(); - ids.forEach(item => { - let obj = this.backgroundImage.getChildByName(item); - if (obj === null) { - obj = this.app.stage.getChildByName(item); - } - this.selection.select(obj); - }); - } /** * 鍒涘缓妤煎眰鍥惧舰 */ @@ -631,10 +584,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV .on('pointerdown', event => { if (event.data.button !== 0) { return; } console.log(this.backgroundImage.toLocal(this.mousePosition)); - if (!event.currentTarget.dragging && this.selection.isMultiselection === false) { - this.selection.deselectAll(); + if (!this.isMove && this.isCtrlKeyClicked === false) { event.currentTarget.data = event.data; - event.currentTarget.dragging = true; + this.isMove = true; event.currentTarget.dragPoint = event.data.getLocalPosition(event.currentTarget.parent); event.currentTarget.dragPoint.x -= event.currentTarget.x; event.currentTarget.dragPoint.y -= event.currentTarget.y; @@ -828,48 +780,47 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV // this.emit('backgroundScale', this.backgroundImage.scale.x); break; } - } else if (!event.currentTarget.dragging && this.selection.isMultiselection === true) { + } else if (!this.isMove && this.isCtrlKeyClicked === true) { this.rectToolGraphics.visible = true; - event.currentTarget.dragging = true; + this.isMove = true; this.initialScreenMousePos = this.backgroundImage.toLocal(this.mousePosition); this.finalScreenMousePos = this.backgroundImage.toLocal(this.mousePosition); } }) .on('pointerup', event => { - if (event.currentTarget.dragging) { - event.currentTarget.dragging = false; - event.currentTarget.data = null; - } + this.isMove = false; + event.currentTarget.data = null; + if (this.rectToolGraphics.visible === true) { + const shapes: AxShape[] = []; this.backgroundImage.children.forEach(item => { - if ( item instanceof AxImageShape - || item instanceof MultipointIcon - || item instanceof PolygonIcon - || item instanceof AxArrowConnector) { + if ( item instanceof AxShape + && item instanceof AxPreviewImageShape === false) { // 鍒ゆ柇2涓煩褰㈡槸鍚︾浉浜 const rect1 = this.rectToolGraphics.getBounds(); const rect2 = item.getBounds(); if (this.isOverlap(rect1, rect2)) { - this.selection.select(item); + shapes.push(item); } } }); this.rectToolGraphics.clear(); this.rectToolGraphics.visible = false; + this.selectAll(shapes); } }) .on('pointerupoutside', event => { - if (event.currentTarget.dragging) { - event.currentTarget.dragging = false; + if (this.isMove) { + this.isMove = false; event.currentTarget.data = null; } }) .on('pointermove', event => { - if (event.currentTarget.dragging && this.selection.isMultiselection === false) { + if (this.isMove && this.isCtrlKeyClicked === false) { const newPosition = event.currentTarget.data.getLocalPosition(event.currentTarget.parent); event.currentTarget.x = newPosition.x - event.currentTarget.dragPoint.x; event.currentTarget.y = newPosition.y - event.currentTarget.dragPoint.y; - } else if (event.currentTarget.dragging && this.selection.isMultiselection === true) { + } else if (this.isMove && this.isCtrlKeyClicked === true) { if (this.rectToolGraphics.visible === true) { this.finalScreenMousePos = this.backgroundImage.toLocal(this.mousePosition); } @@ -877,7 +828,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV }) .on('rightclick', event => { event.stopPropagation(); - this.selection.deselectAll(); + this.deselectAll(); this.setPaintMode(PaintMode.endPaint); }) .on('pointerover', (event) => { @@ -951,11 +902,11 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * @param imageUrl * @param imageAngle */ - public async refresh(imageUrl: string = this.canvasData.selectStorey.imageUrl, imageAngle: number = this.canvasData.selectStorey.imageAngle): Promise { + public async refresh(imageUrl: string = this.canvasData.selectStorey.imageUrl, + imageAngle: number = this.canvasData.selectStorey.imageAngle): Promise { await this.refreshBackgroundImage(); - // 娓呯┖鎵鏈夊浘褰 - this.selection.deselectAll(); + this.deselectAll(); const itemList = []; this.backgroundImage.children.forEach(item => { if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { @@ -978,10 +929,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 鍔犺浇鏃犲叧鑱斾俊鎭缃妗 * @data 澶勭疆棰勬鏁版嵁 */ - public async loadNoRelevantInformationDisposalPlan(data:DisposalNodeData): Promise { - await this.refreshBackgroundImage(data.BackgroundImageUrl,data.BackgroundImageAngle); + public async loadNoRelevantInformationDisposalPlan(data: DisposalNodeData): Promise { + await this.refreshBackgroundImage(data.BackgroundImageUrl, data.BackgroundImageAngle); // 娓呯┖鎵鏈夊浘褰 - this.selection.deselectAll(); + this.deselectAll(); const itemList = []; this.backgroundImage.children.forEach(item => { if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { @@ -1142,7 +1093,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV */ public beginPaint() { console.log(this.canvasData.selectTemplateData); - this.selection.deselectAll(); + this.deselectAll(); this.setPaintMode(PaintMode.endPaint); this.setPaintMode(this.canvasData.selectTemplateData.interactiveMode); } @@ -1291,49 +1242,53 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 澶嶅埗 */ public copy(): void { - this.copyData = []; - this.selection.objects.forEach(item => { - const newData = JSON.parse(JSON.stringify(item.assetData)); - this.copyData.push(newData); - }); + this.copyData = []; + this.selection.all().forEach(item => { + const newData = JSON.parse(JSON.stringify(item.assetData)); + this.copyData.push(newData); + }); } /** * 绮樿创 */ public paste(companyId: string, buildingId: string, floorId: string): void { - this.copyData.forEach(item => { - item.Point = new PIXI.Point(item.Point.x + 5, item.Point.y + 5); - const newData = JSON.parse(JSON.stringify(item)); - newData.Id = ObjectID.default.generate(), - newData.CompanyId = companyId; - newData.BuildingId = buildingId; - newData.FloorId = floorId; - newData.Point = new PIXI.Point(item.Point.x + 5, item.Point.y + 5); - switch (item.InteractiveMode) { - case PaintMode.singlePointIcon: - const singleIcon = new AxImageShape(newData, this); - this.emit('createIcon', singleIcon); - break; - case PaintMode.lineIcon: - const lineIcon = new MultipointIcon(newData, this); - this.emit('createIcon', lineIcon); - break; - case PaintMode.polygonIcon: - const polygonIcon = new PolygonIcon(newData, this); - this.emit('createIcon', polygonIcon); - break; - case PaintMode.Pipeline: - if (item.Name === '璺濈') { - const wall = new AxArrowConnector(newData, this, true, true); - this.emit('createIcon', wall); - } else if (item.Name === '鏅氬' || item.Name === '鎵块噸澧') { - const wall = new AxArrowConnector(newData, this, false, false); - this.emit('createIcon', wall); - } - break; - } - this.selection.select(this.backgroundImage.getChildByName(newData.Id)); - }); + const ids: string[] = []; + if (this.copyData.length > 0) { + this.copyData.forEach(item => { + item.Point = new PIXI.Point(item.Point.x + 5, item.Point.y + 5); + const newData = JSON.parse(JSON.stringify(item)); + newData.Id = ObjectID.default.generate(), + newData.CompanyId = companyId; + newData.BuildingId = buildingId; + newData.FloorId = floorId; + newData.Point = new PIXI.Point(item.Point.x + 5, item.Point.y + 5); + switch (item.InteractiveMode) { + case PaintMode.singlePointIcon: + const singleIcon = new AxImageShape(newData, this); + this.emit('createIcon', singleIcon); + break; + case PaintMode.lineIcon: + const lineIcon = new MultipointIcon(newData, this); + this.emit('createIcon', lineIcon); + break; + case PaintMode.polygonIcon: + const polygonIcon = new PolygonIcon(newData, this); + this.emit('createIcon', polygonIcon); + break; + case PaintMode.Pipeline: + if (item.Name === '璺濈') { + const wall = new AxArrowConnector(newData, this, true, true); + this.emit('createIcon', wall); + } else if (item.Name === '鏅氬' || item.Name === '鎵块噸澧') { + const wall = new AxArrowConnector(newData, this, false, false); + this.emit('createIcon', wall); + } + break; + } + ids.push(newData.Id); + }); + this.setHighlight(ids); + } } //////////////////////////////////////////////////////////////////////// 閫氱敤///////////////////////////////////////////////////////////////////////////// /** @@ -1357,7 +1312,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV public async onExamineeClickFloor() { await this.refreshBackgroundImage(); // 娓呯┖鎵鏈夊浘褰 - this.selection.deselectAll(); + this.deselectAll(); const itemList = []; this.backgroundImage.children.forEach(item => { if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { @@ -1384,7 +1339,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV public async onExaminerClickFloor() { await this.refreshBackgroundImage(); // 娓呯┖鎵鏈夊浘褰 - this.selection.deselectAll(); + this.deselectAll(); const itemList = []; this.backgroundImage.children.forEach(item => { if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { @@ -1410,7 +1365,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV public async onExaminerClickFloor_CreateTestpaper() { await this.refreshBackgroundImage(); // 娓呯┖鎵鏈夊浘褰 - this.selection.deselectAll(); + this.deselectAll(); const itemList = []; this.backgroundImage.children.forEach(item => { if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { @@ -1428,94 +1383,122 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV // 闅愯棌鍥炬爣 this.setNameVisible(false, 0); } -} - -/** - * 閫夋嫨鍣 - */ -export class Selection { - constructor(private workingArea: WorkingAreaComponent) {} - public objects: any[] = []; - public isMultiselection = false; + //////////////////////////////////////////////////////////////////// 閫夋嫨閫昏緫 /** - * 杩斿洖閫夋嫨鍣ㄤ腑鏄惁鍖呭惈瀵硅薄 - * @param obj 瀵硅薄 + * 娓呯┖閫夋嫨锛岄夋嫨鍗曚釜褰㈢姸 + * @param shape 褰㈢姸 */ - public contains(obj: any): boolean { - return this.objects.includes(obj); + public selectSingle(shape: AxShape) { + if (this.selection.first() !== null) { + this.selection.all().forEach(item => { + this.clearSelectEffect(item); + }); + this.selection.clear(); + } + this.selection.add(shape); + this.setSelectEffect(shape); + AxMessageSystem.send(CanvasAction.selectionChanged); } /** - * 閫夊畾瀵硅薄 - * @param obj 瀵硅薄 + * 閫夋嫨 + * @param shape 褰㈢姸 */ - public select(obj: any) { - if (!this.contains(obj)) { - this.workingArea.emit('select', obj); - this.objects.push(obj); + public select(shape: AxShape) { + if (this.selection.first() !== null + && !this.isCtrlKeyClicked + && !this.selection.has(shape)) { + this.selection.all().forEach(item => { + this.clearSelectEffect(item); + }); + this.selection.clear(); } + this.selection.add(shape); + this.setSelectEffect(shape); + AxMessageSystem.send(CanvasAction.selectionChanged); } /** - * 鍙栨秷閫夊畾瀵硅薄 - * @param obj 瀵硅薄 + * 閫夋嫨闆嗗悎涓殑褰㈢姸 + * @param shape 褰㈢姸闆嗗悎 */ - public deselect(obj: any) { - if (this.contains(obj)) { - this.workingArea.emit('deselect', obj); - const idx = this.objects.findIndex(x => x === obj); - this.objects.splice(idx, 1); - } + public selectAll(shape: AxShape[]) { + this.selection.addArray(shape); + this.selection.all().forEach(item => { + this.setSelectEffect(item); + }); + AxMessageSystem.send(CanvasAction.selectionChanged); } /** - * 閫夊畾鎴栧彇娑堥夊畾瀵硅薄 - * @param obj 瀵硅薄 + * 鍏堟竻绌哄啀閫夋嫨鍏ㄩ儴 + * @param shape 褰㈢姸闆嗗悎 */ - public selectOrDeselect(obj: any) { - if (this.contains(obj)) { - this.deselect(obj); - } else { - this.select(obj); + public selectAllWithClear(shape: AxShape[]) { + if (this.selection.first() !== null) { + this.selection.all().forEach(item => { + this.clearSelectEffect(item); + }); + this.selection.clear(); } + this.selection.addArray(shape); + this.selection.all().forEach(item => { + this.setSelectEffect(item); + }); + AxMessageSystem.send(CanvasAction.selectionChanged); } /** - * 鍙栨秷閫夊畾鎵鏈夊凡閫夊畾瀵硅薄 + * 閫夋嫨闆嗗悎涓墍鏈塱d鐨勫舰鐘 + * @param ids 褰㈢姸id闆嗗悎 */ - public deselectAll() { - this.objects.forEach(item => { - this.workingArea.emit('deselect', item); + public setHighlight(ids: string[]): void { + const shapes: AxShape[] = []; + // 閲嶆柊閫夋嫨 + ids.forEach(item => { + const obj = this.backgroundImage.getChildByName(item); + shapes.push(obj as AxShape); }); - this.objects.splice(0, this.objects.length); + this.selectAllWithClear(shapes); } /** - * 鍙栨秷閫夊畾鎵鏈夊璞″悗閫夊畾涓涓璞 - * @param obj 瀵硅薄 + * 鍙栨秷鎵鏈夐夋嫨 */ - public selectOne(obj: any) { - if (this.isMultiselection) { - this.selectOrDeselect(obj); - } else { - this.deselectAll(); - this.select(obj); + public deselectAll() { + if (this.selection.first() !== null) { + this.selection.all().forEach(item => { + this.clearSelectEffect(item); + }); + this.selection.clear(); + AxMessageSystem.send(CanvasAction.selectionChanged); } } /** - * 閫夊畾瀵硅薄闆嗗悎涓墍鏈夊璞 - * @param objects 瀵硅薄闆嗗悎 + * 璁剧疆閫変腑鏁堟灉 + * @param shape 褰㈢姸 */ - public selectAll(objects: any[]) { - this.objects.forEach(item => { - this.select(item); - }); + public setSelectEffect(shape: AxShape) { + shape.hideBorder(); + shape.setPointVisiable(false); + shape.showBorder(); + shape.drawBorder(1 / this.backgroundImage.scale.x); + shape.setPointVisiable(this.allowEdit); + } + /** + * 璁剧疆褰㈢姸閫変腑鏁堟灉 + * @param shape 褰㈢姸 + */ + public clearSelectEffect(shape: AxShape) { + shape.hideBorder(); + shape.setPointVisiable(false); + } + ////////////////////////////////////////////////////////////////////////////////////////////////鍥句緥 + /** + * 璁剧疆鍥句緥鏄剧ず闅愯棌 + * @param b true 鏄剧ず锛宖alse闅愯棌 + */ + public setLegendVisible(b: boolean): void { + const legend = this.backgroundImage.getChildByName('鍥句緥') as AxLegend; + legend.visible = b; } } - - -/** - * 杞﹁締绫诲瀷 - */ -export enum Type { - 姘存簮 = 0, - 涓鹃珮鍠峰皠娑堥槻杞 = 1, - 娉℃搏娑堥槻杞 = 2, - 姘寸綈娑堥槻杞 = 3, - 鍘嬬缉绌烘皵娉℃搏娑堥槻杞 = 4 +enum CanvasAction { + selectionChanged = 'selectionChanged', + copyDataChanged = 'copyDataChanged' }