|
|
|
@ -4,7 +4,7 @@
|
|
|
|
|
* @Author: sueRimn |
|
|
|
|
* @Date: 2021-05-19 15:50:20 |
|
|
|
|
* @LastEditors: sueRimn |
|
|
|
|
* @LastEditTime: 2021-05-21 16:27:07 |
|
|
|
|
* @LastEditTime: 2021-05-26 16:58:15 |
|
|
|
|
*/ |
|
|
|
|
import { Component, Inject, OnInit } from '@angular/core'; |
|
|
|
|
import { HttpClient } from '@angular/common/http' |
|
|
|
@ -25,7 +25,11 @@ export class PlanTemplateComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获取左侧单位信息
|
|
|
|
|
newleftTabledata=[] |
|
|
|
|
newleftTabledata=[ |
|
|
|
|
{name:"333",level:'Ⅲ级',unitid: "5e7c49e861550e2754d461ce",group:[]},//{groupName: "单位概况"}
|
|
|
|
|
{name:"444",level:'Ⅳ级',unitid: "5e7c49e861550e2754d461ce",group:[]} |
|
|
|
|
] |
|
|
|
|
group=[] |
|
|
|
|
getLeftdata(){ |
|
|
|
|
/* this.http.get("/api/PlanTemplate").subscribe((data:any)=>{ |
|
|
|
|
this.leftTabledata=data |
|
|
|
@ -39,12 +43,12 @@ export class PlanTemplateComponent implements OnInit {
|
|
|
|
|
config.duration = 3000 |
|
|
|
|
const dialogRef = this.dialog.open(addPlanname, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '340px', |
|
|
|
|
height:'330px', |
|
|
|
|
height:'380px', |
|
|
|
|
disableClose:true, |
|
|
|
|
data:{plandata:this.newleftTabledata} |
|
|
|
|
}); |
|
|
|
|
dialogRef.afterClosed().subscribe(result => { |
|
|
|
|
console.log(result) |
|
|
|
|
//console.log(result)
|
|
|
|
|
if(result!=undefined){ |
|
|
|
|
this.newleftTabledata.push(result) |
|
|
|
|
for(var i=0;i<this.newleftTabledata.length-2;i++){ |
|
|
|
@ -82,9 +86,126 @@ export class PlanTemplateComponent implements OnInit {
|
|
|
|
|
//左侧预案模板点击事件
|
|
|
|
|
planName |
|
|
|
|
planClick(item){ |
|
|
|
|
console.log(item) |
|
|
|
|
//console.log(item)
|
|
|
|
|
this.planName=item.name |
|
|
|
|
this.newleftTabledata.forEach((value,index,array)=>{ |
|
|
|
|
if(array[index].name==this.planName){ |
|
|
|
|
this.group=array[index].group |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//右侧新增分组点击事件
|
|
|
|
|
addGroupClick(){ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
if(this.planName==undefined){ |
|
|
|
|
this.snackBar.open('请选择预案模板!','确定',config); |
|
|
|
|
}else{ |
|
|
|
|
this.newleftTabledata.forEach((value,index,array)=>{ |
|
|
|
|
if(array[index].name==this.planName){ |
|
|
|
|
this.group=array[index].group |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
const dialogRef = this.dialog.open(addGroup, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '240px', |
|
|
|
|
height:'590px', |
|
|
|
|
disableClose:true, |
|
|
|
|
data:this.group |
|
|
|
|
}); |
|
|
|
|
dialogRef.afterClosed().subscribe(result => { |
|
|
|
|
//console.log(result,this.newleftTabledata)
|
|
|
|
|
this.newleftTabledata.forEach((value,index,array)=>{ |
|
|
|
|
if(array[index].name==this.planName){ |
|
|
|
|
if(result!=undefined){ |
|
|
|
|
result.forEach((valuer,i,rarr) => { |
|
|
|
|
//console.log(valuer)
|
|
|
|
|
/* let groupName={ |
|
|
|
|
groupName:valuer |
|
|
|
|
} */ |
|
|
|
|
//添加分组名称
|
|
|
|
|
array[index].group=rarr |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
//去重
|
|
|
|
|
for(var i=0;i<array[index].group.length;i++){ |
|
|
|
|
for(var j=i+1;j<array[index].group.length;j++){ |
|
|
|
|
if(array[index].group[i].groupName==array[index].group[j].groupName){ |
|
|
|
|
array[index].group.splice(j,1) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.group=array[index].group |
|
|
|
|
} |
|
|
|
|
//console.log(this.group)
|
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
//console.log(this.newleftTabledata)
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//删除分组
|
|
|
|
|
deleteGroup(groupName){ |
|
|
|
|
//console.log(this.group)
|
|
|
|
|
let isTrue = confirm('您确定要删除分组吗') |
|
|
|
|
if(isTrue){ |
|
|
|
|
this.group.forEach((element,index,array)=>{ |
|
|
|
|
if(array[index].groupName==groupName){ |
|
|
|
|
this.group.splice(index,1) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//新增属性
|
|
|
|
|
addAttribute(groupName){ |
|
|
|
|
if(groupName=='单位概况'){ |
|
|
|
|
const dialogRef = this.dialog.open(adddwsurvey, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '240px', |
|
|
|
|
height:'510px', |
|
|
|
|
disableClose:true, |
|
|
|
|
data:this.group |
|
|
|
|
}); |
|
|
|
|
dialogRef.afterClosed().subscribe(result => { |
|
|
|
|
//console.log(result)
|
|
|
|
|
if(result!=undefined){ |
|
|
|
|
this.group.forEach((value,index,array)=>{ |
|
|
|
|
if(array[index].groupName=='单位概况'){ |
|
|
|
|
array[index].attribute=result |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//console.log(this.newleftTabledata)
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//删除具体属性
|
|
|
|
|
delAttribute(surveyName){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//新增属性信息
|
|
|
|
|
addAttInfo(){ |
|
|
|
|
const dialogRef = this.dialog.open(addattinf, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '240px', |
|
|
|
|
height:'400px', |
|
|
|
|
disableClose:true, |
|
|
|
|
data:this.group |
|
|
|
|
}); |
|
|
|
|
dialogRef.afterClosed().subscribe(result => { |
|
|
|
|
console.log(result) |
|
|
|
|
if(result!=undefined){ |
|
|
|
|
/* this.group.forEach((value,index,array)=>{ |
|
|
|
|
if(array[index].groupName=='单位概况'){ |
|
|
|
|
array[index].attribute=result |
|
|
|
|
} |
|
|
|
|
}) */ |
|
|
|
|
} |
|
|
|
|
console.log(this.newleftTabledata) |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//单位基本信息和建筑信息表格
|
|
|
|
|
displayedColumns: string[] = ['name','level','default','must', 'danwei','operation']; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//新建预案
|
|
|
|
@ -97,8 +218,17 @@ export class addPlanname{
|
|
|
|
|
constructor(private http: HttpClient,public dialogRef: MatDialogRef<addPlanname>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {} |
|
|
|
|
unitname//预案名称
|
|
|
|
|
level//预案级别
|
|
|
|
|
unittype//单位类型
|
|
|
|
|
allunittype//所有单位信息
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
console.log(this.data) |
|
|
|
|
this.getUnittype() |
|
|
|
|
} |
|
|
|
|
//获取单位类型
|
|
|
|
|
getUnittype(){ |
|
|
|
|
this.http.get("/api/BasicCategories").subscribe((data:any)=>{ |
|
|
|
|
this.allunittype=data |
|
|
|
|
//console.log(data)
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//取消按钮
|
|
|
|
|
close(){ |
|
|
|
@ -113,17 +243,23 @@ export class addPlanname{
|
|
|
|
|
} |
|
|
|
|
else if(this.level==undefined||this.level==''){ |
|
|
|
|
this.snackBar.open('请输入预案级别!','确定',config); |
|
|
|
|
}else{ |
|
|
|
|
}else if(this.unittype==undefined||this.unittype==''){ |
|
|
|
|
this.snackBar.open('请选择单位类型!','确定',config); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
for(var i=0;i<this.data.plandata.length;i++){ |
|
|
|
|
if(this.data.plandata[i].name==this.unitname){ |
|
|
|
|
this.snackBar.open('预案名称重复,请重新建立预案模板!','确定',config); |
|
|
|
|
this.unitname=='' |
|
|
|
|
this.level=='' |
|
|
|
|
this.unittype=='' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
let planData={ |
|
|
|
|
name:this.unitname, |
|
|
|
|
level:this.level |
|
|
|
|
level:this.level, |
|
|
|
|
unitid:this.unittype, |
|
|
|
|
group:[] |
|
|
|
|
} |
|
|
|
|
this.dialogRef.close(planData) |
|
|
|
|
} |
|
|
|
@ -166,3 +302,126 @@ export class upPlanname{
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//新增分组
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'addGroup', |
|
|
|
|
templateUrl: './addgroup.html', |
|
|
|
|
styleUrls: ['./addgroup.scss'] |
|
|
|
|
}) |
|
|
|
|
export class addGroup{ |
|
|
|
|
constructor(private http: HttpClient,public dialogRef: MatDialogRef<addPlanname>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {} |
|
|
|
|
addgtoup=[ |
|
|
|
|
{groupName:'单位概况',completed:false},{groupName:'灾情设定',completed:false},{groupName:'力量调集',completed:false}, |
|
|
|
|
{groupName:'组织指挥',completed:false},{groupName:'作战行动',completed:false},{groupName:'社会联动',completed:false}, |
|
|
|
|
{groupName:'勤务保障',completed:false},{groupName:'特别警示',completed:false},{groupName:'辅助决策',completed:false}, |
|
|
|
|
{groupName:'交通水源',completed:false},{groupName:'重点图示',completed:false},{groupName:'预案附件',completed:false} |
|
|
|
|
] |
|
|
|
|
groupName=[] |
|
|
|
|
ngOnInit(): void{ |
|
|
|
|
//console.log(this.data)
|
|
|
|
|
/* this.addgtoup.forEach((value,index,array)=>{ |
|
|
|
|
this.data.forEach(element => { |
|
|
|
|
if(element.groupName==array[index].groupName){ |
|
|
|
|
array[index].completed=true |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) */ |
|
|
|
|
if(this.data.length>0){ |
|
|
|
|
this.addgtoup=this.data |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//取消按钮
|
|
|
|
|
close(){ |
|
|
|
|
this.dialogRef.close(); |
|
|
|
|
} |
|
|
|
|
//复选框点击事件
|
|
|
|
|
checkClick(e,item){ |
|
|
|
|
//console.log(e,item)
|
|
|
|
|
if (e.checked) { |
|
|
|
|
this.groupName.push(item) |
|
|
|
|
}else { |
|
|
|
|
this.groupName.forEach((value,index,array)=>{ |
|
|
|
|
if(value==item){ |
|
|
|
|
this.groupName.splice(index,1) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//console.log(this.groupName)
|
|
|
|
|
} |
|
|
|
|
//确定提交
|
|
|
|
|
newGroup(){ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.addgtoup.forEach((value,index,arraay)=>{ |
|
|
|
|
if(arraay[index].completed){ |
|
|
|
|
this.groupName.push(arraay[index].groupName) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
for(var i=0;i<this.groupName.length;i++){ |
|
|
|
|
for(var j=i+1;j<this.groupName.length;j++){ |
|
|
|
|
if(this.groupName[i]==this.groupName[j]){ |
|
|
|
|
this.groupName.splice(j,1) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.dialogRef.close(this.addgtoup) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//单位概况新增弹窗
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'adddwsurvey', |
|
|
|
|
templateUrl: './dwsurvey.html', |
|
|
|
|
styleUrls: ['./addgroup.scss'] |
|
|
|
|
}) |
|
|
|
|
export class adddwsurvey{ |
|
|
|
|
constructor(private http: HttpClient,public dialogRef: MatDialogRef<addPlanname>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {} |
|
|
|
|
addwsurvey=[ |
|
|
|
|
{surveyName:'单位基本信息',completed:false},{surveyName:'建筑信息',completed:false},{surveyName:'四周毗邻',completed:false}, |
|
|
|
|
{surveyName:'消防设施',completed:false},{surveyName:'进攻通道',completed:false},{surveyName:'重点部位',completed:false}, |
|
|
|
|
{surveyName:'功能分区',completed:false},{surveyName:'行车路线',completed:false},{surveyName:'千米水源',completed:false},{surveyName:'实景图',completed:false} |
|
|
|
|
] |
|
|
|
|
ngOnInit(): void{ |
|
|
|
|
console.log(this.data) |
|
|
|
|
this.data.forEach(element => { |
|
|
|
|
if(element.groupName=='单位概况'&&element.attribute!=undefined){ |
|
|
|
|
this.addwsurvey=element.attribute |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
//取消按钮
|
|
|
|
|
close(){ |
|
|
|
|
this.dialogRef.close(); |
|
|
|
|
} |
|
|
|
|
//确定按钮
|
|
|
|
|
defineClick(){ |
|
|
|
|
this.dialogRef.close(this.addwsurvey) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//编辑属性信息弹窗
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'addattinf', |
|
|
|
|
templateUrl: './addattinf.html', |
|
|
|
|
styleUrls: ['./addgroup.scss'] |
|
|
|
|
}) |
|
|
|
|
export class addattinf{ |
|
|
|
|
constructor(private http: HttpClient,public dialogRef: MatDialogRef<addPlanname>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {} |
|
|
|
|
addAttinf=[ |
|
|
|
|
{addAttinfName:'统一社会信用代码',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'}, |
|
|
|
|
{addAttinfName:'单位类型',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'}, |
|
|
|
|
{addAttinfName:'联系人',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'}, |
|
|
|
|
{addAttinfName:'联系电话',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'}, |
|
|
|
|
{addAttinfName:'辖区中队',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'}, |
|
|
|
|
{addAttinfName:'单位地址',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'}, |
|
|
|
|
{addAttinfName:'单位照片',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'} |
|
|
|
|
] |
|
|
|
|
//取消按钮
|
|
|
|
|
close(){ |
|
|
|
|
this.dialogRef.close(); |
|
|
|
|
} |
|
|
|
|
//确定按钮
|
|
|
|
|
defineClick(){ |
|
|
|
|
this.dialogRef.close(this.addAttinf) |
|
|
|
|
} |
|
|
|
|
} |