Browse Source

[修改]预案模板自定义功能无法新建跟报错问题修改

tangshan
陈敬瑜 3 years ago
parent
commit
d05e550dec
  1. 9
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.html
  2. 2
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts
  3. 1
      src/app/ui/plan-template/plan-template.component.scss
  4. 119
      src/app/ui/plan-template/plan-template.component.ts
  5. 2
      src/app/ui/plan-template/zdyaddgroup.html

9
src/app/plan-management/create-plan-online-five/create-plan-online-five.component.html

@ -838,7 +838,8 @@
width: 100%;
background-color: #FFFBE8;
text-align: center;">
<input type="text" placeholder="请输入内容" [(ngModel)]="attack.name" [readonly]='attack.zdy==undefined'>
<input type="text" placeholder="请输入内容" [(ngModel)]="attack.name" [readonly]='attack.zdy==undefined' *ngIf="pattern == 'edit'">
<span style=" margin-left: 20px;font-size: 16px;color: #b99a00;opacity: 1;height: 40px;line-height: 40px;" *ngIf="pattern != 'edit'">{{attack.name}}</span>
<img src="../../../assets/images/delyello.png" *ngIf="pattern == 'edit'&&attack.zdy!=undefined"
(click)='unitDel(element.surveyName,uniti,attacki)'>
<img src="../../../assets/images/addyello.png"
@ -925,12 +926,12 @@
background-color: #FFFBE8;
text-align: center;">
<input type="text" placeholder="请输入内容" [(ngModel)]="parts.heafName" *ngIf="pattern == 'edit'">
<textarea [(ngModel)]="parts.heafName" *ngIf="pattern == 'look'" style="width: 100%;height: 100%;color: #b99a00;" disabled></textarea>
<!-- <span style="font-size: 16px;
<!-- <textarea [(ngModel)]="parts.heafName" *ngIf="pattern == 'look'" style="width: 100%;height: 100%;color: #b99a00;" disabled></textarea> -->
<span style="font-size: 16px;
text-align: center;
height: 40px;
line-height: 40px;
color: #b99a00;" *ngIf="pattern == 'look'">{{parts.heafName}}</span> -->
color: #b99a00;" *ngIf="pattern == 'look'">{{parts.heafName}}</span>
<img src="../../../assets/images/deletered.png" (click)='unitDel(element.surveyName,uniti,infoi)' *ngIf="pattern == 'edit'">
</div>
<div class="partsBody">

2
src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts

@ -1710,7 +1710,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
:(this.unitData.buildingTypes[0].name=='商市场'||this.unitData.buildingTypes[0].name=='医院'||this.unitData.buildingTypes[0].name=='学校'
||this.unitData.buildingTypes[0].name=='宾馆'||this.unitData.buildingTypes[0].name=='娱乐场所'||this.unitData.buildingTypes[0].name=='餐饮业'
||this.unitData.buildingTypes[0].name=='影剧院'||this.unitData.buildingTypes[0].name=='展览建筑'||this.unitData.buildingTypes[0].name=='养老院'
||this.unitData.buildingTypes[0].name=='会议中心')?4:this.unitData.buildingTypes[0].name=='储罐类'?'StorageTankFivePlan':this.unitData.buildingTypes[0].name=='化工生产'?'hgFivePlan':''
||this.unitData.buildingTypes[0].name=='会议中心')?4:this.unitData.buildingTypes[0].name=='储罐类'?'StorageTankFivePlan':this.unitData.buildingTypes[0].name=='化工生产'?'ChemicalProductionFivePlan':''
/* let fileData={
type:this.unitData.buildingTypes[0].name=='高层建筑'?1:2,
file:formData

1
src/app/ui/plan-template/plan-template.component.scss

@ -63,6 +63,7 @@
width: 100%;
display: flex;
flex-direction: column;
overflow-y: auto;
.selectedTr {
background-color: #e1f1ff;
span {

119
src/app/ui/plan-template/plan-template.component.ts

@ -234,11 +234,6 @@ export class PlanTemplateComponent implements OnInit {
if(this.unitName==undefined){
this.snackBar.open('请选择预案模板!','确定',config);
}else{
/* this.newleftTabledata.forEach((value,index,array)=>{
if(array[index].buildingTypeId==this.buildingTypeId){
this.group=array[index].data
}
}) */
const dialogRef = this.dialog.open(addGroup, {//调用open方法打开对话框并且携带参数过去
width: '240px',
height:'620px',
@ -247,19 +242,6 @@ export class PlanTemplateComponent implements OnInit {
});
dialogRef.afterClosed().subscribe(result => {
console.log(result,this.newleftTabledata)
/* if(result.length>this.newleftTabledata[this.leftclicki].data.length){
this.newleftTabledata[this.leftclicki].data.forEach((item,i,value)=>{
result.forEach((element,ri,rval) => {
if(value[i].groupName==rval[ri].groupName){
console.log('000')
}
});
})
this.newleftTabledata[this.leftclicki].data.push(result)
} */
//this.newleftTabledata[this.leftclicki].data.push({groupName: '预案附件', completed: false})
console.log(result)
this.newleftTabledata.forEach((value,index,array)=>{
if(array[index].buildingTypeId==this.buildingTypeId&&array[index].planCategory==this.planCategory){
if(result!=undefined){
@ -269,7 +251,12 @@ export class PlanTemplateComponent implements OnInit {
array[index].data=result
}
else{
array[index].data[i].completed=rarr[i].completed
array[index].data.forEach((group,gi,garr) => {
if(garr[gi].groupName==rarr[i].groupName){
garr[gi].completed=rarr[i].completed
}
});
//array[index].data[i].completed=rarr[i].completed
}
});
@ -299,9 +286,13 @@ export class PlanTemplateComponent implements OnInit {
dialogRef.afterClosed().subscribe(result => {
console.log(result)
if(result!=undefined){
this.newleftTabledata[this.leftclicki].data.push({groupName:result,completed: true,attribute:[],zdy:true})
if(this.newleftTabledata[this.leftclicki].data==null){
//this.newleftTabledata[this.leftclicki].data=[]
this.newleftTabledata[this.leftclicki].data=result.addgtoup
}
this.newleftTabledata[this.leftclicki].data.push({groupName:result.groupName,completed: true,attribute:[],zdy:true})
}
this.group=this.newleftTabledata[this.leftclicki].data
});
}
@ -344,7 +335,12 @@ export class PlanTemplateComponent implements OnInit {
if(array[index].attribute==null){
array[index].attribute=result
}else{
array[index].attribute[i].completed=rarr[i].completed
array[index].attribute.forEach((att,atti,attary) => {
if(rarr[i].surveyName==attary[atti].surveyName){
attary[atti].completed=rarr[i].completed
}
});
//array[index].attribute[i].completed=rarr[i].completed
}
});
@ -403,7 +399,10 @@ export class PlanTemplateComponent implements OnInit {
dialogRef.afterClosed().subscribe(result => {
console.log(result)
if(result!=undefined){
this.newleftTabledata[this.leftclicki].data[0].attribute.push({completed: true, surveyName: result,zdy:true,attinf:[]})
if(this.newleftTabledata[this.leftclicki].data[0].attribute==null){
this.newleftTabledata[this.leftclicki].data[0].attribute=result.addwsurvey
}
this.newleftTabledata[this.leftclicki].data[0].attribute.push({completed: true, surveyName: result.groupName,zdy:true,attinf:[]})
}
console.log(this.group)
});
@ -1450,20 +1449,52 @@ export class zdyaddGroup{
//console.log(this.data)
}
groupName
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:'预案附件',completed:false}
]
newGroups:boolean
//取消按钮
close(){
this.dialogRef.close();
}
//判断是否是分组存在的数据
groupHave(){
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
try{
this.addgtoup.forEach(item=>{
if(item.groupName==this.groupName){
this.newGroups=false
this.snackBar.open('您输入的内容跟新增分组里面的内容重复,请点击新增分组寻找!','确定',config);
throw Error();
}else{
this.newGroups=true
}
})
}catch(e){
}
}
//确定提交
newGroup(){
console.log(this.groupName)
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
config.duration = 5000
if(this.groupName==''||this.groupName==undefined){
this.snackBar.open('请输入分组名称!','确定',config);
}else{
this.dialogRef.close(this.groupName);
if(this.newGroups==true){
this.dialogRef.close({groupName:this.groupName,addgtoup:this.addgtoup});
}
}
}
}
@ -1487,8 +1518,8 @@ ngOnInit(): void{
this.data=JSON.parse(JSON.stringify(this.data))
this.data.forEach(element => {
if(element.groupName=='单位概况'&&element.attribute!=undefined){
this.addwsurvey=element.attribute
/* element.attribute.forEach((datavalue,index,dataarr) => {
//this.addwsurvey=element.attribute
element.attribute.forEach((datavalue,index,dataarr) => {
this.addwsurvey.forEach((value,i,arr)=>{
if(dataarr[index].surveyName==arr[i].surveyName){
if(dataarr[index].completed==true&&arr[i].completed==false){
@ -1496,7 +1527,7 @@ ngOnInit(): void{
}
}
})
}); */
});
}
});
console.log(this.addwsurvey)
@ -1521,11 +1552,38 @@ export class zdyaddattinf{
ngOnInit(): void{
//console.log(this.data)
}
newGroups:boolean
groupName
addwsurvey=[
{surveyName:'单位基本信息',completed:false},{surveyName:'建筑信息',completed:false},
{surveyName:'四周毗邻',completed:false,attinf:[{name:'东',value:''},{name:'西',value:''},{name:'南',value:''},{name:'北',value:''}]},
{surveyName:'消防设施',completed:false},{surveyName:'进攻通道',completed:false},
{surveyName:'重点部位',completed:false,attinf:[{heafName:'',body:[{name:'重点部位名称',value:''},{name:'重点部位所在位置',value:''},{name:'建筑结构',value:''},{name:'使用性质',value:''},{name:'主要危险性',value:''}]}]},
{surveyName:'功能分区',completed:false,attinf:[{name:'',value:''}]}
]
//取消按钮
close(){
this.dialogRef.close();
}
//判断是否跟系统内置的名称重复
groupHave(){
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
try{
this.addwsurvey.forEach(item=>{
if(item.surveyName==this.groupName){
this.newGroups=false
this.snackBar.open('您输入的内容跟编辑里面的内容重复,请点击编辑寻找!','确定',config);
throw Error();
}else{
this.newGroups=true
}
})
}catch(e){
}
}
//确定提交
newGroup(){
console.log(this.groupName)
@ -1535,7 +1593,10 @@ export class zdyaddattinf{
if(this.groupName==''||this.groupName==undefined){
this.snackBar.open('请输入属性名称!','确定',config);
}else{
this.dialogRef.close(this.groupName);
if(this.newGroups){
this.dialogRef.close({groupName:this.groupName,addwsurvey:this.addwsurvey});
}
}
}
}

2
src/app/ui/plan-template/zdyaddgroup.html

@ -6,7 +6,7 @@
<div class="group" >
<label style="margin-right: 10px;">自定义名称:</label>
<mat-form-field class="example-full-width">
<input matInput placeholder="请输入自定义名称" autocomplete="off" [(ngModel)]="groupName" required>
<input matInput placeholder="请输入自定义名称" (keyup)='groupHave()' autocomplete="off" [(ngModel)]="groupName" required>
</mat-form-field>
</div>
</div>

Loading…
Cancel
Save