@ -1,10 +1,26 @@
/ *
* @Descripttion :
* @version :
* @Author : sueRimn
* @Date : 2021 - 05 - 31 10 :40 : 01
* @LastEditors : sueRimn
* @LastEditTime : 2021 - 06 - 03 17 :08 : 37
* /
/ *
* @Descripttion :
* @version :
* @Author : sueRimn
* @Date : 2021 - 05 - 31 10 :40 : 01
* @LastEditors : sueRimn
* @LastEditTime : 2021 - 06 - 02 09 :22 : 24
* /
/ *
* @Descripttion :
* @version :
* @Author : sueRimn
* @Date : 2021 - 05 - 19 15 :50 : 20
* @LastEditors : sueRimn
* @LastEditTime : 2021 - 06 - 01 16 :39 : 49
* @LastEditTime : 2021 - 06 - 02 09 :18 : 05
* /
import { Component , Inject , OnInit } from '@angular/core' ;
import { HttpClient } from '@angular/common/http'
@ -144,11 +160,11 @@ export class PlanTemplateComponent implements OnInit {
if ( this . unitName == undefined ) {
this . snackBar . open ( '请选择预案模板!' , '确定' , config ) ;
} else {
this . newleftTabledata . forEach ( ( value , index , array ) = > {
/ * t h i s . n e w l e f t T a b l e d a t a . f o r E a c h ( ( v a l u e , i n d e x , a r r a y ) = > {
if ( array [ index ] . buildingTypeId == this . buildingTypeId ) {
this . group = array [ index ] . data
}
} )
} ) * /
const dialogRef = this . dialog . open ( addGroup , { //调用open方法打开对话框并且携带参数过去
width : '240px' ,
height : '590px' ,
@ -172,7 +188,7 @@ export class PlanTemplateComponent implements OnInit {
} )
} ) ;
}
//console.log(this.newleftTabledata)
console . log ( this . newleftTabledata )
}
//删除分组
@ -189,8 +205,10 @@ export class PlanTemplateComponent implements OnInit {
this . newleftTabledata [ this . leftclicki ] . data = this . group
}
//新增属性
groupName
addAttribute ( groupName ) {
this . groupPanle = true
this . groupName = groupName
if ( groupName == '单位概况' ) {
const dialogRef = this . dialog . open ( adddwsurvey , { //调用open方法打开对话框并且携带参数过去
width : '240px' ,
@ -199,7 +217,7 @@ export class PlanTemplateComponent implements OnInit {
data :this.group
} ) ;
dialogRef . afterClosed ( ) . subscribe ( result = > {
console . log ( result )
//console.log(result)
if ( result != undefined ) {
this . group . forEach ( ( value , index , array ) = > {
if ( array [ index ] . groupName == '单位概况' ) {
@ -209,6 +227,30 @@ export class PlanTemplateComponent implements OnInit {
}
//console.log(this.newleftTabledata)
} ) ;
} else if ( groupName == '灾情设定' ) {
const dialogRef = this . dialog . open ( disaster , { //调用open方法打开对话框并且携带参数过去
width : '340px' ,
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 == '灾情设定' ) {
if ( array [ index ] . attribute == undefined ) {
array [ index ] . attribute = [ ]
array [ index ] . attribute . push ( result )
} else {
array [ index ] . attribute . push ( result )
}
}
} )
}
console . log ( this . newleftTabledata )
} ) ;
}
}
//删除具体属性
@ -232,7 +274,13 @@ export class PlanTemplateComponent implements OnInit {
danweiInfTable = [ ]
addAttInfo ( surveyName ) {
if ( surveyName == '进攻通道' ) {
this . attack . push ( { head : '进出口' , tableth : [ ] } )
if ( this . group [ 0 ] . attribute [ 4 ] . attinf == undefined ) {
this . group [ 0 ] . attribute [ 4 ] . attinf = [ ]
this . group [ 0 ] . attribute [ 4 ] . attinf . push ( { head : '' , tableth : [ ] , completed :true } )
} else {
this . group [ 0 ] . attribute [ 4 ] . attinf . push ( { head : '' , tableth : [ ] , completed :true } )
}
} else {
this . attPanle = true
const dialogRef = this . dialog . open ( addattinf , { //调用open方法打开对话框并且携带参数过去
@ -273,7 +321,7 @@ export class PlanTemplateComponent implements OnInit {
//array[index].attribute[i].completed=false
attarr [ i ] . attinf . forEach ( ( attinfValue , attinfi , attinfarr ) = > {
if ( attinfValue . propertyName == propertyName ) {
attinfarr [ attinfi ] . completed = false
attinfarr [ attinfi ] . splice ( attinfi , i )
}
} ) ;
}
@ -284,7 +332,7 @@ export class PlanTemplateComponent implements OnInit {
this . newleftTabledata [ this . leftclicki ] . data = this . group
console . log ( this . newleftTabledata )
}
//消防设施具体属性编辑
//消防设施表格 具体属性编辑
fileAdd ( facilityItems , filei ) {
const dialogRef = this . dialog . open ( addattinf , { //调用open方法打开对话框并且携带参数过去
width : '240px' ,
@ -309,7 +357,7 @@ export class PlanTemplateComponent implements OnInit {
console . log ( this . newleftTabledata )
} ) ;
}
//消防设施具体属性删除
//消防设施表格 具体属性删除
fileDel ( i , f ) {
let isTrue = confirm ( '您确定要删除该条信息吗' )
if ( isTrue ) {
@ -318,9 +366,50 @@ export class PlanTemplateComponent implements OnInit {
}
//进攻通道
attack = [ ]
attackAdd ( ) {
this . attack . length + 1
//进攻通道,灾情设定增加表格数据
attackAdd ( name , i ) {
//console.log(name,i)
if ( name == '进攻通道' ) {
this . group [ 0 ] . attribute [ 4 ] . attinf [ i ] . tableth . push ( '' )
} else if ( name == '灾情设定' ) {
this . group [ 1 ] . attribute [ i ] . tableth . push ( '' )
}
console . log ( this . newleftTabledata )
}
//进攻通道,消防设施一级菜单删除
delattAndfileOne ( groupName , surveyName , indexOne ) {
let isTrue = confirm ( '您确定要删除该条信息吗' )
if ( isTrue ) {
this . group . forEach ( ( value , index , array ) = > {
if ( array [ index ] . groupName == groupName ) {
array [ index ] . attribute . forEach ( ( element , i , attarr ) = > {
if ( element . surveyName == surveyName ) {
if ( surveyName == '消防设施' ) {
element . attinf [ indexOne ] . completed = false
}
else {
element . attinf . splice ( indexOne , 1 )
}
}
} ) ;
}
} )
}
this . newleftTabledata [ this . leftclicki ] . data = this . group
console . log ( this . newleftTabledata )
}
//input key值,一个字符焦点消失问题
trackByFn ( index ) {
return index
}
//灾情设定删除一条
delDisaster ( i ) {
let isTrue = confirm ( '您确定要删除该条信息吗' )
if ( isTrue ) {
this . group [ 1 ] . attribute . splice ( i , 1 )
}
}
//保存
save ( ) {
@ -501,8 +590,8 @@ export class addGroup{
]
groupName = [ ]
ngOnInit ( ) : void {
//console.log(this.data)
if ( this . data . length != 0 || this . data != null ) {
console . log ( this . data )
if ( this . data != null ) {
this . addgtoup = this . data
}
@ -656,4 +745,44 @@ defineClick(){
this . dialogRef . close ( this . data . surveyName == '单位基本信息' ? this . addAttinf :this.data.surveyName == '建筑信息' ?
this . addAttinfBuild :this.data.surveyName == '消防设施' ? this . addAttinfFile :this.facilityItems )
}
}
}
//灾情设定弹窗
@Component ( {
selector : 'disaster' ,
templateUrl : './Disaster.html' ,
styleUrls : [ './addKeyname.scss' ]
} )
export class disaster {
constructor ( private http : HttpClient , public dialogRef : MatDialogRef < disaster > , @Inject ( MAT_DIALOG_DATA ) public data , public snackBar : MatSnackBar ) { }
ngOnInit ( ) : void {
console . log ( this . data )
}
level //类型
headName //表头名称
lieNumber //列数
//取消按钮
close ( ) {
this . dialogRef . close ( ) ;
}
//确定按钮
newdisaster ( ) {
const config = new MatSnackBarConfig ( ) ;
config . verticalPosition = 'top' ;
config . duration = 3000
if ( this . level == undefined || this . level == '' ) {
this . snackBar . open ( '请选择类型!' , '确定' , config ) ;
} else if ( this . headName == undefined || this . headName == '' ) {
this . snackBar . open ( '请输入表头名称!' , '确定' , config ) ;
} else {
let attrubute = {
headName :this.headName ,
level :this.level ,
tableth : [ ]
//lieNumber:this.lieNumber,
}
this . dialogRef . close ( attrubute ) ;
}
}
}