|
|
|
@ -50,28 +50,34 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
}, 0); |
|
|
|
|
} |
|
|
|
|
//获得所有消防力量
|
|
|
|
|
newdata:any |
|
|
|
|
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) |
|
|
|
|
this.dataSource.data = this.tree.toTree(data) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
upDateAllFireForce = ():void=>{ |
|
|
|
|
this.http.get('/api/CustomFireForce').subscribe((data:any) => { |
|
|
|
|
this.newdata = 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, |
|
|
|
@ -96,19 +102,28 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
selectedFireForceLevel:any |
|
|
|
|
selectedFireForce:any |
|
|
|
|
//选择要显示的消防力量
|
|
|
|
|
superior:any = { //上级单位
|
|
|
|
|
name:'', |
|
|
|
|
code:'' |
|
|
|
|
} |
|
|
|
|
selectTreeNode(node){ |
|
|
|
|
console.log(node) |
|
|
|
|
this.isGisTopBox = false |
|
|
|
|
if(this.selectedFireForceId != node.id){ |
|
|
|
|
this.clearData() |
|
|
|
|
|
|
|
|
|
this.selectedFireForce = node |
|
|
|
|
this.selectedFireForceId = node.id |
|
|
|
|
this.selectedFireForceLevel = node.level |
|
|
|
|
if(node.forceType != 0){//如果是其他消防力量
|
|
|
|
|
this.selectedFireForceLevel = 4 |
|
|
|
|
}else{ |
|
|
|
|
this.selectedFireForceLevel = node.level |
|
|
|
|
} |
|
|
|
|
this.FireForceDetailInfo.stationName = node.name |
|
|
|
|
if(this.newPositionMarker){ |
|
|
|
|
this.map.remove(this.newPositionMarker); |
|
|
|
|
} |
|
|
|
|
if(node.fireForceDetailId ){ |
|
|
|
|
if(node.fireForceDetailId){ |
|
|
|
|
this.isPost = false//是否走post创建接口
|
|
|
|
|
let type |
|
|
|
|
if(node.forceType == 0){ |
|
|
|
@ -117,9 +132,7 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
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 |
|
|
|
@ -131,13 +144,29 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
// 将 markers 添加到地图
|
|
|
|
|
this.map.add(this.newPositionMarker); |
|
|
|
|
}else{ |
|
|
|
|
this.map.setCity('上海市'); |
|
|
|
|
} |
|
|
|
|
if(this.selectedFireForceLevel == 0){ |
|
|
|
|
if(node.forceType == 0 && node.level == 0){ |
|
|
|
|
this.ZongpersonCountData = JSON.parse(data.personCountData) |
|
|
|
|
this.ZongcontactData = JSON.parse(data.contactData) |
|
|
|
|
} |
|
|
|
|
if(node.forceType == 0 && node.level == 1){ |
|
|
|
|
this.ZongpersonCountData = JSON.parse(data.personCountData) |
|
|
|
|
this.ZhicontactData = JSON.parse(data.contactData) |
|
|
|
|
} |
|
|
|
|
if(node.forceType == 0 && (node.level == 2 || node.level == 3)){ |
|
|
|
|
this.DaZhongpersonCountData = JSON.parse(data.personCountData) |
|
|
|
|
this.DaZhongcontactData = JSON.parse(data.contactData) |
|
|
|
|
} |
|
|
|
|
if(node.forceType != 0){ |
|
|
|
|
this.otherpersonCountData = JSON.parse(data.personCountData) |
|
|
|
|
this.othercontactData = JSON.parse(data.contactData) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
this.map.setCity('上海市'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -164,36 +193,6 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
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 |
|
|
|
@ -211,16 +210,20 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
return style |
|
|
|
|
} |
|
|
|
|
//删除某条消防队
|
|
|
|
|
deleteWater(item,e){ |
|
|
|
|
deleteFireForce(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);
|
|
|
|
|
// })
|
|
|
|
|
this.http.delete(`/api/CustomFireForce/${item.id}`).subscribe(data => { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('删除成功','确定',config); |
|
|
|
|
this.upDateAllFireForce() |
|
|
|
|
if(item.id == this.selectedFireForce.id){ |
|
|
|
|
this.selectedFireForceLevel = null |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//当前点击tab页面第几个
|
|
|
|
@ -239,7 +242,10 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
jurisdictionArea:null,//辖区面积
|
|
|
|
|
remark:'',//备注
|
|
|
|
|
address:'',//地址
|
|
|
|
|
location:null, |
|
|
|
|
location:{ |
|
|
|
|
x:'', |
|
|
|
|
y:'' |
|
|
|
|
}, |
|
|
|
|
personCountData:[],//人员数量自定义
|
|
|
|
|
contactData:[],//联系方式自定义
|
|
|
|
|
dutyForceData:[]//执勤力量自定义
|
|
|
|
@ -299,6 +305,10 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
] |
|
|
|
|
//清空表单数据
|
|
|
|
|
clearData(){ |
|
|
|
|
this.superior = { |
|
|
|
|
name:'', |
|
|
|
|
code:'' |
|
|
|
|
} |
|
|
|
|
this.positionLngLat = {x:'',y:''} |
|
|
|
|
this.FireForceDetailInfo = { |
|
|
|
|
// id:'',//编号
|
|
|
|
@ -309,7 +319,10 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
jurisdictionArea:null,//辖区面积
|
|
|
|
|
remark:'',//备注
|
|
|
|
|
address:'',//地址
|
|
|
|
|
location:null, |
|
|
|
|
location:{ |
|
|
|
|
x:'', |
|
|
|
|
y:'' |
|
|
|
|
}, |
|
|
|
|
personCountData:[],//人员数量自定义
|
|
|
|
|
contactData:[],//联系方式自定义
|
|
|
|
|
dutyForceData:[]//执勤力量自定义
|
|
|
|
@ -393,19 +406,26 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
//保存
|
|
|
|
|
isPost:boolean = false//是否走post创建接口
|
|
|
|
|
newselectedFireForceId:any //创建成功其他消防力量后保存一下创建出来的id
|
|
|
|
|
save(){ |
|
|
|
|
if(!this.FireForceDetailInfo.stationName){ |
|
|
|
|
alert('名称必填') |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
console.log(777,this.atLastPositionLngLat) |
|
|
|
|
this.FireForceDetailInfo.jurisdictionArea = Number(this.FireForceDetailInfo.jurisdictionArea) |
|
|
|
|
//如果是总支大中
|
|
|
|
|
// console.log(8888, this.FireForceDetailInfo)
|
|
|
|
|
this.FireForceDetailInfo.location = {x:'',y:''} |
|
|
|
|
if(this.atLastPositionLngLat.x){ |
|
|
|
|
this.FireForceDetailInfo.location.x = this.atLastPositionLngLat.x |
|
|
|
|
this.FireForceDetailInfo.location.y = this.atLastPositionLngLat.y |
|
|
|
|
}else{ |
|
|
|
|
this.FireForceDetailInfo.location = null |
|
|
|
|
} |
|
|
|
|
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) |
|
|
|
@ -426,6 +446,7 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
this.upDateAllFireForce() |
|
|
|
|
console.log(123,data) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
@ -436,12 +457,18 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
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 id |
|
|
|
|
if(this.selectedFireForce.forceType == 0){ |
|
|
|
|
id = this.newselectedFireForceId |
|
|
|
|
}else{ |
|
|
|
|
id = this.selectedFireForce.id |
|
|
|
|
} |
|
|
|
|
this.http.put(`/api/FireForceDetail/1/${id}`,body).subscribe(data => { |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
console.log(123,data) |
|
|
|
|
// console.log(123,data)
|
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
let forceType |
|
|
|
@ -459,18 +486,21 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
this.http.post('/api/CustomFireForce',body,{params:params}).subscribe((data:any) => { |
|
|
|
|
console.log('创建其他消防力量成功',data) |
|
|
|
|
this.getAllFireForce() |
|
|
|
|
this.newselectedFireForceId = data.id |
|
|
|
|
this.selectedFireForce = data |
|
|
|
|
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.http.put(`/api/FireForceDetail/1/${data.id}`,body).subscribe(data2 => { |
|
|
|
|
this.upDateAllFireForce() |
|
|
|
|
this.selectedFireForceId = data.id |
|
|
|
|
this.isPost = false |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
console.log(123,data) |
|
|
|
|
console.log(123,data2) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
@ -535,7 +565,7 @@ export class FireForceComponent implements OnInit {
|
|
|
|
|
searchTitle:any = ''//
|
|
|
|
|
|
|
|
|
|
positionLngLat:any = {}//临时坐标点
|
|
|
|
|
atLastPositionLngLat:any = {}//最终坐标点
|
|
|
|
|
atLastPositionLngLat:any = {x:null,y:null}//最终坐标点
|
|
|
|
|
setPosition(){ |
|
|
|
|
if(!this.isGisTopBox){ |
|
|
|
|
this.isGisTopBox = true |
|
|
|
|