|
|
|
@ -1,4 +1,13 @@
|
|
|
|
|
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'; |
|
|
|
|
declare var AMap: any; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
@ -8,7 +17,7 @@ declare var AMap: any;
|
|
|
|
|
}) |
|
|
|
|
export class FireForceComponent 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){ |
|
|
|
@ -19,6 +28,7 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
integrityNum:'' |
|
|
|
|
} |
|
|
|
|
listIntegrityNum:any[] = [ |
|
|
|
|
{id:-1,name:'全部'}, |
|
|
|
|
{id:0,name:'<=50%'}, |
|
|
|
|
{id:1,name:'50%-60%'}, |
|
|
|
|
{id:2,name:'60%-70%'}, |
|
|
|
@ -30,34 +40,595 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
{id:0,name:'总队'}, |
|
|
|
|
{id:1,name:'支队'}, |
|
|
|
|
{id:2,name:'大队'}, |
|
|
|
|
{id:3,name:'中队 (消防站)'}, |
|
|
|
|
{id:3,name:'中队(消防站)'}, |
|
|
|
|
{id:4,name:'其他消防队伍'} |
|
|
|
|
] |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
ngOnInit(): void {
|
|
|
|
|
this.getAllFireForce() |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.createMap() |
|
|
|
|
}, 0); |
|
|
|
|
} |
|
|
|
|
//获得所有消防力量
|
|
|
|
|
getAllFireForce(){ |
|
|
|
|
this.http.get('/api/CustomFireForce').subscribe((data:any) => { |
|
|
|
|
this.dataSource.data = this.tree.toTree(data) |
|
|
|
|
const nodes = this.treeControl.dataNodes; |
|
|
|
|
const expandNodes = []; |
|
|
|
|
nodes.forEach((item) => { |
|
|
|
|
if(item.expandable && this.treeControl.isExpanded(item)){ |
|
|
|
|
expandNodes.push(item.id); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
// this.dataSource.data = this.newdata;
|
|
|
|
|
let newNodes = this.treeControl.dataNodes; |
|
|
|
|
newNodes = newNodes.filter(n => { |
|
|
|
|
return expandNodes.indexOf(n.id) >= 0; |
|
|
|
|
}); |
|
|
|
|
console.log(newNodes) |
|
|
|
|
newNodes.forEach(item => { |
|
|
|
|
this.treeControl.expand(item); |
|
|
|
|
}); |
|
|
|
|
console.log('所有消防力量',data) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
private _transformer = (node, level: number) => {//要给渲染节点传那些属性参数
|
|
|
|
|
return { |
|
|
|
|
expandable: !!node.children && node.children.length > 0, |
|
|
|
|
name: node.name, |
|
|
|
|
level: level, |
|
|
|
|
id: node.id, |
|
|
|
|
parentId: node.parentId, |
|
|
|
|
enabled:node.enabled, |
|
|
|
|
order:node.order, |
|
|
|
|
children:node.children, |
|
|
|
|
code:node.code, |
|
|
|
|
division:node.division, |
|
|
|
|
fireForceDetailId:node.fireForceDetailId, |
|
|
|
|
forceType:node.forceType |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
treeControl = new FlatTreeControl<any>(node => node.level, node => node.expandable); |
|
|
|
|
treeFlattener = new MatTreeFlattener(this._transformer, node => node.level, node => node.expandable, node => node.children); |
|
|
|
|
dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener); |
|
|
|
|
hasChild = (_: number, node: any) => node.expandable; |
|
|
|
|
selectedFireForceId:any |
|
|
|
|
selectedFireForceLevel:any |
|
|
|
|
selectedFireForce:any |
|
|
|
|
//选择要显示的消防力量
|
|
|
|
|
selectTreeNode(node){ |
|
|
|
|
console.log(node) |
|
|
|
|
if(this.selectedFireForceId != node.id){ |
|
|
|
|
this.clearData() |
|
|
|
|
|
|
|
|
|
this.selectedFireForce = node |
|
|
|
|
this.selectedFireForceId = node.id |
|
|
|
|
this.selectedFireForceLevel = node.level |
|
|
|
|
this.FireForceDetailInfo.stationName = node.name |
|
|
|
|
if(this.newPositionMarker){ |
|
|
|
|
this.map.remove(this.newPositionMarker); |
|
|
|
|
} |
|
|
|
|
if(node.fireForceDetailId ){ |
|
|
|
|
this.isPost = false//是否走post创建接口
|
|
|
|
|
let type |
|
|
|
|
if(node.forceType == 0){ |
|
|
|
|
type = 0 |
|
|
|
|
}else{ |
|
|
|
|
type = 1 |
|
|
|
|
} |
|
|
|
|
this.http.get(`/api/FireForceDetail/${type}/${node.id}`).subscribe((data:any) => { |
|
|
|
|
console.log('当前详情',data) |
|
|
|
|
this.FireForceDetailInfo = data |
|
|
|
|
|
|
|
|
|
if(data.location && data.location.x){//如果已经标注单位坐标
|
|
|
|
|
console.log('开始标注') |
|
|
|
|
this.positionLngLat = data.location |
|
|
|
|
this.map.setCenter([data.location.x,data.location.y]); |
|
|
|
|
this.newPositionMarker = new AMap.Marker({ |
|
|
|
|
position: [data.location.x,data.location.y], |
|
|
|
|
content: this.newPositionMarkerContent, |
|
|
|
|
offset: new AMap.Pixel(-15, -18) |
|
|
|
|
}) |
|
|
|
|
// 将 markers 添加到地图
|
|
|
|
|
this.map.add(this.newPositionMarker); |
|
|
|
|
} |
|
|
|
|
if(this.selectedFireForceLevel == 0){ |
|
|
|
|
this.ZongpersonCountData = JSON.parse(data.personCountData) |
|
|
|
|
this.ZongcontactData = JSON.parse(data.contactData) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//搜索
|
|
|
|
|
searchList(){ |
|
|
|
|
console.log(this.searchForm) |
|
|
|
|
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(); |
|
|
|
|
} |
|
|
|
|
}
|
|
|
|
|
//点击水源列表
|
|
|
|
|
selectedLiIndex:any
|
|
|
|
|
clickWaterLi(item,index){ |
|
|
|
|
// console.log(item)
|
|
|
|
|
// if(this.selectedLiIndex != index){
|
|
|
|
|
// this.selectedLiIndex = index
|
|
|
|
|
// this.clearData()
|
|
|
|
|
// // this.selectedWaterTypeIndex = item.waterSourceType//点击的水源类型
|
|
|
|
|
// this.waterData = item
|
|
|
|
|
// item.waterSourceType == 0 && item.detailData ? this.fireCockData = JSON.parse(item.detailData) : null
|
|
|
|
|
// item.waterSourceType == 1 && item.detailData ? this.poolData = JSON.parse(item.detailData) : null
|
|
|
|
|
// item.waterSourceType == 2 && item.detailData ? this.naturalWaterData = JSON.parse(item.detailData) : null
|
|
|
|
|
// this.positionLngLat = item.location
|
|
|
|
|
// if(this.newPositionMarker){
|
|
|
|
|
// this.map.remove(this.newPositionMarker);
|
|
|
|
|
// }
|
|
|
|
|
// if(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);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
//完整度颜色
|
|
|
|
|
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 |
|
|
|
|
} |
|
|
|
|
//删除某条消防队
|
|
|
|
|
deleteWater(item,e){ |
|
|
|
|
e.stopPropagation() |
|
|
|
|
let isDelete = window.confirm(`确定要删除${item.name}吗`) |
|
|
|
|
if(isDelete){ |
|
|
|
|
// this.http.delete(`/api/WaterSources/${item.id}`).subscribe(data => {
|
|
|
|
|
// const config = new MatSnackBarConfig();
|
|
|
|
|
// config.verticalPosition = 'top';
|
|
|
|
|
// config.duration = 3000
|
|
|
|
|
// this.snackBar.open('删除成功','确定',config);
|
|
|
|
|
// })
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//当前点击tab页面第几个
|
|
|
|
|
tabIndex:any = 1 |
|
|
|
|
selectedTab(index){ |
|
|
|
|
this.tabIndex = index |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//消防力量详情提交信息
|
|
|
|
|
FireForceDetailInfo:any = { |
|
|
|
|
// id:'',//编号
|
|
|
|
|
stationName:'',//队站名称
|
|
|
|
|
isIndependentAlarm:true,//是否独立报警
|
|
|
|
|
phoneNumber:'',//联系电话
|
|
|
|
|
faxNumber:'',//传真
|
|
|
|
|
jurisdictionArea:null,//辖区面积
|
|
|
|
|
remark:'',//备注
|
|
|
|
|
address:'',//地址
|
|
|
|
|
location:null, |
|
|
|
|
personCountData:[],//人员数量自定义
|
|
|
|
|
contactData:[],//联系方式自定义
|
|
|
|
|
dutyForceData:[]//执勤力量自定义
|
|
|
|
|
} |
|
|
|
|
//总队支队人员数量
|
|
|
|
|
ZongpersonCountData:any=[ |
|
|
|
|
{PropertyName :'现役官兵人数',PropertyValue:''}, |
|
|
|
|
{PropertyName :'政府专职消防员数',PropertyValue:''}, |
|
|
|
|
{PropertyName :'消防文员数',PropertyValue:''} |
|
|
|
|
] |
|
|
|
|
//总队联系方式
|
|
|
|
|
ZongcontactData:any=[ |
|
|
|
|
{PropertyName :'总队长名称',PropertyValue:''}, |
|
|
|
|
{PropertyName :'总队长联系方式',PropertyValue:''}, |
|
|
|
|
{PropertyName :'总队政委名称',PropertyValue:''}, |
|
|
|
|
{PropertyName :'总队政委联系方式',PropertyValue:''} |
|
|
|
|
] |
|
|
|
|
//支队联系方式
|
|
|
|
|
ZhicontactData:any=[ |
|
|
|
|
{PropertyName :'支队长名称',PropertyValue:''}, |
|
|
|
|
{PropertyName :'支队长联系方式',PropertyValue:''}, |
|
|
|
|
{PropertyName :'支队政委名称',PropertyValue:''}, |
|
|
|
|
{PropertyName :'支队政委联系方式',PropertyValue:''} |
|
|
|
|
] |
|
|
|
|
//大队中队人员数量
|
|
|
|
|
DaZhongpersonCountData:any=[ |
|
|
|
|
{PropertyName :'现役人员',PropertyValue:''}, |
|
|
|
|
{PropertyName :'政府专职消防员数',PropertyValue:''}, |
|
|
|
|
{PropertyName :'每日执勤人数',PropertyValue:''} |
|
|
|
|
] |
|
|
|
|
//大队中队联系方式
|
|
|
|
|
DaZhongcontactData:any=[ |
|
|
|
|
{PropertyName :'站长姓名',PropertyValue:''}, |
|
|
|
|
{PropertyName :'站长联系方式',PropertyValue:''}, |
|
|
|
|
{PropertyName :'指导员姓名',PropertyValue:''}, |
|
|
|
|
{PropertyName :'指导员联系方式',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副指导员姓名',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副指导员联系方式',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副站长一姓名',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副站长一联系方式',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副站长二姓名',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副站长二联系方式',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副站长三姓名',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副站长三联系方式',PropertyValue:''} |
|
|
|
|
] |
|
|
|
|
//其他消防力量联系方式
|
|
|
|
|
othercontactData:any = [ |
|
|
|
|
{PropertyName :'队长',PropertyValue:''}, |
|
|
|
|
{PropertyName :'联系方式',PropertyValue:''} |
|
|
|
|
] |
|
|
|
|
//其他消防力量人员数量
|
|
|
|
|
otherpersonCountData:any = [ |
|
|
|
|
{PropertyName :'每日执勤人数',PropertyValue:''}, |
|
|
|
|
{PropertyName :'消防队员总人数',PropertyValue:''}, |
|
|
|
|
{PropertyName :'执勤车辆数',PropertyValue:''}, |
|
|
|
|
{PropertyName :'灭火剂总量',PropertyValue:''} |
|
|
|
|
] |
|
|
|
|
//清空表单数据
|
|
|
|
|
clearData(){ |
|
|
|
|
this.positionLngLat = {x:'',y:''} |
|
|
|
|
this.FireForceDetailInfo = { |
|
|
|
|
// id:'',//编号
|
|
|
|
|
stationName:'',//队站名称
|
|
|
|
|
isIndependentAlarm:null,//是否独立报警
|
|
|
|
|
phoneNumber:'',//联系电话
|
|
|
|
|
faxNumber:'',//传真
|
|
|
|
|
jurisdictionArea:null,//辖区面积
|
|
|
|
|
remark:'',//备注
|
|
|
|
|
address:'',//地址
|
|
|
|
|
location:null, |
|
|
|
|
personCountData:[],//人员数量自定义
|
|
|
|
|
contactData:[],//联系方式自定义
|
|
|
|
|
dutyForceData:[]//执勤力量自定义
|
|
|
|
|
} |
|
|
|
|
this.ZongpersonCountData = [ |
|
|
|
|
{PropertyName :'现役官兵人数',PropertyValue:''}, |
|
|
|
|
{PropertyName :'政府专职消防员数',PropertyValue:''}, |
|
|
|
|
{PropertyName :'消防文员数',PropertyValue:''} |
|
|
|
|
] |
|
|
|
|
this.ZongcontactData = [ |
|
|
|
|
{PropertyName :'总队长名称',PropertyValue:''}, |
|
|
|
|
{PropertyName :'总队长联系方式',PropertyValue:''}, |
|
|
|
|
{PropertyName :'总队政委名称',PropertyValue:''}, |
|
|
|
|
{PropertyName :'总队政委联系方式',PropertyValue:''} |
|
|
|
|
] |
|
|
|
|
this.ZhicontactData = [ |
|
|
|
|
{PropertyName :'支队长名称',PropertyValue:''}, |
|
|
|
|
{PropertyName :'支队长联系方式',PropertyValue:''}, |
|
|
|
|
{PropertyName :'支队政委名称',PropertyValue:''}, |
|
|
|
|
{PropertyName :'支队政委联系方式',PropertyValue:''} |
|
|
|
|
] |
|
|
|
|
this.DaZhongpersonCountData = [ |
|
|
|
|
{PropertyName :'现役人员',PropertyValue:''}, |
|
|
|
|
{PropertyName :'政府专职消防员数',PropertyValue:''}, |
|
|
|
|
{PropertyName :'每日执勤人数',PropertyValue:''} |
|
|
|
|
] |
|
|
|
|
this.DaZhongcontactData = [ |
|
|
|
|
{PropertyName :'站长姓名',PropertyValue:''}, |
|
|
|
|
{PropertyName :'站长联系方式',PropertyValue:''}, |
|
|
|
|
{PropertyName :'指导员姓名',PropertyValue:''}, |
|
|
|
|
{PropertyName :'指导员联系方式',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副指导员姓名',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副指导员联系方式',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副站长一姓名',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副站长一联系方式',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副站长二姓名',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副站长二联系方式',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副站长三姓名',PropertyValue:''}, |
|
|
|
|
{PropertyName :'副站长三联系方式',PropertyValue:''} |
|
|
|
|
] |
|
|
|
|
this.othercontactData = [ |
|
|
|
|
{PropertyName :'队长',PropertyValue:''}, |
|
|
|
|
{PropertyName :'联系方式',PropertyValue:''} |
|
|
|
|
] |
|
|
|
|
this.otherpersonCountData = [ |
|
|
|
|
{PropertyName :'每日执勤人数',PropertyValue:''}, |
|
|
|
|
{PropertyName :'消防队员总人数',PropertyValue:''}, |
|
|
|
|
{PropertyName :'执勤车辆数',PropertyValue:''}, |
|
|
|
|
{PropertyName :'灭火剂总量',PropertyValue:''} |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
//新增水源
|
|
|
|
|
selectedFireForceTypeIndex:any//新增消防力量名称
|
|
|
|
|
addFireForce(){ |
|
|
|
|
if(this.selectedFireForceId){ |
|
|
|
|
const dialogRef = this.dialog.open(AddFireForce, { |
|
|
|
|
data: {}, |
|
|
|
|
id:'addWater' |
|
|
|
|
}); |
|
|
|
|
dialogRef.afterClosed().subscribe( |
|
|
|
|
data=>{ |
|
|
|
|
if(typeof data === 'number' && !isNaN(data)){ |
|
|
|
|
this.isPost = true |
|
|
|
|
this.selectedFireForceTypeIndex = data |
|
|
|
|
this.selectedFireForceLevel = data |
|
|
|
|
// this.newPositionMarker ? this.map.remove(this.newPositionMarker) : null
|
|
|
|
|
// this.positionLngLat.x = 0
|
|
|
|
|
// this.positionLngLat.y = 0
|
|
|
|
|
// this.map.setCity('上海市');
|
|
|
|
|
this.clearData() |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
}else{ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('请先从左侧列表选择一个组织机构','确定',config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//保存
|
|
|
|
|
isPost:boolean = false//是否走post创建接口
|
|
|
|
|
save(){ |
|
|
|
|
if(!this.FireForceDetailInfo.stationName){ |
|
|
|
|
alert('名称必填') |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
this.FireForceDetailInfo.jurisdictionArea = Number(this.FireForceDetailInfo.jurisdictionArea) |
|
|
|
|
//如果是总支大中
|
|
|
|
|
if(this.selectedFireForce.forceType == 0&&(this.selectedFireForceLevel == 0 || this.selectedFireForceLevel == 1 || this.selectedFireForceLevel == 2 || this.selectedFireForceLevel == 3)){//如果是总队
|
|
|
|
|
let body = this.FireForceDetailInfo |
|
|
|
|
if(this.atLastPositionLngLat.x){ |
|
|
|
|
this.FireForceDetailInfo.location.x = this.atLastPositionLngLat.x |
|
|
|
|
this.FireForceDetailInfo.location.y = this.atLastPositionLngLat.y |
|
|
|
|
} |
|
|
|
|
if(this.selectedFireForceLevel == 0){//总队
|
|
|
|
|
this.FireForceDetailInfo.personCountData = JSON.stringify(this.ZongpersonCountData)
|
|
|
|
|
this.FireForceDetailInfo.contactData = JSON.stringify(this.ZongcontactData) |
|
|
|
|
this.FireForceDetailInfo.dutyForceData = null |
|
|
|
|
} |
|
|
|
|
if(this.selectedFireForceLevel == 1){//支队
|
|
|
|
|
this.FireForceDetailInfo.personCountData = JSON.stringify(this.ZongpersonCountData)
|
|
|
|
|
this.FireForceDetailInfo.contactData = JSON.stringify(this.ZhicontactData) |
|
|
|
|
this.FireForceDetailInfo.dutyForceData = null |
|
|
|
|
} |
|
|
|
|
if(this.selectedFireForceLevel == 2 || this.selectedFireForceLevel == 3){//大队 中队
|
|
|
|
|
this.FireForceDetailInfo.personCountData = JSON.stringify(this.DaZhongpersonCountData)
|
|
|
|
|
this.FireForceDetailInfo.contactData = JSON.stringify(this.DaZhongcontactData) |
|
|
|
|
this.FireForceDetailInfo.dutyForceData = null |
|
|
|
|
} |
|
|
|
|
this.http.put(`/api/FireForceDetail/0/${this.selectedFireForce.id}`,body).subscribe(data => { |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
console.log(123,data) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//如果是其他消防力量
|
|
|
|
|
else{ |
|
|
|
|
if(!this.isPost){ |
|
|
|
|
let body = this.FireForceDetailInfo |
|
|
|
|
body.personCountData = JSON.stringify(this.otherpersonCountData)
|
|
|
|
|
body.contactData = JSON.stringify(this.othercontactData) |
|
|
|
|
body.dutyForceData = null |
|
|
|
|
this.http.put(`/api/FireForceDetail/1/${this.selectedFireForce.id}`,body).subscribe(data => { |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
console.log(123,data) |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
let forceType |
|
|
|
|
this.selectedFireForceTypeIndex == 4 ? forceType = 1 : null |
|
|
|
|
this.selectedFireForceTypeIndex == 5 ? forceType = 2 : null |
|
|
|
|
this.selectedFireForceTypeIndex == 6 ? forceType = 4 : null |
|
|
|
|
let body = { |
|
|
|
|
organizationId:this.selectedFireForce.id, |
|
|
|
|
name:this.FireForceDetailInfo.stationName, |
|
|
|
|
createTime:new Date(), |
|
|
|
|
forceType:forceType |
|
|
|
|
} |
|
|
|
|
let params = { |
|
|
|
|
organizationId : this.selectedFireForce.id |
|
|
|
|
} |
|
|
|
|
this.http.post('/api/CustomFireForce',body,{params:params}).subscribe((data:any) => { |
|
|
|
|
console.log('创建其他消防力量成功',data) |
|
|
|
|
this.getAllFireForce() |
|
|
|
|
let body = this.FireForceDetailInfo |
|
|
|
|
body.personCountData = JSON.stringify(this.otherpersonCountData)
|
|
|
|
|
body.contactData = JSON.stringify(this.othercontactData) |
|
|
|
|
body.dutyForceData = null |
|
|
|
|
this.http.put(`/api/FireForceDetail/1/${data.id}`,body).subscribe(data => { |
|
|
|
|
this.isPost = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
console.log(123,data) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
map:any |
|
|
|
|
placeSearch:any//构造地点查询类
|
|
|
|
|
isMapLabel:boolean = false //是否已经标记坐标
|
|
|
|
|
newPositionMarkerContent:any =
|
|
|
|
|
'<div class="custom-content-marker">' + |
|
|
|
|
' <img src="/assets/images/定位.png">' + |
|
|
|
|
'</div>' |
|
|
|
|
newPositionMarkerContentBtn:any =
|
|
|
|
|
'<div class="custom-content-marker">' + |
|
|
|
|
' <img src="/assets/images/定位.png">' + |
|
|
|
|
' <div class="btnbox"><img id="setPositionOk" src="/assets/images/ok.png"><span>|</span><img id="setPositionClose" src="/assets/images/close.png"></div>' + |
|
|
|
|
'</div>' |
|
|
|
|
//创建地图
|
|
|
|
|
newPositionMarker:any//坐标实例
|
|
|
|
|
createMap(){ |
|
|
|
|
this.map = new AMap.Map('map', { |
|
|
|
|
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 = ''//
|
|
|
|
|
|
|
|
|
|
tabsList:any[] = [ |
|
|
|
|
{type:0,name:'详情'}, |
|
|
|
|
{type:1,name:'车辆装备'}, |
|
|
|
|
{type:2,name:'相关资料'}, |
|
|
|
|
] |
|
|
|
|
selectedBtn:number = 0//选择的tabs
|
|
|
|
|
clickTab(typeNum){ |
|
|
|
|
this.selectedBtn = typeNum |
|
|
|
|
positionLngLat:any = {}//临时坐标点
|
|
|
|
|
atLastPositionLngLat:any = {}//最终坐标点
|
|
|
|
|
setPosition(){ |
|
|
|
|
if(!this.isGisTopBox){ |
|
|
|
|
this.isGisTopBox = true |
|
|
|
|
this.newPositionMarker ? this.map.remove(this.newPositionMarker) : null |
|
|
|
|
let center |
|
|
|
|
console.log() |
|
|
|
|
if(this.newPositionMarker && this.atLastPositionLngLat.x){//如果已经标注单位坐标
|
|
|
|
|
console.log(1) |
|
|
|
|
center = [this.atLastPositionLngLat.x, this.atLastPositionLngLat.y] |
|
|
|
|
}else if(this.newPositionMarker && !this.atLastPositionLngLat.x && this.FireForceDetailInfo.location.x){ |
|
|
|
|
console.log(2) |
|
|
|
|
center = [this.FireForceDetailInfo.location.x, this.FireForceDetailInfo.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 |
|
|
|
|
} |
|
|
|
|
})//取消
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//新增水源弹出框
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'addwater', |
|
|
|
|
templateUrl: './addFireForce.html', |
|
|
|
|
styleUrls: ['./fire-force.component.scss'] |
|
|
|
|
}) |
|
|
|
|
export class AddFireForce { |
|
|
|
|
|
|
|
|
|
constructor(private http: HttpClient,public dialogRef: MatDialogRef<AddFireForce>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addList:any = [ |
|
|
|
|
{id:4, name:'微型消防站'}, |
|
|
|
|
{id:5, name:'企业专职消防站'}, |
|
|
|
|
{id:6, name:'义务(志愿)消防站'} |
|
|
|
|
] |
|
|
|
|
selectedFireForceTypeIndex:any = 4 |
|
|
|
|
selecteAddType(item,key){ |
|
|
|
|
this.selectedFireForceTypeIndex = item.id |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
confirm(){ |
|
|
|
|
this.dialogRef.close(this.selectedFireForceTypeIndex) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |