chenjingyu 4 years ago
parent
commit
19c7f54d3c
  1. 6
      src/app/key-unit/basicinfo/basicinfo.component.html
  2. 54
      src/app/key-unit/basicinfo/basicinfo.component.ts
  3. 2
      src/styles.scss

6
src/app/key-unit/basicinfo/basicinfo.component.html

@ -41,7 +41,7 @@
<span style="color: red;">*</span>
<span>联系人:</span>
<mat-form-field>
<input readonly matInput id="linkman" name="linkman" type='text'
<input matInput id="linkman" name="linkman" type='text'
required minlength="1"
[(ngModel)]="unitinfo.contacts"
(focus)="closeorganizationbox()"
@ -52,7 +52,7 @@
<span style="color: red;">*</span>
<span>联系电话:</span>
<mat-form-field>
<input readonly matInput id="linkphone" name="linkphone" type='text' #linkphone="ngModel"
<input matInput id="linkphone" name="linkphone" type='text' #linkphone="ngModel"
required pattern="^(?:\+?86)?1(?:3\d{3}|5[^4\D]\d{2}|8\d{3}|7(?:[35-8]\d{2}|4(?:0\d|1[0-2]|9\d))|9[0135-9]\d{2}|66\d{2})\d{6}$"
[(ngModel)]="unitinfo.phone"
(focus)="closeorganizationbox()"
@ -99,7 +99,7 @@
<span style="color: red;">*</span>
<span>单位地址:</span>
<mat-form-field class="longInput">
<input readonly matInput id="unitaddress" name="unitaddress" type='text'
<input matInput id="unitaddress" name="unitaddress" type='text'
required minlength="1"
[(ngModel)]="unitinfo.address"
(focus)="closeorganizationbox()">

54
src/app/key-unit/basicinfo/basicinfo.component.ts

@ -264,7 +264,32 @@ export class BasicinfoComponent implements OnInit {
this.map.setCenter([this.markerPosition.x,this.markerPosition.y]); //设置地图中心点
this.map.add(this.newPositionMarker);
})
//点击确定
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'touchstart',(event)=>{
this.map.clearMap();
this.isGisTopBox = true
this.isGisTopBoxTwo = false
this.newPositionMarker = new AMap.Marker({
position: [this.markerPosition2.x,this.markerPosition2.y],
content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18)
});
this.markerPosition = this.markerPosition2
this.map.add(this.newPositionMarker);
})
//点击取消
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionClose'),'touchstart',(event)=>{
this.isGisTopBox = true
this.isGisTopBoxTwo = false
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.setCenter([this.markerPosition.x,this.markerPosition.y]); //设置地图中心点
this.map.add(this.newPositionMarker);
})
}else{
// console.log('未标注单位位置')
if(this.newPositionMarker){
@ -294,6 +319,7 @@ export class BasicinfoComponent implements OnInit {
}
this.newPositionMarker.on('dragend', (e)=>{
this.markerPosition2 = {x: e.lnglat.lng, y: e.lnglat.lat}
})
//点击确定
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'click',(event)=>{
@ -308,6 +334,18 @@ export class BasicinfoComponent implements OnInit {
});
this.map.add(this.newPositionMarker);
})
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'touchstart',(event)=>{
this.isGisTopBox = true
this.isGisTopBoxTwo = false
this.markerPosition = this.markerPosition2
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
@ -322,6 +360,20 @@ export class BasicinfoComponent implements OnInit {
this.map.add(this.newPositionMarker);
}
})//取消
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionClose'),'touchstart',(event)=>{
this.map.clearMap();
this.isGisTopBox = true
this.isGisTopBoxTwo = false
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.setCenter([this.markerPosition.x,this.markerPosition.y]); //设置地图中心点
this.map.add(this.newPositionMarker);
}
})//取消
}

2
src/styles.scss

@ -7,7 +7,9 @@
font-family: Regular;
src: url('./assets/font/SourceHanSansCN-Regular.otf'),
}
html,body{
touch-action: none;
width: 100%;
height:100%;
margin:0 auto;

Loading…
Cancel
Save