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/data-collection/data-collection.module.ts b/src/app/data-collection/data-collection.module.ts index ad38bdf..50060c8 100644 --- a/src/app/data-collection/data-collection.module.ts +++ b/src/app/data-collection/data-collection.module.ts @@ -45,11 +45,11 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { DataCollectionRoutingModule } from './data-collection.routing'; import { AddWater, WaterCollectionComponent } from './water-collection/water-collection.component'; import { AddFireForce, FireForceComponent, ViewDetails } from './fire-force/fire-force.component'; -import { LinkageForcesComponent } from './linkage-forces/linkage-forces.component'; +import { AddLinkageForce, LinkageForcesComponent, ViewDetails2 } from './linkage-forces/linkage-forces.component'; import { NzTreeModule } from 'ng-zorro-antd/tree'; @NgModule({ - declarations: [WaterCollectionComponent, FireForceComponent, LinkageForcesComponent,AddWater,AddFireForce,ViewDetails], + declarations: [WaterCollectionComponent, FireForceComponent, LinkageForcesComponent,AddWater,AddFireForce,ViewDetails,AddLinkageForce,ViewDetails2], imports: [ CommonModule, A11yModule, diff --git a/src/app/data-collection/linkage-forces/addLinkageForce.html b/src/app/data-collection/linkage-forces/addLinkageForce.html new file mode 100644 index 0000000..4ba38db --- /dev/null +++ b/src/app/data-collection/linkage-forces/addLinkageForce.html @@ -0,0 +1,15 @@ +
+
+ 鏂板鑱斿姩鍔涢噺 +
+
+
+ + {{item.name}} +
+
+
+ + +
+
\ No newline at end of file diff --git a/src/app/data-collection/linkage-forces/linkage-forces.component.html b/src/app/data-collection/linkage-forces/linkage-forces.component.html index 413184e..abc51c7 100644 --- a/src/app/data-collection/linkage-forces/linkage-forces.component.html +++ b/src/app/data-collection/linkage-forces/linkage-forces.component.html @@ -1,8 +1,260 @@ -
+
+
+
+
+ 鍒楄〃杩囨护 +
+
+ + +
+
+ +
+
+
+
+ 娑堥槻闃 + 瀹屾暣搴 +
+
+
    +
  • +
    {{item.name}}
    +
    + + {{accMul(item.integrityScore.toFixed(3),100,1)}}% + +
    +
    +
    +
    highlight_off
    +
  • +
+
+
+ +
+
-
- +
+
+ +
+ + + + {{item.name}} + + +
+ +
+
+ +
+
+
+ +
+
+
+ + 璇风瓑寰... +
+
+ + 涓婁紶涓...({{progressBarValue}}%) + +
+
+ + 涓嬭浇涓...({{progressBarValue}}%) +
+
+
+
+ 璇︽儏 +
+
+ 鐩稿叧璧勬枡 +
+
+
+
+ + + + +
+ + save淇濆瓨 + open_in_browser鎻愪氦瀹℃牳 +
+
+ +
+
+

鍩烘湰淇℃伅

+ + + + * + 绫诲瀷: + + + + + + * + 鍚嶇О: + + + + + + 鍗曚綅鑱旂郴鐢佃瘽: + + + + + + 鍗曚綅浼犵湡: + + + + + + 澶囨敞: + + + + +

浣嶇疆淇℃伅

+ + + + 琛屾斂鍖: + + + + 鍦板潃: + + + + + + 缁忓害: + + + + 绾害: + + + + + + +

鑱旂郴浜

+ + + + 鑱旂郴浜: + + + + + + 鑱屽姟: + + + + + + 鐢佃瘽: + + + + +

搴旀ヤ俊鎭

+ + + + 鏈嶅姟鍐呭: + + + + + + 璧勬簮璇存槑: + + + + + +
+
+ +
+
+ highlight_off +
+ + + + + +
+ {{item.fileName}} + + +
+
+
+
+ + \ No newline at end of file diff --git a/src/app/data-collection/linkage-forces/linkage-forces.component.scss b/src/app/data-collection/linkage-forces/linkage-forces.component.scss index ef03c8d..9fbcf0f 100644 --- a/src/app/data-collection/linkage-forces/linkage-forces.component.scss +++ b/src/app/data-collection/linkage-forces/linkage-forces.component.scss @@ -5,14 +5,532 @@ display: flex; box-sizing: border-box; padding: 10px; + font-size: 16px; + font-family: Source Han Sans CN; + font-weight: 400; + color: #000000; } .listbox{ width: 400px; height: 100%; background-color: #fff; + display: flex; + flex-direction: column; + .topbox{ + max-height: 200px; + box-sizing: border-box; + padding: 10px 22px 22px; + .add{ + height: 36px; + line-height: 36px; + display: flex; + justify-content: space-between; + } + .searchbox{ + .inputbox{ + width: 100%; + height: 36px; + font-size: 14px; + line-height: 36px; + margin: 10px 0; + display: flex; + span{ + margin-right: 5px; + } + select,input{ + flex: 1; + background-color: #F2F4F6; + border: 0; + border-radius: 5px; + box-sizing: border-box; + padding:0 8px; + + } + .gray{ + color: gray; + } + // input::-moz-placeholder { + // color: rgba(90, 83, 83, 0.89); + // opacity: 1; + // } + // input:-ms-input-placeholder { + // color: rgba(90, 83, 83, 0.89);; + // } + // input::-webkit-input-placeholder { + // color: rgba(90, 83, 83, 0.89);; + // } + } + } + } + .contantbox{ + flex: 1; + overflow-y: auto; + display: flex; + flex-direction: column; + .title{ + display: flex; + justify-content: space-between; + width: 100%; + box-sizing: border-box; + padding: 0 33px 0 22px; + height: 36px; + line-height: 36px; + span{ + font-size: 14px; + font-weight: 500; + } + } + .linkageForceList{ + flex: 1; + overflow-y: auto; + li{ + cursor: pointer; + width: 100%; + height: 36px; + line-height: 36px; + display: flex; + align-items: center; + font-size: 14px; + div{ + float: left; + box-sizing: border-box; + } + .name{ + text-align: left; + width: 60%; + padding-left: 22px; + white-space:nowrap; + overflow:hidden; + text-overflow:ellipsis; + } + .integrity{ + height: 58%; + width: 32%; + position: relative; + background-color: #F2F4F6; + .integrityNum{ + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + color: black; + font-size: 13px; + cursor: default; + } + .integrityColorDiv{ + height: 100%; + } + } + .deletebtn{ + flex: 1; + text-align: center; + mat-icon{ + width: 20px; + height: 20px; + cursor: pointer; + font-size: 20px; + vertical-align: text-top; + color: rgba(49, 46, 46, 0.144); + } + mat-icon:hover{ + color: #000; + } + } + } + li:hover{ + background-color: #b3d3ee; + } + .selectedLi{ + background-color: #b3d3ee; + } + } + .paginator{ + height: 56px; + width: 100%; + } + } } .mapbox{ flex: 1; margin-left: 10px; background-color: #fff; + display: flex; + overflow: hidden; + flex-direction: column; + .mapcheckbox,.swiper-container{ + width: 100%; + height: 50px; + .swiper-wrapper{ + flex: 1; + display: flex; + height: 50px; + line-height: 50px; + } + mat-checkbox{ + font-size: 15px; + span{ + display: flex; + justify-content: center; + align-items: center; + img{ + margin-right: 3px; + } + } + + } + mat-checkbox:nth-child(1){ + margin-left: 20px; + } + + } + #map{ + flex: 1; + position: relative; + #container{ + width: 100%; + height: 100%; + } + .gistopbox{ + position: absolute; + box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16); + border-radius: 5px; + top: 3px; + width: 30%; + height:40px; + background: #FFFFFF; + display: flex; + align-items: center; + cursor: default;; + .inputBox{ + width: 100%; + display: flex; + align-items: center; + justify-content: center; + box-sizing: border-box; + font-size: 14px; + .positionInput{ + border: 0; + border-radius: 6px; + width: 80%; + height: 28px; + background: #F2F2F2; + margin-left: 8px; + box-sizing: border-box; + padding-left: 10px; + } + } + + } + .hidden{ + opacity: 0; + z-index: -1; + } + .show{ + opacity: 1; + z-index: 1; + } + } + .detailsbox{ + width: 100%; + height:500px; + position: relative; + .tabsbox{ + width: 100%; + height: 40px; + overflow: hidden; + overflow-x: auto; + line-height: 40px; + display: flex; + justify-content: space-between; + font-size: 15px; + .tabs{ + div{ + float: left; + width: 120px; + text-align: center; + cursor: pointer; + color: #000000; + opacity: 0.4; + border-right: 1px solid #F2F4F6; + } + .selectedBtn{ + background-color: #2196F3; + color: #fff; + opacity: 1; + } + } + .btnbox{ + display: flex; + align-items: center; + .uploadAttachment{ + display: inline-block; + margin-right: 20px; + width: 120px; + text-align: center; + height: 28px; + line-height: 28px; + position: relative; + button{ + width: 100%; + height: 28px; + line-height: 28px; + mat-icon{ + transform: rotate(25deg); + font-size: 20px; + width: 20px; + height: 20px; + } + } + .a-upload{ + display: inline-block; + position: absolute; + left: 0; + top: 0; + display: inline-block; + width: 100%; + height: 100%; + opacity: 0; + input{ + width: 100%; + height: 100%; + cursor: pointer; + } + } + } + span{ + display: inline-block; + cursor: pointer; + color: #2196F3; + mat-icon{ + vertical-align: text-top; + font-size: 20px; + width: 20px; + height: 20px; + } + } + span:hover{ + text-decoration: underline; + } + .submitAudit{ + margin: 0 30px; + } + + } + } + .contant{ + width: 100%; + height:460px; + overflow-y: auto; + p{ + color: #2196F3; + background-color: #F2F4F6; + height: 33px; + line-height: 33px; + box-sizing: border-box; + padding-left: 20px; + font-size: 15px; + } + span{ + font-size: 15px; + } + input,select{ + height: 30px; + line-height: 30px; + box-sizing: border-box; + padding: 0 12px; + width: 60%; + margin-left: 5px; + border: 1px solid #EBEBEB; + border-radius: 5px; + } + textarea{ + width: 89%; + margin-left: 5px; + height: 85%; + border: 1px solid #EBEBEB; + border-radius: 5px; + } + .longinput{ + width: 74%; + } + .unitDiv{ + width: 60%; + position: relative; + input,select{ + width: 100%; + box-sizing: border-box; + padding-right: 50px; + } + .unit{ + position: absolute; + right: 13px; + top: 4px; + color: #000000; + opacity: 0.4; + } + } + .smallwidth{ + width: 30%; + } + // 鐩稿叧璧勬枡 + .fileDivBox{ + position: relative; + float: left; + border: 1px solid #EBEBEB; + width: 160px; + height: 162px; + box-sizing: border-box; + padding: 16px 16px 0; + display: flex; + flex-direction: column; + margin: 12px; + align-items: center; + cursor: pointer; + .imgbox{ + width: 134px; + height: 110px; + display: flex; + justify-content: center; + align-items: center; + .thumbnailImg{ + width: 134px; + height: 110px; + } + } + + span{ + width: 100%; + text-align: center; + margin-top: 5px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + color: gray; + font-size: 14px; + } + .deleteFile{ + position: absolute; + right: 0; + top: 0; + width: 18px; + height: 18px; + font-size: 18px; + display: none; + } + .btn{ + position: absolute; + height: 30px; + line-height: 30px; + font-size: 14px; + display: none; + } + .btn1{ + top: 37px; + } + .btn2{ + top: 78px; + } + } + .fileDivBox:hover{ + border: 1px solid #000; + .deleteFile{ + display: block; + + } + .deleteFile:hover{ + color: red; + } + .btn{ + display: block; + } + } + } + .masklayer{ + position: absolute; + left: 0; + top: 0; + z-index: 2000; + width: 100%; + height: 100%; + background: rgba(0,0,0,0.2); + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + span{ + font-size: 14px; + margin-top: 5px; + } + .progressbar{ + width: 15%; + } + .cancelbtn{ + height: 32px; + line-height: 32px; + font-size: 14px; + margin-top: 12px; + } + } + } +} + + +.addLinkageForceBox{ + width: 530px; + height: 262px; + display: flex; + flex-direction: column; + .topbox{ + width: 100%; + height: 40px; + line-height: 40px; + background-color: #2196F3; + text-align: center; + color: #FFFFFF; + font-size: 15px; + } + .contant{ + flex: 1; + box-sizing: border-box; + padding:20px 30px; + + div{ + width:86px; + margin: 3px; + height: 36px; + float: left; + line-height: 36px; + text-align: center; + background-color: #F2F4F6; + font-size: 14px; + cursor: pointer; + border: 1px solid #fff; + border-radius: 4px; + display: flex; + justify-content: center; + align-items: center; + img{ + margin-right: 3px; + } + } + .selectedDiv{ + background-color: #fff; + border: 1px solid #2196F3; + } + } + .btnbox{ + width: 100%; + height: 50px; + box-sizing: border-box; + padding: 0px 30px; + display: flex; + align-items: flex-start;; + justify-content: center; + button{ + width: 80px; + height: 36px; + line-height: 36px; + margin: 0 20px; + } + } } \ No newline at end of file diff --git a/src/app/data-collection/linkage-forces/linkage-forces.component.ts b/src/app/data-collection/linkage-forces/linkage-forces.component.ts index cbddc20..919b746 100644 --- a/src/app/data-collection/linkage-forces/linkage-forces.component.ts +++ b/src/app/data-collection/linkage-forces/linkage-forces.component.ts @@ -1,5 +1,16 @@ +import { FlatTreeControl } from '@angular/cdk/tree'; +import { HttpClient } from '@angular/common/http'; +import { Inject, Renderer2 } from '@angular/core'; +import { ElementRef } from '@angular/core'; import { Component, OnInit } from '@angular/core'; - +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; +import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree'; +import { NzTreeNode } from 'ng-zorro-antd/tree'; +import { TreeService } from 'src/app/http-interceptors/tree.service'; +import Viewer from 'viewerjs' +import Swiper from 'swiper'; +declare var AMap: any; @Component({ selector: 'app-linkage-forces', templateUrl: './linkage-forces.component.html', @@ -7,9 +18,754 @@ import { Component, OnInit } from '@angular/core'; }) export class LinkageForcesComponent implements OnInit { - constructor() { } + constructor(private tree: TreeService,public snackBar: MatSnackBar,private http:HttpClient,private elementRef: ElementRef,public renderer2: Renderer2,public dialog: MatDialog) { } + + isCheckedOfSearchDiv:boolean = true//鍒楄〃杩囨护婊戝潡 + slideChange(e){ + this.isCheckedOfSearchDiv = e.checked + } + //鎼滅储琛ㄥ崟 + searchForm:any = { + name:'', + integrityNum:'' + } + listIntegrityNum:any[] = [ + {id:-1,name:'鍏ㄩ儴'}, + {id:0,name:'<=50%'}, + {id:1,name:'50%-60%'}, + {id:2,name:'60%-70%'}, + {id:3,name:'70%-80%'}, + {id:4,name:'80%-90%'}, + {id:5,name:'90%-100%'} + ] + checkBoxList:any[] = [ + {id:0,name:'瀹夌洃',imgUrl:'/assets/linkageForces/瀹夌洃.png'}, + {id:1,name:'鐢靛姏灞',imgUrl:'/assets/linkageForces/鐢靛姏灞.png'}, + {id:2,name:'鍏畨',imgUrl:'/assets/linkageForces/鍏畨.png'}, + {id:3,name:'娴蜂簨',imgUrl:'/assets/linkageForces/娴蜂簨.png'}, + {id:4,name:'鐜繚灞',imgUrl:'/assets/linkageForces/鐜繚灞.png'}, + {id:5,name:'浜ら',imgUrl:'/assets/linkageForces/浜ら.png'}, + {id:6,name:'姘戞斂',imgUrl:'/assets/linkageForces/姘戞斂.png'}, + {id:7,name:'姘旇薄灞',imgUrl:'/assets/linkageForces/姘旇薄灞.png'}, + {id:8,name:'鐕冩皵灞',imgUrl:'/assets/linkageForces/鐕冩皵灞.png'}, + {id:9,name:'甯傛斂',imgUrl:'/assets/linkageForces/甯傛斂.png'}, + {id:10,name:'姘村埄',imgUrl:'/assets/linkageForces/姘村埄.png'}, + {id:11,name:'閫氫俊',imgUrl:'/assets/linkageForces/閫氫俊.png'}, + {id:12,name:'鍖荤枟',imgUrl:'/assets/linkageForces/鍖荤枟.png'}, + {id:13,name:'搴旀ョ鐞',imgUrl:'/assets/linkageForces/搴旀ョ鐞.png'}, + {id:14,name:'浣忓缓',imgUrl:'/assets/linkageForces/浣忓缓.png'} + ] + ngOnInit(): void { + this.getAllFireForce() + window.onload = () => { + var mySwiper = new Swiper('.swiper-container', { + slidesPerView: 10,//姣忛〉鏄剧ず鐨勪釜鏁 + slidesPerGroup: 3,//鐐瑰嚮涓娆¢渶瑕佽烦澶氬皯娆 + // 濡傛灉闇瑕佸墠杩涘悗閫鎸夐挳 + navigation: { + nextEl: '.swiper-button-next', + prevEl: '.swiper-button-prev', + }, + }) + } + setTimeout(() => { + + this.createMap() + }, 0); + } + //鑾峰緱鎵鏈夎仈鍔ㄥ姏閲 + allLinkageForceObj:any//鑾峰緱鐨勬墍鏈夎仈鍔ㄥ姏閲 + dataLength:any //鑾峰彇鐨勬暟鎹竴鍏卞灏戞潯 + PageNumber:any = 1 //褰撳墠绗嚑椤 + getAllFireForce(){ + let MinIntegrity = 0 + let MaxIntegrity = 1.1 + if(this.searchForm.integrityNum == '0'){ + MinIntegrity = 0 + MaxIntegrity = 0.5 + }else if(this.searchForm.integrityNum == '1'){ + MinIntegrity = 0.5 + MaxIntegrity = 0.6 + }else if(this.searchForm.integrityNum == '2'){ + MinIntegrity = 0.6 + MaxIntegrity = 0.7 + }else if(this.searchForm.integrityNum == '3'){ + MinIntegrity = 0.7 + MaxIntegrity = 0.8 + }else if(this.searchForm.integrityNum == '4'){ + MinIntegrity = 0.8 + MaxIntegrity = 0.9 + }else if(this.searchForm.integrityNum == '5'){ + MinIntegrity = 0.9 + MaxIntegrity = 1.1 + }else if(this.searchForm.integrityNum == '-1'){ + MinIntegrity = 0 + MaxIntegrity = 1.1 + } + let params:any = { + Keyword : this.searchForm.name ? this.searchForm.name : '', + MinIntegrity : MinIntegrity, + MaxIntegrity : MaxIntegrity, + PageSize : 15, + PageNumber : this.PageNumber, + } + this.http.get('/api/LinkageForces',{params:params}).subscribe((data:any) => { + console.log('鎵鏈夋秷闃插姏閲忓垪琛',data) + this.dataLength = data.totalCount + this.allLinkageForceObj = data + }) + } + + + //閫夋嫨瑕佹樉绀虹殑鑱斿姩鍔涢噺 + selectedLinkageForce(item){ + this.isGisTopBox = false + if(this.LinkageForceDetailInfo.id != item.id){ + this.clearData() + this.LinkageForceDetailInfo = item + item.location?this.positionLngLat = item.location:null + this.AttachmentArr = JSON.parse(item.relevantInfomationData) + if(this.newPositionMarker){ + this.map.remove(this.newPositionMarker); + } + console.log('褰撳墠鐐瑰嚮鐨刲i',item) + if(item.location && item.location.x){//濡傛灉宸茬粡鏍囨敞鍗曚綅鍧愭爣 + console.log('寮濮嬫爣娉') + + this.map.setCenter([item.location.x,item.location.y]); + this.newPositionMarker = new AMap.Marker({ + position: [item.location.x,item.location.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }) + // 灏 markers 娣诲姞鍒板湴鍥 + this.map.add(this.newPositionMarker); + } + } + } + //鎼滅储 + searchList(){ + this.getAllFireForce() + } + //閲嶇疆鎼滅储 + reset(){ + this.searchForm = { + name:'', + integrityNum:'' + } + this.getAllFireForce() + } + //鍒嗛〉浜嬩欢 + chagePage(e){ + this.PageNumber = e.pageIndex+1 + this.getAllFireForce() + } + //js涔樻硶 + accMul(arg1,arg2,fix) { + if(!parseInt(fix)==fix) + { + return; + } + var m=0,s1=arg1.toString(),s2=arg2.toString(); + try{m+=s1.split(".")[1].length}catch(e){} + try{m+=s2.split(".")[1].length}catch(e){} + if(m>fix){ + return (Math.round(Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m-fix))/Math.pow(10,fix)); + }else if(m<=fix){ + return (Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)).toFixed(fix); + }else{ + return (arg1*arg2).toFixed(fix).toString(); + } + } + //瀹屾暣搴﹂鑹 + integrity(width){ + let _this = this + let style:any = {} + style.width = width +'%'; + if(width < 30){ + style.background = '#FF5D4A' + } + if(width >= 30 && width < 60){ + style.background = '#FFDD00' + } + if(width >= 60){ + style.background = '#5CD64E' + } + return style + } + //鍒犻櫎鏌愭潯鑱斿姩鍔涢噺 + deleteLinkageForc(item,e){ + e.stopPropagation() + let isDelete = window.confirm(`纭畾瑕佸垹闄${item.name}鍚梎) + if(isDelete){ + this.http.delete(`/api/LinkageForces/${item.id}`).subscribe(data => { + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鍒犻櫎鎴愬姛','纭畾',config); + if(item.id == this.LinkageForceDetailInfo.id){ + this.LinkageForceDetailInfo.linkageForceType = null + } + this.getAllFireForce() + }) + } + } + //褰撳墠鐐瑰嚮tab椤甸潰绗嚑涓 + tabIndex:any = 1 + selectedTab(index){ + this.tabIndex = index + } + + //鑱斿姩鍔涢噺璇︽儏鎻愪氦淇℃伅 + LinkageForceDetailInfo:any = { + // id:'',//缂栧彿 + linkageForceType:'', + name:'',//鍚嶇О + phoneNumber:'',//鑱旂郴鐢佃瘽 + faxNumber:'',//浼犵湡 + remark:'',//澶囨敞 + administrativeRegion:'',//琛屾斂鍖 + address:'',//鍦板潃 + location:{ + x:'', + y:'' + }, + contactName:'',//鑱旂郴浜哄鍚 + contactTitle:'',//鑱旂郴浜鸿亴鍔 + contactPhone:'',//鑱旂郴浜虹數璇 + serviceContent:'',//鏈嶅姟鍐呭 + resourceRemark:'',//璧勬簮璇存槑 + relevantInfomationData:[]//鐩稿叧璧勬枡 + } + + //娓呯┖琛ㄥ崟鏁版嵁 + clearData(){ + this.deletedFile = []//娓呯┖鐩稿叧璧勬枡宸插垹闄ょ紦瀛 + this.AttachmentArr = []//娓呯┖鐩稿叧璧勬枡 + this.positionLngLat = {x:'',y:''} + this.atLastPositionLngLat = {x:'',y:''} + this.LinkageForceDetailInfo = { + // id:'',//缂栧彿 + linkageForceType:'', + name:'',//鍚嶇О + phoneNumber:'',//鑱旂郴鐢佃瘽 + faxNumber:'',//浼犵湡 + remark:'',//澶囨敞 + administrativeRegion:'',//琛屾斂鍖 + address:'',//鍦板潃 + location:{ + x:'', + y:'' + }, + contactName:'',//鑱旂郴浜哄鍚 + contactTitle:'',//鑱旂郴浜鸿亴鍔 + contactPhone:'',//鑱旂郴浜虹數璇 + serviceContent:'',//鏈嶅姟鍐呭 + resourceRemark:'',//璧勬簮璇存槑 + relevantInfomationData:[]//鐩稿叧璧勬枡 + } + } + //鏂板鑱斿姩鍔涢噺 + selectedFireForceTypeIndex:any//鏂板娑堥槻鍔涢噺鍚嶇О + addLinkageForce(){ + const dialogRef = this.dialog.open(AddLinkageForce, { + data: {}, + id:'addLinkageForce' + }); + dialogRef.afterClosed().subscribe( + data=>{ + if(typeof data === 'number' && !isNaN(data)){ + this.clearData() + console.log('娓呯┖浜',this.LinkageForceDetailInfo) + this.LinkageForceDetailInfo.linkageForceType = data + this.newPositionMarker ? this.map.remove(this.newPositionMarker) : null + this.map.setCity('涓婃捣甯'); + + } + } + ) + } + //淇濆瓨 + save(){ + if(!this.LinkageForceDetailInfo.name){ + alert('鍚嶇О蹇呭~') + return + } + this.isMasklayer = true + //鍒犻櫎涓涓嬫暟鎹簱鐨勬枃浠 + if(this.deletedFile.length != 0){ + this.deletedFile.forEach(item => { + this.http.delete(`/api/Objects/PlanPlatform/${item.objectName}`).subscribe(data=>{ + console.log('鍒犻櫎鍘熸枃浠舵垚鍔') + }) + }); + } + + this.LinkageForceDetailInfo.location = {x:'',y:''} + this.LinkageForceDetailInfo.RelevantInfomationData = JSON.stringify(this.AttachmentArr) + if(this.atLastPositionLngLat.x){ + this.LinkageForceDetailInfo.location.x = this.atLastPositionLngLat.x + this.LinkageForceDetailInfo.location.y = this.atLastPositionLngLat.y + }else{ + this.LinkageForceDetailInfo.location = null + } + this.LinkageForceDetailInfo.relevantInfomationData = JSON.stringify(this.LinkageForceDetailInfo.relevantInfomationData) + let body = this.LinkageForceDetailInfo + if(this.LinkageForceDetailInfo.id){ + this.http.put(`/api/LinkageForces/${this.LinkageForceDetailInfo.id}`,body).subscribe((data:any) =>{ + console.log('淇敼鎴愬姛',data) + this.isMasklayer = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇敼鎴愬姛','纭畾',config); + // this.LinkageForceDetailInfo.id = data.id + this.getAllFireForce() + + }) + }else{ + this.http.post('/api/LinkageForces',body).subscribe((data:any) =>{ + console.log('鍒涘缓鎴愬姛',data) + this.isMasklayer = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('淇濆瓨鎴愬姛','纭畾',config); + this.LinkageForceDetailInfo = data + this.getAllFireForce() + }) + } + + + } + + map:any + placeSearch:any//鏋勯犲湴鐐规煡璇㈢被 + isMapLabel:boolean = false //鏄惁宸茬粡鏍囪鍧愭爣 + newPositionMarkerContent:any = + '
' + + ' ' + + '
' + newPositionMarkerContentBtn:any = + '
' + + ' ' + + '
|
' + + '
' + //鍒涘缓鍦板浘 + newPositionMarker:any//鍧愭爣瀹炰緥 + createMap(){ + this.map = new AMap.Map('container', { + zoom:12 + }) + this.map.setCity('涓婃捣甯'); + //杈撳叆鎻愮ず + var autoOptions = { + input: "tipinput" + }; + AMap.plugin(['AMap.PlaceSearch','AMap.AutoComplete'], ()=>{ + let auto = new AMap.AutoComplete(autoOptions); + this.placeSearch = new AMap.PlaceSearch(); //鏋勯犲湴鐐规煡璇㈢被 + auto.on("select", (e)=>{ + this.newPositionMarker.setPosition([e.poi.location.lng,e.poi.location.lat]) + this.positionLngLat = {x: e.poi.location.lng, y: e.poi.location.lat} + this.map.setCenter([e.poi.location.lng,e.poi.location.lat]); //璁剧疆鍦板浘涓績鐐 + });//娉ㄥ唽鐩戝惉锛屽綋閫変腑鏌愭潯璁板綍鏃朵細瑙﹀彂 + + }); + + if(this.isMapLabel){//濡傛灉宸茬粡鏍囨敞鍗曚綅鍧愭爣 + console.log('宸叉爣娉ㄥ崟浣嶄綅缃') + // this.map.setCenter([this.unitinfo.location.x,this.unitinfo.location.y]); + // this.oldPositionMarker = new AMap.Marker({ + // position: [this.unitinfo.location.x,this.unitinfo.location.y], + // content: this.newPositionMarkerContent, + // offset: new AMap.Pixel(-15, -18) + // }) + // // 灏 markers 娣诲姞鍒板湴鍥 + // this.map.add(this.oldPositionMarker); + }else{ + console.log('鏈爣娉ㄥ崟浣嶄綅缃') + // this.map.setCity('涓婃捣甯'); + } + } + //鐐瑰嚮浣嶇疆 + isGisTopBox:boolean = false // + searchTitle:any = ''// + + positionLngLat:any = {x:'',y:''}//涓存椂鍧愭爣鐐 + atLastPositionLngLat:any = {x:'',y:''}//鏈缁堝潗鏍囩偣 + setPosition(){ + if(!this.isGisTopBox){ + this.isGisTopBox = true + this.newPositionMarker ? this.map.remove(this.newPositionMarker) : null + let center + console.log(789,this.atLastPositionLngLat) + if(this.newPositionMarker && this.atLastPositionLngLat.x){//濡傛灉宸茬粡鏍囨敞鍗曚綅鍧愭爣 + console.log(1) + center = [this.atLastPositionLngLat.x, this.atLastPositionLngLat.y] + }else if(this.newPositionMarker && !this.atLastPositionLngLat.x && this.LinkageForceDetailInfo.location && this.LinkageForceDetailInfo.location.x){ + console.log(2) + center = [this.LinkageForceDetailInfo.location.x, this.LinkageForceDetailInfo.location.y] + }else{ + console.log(3) + center = this.map.getCenter(); //鑾峰彇褰撳墠鍦板浘涓績浣嶇疆 + } + this.newPositionMarker = new AMap.Marker({ + draggable: true, + position: center, + content: this.newPositionMarkerContentBtn, + offset: new AMap.Pixel(-15, -18) + }); + this.positionLngLat = {x: center.lng || center[0], y: center.lat || center[1]} + this.map.add(this.newPositionMarker); + this.isMapLabel = true + this.newPositionMarker.on('dragend', (e)=>{ + this.positionLngLat = {x: e.lnglat.lng, y: e.lnglat.lat} + }) + //鐐瑰嚮纭畾 + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'click',(event)=>{ + this.isGisTopBox = false + this.map.remove(this.newPositionMarker) + this.newPositionMarker = new AMap.Marker({ + position: [this.positionLngLat.x,this.positionLngLat.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }); + this.atLastPositionLngLat = JSON.parse(JSON.stringify(this.positionLngLat)) + this.map.add(this.newPositionMarker); + this.positionLngLat = this.atLastPositionLngLat + }) + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionClose'),'click',(event)=>{ + this.isGisTopBox = false + this.map.remove(this.newPositionMarker) + if(this.positionLngLat.x && this.positionLngLat.x != 0 && !this.atLastPositionLngLat.x){//鐩存帴鍙栨秷 + this.map.remove(this.newPositionMarker) + this.positionLngLat = {} + this.atLastPositionLngLat = {} + }else{ + this.newPositionMarker = new AMap.Marker({ + position: [this.atLastPositionLngLat.x,this.atLastPositionLngLat.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }); + this.map.setCenter([this.atLastPositionLngLat.x,this.atLastPositionLngLat.y]); //璁剧疆鍦板浘涓績鐐 + this.map.add(this.newPositionMarker); + this.positionLngLat = this.atLastPositionLngLat + } + })//鍙栨秷 + } + + } + + + + + //涓婁紶闄勪欢 + file:any; //涓婁紶鐨勬枃浠 + AttachmentArr:any = []//涓婁紶闄勪欢鍦板潃闆嗗悎 + uploadId:any//鍒嗗潡涓婁紶id + objectName:any + progressBarValue:any = 0//鍒嗗潡涓婁紶杩涘害 + isMasklayer:boolean = false//鍦嗗湀閬僵灞傛槸鍚︽墦寮 + isMasklayerUploading:boolean = false//涓婁紶杩涘害鏉¢伄缃╁眰鏄惁鎵撳紑 + isMasklayerDownload:boolean = false//涓嬭浇杩涘害鏉¢伄缃╁眰鏄惁鎵撳紑 + uploadAttachment(e){ + console.log('閫夋嫨鐨勬枃浠',e) + this.file = e.target.files[0] || null //涓婁紶鐨勬枃浠 + let file = e.target.files[0] || null //鑾峰彇涓婁紶鐨勬枃浠 + let fileSize = file.size || null //涓婁紶鏂囦欢鐨勬诲ぇ灏 + let shardSize = 5 * 1024 * 1024 //5MB涓涓垎鐗 + + if (file && fileSize<=shardSize) { //涓婁紶鏂囦欢<=5MB鏃 + this.isMasklayer = true + console.log('file',this.file) + let formData = new FormData() + formData.append("file",file) + //this.selectedFireForce.id 閫夋嫨鐨勭粍缁囨満鏋勭殑id + this.http.post(`/api/Objects/PlanPlatform/LinkageForce/${this.LinkageForceDetailInfo.id}`,formData).subscribe((data:any)=>{ + // this.objectName = data.objectName + let obj = { + objectName:data.objectName, + fileName:data.fileName, + fileLength:data.fileLength + } + this.AttachmentArr.push(obj) + this.isMasklayer = false + console.log('涓婁紶鎴愬姛',data) + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('涓婁紶鎴愬姛','纭畾',config); + }) + } else if (file && fileSize>shardSize) { //涓婁紶鏂囦欢>5MB鏃,鍒嗗潡涓婁紶 + this.isMasklayerUploading = true + let data = {filename: file.name} + this.http.post(`/api/NewMultipartUpload/PlanPlatform/LinkageForce/${this.LinkageForceDetailInfo.id}`,{},{params:data}).subscribe((data:any)=>{ //鍒濆鍖栧垎娈典笂浼 + console.log('鍒濆鍖栧垎鍧椾笂浼犳垚鍔',data) + this.objectName = data.objectName + this.uploadId = data.uploadId + this.subsectionUploading() + }) + } + } + PartNumberETag:any=[]; //姣忔杩斿洖闇瑕佷繚瀛樼殑淇℃伅 + + //寮濮嬪垎娈典笂浼 + async subsectionUploading () { + let file = this.file || null //鑾峰彇涓婁紶鐨勬枃浠 + let fileSize = file.size || null //涓婁紶鏂囦欢鐨勬诲ぇ灏 + let shardSize = 5 * 1024 * 1024 //5MB涓涓垎鐗 + let allSlice = Math.ceil(fileSize / shardSize) //鎬绘枃浠/5MB===鍏卞垎澶氬皯娈 + for (let i = 0;i < allSlice;i++) { //寰幆鍒嗘涓婁紶 + let start = i * shardSize //鍒囧壊鏂囦欢寮濮嬩綅缃 + let end = Math.min(fileSize, start + shardSize); //鍒囧壊鏂囦欢缁撴潫浣嶇疆 + let formData = new FormData() + formData.append("file",file.slice(start, end)) + + //鍚屾鍐欐硶瀹炵幇寮傛璋冪敤 + let result = await new Promise((resolve, reject) => { + // await 闇瑕佸悗闈㈣繑鍥炰竴涓 promise 瀵硅薄 + this.http.post(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}&partNumber=${i+1}`,formData).subscribe((data:any)=>{ + let msg = { + "partNumber":data.partNumber || null, + "eTag": data.eTag || null} + resolve(msg) // 璋冪敤 promise 鍐呯疆鏂规硶澶勭悊鎴愬姛 + }) + }); + this.PartNumberETag.push(result) + // this.progressBarValue = Number((i/allSlice).toFixed(2))*100 + this.progressBarValue = this.accMul(Number((i/allSlice).toFixed(2))*100,1,0) + if (this.PartNumberETag.length === allSlice) { + this.progressBarValue = 100 + this.endUploading()} + }//for寰幆 + + } + + //瀹屾垚鍒嗗潡涓婁紶 + endUploading () { + let data = this.PartNumberETag + let paramsData = {uploadId:this.uploadId} + this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${this.objectName}`,data,{params:paramsData}).subscribe(data=>{ + this.PartNumberETag =[] //娓呯┖淇濆瓨杩斿洖鐨勪俊鎭 + let obj = { + objectName:this.objectName, + fileName:this.file.name, + fileLength:this.file.size + } + this.AttachmentArr.push(obj) + this.isMasklayerUploading = false//鍏抽棴杩涘害鏉¢伄缃╁眰 + this.progressBarValue = 0//閲嶇疆杩涘害鏁 + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('涓婁紶鎴愬姛','纭畾',config); + }) + } + //鍙栨秷鍒嗗潡涓婁紶 + cancelUploading() { + this.http.delete(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}`).subscribe(data=>{ + this.progressBarValue = 0; + this.isMasklayerUploading= false + this.PartNumberETag =[] //娓呯┖淇濆瓨杩斿洖鐨勪俊鎭 + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鍙栨秷涓婁紶鎴愬姛','纭畾',config); + }) + } + + //涓嬭浇 + download (e) { + this.isMasklayerDownload = true //寮鍚笅杞借繘搴︽潯 + let file = e //浼犻掕繃鏉ョ殑鏂囦欢鍏冩暟鎹 + let fileSize = file.fileLength //涓嬭浇鏂囦欢鐨勬诲ぇ灏 + let shardSize = 3 * 1024 * 1024 //鏂囦欢澶у皬鏄惁澶т簬10MB + if (file && fileSize<=shardSize) { //<=3MB鏃剁洿鎺ヤ笅杞 + this.progressBarValue = 60 + this.http.get(`/api/Objects/PlanPlatform/${e.objectName}`,{responseType: 'blob'},).subscribe(data=>{ + let url = window.URL.createObjectURL(new Blob([data])); //createObjectURL鍒涘缓涓涓笅杞紹lob鐨剈rl鍦板潃 + let link = document.createElement("a"); + link.style.display = "none"; + link.href = url; + let fileName = e.fileName ? e.fileName : e.objectName.split('/')[e.objectName.split('/').length-1] + link.setAttribute("download", fileName); + document.body.appendChild(link); + link.click(); + this.isMasklayerDownload = false //鍏抽棴涓嬭浇杩涘害鏉 + this.progressBarValue = 0 //鍒濆鍖栬繘搴︽潯 + }) + } else if (file && fileSize>shardSize) { //>3MB鏃跺垎鍧椾笅杞 + this.blockingDownload(e) //鍒嗘涓嬭浇 + } + + } + + //鍒嗘涓嬭浇骞跺悎骞 + async blockingDownload (e) { + let file = e //浼犻掕繃鏉ョ殑鏂囦欢鍏冩暟鎹 + let fileSize = file.fileLength //涓嬭浇鏂囦欢鐨勬诲ぇ灏 + let shardSize = 3 * 1024 * 1024 //3MB涓涓垎鐗 + let allSlice = Math.ceil(fileSize / shardSize) //鎬绘枃浠/3MB===鍏卞垎澶氬皯娈 + let allFile:any = [] //鎵鏈夌殑file鍒嗘 + + for (let i=0;i{ + this.http.get(`/api/Objects/PlanPlatform/${e.objectName}`,{headers:{'range':`bytes= ${start}-${end}`},responseType:'blob'}).subscribe(data=>{ + result(data) }) + }) + allFile.push(result) + // this.progressBarValue = Number((i/allSlice).toFixed(2))*100 //鏂囦欢杩涘害鏁 + this.progressBarValue = this.accMul(Number((i/allSlice).toFixed(2))*100,1,0) + if (allFile.length === allSlice) { //鍚堝苟鏂囦欢杈撳嚭缁欐祻瑙堝櫒 + let url = window.URL.createObjectURL(new Blob(allFile)); //createObjectURL鍒涘缓涓涓笅杞紹lob鐨剈rl鍦板潃 + let link = document.createElement("a"); + link.style.display = "none"; + link.href = url; + let fileName = e.fileName ? e.fileName : e.objectName.split('/')[e.objectName.split('/').length-1] + link.setAttribute("download", fileName); + document.body.appendChild(link); + link.click(); + this.isMasklayerDownload = false //鍏抽棴涓嬭浇杩涘害鏉 + this.progressBarValue = 0 //鍒濆鍖栬繘搴︽潯 + } + + } //for寰幆缁撴潫 + + } + + //鍒犻櫎鍥剧墖 + deletedFile:any = [] + deleteFile(item,e){ + console.log(this.AttachmentArr) + e.stopPropagation() + let isTrue = window.confirm('纭畾瑕佸垹闄よ鏂囦欢鍚楋紵') + if(isTrue){ + let index + this.AttachmentArr.forEach((element,key) => { + if(element.objectName == item.objectName){ + index = key + } + }); + this.AttachmentArr.splice(index,1) + this.deletedFile.push(item) + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鍒犻櫎鎴愬姛','纭畾',config); + } + } + + //鐐瑰嚮鏂囦欢 + clickFile(item){ + console.log(item) + let suffix = item.fileName.split('.')[item.fileName.split('.').length-1] + if(suffix == 'png' || suffix == 'jpg' || suffix == 'JPG'){ + console.log('杩欐槸鍥剧墖') + let dom = document.getElementById(`viewerjs`) + let pObjs = dom.childNodes; + let node = document.createElement("img") + node.style.display = "none"; + node.src = "/api/Objects/PlanPlatform/" + item.objectName; + node.id = 'img' + dom.appendChild(node) + setTimeout(() => { + let viewer = new Viewer(document.getElementById(`viewerjs`), { + hidden:()=>{ + dom.removeChild(pObjs[0]); + viewer.destroy(); + } + }); + node.click(); + }, 0); + } + if(suffix == 'docx' || suffix == 'doc' || suffix == 'pdf'){ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('鏆備笉鏀寔鏌ョ湅','纭畾',config); + } + if(suffix == 'mp4'){ + const dialogRef = this.dialog.open(ViewDetails2, {//璋冪敤open鏂规硶鎵撳紑瀵硅瘽妗嗗苟涓旀惡甯﹀弬鏁拌繃鍘 + data: {item:item,type:"video"}, + id:'videodialog2' + }); + dialogRef.afterClosed().subscribe(); + } + } + +} + + + + +//鏂板鑱斿姩鍔涢噺寮瑰嚭妗 +@Component({ + selector: 'AddLinkageForce', + templateUrl: './addLinkageForce.html', + styleUrls: ['./linkage-forces.component.scss'] +}) +export class AddLinkageForce { + + constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {} + + + addList:any = [ + {id:0,name:'瀹夌洃',imgUrl:'/assets/linkageForces/瀹夌洃.png'}, + {id:1,name:'鐢靛姏灞',imgUrl:'/assets/linkageForces/鐢靛姏灞.png'}, + {id:2,name:'鍏畨',imgUrl:'/assets/linkageForces/鍏畨.png'}, + {id:3,name:'娴蜂簨',imgUrl:'/assets/linkageForces/娴蜂簨.png'}, + {id:4,name:'鐜繚灞',imgUrl:'/assets/linkageForces/鐜繚灞.png'}, + {id:5,name:'浜ら',imgUrl:'/assets/linkageForces/浜ら.png'}, + {id:6,name:'姘戞斂',imgUrl:'/assets/linkageForces/姘戞斂.png'}, + {id:7,name:'姘旇薄灞',imgUrl:'/assets/linkageForces/姘旇薄灞.png'}, + {id:8,name:'鐕冩皵灞',imgUrl:'/assets/linkageForces/鐕冩皵灞.png'}, + {id:9,name:'甯傛斂',imgUrl:'/assets/linkageForces/甯傛斂.png'}, + {id:10,name:'姘村埄',imgUrl:'/assets/linkageForces/姘村埄.png'}, + {id:11,name:'閫氫俊',imgUrl:'/assets/linkageForces/閫氫俊.png'}, + {id:12,name:'鍖荤枟',imgUrl:'/assets/linkageForces/鍖荤枟.png'}, + {id:13,name:'搴旀ョ鐞',imgUrl:'/assets/linkageForces/搴旀ョ鐞.png'}, + {id:14,name:'浣忓缓',imgUrl:'/assets/linkageForces/浣忓缓.png'} + ] + selectedFireForceTypeIndex:any = 0 + selecteAddType(item,key){ + this.selectedFireForceTypeIndex = item.id + + } ngOnInit(): void { + + } + + confirm(){ + this.dialogRef.close(this.selectedFireForceTypeIndex) } } + +//鏌ョ湅鍥剧墖澶у浘鍜岃棰 +@Component({ + selector: 'viewdetails', + templateUrl: './viewdetails.html', + styleUrls: ['./linkage-forces.component.scss'] +}) +export class ViewDetails2 { + // myControl = new FormControl(); + //娉ㄥ叆MatDialogRef锛屽彲浠ョ敤鏉ュ叧闂璇濇 + //瑕佽闂璇濇缁勪欢涓殑鏁版嵁锛屽繀椤讳娇鐢∕AT_DIALOG_DATA娉ㄥ叆浠ょ墝 + constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data) {} + Url:string + onNoClick(): void { + this.dialogRef.close(); + } + ngOnInit(): void { + this.Url = '/api/Objects/PlanPlatform/' + this.data.item.objectName + } + closeDialog(){ + this.dialogRef.close(); + } + +} \ No newline at end of file diff --git a/src/app/data-collection/linkage-forces/viewdetails.html b/src/app/data-collection/linkage-forces/viewdetails.html new file mode 100644 index 0000000..6d917bb --- /dev/null +++ b/src/app/data-collection/linkage-forces/viewdetails.html @@ -0,0 +1 @@ + diff --git a/src/app/data-collection/water-collection/water-collection.component.html b/src/app/data-collection/water-collection/water-collection.component.html index 542ed80..9fe492c 100644 --- a/src/app/data-collection/water-collection/water-collection.component.html +++ b/src/app/data-collection/water-collection/water-collection.component.html @@ -52,7 +52,7 @@
- +
diff --git a/src/app/data-collection/water-collection/water-collection.component.ts b/src/app/data-collection/water-collection/water-collection.component.ts index 17dd475..c88aa80 100644 --- a/src/app/data-collection/water-collection/water-collection.component.ts +++ b/src/app/data-collection/water-collection/water-collection.component.ts @@ -74,7 +74,7 @@ export class WaterCollectionComponent implements OnInit { } let params:any = { Keyword : this.searchForm.name, - PageSize : 30, + PageSize : 15, PageNumber : this.PageNumber, MinIntegrity : MinIntegrity, MaxIntegrity : MaxIntegrity diff --git a/src/app/gis-management/gis-labeling/gis-labeling.component.html b/src/app/gis-management/gis-labeling/gis-labeling.component.html index 331be05..60f2b04 100644 --- a/src/app/gis-management/gis-labeling/gis-labeling.component.html +++ b/src/app/gis-management/gis-labeling/gis-labeling.component.html @@ -114,6 +114,7 @@ 鏄剧ず鑼冨洿 : + diff --git a/src/app/gis-management/gis-labeling/gis-labeling.component.ts b/src/app/gis-management/gis-labeling/gis-labeling.component.ts index 819a3ff..d8d3330 100644 --- a/src/app/gis-management/gis-labeling/gis-labeling.component.ts +++ b/src/app/gis-management/gis-labeling/gis-labeling.component.ts @@ -27,28 +27,14 @@ export class GisLabelingComponent implements OnInit { {id:'0',name:'娑堢伀鏍',selected:false}, {id:'1',name:'娑堥槻姘存睜',selected:false}, {id:'2',name:'澶╃劧姘存簮',selected:false}, - // {id:'0',name:'鍗曚綅鍦颁笂娑堢伀鏍',selected:false}, - // {id:'0',name:'鍗曚綅鍦颁笅娑堢伀鏍',selected:false}, - // {id:'0',name:'甯傛斂鍦颁笂娑堢伀鏍',selected:false}, - // {id:'0',name:'娑堥槻姘存睜',selected:false}, - // {id:'0',name:'鏂瑰舰鍌ㄦ按姹',selected:false}, - // {id:'0',name:'钃勬按姹',selected:false}, - // {id:'0',name:'鍘熷瀷姘村',selected:false}, - // {id:'0',name:'姘村簱',selected:false}, - // {id:'0',name:'娑堥槻姘寸',selected:false}, - // {id:'0',name:'鐮佸ご',selected:false}, - // {id:'0',name:'娴锋磱',selected:false}, - // {id:'0',name:'娌虫祦',selected:false}, - // {id:'0',name:'婀栨硦',selected:false}, - // {id:'0',name:'娌熸笭',selected:false} - ] + ] keyUnitForm : FormGroup//gis鍙充笂瑙掗噸鐐瑰崟浣嶈〃鍗 watertForm : FormGroup//gis鍙充笂瑙掓按婧愯〃鍗 selectedUnitList:any = []//閫夋嫨鎻愪氦鐨勫崟浣 selectedWaterList:any = []//閫夋嫨鎻愪氦鐨勬按婧 - unitAreaDefault:any = '0'//榛樿鍗曚綅鑼冨洿 - waterAreaDefault:any = '0'//榛樿姘存簮鑼冨洿 + unitAreaDefault:any = '-1'//榛樿鍗曚綅鑼冨洿 + waterAreaDefault:any = '-1'//榛樿姘存簮鑼冨洿 //鑾峰緱鍗曚綅寰幆鍑烘潵鐨刢heckbox鍒楄〃锛坒ormControl瀹炰緥锛 get units():any{ return this.keyUnitForm.get('units') @@ -156,17 +142,19 @@ export class GisLabelingComponent implements OnInit { //閲嶇偣鍗曚綅鎻愪氦 ketUnitSubmit(value){ if(this.markers.length == 0){ - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('璇峰厛閫夋嫨涓涓崟浣','纭畾',config); + let paramsdata:any = { + PageSize:99999, + BuildingTypeIdList : this.selectedUnitList.length != 0 ? this.selectedUnitList : ['123'] + } + this.http.get("/api/Companies",{params:paramsdata}).subscribe((data:any) => { + this.createUnitMarker(data.items) + }) }else if(!this.mapPattern){ const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 this.snackBar.open('璇峰垏鎹2D妯″紡浣跨敤姝ゅ姛鑳','纭畾',config); }else{ - // console.log('鎻愪氦',this.selectedUnit) this.circle.setRadius(Number(this.unitAreaDefault)) this.circle.setCenter(this.markers[0]._position) this.circle.setMap(this.map) @@ -178,32 +166,43 @@ export class GisLabelingComponent implements OnInit { }else{ Distance = Math.abs(lnglat.offset(0, this.unitAreaDefault).lat - this.selectedUnit.location.y) } - - let paramsdata:any = { - Lon : this.selectedUnit.location.x, - Lat : this.selectedUnit.location.y, - Distance : Distance, - BuildingTypeIdList : this.selectedUnitList.length != 0 ? this.selectedUnitList : ['123'] - } - // console.log(666,paramsdata) - this.http.get("/api/Companies",{params:paramsdata}).subscribe((data:any) => { - data.items.forEach((i,index) => { - if(i.id == this.selectedUnit.id){ - data.items.splice(index,1) - } + if(this.unitAreaDefault == '-1'){//濡傛灉鍕鹃夊叏閮 + let paramsdata:any = { + PageSize:99999, + BuildingTypeIdList : this.selectedUnitList.length != 0 ? this.selectedUnitList : ['123'] + } + this.http.get("/api/Companies",{params:paramsdata}).subscribe((data:any) => { + data.items.forEach((i,index) => { + if(i.id == this.selectedUnit.id){ + data.items.splice(index,1) + } + }) + this.createUnitMarker(data.items) }) - this.createUnitMarker(data.items) - }) + }else{ + let paramsdata:any = { + PageSize:99999, + Lon : this.selectedUnit.location.x, + Lat : this.selectedUnit.location.y, + Distance : Distance, + BuildingTypeIdList : this.selectedUnitList.length != 0 ? this.selectedUnitList : ['123'] + } + this.http.get("/api/Companies",{params:paramsdata}).subscribe((data:any) => { + data.items.forEach((i,index) => { + if(i.id == this.selectedUnit.id){ + data.items.splice(index,1) + } + }) + this.createUnitMarker(data.items) + }) + } } } //鍒涘缓鍗曚綅markers - unitMarkerList:any = [] - unitlabelsLayer:any + unitCluster:any //閲嶇偣鍗曚綅鐐硅仛鍚堝疄渚 createUnitMarker(list){ - this.unitlabelsLayer ? this.map.remove(this.unitlabelsLayer) : null - this.unitMarkerList ? this.map.remove(this.unitMarkerList) : null - - let markerArr = [] + let unitMarkerArrcluster = [] + this.unitCluster ? this.unitCluster.setData([]) : null list.forEach((item) => { let image if(item.buildingTypes[0].name.indexOf('楂樺眰') != -1){ @@ -241,176 +240,262 @@ export class GisLabelingComponent implements OnInit { }else{ image = '/assets/images/鍏朵粬.png' } - var icon = { - // 鍥炬爣绫诲瀷锛岀幇闃舵鍙敮鎸 image 绫诲瀷 - type: 'image', - // 鍥剧墖 url - image: image, - // 鍥剧墖灏哄 - size: [32, 32], - // 鍥剧墖鐩稿 position 鐨勯敋鐐癸紝榛樿涓 bottom-center - anchor: 'center', - }; - var text = { - // 瑕佸睍绀虹殑鏂囧瓧鍐呭 - content: item.name, - // 鏂囧瓧鏂瑰悜锛屾湁 icon 鏃朵负鍥寸粫鏂囧瓧鐨勬柟鍚戯紝娌℃湁 icon 鏃讹紝鍒欎负鐩稿 position 鐨勪綅缃 - direction: 'bottom', - // 鍦 direction 鍩虹涓婄殑鍋忕Щ閲 - offset: [-3, -3], - // 鏂囧瓧鏍峰紡 - style: { - // 瀛椾綋澶у皬 - fontSize: 12, - // 瀛椾綋棰滆壊 - fillColor: '#22886f', - // 鎻忚竟棰滆壊 - strokeColor: '#fff', - // 鎻忚竟瀹藉害 - strokeWidth: 2, - } + // 鐢ㄤ簬鐐归泦鍚堢殑鏁扮粍 + unitMarkerArrcluster.push({ + lnglat : [item.location.x,item.location.y], + image : image, + data : item + }) + }) + this.map.plugin(["AMap.MarkerClusterer"],() => { + var gridSize = 60 + var count = unitMarkerArrcluster.length; + var _renderClusterMarker = function (context) { + var factor = Math.pow(context.count / count, 1 / 18); + var div = document.createElement('div'); + var Hue = 180 - factor * 180; + var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)'; + var fontColor = 'hsla(' + Hue + ',100%,90%,1)'; + var borderColor = 'hsla(' + Hue + ',100%,40%,1)'; + var shadowColor = 'hsla(' + Hue + ',100%,90%,1)'; + div.style.backgroundColor = bgColor; + var size = Math.round(30 + Math.pow(context.count / count, 1 / 5) * 20); + div.style.width = div.style.height = size + 'px'; + div.style.border = 'solid 1px ' + borderColor; + div.style.borderRadius = size / 2 + 'px'; + div.style.boxShadow = '0 0 5px ' + shadowColor; + div.innerHTML = context.count; + div.style.lineHeight = size + 'px'; + div.style.color = fontColor; + div.style.fontSize = '14px'; + div.style.textAlign = 'center'; + context.marker.setOffset(new AMap.Pixel(-size / 2, -size / 2)); + context.marker.setContent(div) }; - var labelMarker = new AMap.LabelMarker({ - name: item.name, // 姝ゅ睘鎬ч潪缁樺埗鏂囧瓧鍐呭锛屼粎鏈涓烘爣璇嗕娇鐢 - position: [item.location.x,item.location.y], - zIndex: 16, - // 灏嗙涓姝ュ垱寤虹殑 icon 瀵硅薄浼犵粰 icon 灞炴 - icon: icon, - // 灏嗙浜屾鍒涘缓鐨 text 瀵硅薄浼犵粰 text 灞炴 - text: text, - }); - labelMarker.on('click', (e)=>{ - // console.log(item) - let markerContent = - `
-
${item.name}
-
-
鍗曚綅鎬ц川:
-
娑堥槻璐熻矗浜:
-
-
-
闃茬伀绾у埆:
-
娑堥槻绠$悊浜:
-
-
-
闃茬伀绠¤緰:
-
闃茬伀鐩戠潱鍛:
-
-
-
璐d换闃熺珯:
-
鎬诲缓绛戦潰绉:
-
-
-
寤虹瓚淇℃伅鍒嗙被:
-
鎬诲崰鍦伴潰绉:
-
-
-
鍊肩彮鐢佃瘽:
-
-
-
鍩烘湰淇℃伅
-
瀵艰埅
-
鍏ㄦ櫙婕父
-
涓夌淮鍦烘櫙
-
鏌ョ湅棰勬
-
鍒嗕韩
-
-
` - // 鍒涘缓涓涓嚜瀹氫箟鍐呭鐨 infowindow 瀹炰緥 - this.infoWindow = new AMap.InfoWindow({ - position: [item.location.x,item.location.y], - offset: new AMap.Pixel(0, -30), - content: markerContent, - }); - this.infoWindow.open(this.map); - this.renderer2.listen(this.elementRef.nativeElement.querySelector('#baseInformation'),'click',(event)=>{ this.baseInformation(item) })//鍩烘湰淇℃伅鐐瑰嚮浜嬩欢 - this.renderer2.listen(this.elementRef.nativeElement.querySelector('#route'),'click',(event)=>{ this.route(item) })//瀵艰埅鐐瑰嚮浜嬩欢 - this.renderer2.listen(this.elementRef.nativeElement.querySelector('#fullViewNavigation'),'click',(event)=>{ this.fullViewNavigation(item) })//鍏ㄦ櫙婕父鐐瑰嚮浜嬩欢 - this.renderer2.listen(this.elementRef.nativeElement.querySelector('#threeeScene'),'click',(event)=>{ this.threeeScene(item) })//涓夌淮鍦烘櫙鐐瑰嚮浜嬩欢 - this.renderer2.listen(this.elementRef.nativeElement.querySelector('#seePlan'),'click',(event)=>{ this.seePlan(item) })//鏌ョ湅棰勬鐐瑰嚮浜嬩欢 - this.renderer2.listen(this.elementRef.nativeElement.querySelector('#share'),'click',(event)=>{ this.share(item) })//鍒嗕韩鐐瑰嚮浜嬩欢 + var _renderMarker = (context)=> { + var content = ``; + var offset = new AMap.Pixel(-15, -25); + context.marker.setContent(content) + context.marker.setOffset(offset) + } + this.unitCluster = new AMap.MarkerCluster(this.map, unitMarkerArrcluster, { + gridSize: gridSize, // 璁剧疆缃戞牸鍍忕礌澶у皬 + renderClusterMarker: _renderClusterMarker, // 鑷畾涔夎仛鍚堢偣鏍峰紡 + renderMarker: _renderMarker, // 鑷畾涔夐潪鑱氬悎鐐规牱寮 }); - markerArr.push(labelMarker) - }) - this.unitlabelsLayer = new AMap.LabelsLayer({ - zooms: [3, 20], - zIndex: 1000, - // 璇ュ眰鍐呮爣娉ㄦ槸鍚﹂伩璁 - collision: false, - // 璁剧疆 allowCollision锛歵rue锛屽彲浠ヨ鏍囨敞閬胯鐢ㄦ埛鐨勬爣娉 - // allowCollision: true, + this.unitCluster.on('click',(e)=>{ + if(e.clusterData.length == 1){ + let item = e.clusterData[0].data + let markerContent = + `
+
${item.name}
+
+
鍗曚綅鎬ц川:
+
娑堥槻璐熻矗浜:
+
+
+
闃茬伀绾у埆:
+
娑堥槻绠$悊浜:
+
+
+
闃茬伀绠¤緰:
+
闃茬伀鐩戠潱鍛:
+
+
+
璐d换闃熺珯:
+
鎬诲缓绛戦潰绉:
+
+
+
寤虹瓚淇℃伅鍒嗙被:
+
鎬诲崰鍦伴潰绉:
+
+
+
鍊肩彮鐢佃瘽:
+
+
+
鍩烘湰淇℃伅
+
瀵艰埅
+
鍏ㄦ櫙婕父
+
涓夌淮鍦烘櫙
+
鏌ョ湅棰勬
+
鍒嗕韩
+
+
` + // 鍒涘缓涓涓嚜瀹氫箟鍐呭鐨 infowindow 瀹炰緥 + this.infoWindow = new AMap.InfoWindow({ + position: [item.location.x,item.location.y], + offset: new AMap.Pixel(0, -30), + content: markerContent, + }); + this.infoWindow.open(this.map); + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#baseInformation'),'click',(event)=>{ this.baseInformation(item) })//鍩烘湰淇℃伅鐐瑰嚮浜嬩欢 + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#route'),'click',(event)=>{ this.route(item) })//瀵艰埅鐐瑰嚮浜嬩欢 + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#fullViewNavigation'),'click',(event)=>{ this.fullViewNavigation(item) })//鍏ㄦ櫙婕父鐐瑰嚮浜嬩欢 + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#threeeScene'),'click',(event)=>{ this.threeeScene(item) })//涓夌淮鍦烘櫙鐐瑰嚮浜嬩欢 + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#seePlan'),'click',(event)=>{ this.seePlan(item) })//鏌ョ湅棰勬鐐瑰嚮浜嬩欢 + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#share'),'click',(event)=>{ this.share(item) })//鍒嗕韩鐐瑰嚮浜嬩欢 + } + }) }); - this.unitlabelsLayer.add(markerArr); - this.map.add(this.unitlabelsLayer);//澧炲姞鍥惧眰 - - this.unitMarkerList = markerArr - this.map.add(this.unitMarkerList);//灏唌arkers娣诲姞鍒板浘灞備笂 + } - //鍙栨秷鍗曚綅markers - clearUnitMarker(){ - this.map.remove(this.unitlabelsLayer) - this.map.remove(this.unitMarkerList); + //鍙栨秷鏄剧ず鍗曚綅 + resetUnit(){ + this.keyUnitForm.reset() + this.keyUnitForm.controls.areaUnit.setValue('-1') + this.map.remove(this.circle) + this.unitCluster.setData([]) } - //姘存簮鎻愪氦 waterSubmit(value){ if(this.markers.length == 0){ - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('璇峰厛閫夋嫨涓涓崟浣','纭畾',config); + if(this.selectedWaterList.length != 0){//鍕鹃変簡姘存簮绫诲瀷 + let paramsdata:any = { + PageSize:99999, + WaterSourceTypes : this.selectedWaterList + } + this.http.get("/api/WaterSources",{params:paramsdata}).subscribe((data:any) => { + console.log('鎵鏈夋按婧',data) + this.createwaterMarker(data.items) + }) + }else{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('璇峰嬀閫夋兂瑕佹樉绀虹殑姘存簮绫诲瀷','纭畾',config); + } }else if(!this.mapPattern){ const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 this.snackBar.open('璇峰垏鎹2D妯″紡浣跨敤姝ゅ姛鑳','纭畾',config); }else{ - this.createwaterMarker() this.circleofwater.setRadius(Number(this.waterAreaDefault)) this.circleofwater.setCenter(this.markers[0]._position) this.circleofwater.setMap(this.map) + let Distance + let lnglat = new AMap.LngLat(this.selectedUnit.location.x, this.selectedUnit.location.y) // lng, lat 鏇挎崲鎴愪紶鍏ョ殑鍧愭爣 + + //濡傛灉閫夋嫨褰撳墠鐨勮閲庤寖鍥寸畻鍑烘煡璇㈠崐寰 if(this.waterAreaDefault == '0'){ this.circleofwater.setRadius(this.Calculationofdistance(this.map.getBounds())/2) + Distance = Math.abs(lnglat.offset(0, this.Calculationofdistance(this.map.getBounds())/2).lat - this.selectedUnit.location.y) + }else{ + Distance = Math.abs(lnglat.offset(0, this.waterAreaDefault).lat - this.selectedUnit.location.y) + } + //濡傛灉閫夋嫨鍏ㄩ儴 + if(this.waterAreaDefault == '-1'){ + if(this.selectedWaterList.length != 0){ + let paramsdata:any = { + PageSize:99999, + WaterSourceTypes : this.selectedWaterList + } + this.http.get("/api/WaterSources",{params:paramsdata}).subscribe((data:any) => { + console.log('鎵鏈夋按婧',data) + this.createwaterMarker(data.items) + }) + }else{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('璇峰嬀閫夋兂瑕佹樉绀虹殑姘存簮绫诲瀷','纭畾',config); + } + + }else{ + if(this.selectedWaterList.length != 0){ + let paramsdata:any = { + PageSize:99999, + Lon : this.selectedUnit.location.x, + Lat : this.selectedUnit.location.y, + Distance : Distance, + WaterSourceTypes :this.selectedWaterList + } + this.http.get("/api/WaterSources",{params:paramsdata}).subscribe((data:any) => { + console.log('鎵鏈夋按婧',data) + this.createwaterMarker(data.items) + }) + }else{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('璇峰嬀閫夋兂瑕佹樉绀虹殑姘存簮绫诲瀷','纭畾',config); + } } } } - waterIconList = []; //灞曠ず鐨勬按婧愬浘鏍 + //鍙栨秷鏄剧ず姘存簮 + resetWater(){ + this.watertForm.reset() + + this.watertForm.controls.areaWater.setValue('-1') + + this.map.remove(this.circleofwater) + this.waterCluster.setData([]) + } //寰幆娓叉煋鍑烘墍鏈夋按婧恗arkers - createwaterMarker(){ - this.waterIconList.forEach((element,index) => { this.map.remove(element) }); //鍏堝垹闄ゆ墍鏈夋爣鐐 - this.waterIconList = [] - let waterType = this.selectedWaterList //绛涢夊嚭灞曠ず鐨 姘存簮绫诲瀷 - if (waterType.length) { - let x = JSON.parse( JSON.stringify(this.markers[0]._position[0]) ) //涓績鏍囨敞鐨 鍧愭爣 - let y = JSON.parse( JSON.stringify(this.markers[0]._position[1]) ) //涓績鏍囨敞鐨 鍧愭爣 - let positonList = [0.015, -0.035, 0.045, 0.061, -0.013, 0.029] - // 鍒涘缓涓涓 Icon - let startIcon = new AMap.Icon({ - image: '../../../assets/images/fireHydrant.png', - imageSize: new AMap.Size(20, 20), - }); - positonList.forEach((item,index)=>{ - let marker = new AMap.Marker({ - map: this.map, - position: index%2==0? JSON.parse( JSON.stringify([x+item,y-item]) ) : JSON.parse( JSON.stringify([x-item,y+item]) ), - icon: startIcon, - }); - this.waterIconList.push(marker) + waterCluster:any //姘存簮鑱氬悎瀹炰緥 + createwaterMarker(list){ + let waterMarkerArrcluster = [] + this.waterCluster ? this.waterCluster.setData([]) : null + list.forEach((item) => { + let image + if(item.waterSourceType == 0){//娑堢伀鏍 + image = '/assets/images/甯傛斂娑堢伀鏍.png' + }else if(item.waterSourceType == 1){//娑堥槻姘存睜 + image = '/assets/images/鏂瑰舰鍌ㄦ按姹.png' + }else if(item.waterSourceType == 2){//澶╃劧姘存簮 + image = '/assets/images/澶╃劧姘存簮.png' + } + // 鐢ㄤ簬鐐归泦鍚堢殑鏁扮粍 + waterMarkerArrcluster.push({ + lnglat : [item.location.x,item.location.y], + image : image, + data : item }) - positonList.forEach((item,index)=>{ - let marker = new AMap.Marker({ - map: this.map, - position: index%2==0? JSON.parse( JSON.stringify([x+item,y+item]) ) : JSON.parse( JSON.stringify([x-item,y-item]) ), - icon: startIcon, - }); - this.waterIconList.push(marker) + }) + this.map.plugin(["AMap.MarkerClusterer"],() => { + var gridSize = 60 + var count = waterMarkerArrcluster.length; + var _renderClusterMarker = function (context) { + var factor = Math.pow(context.count / count, 1 / 18); + var div = document.createElement('div'); + var Hue = 180 - factor * 180; + var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)'; + var fontColor = 'hsla(' + Hue + ',100%,90%,1)'; + var borderColor = 'hsla(' + Hue + ',100%,40%,1)'; + var shadowColor = 'hsla(' + Hue + ',100%,90%,1)'; + div.style.backgroundColor = bgColor; + var size = Math.round(30 + Math.pow(context.count / count, 1 / 5) * 20); + div.style.width = div.style.height = size + 'px'; + div.style.border = 'solid 1px ' + borderColor; + div.style.borderRadius = size / 2 + 'px'; + div.style.boxShadow = '0 0 5px ' + shadowColor; + div.innerHTML = context.count; + div.style.lineHeight = size + 'px'; + div.style.color = fontColor; + div.style.fontSize = '14px'; + div.style.textAlign = 'center'; + context.marker.setOffset(new AMap.Pixel(-size / 2, -size / 2)); + context.marker.setContent(div) + }; + var _renderMarker = (context)=> { + var content = ``; + var offset = new AMap.Pixel(-15, -25); + context.marker.setContent(content) + context.marker.setOffset(offset) + } + this.waterCluster = new AMap.MarkerCluster(this.map, waterMarkerArrcluster, { + gridSize: gridSize, // 璁剧疆缃戞牸鍍忕礌澶у皬 + renderClusterMarker: _renderClusterMarker, // 鑷畾涔夎仛鍚堢偣鏍峰紡 + renderMarker: _renderMarker, // 鑷畾涔夐潪鑱氬悎鐐规牱寮 + }); + this.waterCluster.on('click',(e)=>{ + if(e.clusterData.length == 1){ + + } }) - } else { - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('璇烽夋嫨姘存簮绫诲瀷','纭畾',config); - } + }); + } //璁$畻涓ゅ湴璺濈 @@ -442,24 +527,9 @@ export class GisLabelingComponent implements OnInit { } } - //鍙栨秷鏄剧ず鍗曚綅 - resetUnit(){ - this.keyUnitForm.reset() - this.keyUnitForm.controls.areaUnit.setValue('0') - this.map.remove(this.circle) - this.clearUnitMarker()//鍙栨秷鏄剧ず鍗曚綅markers - // console.log('鍙栨秷') - } - //鍙栨秷鏄剧ず姘存簮 - resetWater(){ - this.waterIconList.forEach((element,index) => { this.map.remove(element) }); //鍏堝垹闄ゆ墍鏈夋爣鐐 - this.waterIconList = [] - this.watertForm.reset() - this.watertForm.controls.areaWater.setValue('0') - this.map.remove(this.circleofwater) - // console.log('鍙栨秷') - } + + //鍙充笂瑙掔偣鍑绘瘡涓涓猼itle clickTitle(index){ @@ -482,15 +552,6 @@ export class GisLabelingComponent implements OnInit { loadChange(e){ e.checked ? this.map.add(this.roadNetLayer) : this.map.remove(this.roadNetLayer); } - // floorLayer = new AMap.Buildings({ - // zooms: [16, 18], - // zIndex: 10, - // heightFactor: 2 //2鍊嶄簬榛樿楂樺害锛3D涓嬫湁鏁 - // }) - //妤煎眰鍥惧眰 - // floorChange(e){ - // e.checked ? this.map.add(this.floorLayer) : this.map.remove(this.floorLayer); - // } @ViewChild( 'appLeft',{static: false} ) appLeft:any //瀛愮粍浠 leftDivState:boolean = false; //宸︿晶宸ヤ綔鍖烘樉绀洪殣钘 @@ -556,19 +617,6 @@ export class GisLabelingComponent implements OnInit { that.map.setCity('涓婃捣甯'); AMap.plugin(["AMap.RangingTool", "AMap.MouseTool"],function () { that.mouseTool=new AMap.MouseTool(that.map); - /* that.measureDistance = new AMap.RangingTool(that.map, rulerOptions); //娴嬭窛绂 - that.measureArea = new AMap.MouseTool(that.map); //渚ч潰绉 */ - /* that.measureDistance.on('addnode',function(e){ //鐩戝惉娴嬭窛绂 鏍囩偣浜嬩欢 - that.distanceList.push(e.marker) - }) - that.measureDistance.on('end',function(e){ //鐩戝惉娴嬭窛绂 杩炵嚎浜嬩欢 - that.distanceList.push(e.polyline) - }) */ - /* that.mouseTool.on("rightclick",function(e){ - if(this.mouseTool.eventsList[1]==undefined){ - alert("000") - } - }) */ }); } @@ -1093,7 +1141,6 @@ export class LookPlanDialog { } this.http.get("/api/PlanComponents",{params:paramsData}).subscribe((data:any)=>{ this.allPlanComponents = data.items - // console.log(this.allPlanComponents) }) } //鏌ョ湅棰勬 @@ -1137,7 +1184,6 @@ export class LookPlanDialog { dialogRef.afterClosed().subscribe( data=>{ if(data){ - // console.log(123,data) this.downloadFileName = data.fileName this.download = data this.downloadFile() diff --git a/src/app/plan-audit/wait-examineer/wait-examineer.component.html b/src/app/plan-audit/wait-examineer/wait-examineer.component.html index c7961ea..fccb149 100644 --- a/src/app/plan-audit/wait-examineer/wait-examineer.component.html +++ b/src/app/plan-audit/wait-examineer/wait-examineer.component.html @@ -56,7 +56,8 @@ diff --git a/src/app/plan-audit/wait-examineer/wait-examineer.component.ts b/src/app/plan-audit/wait-examineer/wait-examineer.component.ts index a444aff..d7e833a 100644 --- a/src/app/plan-audit/wait-examineer/wait-examineer.component.ts +++ b/src/app/plan-audit/wait-examineer/wait-examineer.component.ts @@ -4,7 +4,7 @@ * @Author: sueRimn * @Date: 2020-12-25 16:13:50 * @LastEditors: sueRimn - * @LastEditTime: 2021-01-21 11:17:39 + * @LastEditTime: 2021-01-23 14:16:10 */ import { Component, OnInit } from '@angular/core'; import { FormControl } from '@angular/forms'; @@ -91,6 +91,7 @@ export class WaitExamineerComponent implements OnInit { checked//鏄惁閫変腑 chuorzhong//鍒ゆ柇鍒濆杩樻槸缁堝 radioid//閫変腑鐨刬d + shenheTable=[]//閫変腑瑕佸鏍哥殑瀵硅薄 //鑾峰彇琛ㄦ牸鏁版嵁 getAlltabledate(){ @@ -132,11 +133,21 @@ export class WaitExamineerComponent implements OnInit { this.getAlltabledate() } //radio鐐瑰嚮浜嬩欢 - radioClick(item){ + radioClick(e,item){ //e.target.parentElement.bgColor='#2196F3' - console.log(item) - this.chuorzhong=item.verifyState - this.radioid=item.itemId + //console.log(e,item) + if(e.checked){ + this.shenheTable.push(item) + } + else{ + for(var i=0;i{ + this.snackBar.open('鎿嶄綔鎴愬姛!','纭畾',config); + this.getAlltabledate() + }) + }else if(this.shenheTable[0].verifyState==3){ + this.http.put(`/api/PlanAudits/${this.radioid}`,{auditStatus:2}).subscribe(data=>{ + this.snackBar.open('鎿嶄綔鎴愬姛!','纭畾',config); + this.getAlltabledate() + }) + } + } + else{ + for(var i=0;i{ + this.snackBar.open('鎿嶄綔鎴愬姛!','纭畾',config); + this.getAlltabledate() + }) } - if(this.chuorzhong==0){ - this.http.put(`/api/PlanAudits/${this.radioid}/First`,{auditStatus:16}).subscribe(data=>{ + this.shenheTable=[] + } + //鎷掔粷鎿嶄綔 + refuse(){ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + var refuseList=[] + if(this.shenheTable.length==0){ + this.snackBar.open('璇烽夋嫨瑕佸鏍哥殑棰勬!','纭畾',config); + } + else if(this.shenheTable.length==1){ + if(this.shenheTable[0].verifyState==0){ + this.http.put(`/api/PlanAudits/${this.shenheTable[0].itemId}/First`,{auditStatus:32}).subscribe(data=>{ + this.snackBar.open('鎿嶄綔鎴愬姛!','纭畾',config); + this.getAlltabledate() + }) + }else if(this.shenheTable[0].verifyState==3){ + this.http.put(`/api/PlanAudits/${this.radioid}`,{auditStatus:4}).subscribe(data=>{ this.snackBar.open('鎿嶄綔鎴愬姛!','纭畾',config); - this.checked='' this.getAlltabledate() }) + } } - else if(this.chuorzhong==3){ - this.http.put(`/api/PlanAudits/${this.radioid}`,{auditStatus:2}).subscribe(data=>{ + else{ + for(var i=0;i{ this.snackBar.open('鎿嶄綔鎴愬姛!','纭畾',config); - this.checked='' this.getAlltabledate() }) } - this.chuorzhong=undefined - } - //鎷掔粷鎿嶄綔 - refuse(){ - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - if(this.chuorzhong==2){ - this.snackBar.open('瀹℃牳鏈氳繃锛岃淇敼鍚庡啀鏉ュ鏍!','纭畾',config); - } -if(this.chuorzhong==0){ - this.http.put(`/api/PlanAudits/${this.radioid}/First`,{auditStatus:32}).subscribe(data=>{ - this.snackBar.open('鎿嶄綔鎴愬姛!','纭畾',config); - this.checked='' - this.getAlltabledate() - }) -} -else if(this.chuorzhong==3){ -this.http.put(`/api/PlanAudits/${this.radioid}`,{auditStatus:4}).subscribe(data=>{ - this.snackBar.open('鎿嶄綔鎴愬姛!','纭畾',config); - this.checked='' - this.getAlltabledate() -}) -} -this.chuorzhong=undefined + this.shenheTable=[] + + } //鍒嗘暟楗肩姸鍥 diff --git a/src/app/plan-management/entry-plan/entry-plan.component.html b/src/app/plan-management/entry-plan/entry-plan.component.html index fcc41f3..67ad0fb 100644 --- a/src/app/plan-management/entry-plan/entry-plan.component.html +++ b/src/app/plan-management/entry-plan/entry-plan.component.html @@ -94,6 +94,15 @@ +
+ + + + 鏈夐妗 + 鏃犻妗 + + +
diff --git a/src/app/plan-management/entry-plan/entry-plan.component.ts b/src/app/plan-management/entry-plan/entry-plan.component.ts index feb6b5d..807af6f 100644 --- a/src/app/plan-management/entry-plan/entry-plan.component.ts +++ b/src/app/plan-management/entry-plan/entry-plan.component.ts @@ -53,6 +53,7 @@ export class EntryPlanComponent implements OnInit { organizationName:any //褰撳墠鍗曚綅缁勭粐鏈烘瀯鍚嶇О preparelevels:any integritySort:any //瀹屾暣搴︽帓搴 + haveyuan//鏈夋棤棰勬 colorRgb(sColor){ var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/; var sColor = sColor.toLowerCase(); @@ -304,6 +305,7 @@ export class EntryPlanComponent implements OnInit { PageSize: this.pageSizeOptions[0], Sort: this.integritySort ? 'integrityscore' : '', SortType: this.integritySort || '', + HasPlanComponents:this.haveyuan||'' } this.http.get("/api/Plans",{params:paramsdata}).subscribe((data:any)=>{ @@ -349,6 +351,7 @@ export class EntryPlanComponent implements OnInit { this.preparelevel = '' this.integritySort = '' this.plcheck = false + this.haveyuan='' //閲嶆柊鑾峰彇鍒濆鍖栧垪琛 // console.log(this.pageEvent) this.pageEvent.pageIndex = 0 diff --git a/src/app/plan-management/meet-plan/meet-plan.component.ts b/src/app/plan-management/meet-plan/meet-plan.component.ts index 8ff1a69..cc7d5f8 100644 --- a/src/app/plan-management/meet-plan/meet-plan.component.ts +++ b/src/app/plan-management/meet-plan/meet-plan.component.ts @@ -87,8 +87,8 @@ export class MeetPlanComponent implements OnInit { PlanType:reservePlanType||'', CreatorName:this.addname||'', AuditStatus:this.unitstate|| '', - QueryStartTime:this.addtime||'', - QueryEndTime:this.endtime||'', + CreationTimeRangeStart:this.addtime||'', + CreationTimeRangeEnd:this.endtime||'', PlanLevel:this.projectlevel||'', HasChildrenPlanLevel:this.plcheck||'', PageNumber: this.PageNumber || '1', diff --git a/src/app/plan-management/onetwo-entry-plan/onetwo-entry-plan.component.ts b/src/app/plan-management/onetwo-entry-plan/onetwo-entry-plan.component.ts index 693ad3a..01ff599 100644 --- a/src/app/plan-management/onetwo-entry-plan/onetwo-entry-plan.component.ts +++ b/src/app/plan-management/onetwo-entry-plan/onetwo-entry-plan.component.ts @@ -4,7 +4,7 @@ * @Author: sueRimn * @Date: 2020-12-24 14:15:10 * @LastEditors: sueRimn - * @LastEditTime: 2021-01-21 14:32:43 + * @LastEditTime: 2021-01-22 09:17:40 */ import { Component, OnInit, ViewChild, Inject } from '@angular/core'; import { HttpClient } from '@angular/common/http' @@ -98,8 +98,8 @@ export class OnetwoEntryPlanComponent implements OnInit { PlanType:reservePlanType||'', CreatorName:this.addname||'', AuditStatus:this.unitstate|| '', - QueryStartTime:this.addtime||'', - QueryEndTime:this.endtime||'', + CreationTimeRangeStart:this.addtime||'', + CreationTimeRangeEnd:this.endtime||'', PlanLevel:this.projectlevel||'', HasChildrenPlanLevel:this.plcheck||'', PageNumber: this.PageNumber || '1', diff --git a/src/app/plan-management/pass-plan/pass-plan.component.html b/src/app/plan-management/pass-plan/pass-plan.component.html index 8c34ed6..6c0411c 100644 --- a/src/app/plan-management/pass-plan/pass-plan.component.html +++ b/src/app/plan-management/pass-plan/pass-plan.component.html @@ -83,16 +83,6 @@
-
- - - - - 馃爦 - - - -
@@ -114,126 +104,16 @@
- + + + + + diff --git a/src/app/plan-management/pass-plan/pass-plan.component.ts b/src/app/plan-management/pass-plan/pass-plan.component.ts index 0f0334d..9096503 100644 --- a/src/app/plan-management/pass-plan/pass-plan.component.ts +++ b/src/app/plan-management/pass-plan/pass-plan.component.ts @@ -42,7 +42,7 @@ export class PassPlanComponent implements OnInit { pageSizeOptions: number[] = [10] //璁剧疆姣忛〉鏉℃暟 PageNumber:any; //绗嚑椤 - displayedColumns: string[] = ['planname', 'addpeople','addtime','plantype','auditStatus','openRange','projectlevel','operation']; + displayedColumns: string[] = ['planname', 'addpeople','level','addtime','plantype','auditStatus','openRange','projectlevel','operation']; allorganizations:any //鎵鏈夌粍缁囨満鏋 allunittype:any //鎵鏈夊崟浣嶇被鍨 tabledataSource:any //琛ㄦ牸鏁版嵁 @@ -97,6 +97,8 @@ export class PassPlanComponent implements OnInit { AuditStatus:'', //瀹℃牳鐘舵 PlanLevel: this.preparelevel || '', HasChildrenPlanLevel: this.plcheck || '', + CreationTimeRangeStart:this.addtime||'', + CreationTimeRangeEnd:this.endtime||'', PageNumber: this.PageNumber || '1', PageSize: this.pageSizeOptions[0], Sort: '' @@ -342,6 +344,8 @@ export class PassPlanComponent implements OnInit { this.unittype = '' this.reservePlanType = '' this.preparelevel = '' + this.addtime='' + this.endtime='' this.plcheck = false //閲嶆柊鑾峰彇鍒濆鍖栧垪琛 this.pageEvent.pageIndex = 0 diff --git a/src/app/plan-management/type-plan/type-plan.component.ts b/src/app/plan-management/type-plan/type-plan.component.ts index 0a1163c..91227db 100644 --- a/src/app/plan-management/type-plan/type-plan.component.ts +++ b/src/app/plan-management/type-plan/type-plan.component.ts @@ -4,7 +4,7 @@ * @Author: sueRimn * @Date: 2021-01-06 09:47:43 * @LastEditors: sueRimn - * @LastEditTime: 2021-01-21 14:15:40 + * @LastEditTime: 2021-01-23 09:45:17 */ import { Component, OnInit, ViewChild, Inject } from '@angular/core'; import { HttpClient } from '@angular/common/http' @@ -86,8 +86,8 @@ export class TypePlanComponent implements OnInit { planCategories:8, CreatorName:this.addname||'', AuditStatus:this.unitstate|| '', - QueryStartTime:this.addtime||'', - QueryEndTime:this.endtime||'', + CreationTimeRangeStart:this.addtime||'', + CreationTimeRangeEnd:this.endtime||'', PlanLevel:this.projectlevel||'', HasChildrenPlanLevel:this.plcheck||'', PageNumber: this.PageNumber || '1', @@ -371,6 +371,7 @@ export class newunitType{ PlanCategory:8, PlanLevel:PlanLevel, PlanMode:1, + PlanType:8, attachmentUrls:[`${this.objectName}`] } this.http.post("/api/PlanComponentsMajor",body).subscribe((data:any)=>{ @@ -461,6 +462,7 @@ export class newunitType{ PlanCategory:8, PlanLevel:PlanLevel, PlanMode:1, + PlanType:8, attachmentUrls:[`${this.objectName}`] } 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 4f411b2..ac69822 100644 --- a/src/app/ui/collection-tools-plan/collection-tools.component.html +++ b/src/app/ui/collection-tools-plan/collection-tools.component.html @@ -253,44 +253,44 @@

{{item.PropertyName}}

{{item.PropertyName}}

- - + +

{{item.PropertyName}}

{{item.PropertyName}}

diff --git a/src/app/ui/collection-tools-plan/collection-tools.component.ts b/src/app/ui/collection-tools-plan/collection-tools.component.ts index 17f69c5..0fe2b71 100644 --- a/src/app/ui/collection-tools-plan/collection-tools.component.ts +++ b/src/app/ui/collection-tools-plan/collection-tools.component.ts @@ -659,6 +659,7 @@ export class CollectionToolsPlanComponent implements OnInit { this.canvas.on("select",obj=>{ //閫変腑绱犳潗灞炴ф敞鍏ュ嚱鏁 this.setAssetsProperty(obj.assetData) + console.log(obj.assetData) }) // 鐩戝惉canvas缁勪欢鍙栨秷閫変腑绱犳潗浜嬩欢 this.canvas.on("deselect",obj=>{ @@ -1256,6 +1257,7 @@ export class CollectionToolsPlanComponent implements OnInit { //鐐瑰嚮鏁拌妭鐐圭殑鏄剧ず闅愯棌icon clickLookItem(node){ + //淇敼鐪熷疄绱犳潗islook灞炴 for(let key in this.storeyData.data){ if(key == node.id){ diff --git a/src/app/ui/collection-tools/collection-tools.component.html b/src/app/ui/collection-tools/collection-tools.component.html index b6a073f..ac990f4 100644 --- a/src/app/ui/collection-tools/collection-tools.component.html +++ b/src/app/ui/collection-tools/collection-tools.component.html @@ -359,44 +359,44 @@

{{item.PropertyName}}

{{item.PropertyName}}

- - + +

{{item.PropertyName}}

{{item.PropertyName}}

diff --git a/src/app/ui/collection-tools/collection-tools.component.scss b/src/app/ui/collection-tools/collection-tools.component.scss index 9f00105..af88cc7 100644 --- a/src/app/ui/collection-tools/collection-tools.component.scss +++ b/src/app/ui/collection-tools/collection-tools.component.scss @@ -351,6 +351,7 @@ //鍙充晶娑堥槻瑕佺礌 .firecategories{ position: relative; + background-color: #fff; display: flex; flex-flow: column; .firecategoriesTree{ diff --git a/src/app/ui/collection-tools/collection-tools.component.ts b/src/app/ui/collection-tools/collection-tools.component.ts index e3ce60c..ec74a0b 100644 --- a/src/app/ui/collection-tools/collection-tools.component.ts +++ b/src/app/ui/collection-tools/collection-tools.component.ts @@ -1212,10 +1212,9 @@ export class CollectionToolsComponent implements OnInit { if(selectPanelPoint.Data){ for(let key in selectPanelPoint.Data.Stock){ selectPanelPoint.Data.Stock[key].isLookPattern = true + selectPanelPoint.Data.Stock[key].isLook = true if(element.id == selectPanelPoint.Data.Stock[key].FireElementId){ selectPanelPoint.Data.Stock[key].isTemplate = false - selectPanelPoint.Data.Stock[key].isLook = true - element.isNewElement = true //璇ヨ妭鐐筩hildren鏄惁瀛樺湪鏂版坊鍔犵殑鐪熷疄绱犳潗 鏍囪瘑 //瀹氫箟鏌ョ湅妯″紡涓嬭兘鐪嬪埌鐨勫厓绱 @@ -1277,6 +1276,13 @@ export class CollectionToolsComponent implements OnInit { this.storeyData.data[key].isLook = !this.storeyData.data[key].isLook } } + if(this.selectPanelPoint && this.selectPanelPoint.Data){ + for(let key in this.selectPanelPoint.Data.Stock){ + if(key == node.id){ + this.selectPanelPoint.Data.Stock[key].isLook = !this.selectPanelPoint.Data.Stock[key].isLook + } + } + } //鎵鏈夋秷闃茶绱犳ā鏉垮彉鍖杋slook鍊 if(node.isTemplate){ @@ -1390,7 +1396,7 @@ export class CollectionToolsComponent implements OnInit { this.allFireElements[this.allFireElements.length-1].children.push(storeyData.data[key]) } } - let selectPanelPoint = JSON.parse(JSON.stringify(this.canvasData.selectPanelPoint || {} )) //褰撳墠 鑺傜偣 鏁版嵁 + let selectPanelPoint:any = 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 ) diff --git a/src/app/ui/collection-tools/save.ts b/src/app/ui/collection-tools/save.ts index 4be3e0b..8721c18 100644 --- a/src/app/ui/collection-tools/save.ts +++ b/src/app/ui/collection-tools/save.ts @@ -57,10 +57,11 @@ export class saveOneDialog { @Inject(MAT_DIALOG_DATA) public data) {} type = this.data.type - allDisposalNode = this.data.allDisposalNode - allPlanDisposalNode = [] + allDisposalNode = this.data.allDisposalNode//鎵鏈夎妭鐐规暟鎹 + allPlanDisposalNode = []//鎵鏈夐潪鏁版嵁鑺傜偣 allRootDisposalNode = [{name:"鏍硅妭鐐",id:null}] allDisposalNodeChild = [] + defaultSelectedName = '鏍硅妭鐐' ngOnInit(): void { //鎵鏈夐潪鏁版嵁鑺傜偣 this.allDisposalNode.forEach(item => { @@ -84,13 +85,12 @@ export class saveOneDialog { } }) }) - // console.log(this.nodeItem.id) } onNoClick(): void { this.dialogRef.close(); } - nodeItem - itemChildNum = 0 //鐐瑰嚮澶勭疆鑺傜偣瀛愭暟鎹妭鐐圭殑鏁伴噺 + nodeItem:any//褰撳墠閫変腑鐨勮淇濆瓨鍒扮殑鐖惰妭鐐 + itemChildNum = 0 //鐐瑰嚮澶勭疆鑺傜偣瀛愭暟鎹妭鐐圭殑鏁伴噺锛堣祴鍊紀rder锛 clickNode(item){ this.nodeItem = item this.allDisposalNodeChild.forEach(item => { @@ -189,7 +189,6 @@ export class saveOneDialog { resolve("鏇存柊澶勭疆鑺傜偣鎴愬姛,灏嗗ぉ姘 鑺傜偣璇︽儏绛変俊鎭繚瀛樺埌鐐瑰嚮鐨勮妭鐐") }) }).then((values)=>{ - // console.log(values) postdata.level = putdata.level + 1 new Promise((resolve,reject) => { this.http.post(`/api/DisposalNodes`,postdata).subscribe(data => { diff --git a/src/app/ui/collection-tools/saveTwo.html b/src/app/ui/collection-tools/saveTwo.html index fec97ff..ad8f075 100644 --- a/src/app/ui/collection-tools/saveTwo.html +++ b/src/app/ui/collection-tools/saveTwo.html @@ -11,7 +11,7 @@
- + {{item.name}} 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 42b4a9c..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.10.20210118_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); } } /** @@ -354,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); - }); /** * 鍒涘缓鍥炬爣浜嬩欢锛堟暟鎹鐞嗭級 */ @@ -414,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; - }); } /** * 閲嶇疆鐢诲竷 @@ -511,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); - }); - } /** * 鍒涘缓妤煎眰鍥惧舰 */ @@ -628,10 +583,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.backgroundImage .on('pointerdown', event => { if (event.data.button !== 0) { return; } - if (!event.currentTarget.dragging && this.selection.isMultiselection === false) { - this.selection.deselectAll(); + console.log(this.backgroundImage.toLocal(this.mousePosition)); + 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; @@ -825,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); } @@ -874,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) => { @@ -948,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) { @@ -975,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) { @@ -1139,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); } @@ -1288,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); + } } //////////////////////////////////////////////////////////////////////// 閫氱敤///////////////////////////////////////////////////////////////////////////// /** @@ -1354,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) { @@ -1381,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) { @@ -1407,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) { @@ -1425,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' } diff --git a/src/assets/images/鍏朵粬.png b/src/assets/images/鍏朵粬.png index 5b0bcbc..678a7dc 100644 Binary files a/src/assets/images/鍏朵粬.png and b/src/assets/images/鍏朵粬.png differ diff --git a/src/assets/images/鍙ゅ缓绛.png b/src/assets/images/鍙ゅ缓绛.png index 0d3c068..7329c51 100644 Binary files a/src/assets/images/鍙ゅ缓绛.png and b/src/assets/images/鍙ゅ缓绛.png differ diff --git a/src/assets/images/杞ㄩ亾浜ら.png b/src/assets/images/杞ㄩ亾浜ら.png index 9d2483a..2d2f97d 100644 Binary files a/src/assets/images/杞ㄩ亾浜ら.png and b/src/assets/images/杞ㄩ亾浜ら.png differ diff --git a/src/assets/linkageForces/浜ら.png b/src/assets/linkageForces/浜ら.png new file mode 100644 index 0000000..96cb8f6 Binary files /dev/null and b/src/assets/linkageForces/浜ら.png differ diff --git a/src/assets/linkageForces/浣忓缓.png b/src/assets/linkageForces/浣忓缓.png new file mode 100644 index 0000000..d3378a4 Binary files /dev/null and b/src/assets/linkageForces/浣忓缓.png differ diff --git a/src/assets/linkageForces/鍏畨.png b/src/assets/linkageForces/鍏畨.png new file mode 100644 index 0000000..cb3a71c Binary files /dev/null and b/src/assets/linkageForces/鍏畨.png differ diff --git a/src/assets/linkageForces/鍖荤枟.png b/src/assets/linkageForces/鍖荤枟.png new file mode 100644 index 0000000..61d8034 Binary files /dev/null and b/src/assets/linkageForces/鍖荤枟.png differ diff --git a/src/assets/linkageForces/瀹夌洃.png b/src/assets/linkageForces/瀹夌洃.png new file mode 100644 index 0000000..6b2a903 Binary files /dev/null and b/src/assets/linkageForces/瀹夌洃.png differ diff --git a/src/assets/linkageForces/甯傛斂.png b/src/assets/linkageForces/甯傛斂.png new file mode 100644 index 0000000..dc1b744 Binary files /dev/null and b/src/assets/linkageForces/甯傛斂.png differ diff --git a/src/assets/linkageForces/搴旀ョ鐞.png b/src/assets/linkageForces/搴旀ョ鐞.png new file mode 100644 index 0000000..3cd54b8 Binary files /dev/null and b/src/assets/linkageForces/搴旀ョ鐞.png differ diff --git a/src/assets/linkageForces/姘戞斂.png b/src/assets/linkageForces/姘戞斂.png new file mode 100644 index 0000000..790924f Binary files /dev/null and b/src/assets/linkageForces/姘戞斂.png differ diff --git a/src/assets/linkageForces/姘旇薄灞.png b/src/assets/linkageForces/姘旇薄灞.png new file mode 100644 index 0000000..654a198 Binary files /dev/null and b/src/assets/linkageForces/姘旇薄灞.png differ diff --git a/src/assets/linkageForces/姘村埄.png b/src/assets/linkageForces/姘村埄.png new file mode 100644 index 0000000..3c542ee Binary files /dev/null and b/src/assets/linkageForces/姘村埄.png differ diff --git a/src/assets/linkageForces/娴蜂簨.png b/src/assets/linkageForces/娴蜂簨.png new file mode 100644 index 0000000..f6940d8 Binary files /dev/null and b/src/assets/linkageForces/娴蜂簨.png differ diff --git a/src/assets/linkageForces/鐕冩皵灞.png b/src/assets/linkageForces/鐕冩皵灞.png new file mode 100644 index 0000000..b430203 Binary files /dev/null and b/src/assets/linkageForces/鐕冩皵灞.png differ diff --git a/src/assets/linkageForces/鐜繚灞.png b/src/assets/linkageForces/鐜繚灞.png new file mode 100644 index 0000000..21d6bbd Binary files /dev/null and b/src/assets/linkageForces/鐜繚灞.png differ diff --git a/src/assets/linkageForces/鐢靛姏灞.png b/src/assets/linkageForces/鐢靛姏灞.png new file mode 100644 index 0000000..69f21cd Binary files /dev/null and b/src/assets/linkageForces/鐢靛姏灞.png differ diff --git a/src/assets/linkageForces/閫氫俊.png b/src/assets/linkageForces/閫氫俊.png new file mode 100644 index 0000000..79f5180 Binary files /dev/null and b/src/assets/linkageForces/閫氫俊.png differ diff --git a/src/styles.scss b/src/styles.scss index 2ef5a9e..a1e9b69 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -129,7 +129,7 @@ table td.mat-footer-cell:last-of-type{ } //寮瑰嚭妗嗘牱寮忓彇娑坧adding -#shareDialog,#lookPlanDialog,#openPlanToolDialog,#addWater,#videodialog{ +#shareDialog,#lookPlanDialog,#openPlanToolDialog,#addWater,#videodialog,#addLinkageForce,#videodialog2{ padding: 0; } @@ -182,3 +182,13 @@ table td.mat-footer-cell:last-of-type{ line-height: 30px; } } +#linkageForcesSwiper{ + .swiper-container{ + --swiper-navigation-size: 26px;/* 璁剧疆鎸夐挳澶у皬 */ + } +} +//鐐硅仛鍚堣嚜瀹氫箟鍥剧墖澶у皬 +.clusterImg{ + width: 30px; + height: 30px; +}
- + + {{item.contentType=='1'?'鈪犵骇棰勬':item.contentType=='2'?'鈪$骇棰勬':item.contentType=='3'?'鈪㈢骇棰勬':item.contentType=='4'?'鈪g骇棰勬':item.contentType=='5'? '鈪ょ骇棰勬':item.contentType=='6'?'搴旀ラ妗堬紙鍥藉绾э級':item.contentType=='7'?'搴旀ラ妗堬紙甯傜骇锛':item.contentType=='8'?'绫诲瀷棰勬':item.contentType=='11'?'閲嶇偣鍗曚綅':'娑堥槻杞﹁締'}} {{item.operation=='0'?'鏂板':item.operation=='1'?'鏇存柊':'鍒犻櫎'}}棰勬鍚嶇О {{element.name}} 娣诲姞浜 {{element.creatorName}} 棰勬绾у埆{{element.planCategory==1?'鈪犵骇棰勬':element.planCategory==2?'鈪$骇棰勬': + element.planCategory==3?'鈪㈢骇棰勬':element.planCategory==4?'鈪g骇棰勬':element.planCategory==5?'鈪ょ骇棰勬':element.planCategory==8?'绫诲瀷棰勬':'搴旀ラ妗'}} 娣诲姞鏃堕棿 {{element.creationTime | date:'yyyy-MM-dd'}}