From b927feacd1a31824b7c12f11fd0741b3d7328d7d Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Fri, 25 Dec 2020 09:36:38 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=8D=95=E4=BD=8D=E5=9C=B0=E5=9D=80=E6=A0=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basicinfo-look/basicinfo.component.html | 29 +- .../basicinfo-look/basicinfo.component.scss | 60 +++- .../basicinfo-look/basicinfo.component.ts | 267 +++++++++++++---- .../basicinfo/basicinfo.component.html | 39 ++- .../basicinfo/basicinfo.component.scss | 86 ++++-- .../key-unit/basicinfo/basicinfo.component.ts | 272 ++++++++++++++---- .../edit-plan-info.component.html | 2 +- src/assets/images/close.png | Bin 0 -> 521 bytes src/assets/images/newposition.png | Bin 0 -> 1426 bytes src/assets/images/ok.png | Bin 0 -> 561 bytes src/assets/images/oldposition.png | Bin 0 -> 1197 bytes src/styles.scss | 38 +++ 12 files changed, 648 insertions(+), 145 deletions(-) create mode 100644 src/assets/images/close.png create mode 100644 src/assets/images/newposition.png create mode 100644 src/assets/images/ok.png create mode 100644 src/assets/images/oldposition.png diff --git a/src/app/key-unit/basicinfo-look/basicinfo.component.html b/src/app/key-unit/basicinfo-look/basicinfo.component.html index a35c152..7ed3469 100644 --- a/src/app/key-unit/basicinfo-look/basicinfo.component.html +++ b/src/app/key-unit/basicinfo-look/basicinfo.component.html @@ -99,9 +99,32 @@ --> - - - +
+
+ +
+
+
+ + 经度 : + +
+ {{markerPosition.x || '暂未标注'}} +
+
+
+ + 纬度 : + +
+ {{markerPosition.y || '暂未标注'}} +
+
+ +
+
diff --git a/src/app/key-unit/basicinfo-look/basicinfo.component.scss b/src/app/key-unit/basicinfo-look/basicinfo.component.scss index 720063f..2648fb9 100644 --- a/src/app/key-unit/basicinfo-look/basicinfo.component.scss +++ b/src/app/key-unit/basicinfo-look/basicinfo.component.scss @@ -5,6 +5,7 @@ .mainbox{ height: 100%; position: relative; + display: flex; .mainleft{ width:800px; height: 100%; @@ -94,11 +95,60 @@ } .mainright{ float: left; - width: 600px; - height: 400px; - // position: absolute; - // right: 170px; - + flex: 1; + height: 430px; + margin-right: 100px; + position: relative; + .searchinput{ + display: flex; + position: absolute; + left: 0; + top: 0; + } + .gistopbox{ + position: absolute; + + box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16); + border-radius: 4px; + left: 5%; + top: 10px; + width: 90%; + height:46px; + background: #FFFFFF; + display: flex; + justify-content: space-around; + align-items: center; + cursor: default;; + .positionItem{ + width: 30%; + height: 35px; + display: flex; + align-items: center; + .itemNum{ + background: #F2F2F2; + box-sizing: border-box; + padding-left: 10px; + width: 80%; + height: 32px; + line-height: 32px; + margin-left: 5px; + border-radius: 4px; + } + } + .setPosition{ + cursor: pointer; + width: 15%; + height: 32px; + background: #2196F3; + color: #fff; + border-radius: 4px; + display: flex; + align-items: center; + justify-content: center; + } + + + } } } } diff --git a/src/app/key-unit/basicinfo-look/basicinfo.component.ts b/src/app/key-unit/basicinfo-look/basicinfo.component.ts index 6357f13..dc8a770 100644 --- a/src/app/key-unit/basicinfo-look/basicinfo.component.ts +++ b/src/app/key-unit/basicinfo-look/basicinfo.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Inject ,ViewChild} from '@angular/core'; +import { Component, OnInit, Inject ,ViewChild, ElementRef, Renderer2} from '@angular/core'; import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree'; import { FlatTreeControl } from '@angular/cdk/tree'; import { HttpClient,HttpHeaders, HttpEventType } from '@angular/common/http'; @@ -19,7 +19,7 @@ import * as _ from 'lodash'; // import Swiper from 'swiper'; import { LookMaster2 } from './lookmaster.component' import { Router,ActivatedRoute } from '@angular/router' - +declare var AMap: any; @Component({ selector: 'app-basicinfo-look', templateUrl: './basicinfo.component.html', @@ -83,7 +83,7 @@ export class BasicinfoLookComponent implements OnInit { buildingCustomData:any //存储当前建筑的自定义信息 allunittype: any //所有单位类型 allorganizing:any = [] //所有组织机构 - constructor(private router:Router,private route:ActivatedRoute,private http: HttpClient, private tree: TreeService, private sanitizer: DomSanitizer, public dialog: MatDialog,public snackBar: MatSnackBar) { } + constructor(private elementRef: ElementRef,public renderer2: Renderer2,private router:Router,private route:ActivatedRoute,private http: HttpClient, private tree: TreeService, private sanitizer: DomSanitizer, public dialog: MatDialog,public snackBar: MatSnackBar) { } unitId : any //当前单位id @@ -94,6 +94,163 @@ export class BasicinfoLookComponent implements OnInit { this.getunitallbuilding() this.unitId = this.route.snapshot.queryParams.id } + isMapLabel:boolean + //地图标注位置 + markerPosition:any = {x: 0, y: 0}//单位坐标 + map:any //地图实例 + isGisTopBox:boolean = false//点击位置按钮 + oldPositionMarker:any //旧位置marker实例 + newPositionMarker:any //新位置marker实例 + + newPositionMarkerContent:any = + '
' + + ' ' + + '
' + newPositionMarkerContentBtn:any = + '
' + + ' ' + + '
|
' + + '
' + oldPositionMarkerContent:any = + '
' + + ' ' + + '
' + //初始化地图 + labelGis(){ + this.map = new AMap.Map('container', { + zoom:12 + }) + this.map.on('complete', () => { + this.isGisTopBox = true + }); + 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('上海市'); + } + } + //点击位置按钮 + setPosition(){ + this.isGisTopBox = false + if(this.isMapLabel){//如果已经标注单位坐标 + console.log('已标注单位位置') + + if(this.oldPositionMarker){ + this.oldPositionMarker.setContent(this.oldPositionMarkerContent) + } + if(this.newPositionMarker){ + this.newPositionMarker.setContent(this.oldPositionMarkerContent) + } + + this.newPositionMarker = new AMap.Marker({ + draggable: true, + position: [this.markerPosition.x,this.markerPosition.y], + content: this.newPositionMarkerContentBtn, + offset: new AMap.Pixel(-15, -18) + }); + this.map.add(this.newPositionMarker); + + + let markerPosition + if(this.markerPosition.x && this.markerPosition.x != 0){ + markerPosition = {x: this.markerPosition.x,y: this.markerPosition.y} + }else{ + markerPosition = {x: this.map.getCenter().lng,y: this.map.getCenter().lat} //获取当前地图中心位置 + } + this.newPositionMarker.on('dragend', (e)=>{ + markerPosition = {x: e.lnglat.lng, y: e.lnglat.lat} + }) + //点击确定 + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'click',(event)=>{ + this.map.clearMap(); + this.isGisTopBox = true + this.newPositionMarker = new AMap.Marker({ + position: [markerPosition.x,markerPosition.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }); + this.markerPosition = markerPosition + this.map.add(this.newPositionMarker); + }) + //点击取消 + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionClose'),'click',(event)=>{ + this.isGisTopBox = true + this.map.clearMap(); + this.newPositionMarker = new AMap.Marker({ + position: [this.markerPosition.x,this.markerPosition.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }); + this.map.add(this.newPositionMarker); + }) + + }else{ + console.log('未标注单位位置') + if(this.newPositionMarker){ + this.newPositionMarker.setContent(this.oldPositionMarkerContent) + } + let center + if(this.markerPosition.x && this.markerPosition.x != 0){ + center = [this.markerPosition.x,this.markerPosition.y] + }else{ + center = this.map.getCenter(); //获取当前地图中心位置 + this.map.setCenter(center); + } + + this.newPositionMarker = new AMap.Marker({ + draggable: true, + position: center, + content: this.newPositionMarkerContentBtn, + offset: new AMap.Pixel(-15, -18) + }); + this.map.add(this.newPositionMarker); + + let markerPosition + if(this.markerPosition.x && this.markerPosition.x != 0){ + markerPosition = {x: this.markerPosition.x,y: this.markerPosition.y} + }else{ + markerPosition = {x: this.map.getCenter().lng,y: this.map.getCenter().lat} //获取当前地图中心位置 + } + this.newPositionMarker.on('dragend', (e)=>{ + markerPosition = {x: e.lnglat.lng, y: e.lnglat.lat} + }) + //点击确定 + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'click',(event)=>{ + this.isGisTopBox = true + this.markerPosition = markerPosition + this.map.clearMap(); + this.newPositionMarker = new AMap.Marker({ + position: [this.markerPosition.x,this.markerPosition.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }); + this.map.add(this.newPositionMarker); + }) + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionClose'),'click',(event)=>{ + this.map.clearMap(); + this.isGisTopBox = true + if(this.markerPosition.x && this.markerPosition.x != 0){//说明之前标过点 + this.newPositionMarker = new AMap.Marker({ + position: [this.markerPosition.x,this.markerPosition.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }); + this.map.add(this.newPositionMarker); + } + })//取消 + } + + } + //获得所有单位类型 getallunittype() { this.http.get("/api/BuildingTypes/Simple").subscribe(data => { @@ -106,59 +263,71 @@ export class BasicinfoLookComponent implements OnInit { (data: any) => { this.allorganizing = data; this.dataSource.data = this.tree.toTree(data); - this.getunitinfo(); + let _this = this + this.getunitinfo().then((e)=>{ + if(this.unitinfo.location && (this.unitinfo.location.x != 0 && this.unitinfo.location.y != 0) ){//已标注 + _this.isMapLabel = true + _this.markerPosition = _this.unitinfo.location + }else{//未标注 + _this.isMapLabel = false + } + this.labelGis() + }) } ) } //获得当前单位的基本信息 - getunitinfo(){ - - this.http.get(`/api/Companies/${this.unitId}`).subscribe((data:any)=>{ - // console.log(111,data) - if(data.buildingTypes.length){ - sessionStorage.setItem('buildingTypeId',data.buildingTypes[0].id) - }else{ - sessionStorage.setItem('buildingTypeId',"") - } - let node - this.allorganizing.forEach(item => { - if(item.id == data.organizationId){ - node = item - } - }); - if(node){ - if(!node.parentId){ - this.selectedorganization = node.name + async getunitinfo(){ + let result = await new Promise((resolve, reject) => { + this.http.get(`/api/Companies/${this.unitId}`).subscribe((data:any)=>{ + // console.log(111,data) + if(data.buildingTypes.length){ + sessionStorage.setItem('buildingTypeId',data.buildingTypes[0].id) }else{ - let namearr = [node.name] - let targetId = node.parentId; // 临时变量 - for(let i = 0; i < node.level ; i++){ - this.allorganizing.forEach(item => { - if(item.id == targetId ){ - namearr.push(item.name) - targetId = item.parentId; // 临时变量更新没有副作用 - } - }); + sessionStorage.setItem('buildingTypeId',"") + } + let node + this.allorganizing.forEach(item => { + if(item.id == data.organizationId){ + node = item + } + }); + if(node){ + if(!node.parentId){ + this.selectedorganization = node.name + }else{ + let namearr = [node.name] + let targetId = node.parentId; // 临时变量 + for(let i = 0; i < node.level ; i++){ + this.allorganizing.forEach(item => { + if(item.id == targetId ){ + namearr.push(item.name) + targetId = item.parentId; // 临时变量更新没有副作用 + } + }); + } + namearr.reverse() + let str = '' + namearr.forEach(item=>{ + str += '/' + item + }) + this.selectedorganization = str.substr(1) } - namearr.reverse() - let str = '' - namearr.forEach(item=>{ - str += '/' + item - }) - this.selectedorganization = str.substr(1) } - } - - this.unitinfo = data - this.selectedorganizationid = data.organizationId - if(data.imageUrl){ - this.imgsrc = data.imageUrl - } - if(data.buildingTypes[0]){ - this.defaultbuildingTypes = data.buildingTypes[0].id - this.buildingTypesname = data.buildingTypes[0].name - } - }) + + this.unitinfo = data + resolve(this.unitinfo) + this.selectedorganizationid = data.organizationId + if(data.imageUrl){ + this.imgsrc = data.imageUrl + } + if(data.buildingTypes[0]){ + this.defaultbuildingTypes = data.buildingTypes[0].id + this.buildingTypesname = data.buildingTypes[0].name + } + }) + }) + } unitallbuilding:any = []//用于存储当前单位所有的建筑 buildinginfoId:any = []//用于存储当前单位所有具体建筑的id diff --git a/src/app/key-unit/basicinfo/basicinfo.component.html b/src/app/key-unit/basicinfo/basicinfo.component.html index 5d16d34..0927268 100644 --- a/src/app/key-unit/basicinfo/basicinfo.component.html +++ b/src/app/key-unit/basicinfo/basicinfo.component.html @@ -119,9 +119,32 @@ - - - +
+
+ +
+
+
+ + 经度 : + +
+ {{markerPosition.x || '暂未标注'}} +
+
+
+ + 纬度 : + +
+ {{markerPosition.y || '暂未标注'}} +
+
+
+ place 位置 +
+
+
@@ -131,7 +154,7 @@
-
+
@@ -195,7 +218,7 @@
- +

自定义信息

@@ -278,7 +301,7 @@
- +

{{item.buildingBasicGroups[1].name}}

@@ -316,7 +339,7 @@
- +

储罐信息

@@ -480,7 +503,7 @@
- +

自定义信息

diff --git a/src/app/key-unit/basicinfo/basicinfo.component.scss b/src/app/key-unit/basicinfo/basicinfo.component.scss index c80c8c3..cb6cf21 100644 --- a/src/app/key-unit/basicinfo/basicinfo.component.scss +++ b/src/app/key-unit/basicinfo/basicinfo.component.scss @@ -5,10 +5,10 @@ .mainbox{ height: 100%; position: relative; + display: flex; .mainleft{ width:800px; height: 100%; - // background-color: yellow; float: left; .inputbox{ width: 343px; @@ -40,13 +40,7 @@ } .addbtn{ width: 695px; - position: absolute; - bottom: -495px; - text-align: center; - margin-bottom:20px; - button{ - margin: 0 4px; - } + margin:9px 0; } .uploadimg{ width: 400px; @@ -55,18 +49,13 @@ margin-top:12px; position: relative; margin-left: 80px; - cursor: pointer; span{ float: left; } - // img{ - // float: left; - // } .uploadingimg{ width: 299px; height: 170px; - // background: url('../../../assets/images/upload2.png') no-repeat center center; - + cursor: pointer; position: absolute; top: 0px; left: 79px; @@ -76,30 +65,71 @@ } .image{ - // position: absolute; - // top: 199px; - // left: 160px; - // width: 299px; - // height: 170px; input{ - // width: 299px; - // height: 170px; width: 190px; margin-top: 160px; cursor: pointer; } - // opacity:0; - } } .mainright{ float: left; - width: 600px; - height: 400px; - // position: absolute; - // right: 170px; - + flex: 1; + height: 430px; + margin-right: 100px; + position: relative; + .searchinput{ + display: flex; + position: absolute; + left: 0; + top: 0; + } + .gistopbox{ + position: absolute; + + box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16); + border-radius: 4px; + left: 5%; + top: 10px; + width: 90%; + height:46px; + background: #FFFFFF; + display: flex; + justify-content: space-around; + align-items: center; + cursor: default;; + .positionItem{ + width: 30%; + height: 35px; + display: flex; + align-items: center; + .itemNum{ + background: #F2F2F2; + box-sizing: border-box; + padding-left: 10px; + width: 80%; + height: 32px; + line-height: 32px; + margin-left: 5px; + border-radius: 4px; + } + } + .setPosition{ + cursor: pointer; + width: 15%; + height: 32px; + background: #2196F3; + color: #fff; + border-radius: 4px; + display: flex; + align-items: center; + justify-content: center; + } + + + } } + } } .bottombox{ diff --git a/src/app/key-unit/basicinfo/basicinfo.component.ts b/src/app/key-unit/basicinfo/basicinfo.component.ts index 3060541..1fd8443 100644 --- a/src/app/key-unit/basicinfo/basicinfo.component.ts +++ b/src/app/key-unit/basicinfo/basicinfo.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Inject ,ViewChild} from '@angular/core'; +import { Component, OnInit, Inject ,ViewChild, ElementRef, Renderer2} from '@angular/core'; import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree'; import { FlatTreeControl } from '@angular/cdk/tree'; import { HttpClient,HttpHeaders, HttpEventType } from '@angular/common/http'; @@ -21,6 +21,7 @@ import * as _ from 'lodash'; import { LookMaster } from './lookmaster.component' import { Router,ActivatedRoute } from '@angular/router' import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service'; +declare var AMap: any; @Component({ selector: 'app-basicinfo', @@ -85,7 +86,7 @@ export class BasicinfoComponent implements OnInit { buildingCustomData:any //存储当前建筑的自定义信息 allunittype: any //所有单位类型 allorganizing:any = [] //所有组织机构 - constructor(private tabbarService: TabbarAndScoreService,private router:Router,private route:ActivatedRoute,private http: HttpClient, private tree: TreeService, private sanitizer: DomSanitizer, public dialog: MatDialog,public snackBar: MatSnackBar) { } + constructor(private elementRef: ElementRef,public renderer2: Renderer2,private tabbarService: TabbarAndScoreService,private router:Router,private route:ActivatedRoute,private http: HttpClient, private tree: TreeService, private sanitizer: DomSanitizer, public dialog: MatDialog,public snackBar: MatSnackBar) { } unitId : any //当前单位id @@ -97,6 +98,166 @@ export class BasicinfoComponent implements OnInit { this.unitId = this.route.snapshot.queryParams.id sessionStorage.setItem("companyId",this.route.snapshot.queryParams.id); } + + isMapLabel:boolean + //地图标注位置 + markerPosition:any = {x: 0, y: 0}//单位坐标 + map:any //地图实例 + isGisTopBox:boolean = false//点击位置按钮 + oldPositionMarker:any //旧位置marker实例 + newPositionMarker:any //新位置marker实例 + + newPositionMarkerContent:any = + '
' + + ' ' + + '
' + newPositionMarkerContentBtn:any = + '
' + + ' ' + + '
|
' + + '
' + oldPositionMarkerContent:any = + '
' + + ' ' + + '
' + //初始化地图 + labelGis(){ + this.map = new AMap.Map('container', { + zoom:12 + }) + this.map.on('complete', () => { + this.isGisTopBox = true + }); + 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('上海市'); + } + } + //点击位置按钮 + setPosition(){ + this.isGisTopBox = false + if(this.isMapLabel){//如果已经标注单位坐标 + console.log('已标注单位位置') + + if(this.oldPositionMarker){ + this.oldPositionMarker.setContent(this.oldPositionMarkerContent) + } + if(this.newPositionMarker){ + this.newPositionMarker.setContent(this.oldPositionMarkerContent) + } + + this.newPositionMarker = new AMap.Marker({ + draggable: true, + position: [this.markerPosition.x,this.markerPosition.y], + content: this.newPositionMarkerContentBtn, + offset: new AMap.Pixel(-15, -18) + }); + this.map.add(this.newPositionMarker); + + + let markerPosition + if(this.markerPosition.x && this.markerPosition.x != 0){ + markerPosition = {x: this.markerPosition.x,y: this.markerPosition.y} + }else{ + markerPosition = {x: this.map.getCenter().lng,y: this.map.getCenter().lat} //获取当前地图中心位置 + } + this.newPositionMarker.on('dragend', (e)=>{ + markerPosition = {x: e.lnglat.lng, y: e.lnglat.lat} + }) + //点击确定 + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'click',(event)=>{ + this.map.clearMap(); + this.isGisTopBox = true + this.newPositionMarker = new AMap.Marker({ + position: [markerPosition.x,markerPosition.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }); + this.markerPosition = markerPosition + this.map.add(this.newPositionMarker); + }) + //点击取消 + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionClose'),'click',(event)=>{ + this.isGisTopBox = true + this.map.clearMap(); + this.newPositionMarker = new AMap.Marker({ + position: [this.markerPosition.x,this.markerPosition.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }); + this.map.add(this.newPositionMarker); + }) + + }else{ + console.log('未标注单位位置') + if(this.newPositionMarker){ + this.newPositionMarker.setContent(this.oldPositionMarkerContent) + } + let center + if(this.markerPosition.x && this.markerPosition.x != 0){ + center = [this.markerPosition.x,this.markerPosition.y] + }else{ + center = this.map.getCenter(); //获取当前地图中心位置 + this.map.setCenter(center); + } + + this.newPositionMarker = new AMap.Marker({ + draggable: true, + position: center, + content: this.newPositionMarkerContentBtn, + offset: new AMap.Pixel(-15, -18) + }); + this.map.add(this.newPositionMarker); + + let markerPosition + if(this.markerPosition.x && this.markerPosition.x != 0){ + markerPosition = {x: this.markerPosition.x,y: this.markerPosition.y} + }else{ + markerPosition = {x: this.map.getCenter().lng,y: this.map.getCenter().lat} //获取当前地图中心位置 + } + this.newPositionMarker.on('dragend', (e)=>{ + markerPosition = {x: e.lnglat.lng, y: e.lnglat.lat} + }) + //点击确定 + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'click',(event)=>{ + this.isGisTopBox = true + this.markerPosition = markerPosition + this.map.clearMap(); + this.newPositionMarker = new AMap.Marker({ + position: [this.markerPosition.x,this.markerPosition.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }); + this.map.add(this.newPositionMarker); + }) + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionClose'),'click',(event)=>{ + this.map.clearMap(); + this.isGisTopBox = true + if(this.markerPosition.x && this.markerPosition.x != 0){//说明之前标过点 + this.newPositionMarker = new AMap.Marker({ + position: [this.markerPosition.x,this.markerPosition.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }); + this.map.add(this.newPositionMarker); + } + })//取消 + } + + + + } + //获得所有单位类型 getallunittype() { this.http.get("/api/BuildingTypes/Simple").subscribe(data => { @@ -109,59 +270,71 @@ export class BasicinfoComponent implements OnInit { (data: any) => { this.allorganizing = data; this.dataSource.data = this.tree.toTree(data); - this.getunitinfo(); + let _this = this + this.getunitinfo().then((e)=>{ + if(this.unitinfo.location && (this.unitinfo.location.x != 0 && this.unitinfo.location.y != 0) ){//已标注 + _this.isMapLabel = true + _this.markerPosition = _this.unitinfo.location + }else{//未标注 + _this.isMapLabel = false + } + this.labelGis() + }) } ) } //获得当前单位的基本信息 CompanyId - getunitinfo(){ - - this.http.get(`/api/Companies/${this.unitId}`).subscribe((data:any)=>{ - if(data.buildingTypes.length){ - sessionStorage.setItem('buildingTypeId',data.buildingTypes[0].id) - }else{ - sessionStorage.setItem('buildingTypeId',"") - } - let node - this.allorganizing.forEach(item => { - if(item.id == data.organizationId){ - node = item - } - }); - if(node){ - if(!node.parentId){ - this.selectedorganization = node.name + async getunitinfo(){ + let result = await new Promise((resolve, reject) => { + this.http.get(`/api/Companies/${this.unitId}`).subscribe((data:any)=>{ + if(data.buildingTypes.length){ + sessionStorage.setItem('buildingTypeId',data.buildingTypes[0].id) }else{ - let namearr = [node.name] - let targetId = node.parentId; // 临时变量 - for(let i = 0; i < node.level ; i++){ - this.allorganizing.forEach(item => { - if(item.id == targetId ){ - namearr.push(item.name) - targetId = item.parentId; // 临时变量更新没有副作用 - } - }); + sessionStorage.setItem('buildingTypeId',"") + } + let node + this.allorganizing.forEach(item => { + if(item.id == data.organizationId){ + node = item + } + }); + if(node){ + if(!node.parentId){ + this.selectedorganization = node.name + }else{ + let namearr = [node.name] + let targetId = node.parentId; // 临时变量 + for(let i = 0; i < node.level ; i++){ + this.allorganizing.forEach(item => { + if(item.id == targetId ){ + namearr.push(item.name) + targetId = item.parentId; // 临时变量更新没有副作用 + } + }); + } + namearr.reverse() + let str = '' + namearr.forEach(item=>{ + str += '/' + item + }) + this.selectedorganization = str.substr(1) } - namearr.reverse() - let str = '' - namearr.forEach(item=>{ - str += '/' + item - }) - this.selectedorganization = str.substr(1) } - } - - this.unitinfo = data - this.selectedorganizationid = data.organizationId - if(data.imageUrl){ - this.imgsrc = data.imageUrl - } - if(data.buildingTypes[0]){ - this.defaultbuildingTypes = data.buildingTypes[0].id - this.buildingTypesname = data.buildingTypes[0].name - } - }) + + this.unitinfo = data + resolve(this.unitinfo) + this.selectedorganizationid = data.organizationId + if(data.imageUrl){ + this.imgsrc = data.imageUrl + } + if(data.buildingTypes[0]){ + this.defaultbuildingTypes = data.buildingTypes[0].id + this.buildingTypesname = data.buildingTypes[0].name + } + }) + }) + } //石油化工 装置信息 勾选框 checkboxchange(item,e){ @@ -1012,10 +1185,7 @@ export class BasicinfoComponent implements OnInit { phone: value.linkphone, address: value.unitaddress, imageUrl: this.imgsrc, - location: { - x: 0, - y: 0 - }, + location: this.markerPosition, modifiedTime: time, organizationId: this.selectedorganizationid, organizationName: null, diff --git a/src/app/key-unit/edit-plan-info/edit-plan-info.component.html b/src/app/key-unit/edit-plan-info/edit-plan-info.component.html index ef843ae..f05cd1d 100644 --- a/src/app/key-unit/edit-plan-info/edit-plan-info.component.html +++ b/src/app/key-unit/edit-plan-info/edit-plan-info.component.html @@ -1,7 +1,7 @@ - + diff --git a/src/assets/images/close.png b/src/assets/images/close.png new file mode 100644 index 0000000000000000000000000000000000000000..c33434e15b7e4463fd5b38ba5b9d2be791771102 GIT binary patch literal 521 zcmV+k0`~ohP)U1r1`v$#cO75(5C9m!|{DF(5sr8{s3%F1Z7`VIlJ5*sl5Si zly>g{8{w;}HMiUk5A2lqFMo?Hp?8i_CyS5ObE`{Pr7D`!GDb)~_)Ytl;HCKYIhh-0iD+km5 z@#!!L2U+#hWgFoS$cczq5*k@&BFrnYwyYBVMtYQM$QU#>56dbW9X7kT3+Q|1lzHH& z{IpRC;KY*cx$4KQLC+x3(_E-8`4&@*ciKB@#0Gd3DWfuxa;Ch0u|^?qF5WyogV8bs zi;VYd*i(qUL2#OhO=NHG6Kv=HuUms1H#^YB|N84Wb$dsRhZ+t$sx`Oc;owz1^!SRS zG|1ZSUkzAe%axfsU=t<}u7KA_uaGTa!z(~^FnISK#B@e1*z00000 LNkvXXu0mjfnb7Zt literal 0 HcmV?d00001 diff --git a/src/assets/images/newposition.png b/src/assets/images/newposition.png new file mode 100644 index 0000000000000000000000000000000000000000..98bf1bb148f1027506d408b138c181c46909a509 GIT binary patch literal 1426 zcmV;D1#S9?P)=Z@000G9NklymgFHJ2`F*Puj)tuQTrSVJX<`TCq#`u}3nYJ=h z%M??Xmr8AHc|~)QCRyIlIYo!2f;SXTdp-Z>fBpEOw!V$=pYy%vea?G1?|DB(ZJumB zfG~!j=ngyuv;pd)DMxV$%_(3TnmlHz@=z*OjRGz`4#+~$HI$+U?=@98C_s}#y4r8I zCO9-(#}dwJpl_{U!Gtu6P-K#>Zu!3sgu3)#;CmF!EaAr+LQ*s&c7U!ep=EvZru;Vi zUJjd2LHr zEgL{WYZ%_nY-n*YxDG<)T_5;4su;j5b=I2oKy!329P9<^$;&4i!{#J7b_Hhdg3{|X zJ31;7J{kxyO<`0%l=)hHglhVcp>Bv416`);QORKxon+XiG3-r&#lOMF2kI8p%s!CT z9r}Fh2i7ddsU~}%E}e;DzU9)L$?)BuzQFv^W={TsJ>z1bvI>4W0|Fi&3xo6gTwP59 z8LCK;s~Z64faaoXZUS^_4imQ;)ss4#|EZmzV{@3h$BfTaLci89p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SnShRU^&nEN_eS6v-XHWc|00000 LNkvXXu0mjfH{dFy literal 0 HcmV?d00001 diff --git a/src/styles.scss b/src/styles.scss index 54b0d04..d04eb3b 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -138,3 +138,41 @@ table td.mat-footer-cell:last-of-type{ #shareDialog,#lookPlanDialog,#openPlanToolDialog{ padding: 0; } + +#setPosition{ + .custom-content-marker { + position: relative; + width: 29px; + height: 36px; + } + + .custom-content-marker img { + width: 100%; + height: 100%; + } + + .custom-content-marker .btnbox { + position: absolute; + left: -20px; + bottom: -36px; + width: 68px; + height: 30px; + background:#FFFFFF; + border-radius: 60px; + color: #EBEBEB; + display: flex; + justify-content: space-around; + box-sizing: border-box; + padding: 0 5px; + align-items: center; + img{ + width: 20px; + height: 20px; + cursor: pointer; + } + } + + .custom-content-marker .close-btn:hover{ + background: #666; + } +} \ No newline at end of file From b7d39aa1cf95003d06190705db342307b6342761 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Fri, 25 Dec 2020 17:26:12 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[=E4=BF=AE=E6=94=B9]=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=99=BB=E5=BD=95logo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/pages/login/login.component.html | 4 ++-- src/assets/images/消防徽.png | Bin 0 -> 1044126 bytes 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 src/assets/images/消防徽.png diff --git a/src/app/pages/login/login.component.html b/src/app/pages/login/login.component.html index 0ed8f33..f60da23 100644 --- a/src/app/pages/login/login.component.html +++ b/src/app/pages/login/login.component.html @@ -1,9 +1,9 @@