chenjingyu 4 years ago
parent
commit
ec9edb3eb5
  1. 29
      src/app/key-unit/basicinfo-look/basicinfo.component.html
  2. 58
      src/app/key-unit/basicinfo-look/basicinfo.component.scss
  3. 263
      src/app/key-unit/basicinfo-look/basicinfo.component.ts
  4. 39
      src/app/key-unit/basicinfo/basicinfo.component.html
  5. 84
      src/app/key-unit/basicinfo/basicinfo.component.scss
  6. 268
      src/app/key-unit/basicinfo/basicinfo.component.ts
  7. 2
      src/app/key-unit/edit-plan-info/edit-plan-info.component.html
  8. 5
      src/app/key-unit/key-unit-management/key-unit-management.component.html
  9. 10
      src/app/key-unit/key-unit-management/key-unit-management.component.scss
  10. 5
      src/app/key-unit/key-unit-management/key-unit-management.component.ts
  11. 4
      src/app/pages/login/login.component.html
  12. BIN
      src/assets/images/close.png
  13. BIN
      src/assets/images/newposition.png
  14. BIN
      src/assets/images/ok.png
  15. BIN
      src/assets/images/oldposition.png
  16. BIN
      src/assets/images/消防徽.png
  17. 38
      src/styles.scss

29
src/app/key-unit/basicinfo-look/basicinfo.component.html

@ -99,9 +99,32 @@
<button type="submit" color="primary" class="submit1" mat-button mat-raised-button>保存</button> <button type="submit" color="primary" class="submit1" mat-button mat-raised-button>保存</button>
</div> --> </div> -->
</div> </div>
<!-- <div class="mainright" (click)="closeorganizationbox()"> --> <div class="mainright" id="setPosition">
<!-- 地图预留位置 --> <div style="width: 100%;height: 100%;" id="container">
<!-- </div> -->
</div>
<div class="gistopbox" *ngIf="isGisTopBox">
<div class="positionItem">
<span>
经度 :
</span>
<div class="itemNum">
{{markerPosition.x || '暂未标注'}}
</div>
</div>
<div class="positionItem">
<span>
纬度 :
</span>
<div class="itemNum">
{{markerPosition.y || '暂未标注'}}
</div>
</div>
<!-- <div class="setPosition" (click)="setPosition()">
<mat-icon style="width: 22px;height: 22px;font-size: 22px;">place</mat-icon> 位置
</div> -->
</div>
</div>
</div> </div>
</form> </form>
</div> </div>

58
src/app/key-unit/basicinfo-look/basicinfo.component.scss

@ -5,6 +5,7 @@
.mainbox{ .mainbox{
height: 100%; height: 100%;
position: relative; position: relative;
display: flex;
.mainleft{ .mainleft{
width:800px; width:800px;
height: 100%; height: 100%;
@ -94,11 +95,60 @@
} }
.mainright{ .mainright{
float: left; float: left;
width: 600px; flex: 1;
height: 400px; height: 430px;
// position: absolute; margin-right: 100px;
// right: 170px; 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;
}
}
} }
} }
} }

263
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 { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree';
import { FlatTreeControl } from '@angular/cdk/tree'; import { FlatTreeControl } from '@angular/cdk/tree';
import { HttpClient,HttpHeaders, HttpEventType } from '@angular/common/http'; import { HttpClient,HttpHeaders, HttpEventType } from '@angular/common/http';
@ -19,7 +19,7 @@ import * as _ from 'lodash';
// import Swiper from 'swiper'; // import Swiper from 'swiper';
import { LookMaster2 } from './lookmaster.component' import { LookMaster2 } from './lookmaster.component'
import { Router,ActivatedRoute } from '@angular/router' import { Router,ActivatedRoute } from '@angular/router'
declare var AMap: any;
@Component({ @Component({
selector: 'app-basicinfo-look', selector: 'app-basicinfo-look',
templateUrl: './basicinfo.component.html', templateUrl: './basicinfo.component.html',
@ -83,7 +83,7 @@ export class BasicinfoLookComponent implements OnInit {
buildingCustomData:any //存储当前建筑的自定义信息 buildingCustomData:any //存储当前建筑的自定义信息
allunittype: any //所有单位类型 allunittype: any //所有单位类型
allorganizing: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 unitId : any //当前单位id
@ -94,6 +94,163 @@ export class BasicinfoLookComponent implements OnInit {
this.getunitallbuilding() this.getunitallbuilding()
this.unitId = this.route.snapshot.queryParams.id 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 =
'<div class="custom-content-marker">' +
' <img src="/assets/images/newposition.png">' +
'</div>'
newPositionMarkerContentBtn:any =
'<div class="custom-content-marker">' +
' <img src="/assets/images/newposition.png">' +
' <div class="btnbox"><img id="setPositionOk" src="/assets/images/ok.png"><span>|</span><img id="setPositionClose" src="/assets/images/close.png"></div>' +
'</div>'
oldPositionMarkerContent:any =
'<div class="custom-content-marker">' +
' <img src="/assets/images/oldposition.png">' +
'</div>'
//初始化地图
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() { getallunittype() {
this.http.get("/api/BuildingTypes/Simple").subscribe(data => { this.http.get("/api/BuildingTypes/Simple").subscribe(data => {
@ -106,59 +263,71 @@ export class BasicinfoLookComponent implements OnInit {
(data: any) => { (data: any) => {
this.allorganizing = data; this.allorganizing = data;
this.dataSource.data = this.tree.toTree(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(){ async getunitinfo(){
let result = await new Promise((resolve, reject) => {
this.http.get(`/api/Companies/${this.unitId}`).subscribe((data:any)=>{ this.http.get(`/api/Companies/${this.unitId}`).subscribe((data:any)=>{
// console.log(111,data) // console.log(111,data)
if(data.buildingTypes.length){ if(data.buildingTypes.length){
sessionStorage.setItem('buildingTypeId',data.buildingTypes[0].id) 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
}else{ }else{
let namearr = [node.name] sessionStorage.setItem('buildingTypeId',"")
let targetId = node.parentId; // 临时变量 }
for(let i = 0; i < node.level ; i++){ let node
this.allorganizing.forEach(item => { this.allorganizing.forEach(item => {
if(item.id == targetId ){ if(item.id == data.organizationId){
namearr.push(item.name) node = item
targetId = item.parentId; // 临时变量更新没有副作用 }
} });
}); 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.unitinfo = data
this.selectedorganizationid = data.organizationId resolve(this.unitinfo)
if(data.imageUrl){ this.selectedorganizationid = data.organizationId
this.imgsrc = data.imageUrl if(data.imageUrl){
} this.imgsrc = data.imageUrl
if(data.buildingTypes[0]){ }
this.defaultbuildingTypes = data.buildingTypes[0].id if(data.buildingTypes[0]){
this.buildingTypesname = data.buildingTypes[0].name this.defaultbuildingTypes = data.buildingTypes[0].id
} this.buildingTypesname = data.buildingTypes[0].name
}
})
}) })
} }
unitallbuilding:any = []//用于存储当前单位所有的建筑 unitallbuilding:any = []//用于存储当前单位所有的建筑
buildinginfoId:any = []//用于存储当前单位所有具体建筑的id buildinginfoId:any = []//用于存储当前单位所有具体建筑的id

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

@ -119,9 +119,32 @@
<button type="submit" color="primary" class="submit1" mat-button mat-raised-button>保存</button> <button type="submit" color="primary" class="submit1" mat-button mat-raised-button>保存</button>
</div> </div>
</div> </div>
<!-- <div class="mainright" (click)="closeorganizationbox()"> --> <div class="mainright" id="setPosition">
<!-- 地图预留位置 --> <div style="width: 100%;height: 100%;" id="container">
<!-- </div> -->
</div>
<div class="gistopbox" *ngIf="isGisTopBox">
<div class="positionItem">
<span>
经度 :
</span>
<div class="itemNum">
{{markerPosition.x || '暂未标注'}}
</div>
</div>
<div class="positionItem">
<span>
纬度 :
</span>
<div class="itemNum">
{{markerPosition.y || '暂未标注'}}
</div>
</div>
<div class="setPosition" (click)="setPosition()">
<mat-icon style="width: 22px;height: 22px;font-size: 22px;">place</mat-icon> 位置
</div>
</div>
</div>
</div> </div>
</form> </form>
</div> </div>
@ -131,7 +154,7 @@
<!-- body --> <!-- body -->
<div class="bottombox" style="flex: 70%;overflow-y: auto;" > <div class="bottombox" style="flex: 70%;overflow-y: auto;" >
<div class="houseinfobox" style="height: 100%; overflow-y: auto;padding-bottom: 64px; box-sizing:border-box"> <div class="houseinfobox" style="height: 100%; overflow-y: auto;box-sizing:border-box">
<button type="button" mat-icon-button (click)="addhouseinfo()" class="addhouseinfo"><mat-icon style="font-size: 38px;">add_circle_outline</mat-icon></button> <button type="button" mat-icon-button (click)="addhouseinfo()" class="addhouseinfo"><mat-icon style="font-size: 38px;">add_circle_outline</mat-icon></button>
<mat-tab-group style="height: 100%;;" (focusChange)="selecttab($event)" > <mat-tab-group style="height: 100%;;" (focusChange)="selecttab($event)" >
<mat-tab [label]="item.username" *ngFor="let item of houses;let key = index"> <mat-tab [label]="item.username" *ngFor="let item of houses;let key = index">
@ -195,7 +218,7 @@
</div> </div>
<div class="CustomData" style="width: 200px;"> <div class="CustomData" style="width: 200px;">
<mat-checkbox (change)="checkCustomData($event)" name="checkbuilding" [(ngModel)]="item.isCustomData" style="float: left;margin-right: 10px;"></mat-checkbox> <mat-checkbox color="primary" (change)="checkCustomData($event)" name="checkbuilding" [(ngModel)]="item.isCustomData" style="float: left;margin-right: 10px;"></mat-checkbox>
<h1 style="font-size: 22px;width: 200px;">自定义信息</h1> <h1 style="font-size: 22px;width: 200px;">自定义信息</h1>
</div> </div>
<div *ngIf="item.isCustomData" style="position: relative;"> <div *ngIf="item.isCustomData" style="position: relative;">
@ -278,7 +301,7 @@
<div class="deviceinfo"> <div class="deviceinfo">
<div style="width: 200px;"> <div style="width: 200px;">
<mat-checkbox (change)="checkboxchange(item.buildingBasicGroups[1].submitted,$event)" name="item.buildingBasicGroups[1].name" *ngIf="item.buildingBasicGroups[1].isOptional" [(ngModel)]="item.buildingBasicGroups[1].submitted" style="float: left;margin-right: 10px;"></mat-checkbox> <mat-checkbox color="primary" (change)="checkboxchange(item.buildingBasicGroups[1].submitted,$event)" name="item.buildingBasicGroups[1].name" *ngIf="item.buildingBasicGroups[1].isOptional" [(ngModel)]="item.buildingBasicGroups[1].submitted" style="float: left;margin-right: 10px;"></mat-checkbox>
<h1 style="font-size: 22px;width: 200px;">{{item.buildingBasicGroups[1].name}}</h1> <h1 style="font-size: 22px;width: 200px;">{{item.buildingBasicGroups[1].name}}</h1>
</div> </div>
@ -316,7 +339,7 @@
</div> </div>
<div style="width: 200px;"> <div style="width: 200px;">
<mat-checkbox (change)="checkboxchange(item,$event)" *ngIf="item.buildingBasicGroups[2].isOptional" name="item.buildingBasicGroups[2].name" [(ngModel)]="item.buildingBasicGroups[2].submitted" style="float: left;margin-right: 10px;"></mat-checkbox> <mat-checkbox color="primary" (change)="checkboxchange(item,$event)" *ngIf="item.buildingBasicGroups[2].isOptional" name="item.buildingBasicGroups[2].name" [(ngModel)]="item.buildingBasicGroups[2].submitted" style="float: left;margin-right: 10px;"></mat-checkbox>
<h1 style="font-size: 22px;width: 200px;">储罐信息</h1> <h1 style="font-size: 22px;width: 200px;">储罐信息</h1>
</div> </div>
@ -480,7 +503,7 @@
<div class="CustomData" style="width: 200px;margin-top: 60px;"> <div class="CustomData" style="width: 200px;margin-top: 60px;">
<mat-checkbox (change)="checkCustomData($event)" name="checkbuilding" [(ngModel)]="item.isCustomData" style="float: left;margin-right: 10px;"></mat-checkbox> <mat-checkbox color="primary" (change)="checkCustomData($event)" name="checkbuilding" [(ngModel)]="item.isCustomData" style="float: left;margin-right: 10px;"></mat-checkbox>
<h1 style="font-size: 22px;width: 200px;">自定义信息</h1> <h1 style="font-size: 22px;width: 200px;">自定义信息</h1>
</div> </div>
<div *ngIf="item.isCustomData" style="position: relative;"> <div *ngIf="item.isCustomData" style="position: relative;">

84
src/app/key-unit/basicinfo/basicinfo.component.scss

@ -5,10 +5,10 @@
.mainbox{ .mainbox{
height: 100%; height: 100%;
position: relative; position: relative;
display: flex;
.mainleft{ .mainleft{
width:800px; width:800px;
height: 100%; height: 100%;
// background-color: yellow;
float: left; float: left;
.inputbox{ .inputbox{
width: 343px; width: 343px;
@ -40,13 +40,7 @@
} }
.addbtn{ .addbtn{
width: 695px; width: 695px;
position: absolute; margin:9px 0;
bottom: -495px;
text-align: center;
margin-bottom:20px;
button{
margin: 0 4px;
}
} }
.uploadimg{ .uploadimg{
width: 400px; width: 400px;
@ -55,18 +49,13 @@
margin-top:12px; margin-top:12px;
position: relative; position: relative;
margin-left: 80px; margin-left: 80px;
cursor: pointer;
span{ span{
float: left; float: left;
} }
// img{
// float: left;
// }
.uploadingimg{ .uploadingimg{
width: 299px; width: 299px;
height: 170px; height: 170px;
// background: url('../../../assets/images/upload2.png') no-repeat center center; cursor: pointer;
position: absolute; position: absolute;
top: 0px; top: 0px;
left: 79px; left: 79px;
@ -76,30 +65,71 @@
} }
.image{ .image{
// position: absolute;
// top: 199px;
// left: 160px;
// width: 299px;
// height: 170px;
input{ input{
// width: 299px;
// height: 170px;
width: 190px; width: 190px;
margin-top: 160px; margin-top: 160px;
cursor: pointer; cursor: pointer;
} }
// opacity:0;
} }
} }
.mainright{ .mainright{
float: left; float: left;
width: 600px; flex: 1;
height: 400px; height: 430px;
// position: absolute; margin-right: 100px;
// right: 170px; 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{ .bottombox{

268
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 { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree';
import { FlatTreeControl } from '@angular/cdk/tree'; import { FlatTreeControl } from '@angular/cdk/tree';
import { HttpClient,HttpHeaders, HttpEventType } from '@angular/common/http'; import { HttpClient,HttpHeaders, HttpEventType } from '@angular/common/http';
@ -21,6 +21,7 @@ import * as _ from 'lodash';
import { LookMaster } from './lookmaster.component' import { LookMaster } from './lookmaster.component'
import { Router,ActivatedRoute } from '@angular/router' import { Router,ActivatedRoute } from '@angular/router'
import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service'; import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service';
declare var AMap: any;
@Component({ @Component({
selector: 'app-basicinfo', selector: 'app-basicinfo',
@ -85,7 +86,7 @@ export class BasicinfoComponent implements OnInit {
buildingCustomData:any //存储当前建筑的自定义信息 buildingCustomData:any //存储当前建筑的自定义信息
allunittype: any //所有单位类型 allunittype: any //所有单位类型
allorganizing: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 unitId : any //当前单位id
@ -97,6 +98,166 @@ export class BasicinfoComponent implements OnInit {
this.unitId = this.route.snapshot.queryParams.id this.unitId = this.route.snapshot.queryParams.id
sessionStorage.setItem("companyId",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 =
'<div class="custom-content-marker">' +
' <img src="/assets/images/newposition.png">' +
'</div>'
newPositionMarkerContentBtn:any =
'<div class="custom-content-marker">' +
' <img src="/assets/images/newposition.png">' +
' <div class="btnbox"><img id="setPositionOk" src="/assets/images/ok.png"><span>|</span><img id="setPositionClose" src="/assets/images/close.png"></div>' +
'</div>'
oldPositionMarkerContent:any =
'<div class="custom-content-marker">' +
' <img src="/assets/images/oldposition.png">' +
'</div>'
//初始化地图
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() { getallunittype() {
this.http.get("/api/BuildingTypes/Simple").subscribe(data => { this.http.get("/api/BuildingTypes/Simple").subscribe(data => {
@ -109,59 +270,71 @@ export class BasicinfoComponent implements OnInit {
(data: any) => { (data: any) => {
this.allorganizing = data; this.allorganizing = data;
this.dataSource.data = this.tree.toTree(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 CompanyId
getunitinfo(){ async getunitinfo(){
let result = await new Promise((resolve, reject) => {
this.http.get(`/api/Companies/${this.unitId}`).subscribe((data:any)=>{ this.http.get(`/api/Companies/${this.unitId}`).subscribe((data:any)=>{
if(data.buildingTypes.length){ if(data.buildingTypes.length){
sessionStorage.setItem('buildingTypeId',data.buildingTypes[0].id) 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
}else{ }else{
let namearr = [node.name] sessionStorage.setItem('buildingTypeId',"")
let targetId = node.parentId; // 临时变量 }
for(let i = 0; i < node.level ; i++){ let node
this.allorganizing.forEach(item => { this.allorganizing.forEach(item => {
if(item.id == targetId ){ if(item.id == data.organizationId){
namearr.push(item.name) node = item
targetId = item.parentId; // 临时变量更新没有副作用 }
} });
}); 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.unitinfo = data
this.selectedorganizationid = data.organizationId resolve(this.unitinfo)
if(data.imageUrl){ this.selectedorganizationid = data.organizationId
this.imgsrc = data.imageUrl if(data.imageUrl){
} this.imgsrc = data.imageUrl
if(data.buildingTypes[0]){ }
this.defaultbuildingTypes = data.buildingTypes[0].id if(data.buildingTypes[0]){
this.buildingTypesname = data.buildingTypes[0].name this.defaultbuildingTypes = data.buildingTypes[0].id
} this.buildingTypesname = data.buildingTypes[0].name
}
})
}) })
} }
//石油化工 装置信息 勾选框 //石油化工 装置信息 勾选框
checkboxchange(item,e){ checkboxchange(item,e){
@ -1012,10 +1185,7 @@ export class BasicinfoComponent implements OnInit {
phone: value.linkphone, phone: value.linkphone,
address: value.unitaddress, address: value.unitaddress,
imageUrl: this.imgsrc, imageUrl: this.imgsrc,
location: { location: this.markerPosition,
x: 0,
y: 0
},
modifiedTime: time, modifiedTime: time,
organizationId: this.selectedorganizationid, organizationId: this.selectedorganizationid,
organizationName: null, organizationName: null,

2
src/app/key-unit/edit-plan-info/edit-plan-info.component.html

@ -1,7 +1,7 @@
<mat-tab-group selectedIndex="0" style="height: 97%;" > <mat-tab-group selectedIndex="0" style="height: 100%;" >
<mat-tab label="1.基本信息"> <mat-tab label="1.基本信息">
<ng-template matTabContent> <ng-template matTabContent>
<app-basicinfo></app-basicinfo> <app-basicinfo></app-basicinfo>

5
src/app/key-unit/key-unit-management/key-unit-management.component.html

@ -108,7 +108,10 @@
</ng-container> </ng-container>
<ng-container matColumnDef="unitname"> <ng-container matColumnDef="unitname">
<th mat-header-cell *matHeaderCellDef>单位名称</th> <th mat-header-cell *matHeaderCellDef>单位名称</th>
<td mat-cell *matCellDef="let element">{{element.name}}</td> <td mat-cell *matCellDef="let element">
{{element.name}}
<mat-icon class="editUnitName" (click)="editUnitName(element)">create</mat-icon>
</td>
</ng-container> </ng-container>
<ng-container matColumnDef="integrity" > <ng-container matColumnDef="integrity" >

10
src/app/key-unit/key-unit-management/key-unit-management.component.scss

@ -86,6 +86,16 @@
width: 100%; width: 100%;
// margin-top: 30px; // margin-top: 30px;
} }
.editUnitName{
width: 13px;
height: 13px;
font-size: 18px;
vertical-align: sub;
cursor: pointer;
}
.editUnitName:hover{
color: red;
}
} }
} }

5
src/app/key-unit/key-unit-management/key-unit-management.component.ts

@ -546,7 +546,10 @@ export class KeyUnitManagementComponent implements OnInit {
this.integritySort = '' this.integritySort = ''
this.getAllKeyUnit(); this.getAllKeyUnit();
} }
//编辑单位名称
editUnitName(element){
console.log(element)
}
//跳转查看基本信息页面 //跳转查看基本信息页面
unitdetails(element){ unitdetails(element){
console.log(element) console.log(element)

4
src/app/pages/login/login.component.html

@ -1,9 +1,9 @@
<div class="login"> <div class="login">
<div class="intro"> <div class="intro">
<div style="display: flex; margin-top: 20%;margin-left: 10%"> <div style="display: flex; margin-top: 20%;margin-left: 12%">
<div class="logo"> <div class="logo">
<img src="../../../assets/images/filelogo.png" alt=""> <img style="width: 230px;height: 234px;" src="../../../assets/images/消防徽.png" alt="">
</div> </div>
<div class="text"> <div class="text">
<span style="font-size: 36px;color: white; display: block;margin-bottom: 35px;">数字化预案编制管理平台</span> <span style="font-size: 36px;color: white; display: block;margin-bottom: 35px;">数字化预案编制管理平台</span>

BIN
src/assets/images/close.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

BIN
src/assets/images/newposition.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
src/assets/images/ok.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

BIN
src/assets/images/oldposition.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
src/assets/images/消防徽.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1020 KiB

38
src/styles.scss

@ -138,3 +138,41 @@ table td.mat-footer-cell:last-of-type{
#shareDialog,#lookPlanDialog,#openPlanToolDialog{ #shareDialog,#lookPlanDialog,#openPlanToolDialog{
padding: 0; 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;
}
}
Loading…
Cancel
Save