From bb024c6ae71683f054424e27d4ec59b067fd6d17 Mon Sep 17 00:00:00 2001
From: SHAOJIAHAO <55341701@qq.com>
Date: Mon, 18 Jan 2021 14:19:46 +0800
Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E5=AE=8C=E5=96=84=E6=B6=88?=
=?UTF-8?q?=E9=98=B2=E5=8A=9B=E9=87=8F=E8=AF=A6=E6=83=85=E4=BF=9D=E5=AD=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../fire-force/fire-force.component.html | 16 +-
.../fire-force/fire-force.component.scss | 17 ++
.../fire-force/fire-force.component.ts | 174 ++++++++++--------
3 files changed, 129 insertions(+), 78 deletions(-)
diff --git a/src/app/data-collection/fire-force/fire-force.component.html b/src/app/data-collection/fire-force/fire-force.component.html
index 70d1cde..2a96222 100644
--- a/src/app/data-collection/fire-force/fire-force.component.html
+++ b/src/app/data-collection/fire-force/fire-force.component.html
@@ -46,7 +46,7 @@
+
相关资料
diff --git a/src/app/data-collection/fire-force/fire-force.component.scss b/src/app/data-collection/fire-force/fire-force.component.scss
index 4463fe4..5029bf4 100644
--- a/src/app/data-collection/fire-force/fire-force.component.scss
+++ b/src/app/data-collection/fire-force/fire-force.component.scss
@@ -233,6 +233,22 @@
.submitAudit{
margin: 0 30px;
}
+ .uploadAttachment{
+ margin-right: 20px;
+ width: 120px;
+ text-align: center;
+ height: 28px;
+ line-height: 28px;
+ mat-icon{
+ transform: rotate(25deg);
+ font-size: 20px;
+ width: 20px;
+ height: 20px;
+ }
+ mat-icon{
+ padding: 0 8px;
+ }
+ }
}
}
.contant{
@@ -294,6 +310,7 @@
}
}
+
.addWaterBox{
width: 260px;
height: 284px;
diff --git a/src/app/data-collection/fire-force/fire-force.component.ts b/src/app/data-collection/fire-force/fire-force.component.ts
index 2e2b582..799587a 100644
--- a/src/app/data-collection/fire-force/fire-force.component.ts
+++ b/src/app/data-collection/fire-force/fire-force.component.ts
@@ -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