@ -62,6 +62,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
if ( this . route . snapshot . queryParams . pattern == 'false' ) {
this . pattern = 'look'
this . blockyl = false
this . clickTitleItem ( '单位概况' )
} else {
this . pattern = 'edit'
}
@ -249,6 +250,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
selectedContent :any
async clickTitleItem ( item ) {
//this.planTemplateData[key].new=true
this . selectedContent = item
this . addNumber = - 1
this . yinruData = {
@ -372,9 +374,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
console . log ( this . planTemplateData )
} / * else if ( this . selectedItem == '单位概况' ) {
//this.getAllBuildings()
} * / e l s e i f ( t h i s . s e l e c t e d I t e m = = ' 预 案 附 件 ' ) {
} else if ( this . selectedItem == '预案附件' ) {
this . getTwoDPlanList ( )
} else if ( this . selectedItem == '新建' ) {
const dialogRef = this . dialog . open ( newTitle , { //调用open方法打开对话框并且携带参数过去
@ -606,11 +606,27 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
element . attribute = [ { name : '特别警示' , content : '' } ]
}
}
if ( element . groupName == '三位概况' ) {
this . clickTitleItem ( '单位概况' )
}
} ) ;
if ( this . planLevel == '4' ) {
this . planTemplateData . push ( { completed : true , groupName : '新建' } )
}
this . planTemplateData . forEach ( element = > {
if ( element . attribute != undefined ) {
/ * e l e m e n t . a t t r i b u t e . f o r E a c h ( ( i t e m , i n d e x , v a l u e ) = > {
if ( value [ index ] . level != undefined && value [ index ] . level == 1 ) {
value [ index ] . lieNumber = value [ index ] . tableth . length
}
} ) ; * /
for ( let i = 0 ; i < element.attribute.length ; i + + ) {
if ( element . attribute [ i ] . level != undefined && element . attribute [ i ] . level == 1 ) {
element . attribute [ i ] . lieNumber = element . attribute [ i ] . tableth . length
}
}
}
} ) ;
console . log ( this . planTemplateData )
} )
@ -1192,15 +1208,22 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
trackByFn ( index ) {
return index
}
//灾情设定表格 增加一行
//四种类型 增加一行
addNumber = - 1
addTd ( key , i ) {
this . addNumber ++
if ( this . planTemplateData [ key ] . attribute [ i ] . tabletr == undefined ) {
this . planTemplateData [ key ] . attribute [ i ] . tabletr = [ ]
}
this . planTemplateData [ key ] . attribute [ i ] . tabletr . push ( { tabletd : [ ] } )
for ( var j = 0 ; j < this . planTemplateData [ key ] . attribute [ i ] . tableth . length ; j ++ ) {
if ( this . planTemplateData [ key ] . attribute [ i ] . tableth == undefined ) {
//this.planTemplateData[key].attribute[i].tabletr = []
const config = new MatSnackBarConfig ( ) ;
config . verticalPosition = 'top' ;
config . duration = 3000
this . snackBar . open ( '请先编辑列!' , '确定' , config ) ;
} else {
if ( this . planTemplateData [ key ] . attribute [ i ] . tabletr == undefined ) {
this . planTemplateData [ key ] . attribute [ i ] . tabletr = [ ]
}
this . planTemplateData [ key ] . attribute [ i ] . tabletr . push ( { tabletd : [ ] } )
for ( var j = 0 ; j < this . planTemplateData [ key ] . attribute [ i ] . tableth . length ; j ++ ) {
if ( this . planTemplateData [ key ] . attribute [ i ] . tabletr != undefined ) {
this . planTemplateData [ key ] . attribute [ i ] . tabletr [ this . planTemplateData [ key ] . attribute [ i ] . tabletr . length - 1 ] . tabletd . push ( '' )
}
@ -1208,23 +1231,127 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
this . planTemplateData [ key ] . attribute [ i ] . tabletr [ this . addNumber ] . tabletd . push ( '' )
}
}
}
// console.log(this.planTemplateData)
}
//灾情设定表格 删除一行
delTd ( key , i ) {
//四种类型 删除一行
delTd ( key , i , tri? :number , uniti? :number , elei? :number ) {
const config = new MatSnackBarConfig ( ) ;
config . verticalPosition = 'top' ;
config . duration = 3000
if ( this . planTemplateData [ key ] . attribute [ i ] . tabletr != undefined ) {
this . planTemplateData [ key ] . attribute [ i ] . tabletr . splice ( this . planTemplateData [ key ] . attribute [ i ] . tabletr . length - 1 , 1 )
this . addNumber --
if ( this . planTemplateData [ key ] . attribute [ i ] . tabletr . length == 0 ) {
this . addNumber = - 1
let isTrue = confirm ( '您确定要删除该条信息吗' )
if ( isTrue ) {
if ( tri == undefined ) {
this . planTemplateData [ key ] . attribute . splice ( i , 1 )
} else {
if ( uniti == undefined && elei == undefined ) {
this . planTemplateData [ key ] . attribute [ i ] . tabletr . splice ( tri , 1 )
} else {
this . planTemplateData [ key ] . building [ i ] . body [ tri ] . attinf [ uniti ] . tabletr . splice ( elei , 1 )
}
}
} else {
this . snackBar . open ( '请先增加一行!' , '确定' , config ) ;
}
}
//修改多行文本,表格行列数量
updataHl ( . . . num :number [ ] ) {
const dialogRef = this . dialog . open ( updataHl , { //调用open方法打开对话框并且携带参数过去
width : '340px' ,
height : '350px' ,
disableClose :true ,
data :JSON.parse ( JSON . stringify ( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) )
} ) ;
dialogRef . afterClosed ( ) . subscribe ( result = > {
if ( result != undefined ) {
//外层四种类型编辑行跟列
if ( ( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .level = = 1 ) {
//表格类型编辑列数
if ( ( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tabletr = = undefined ) {
( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tabletr = [ ]
}
if ( ( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tableth.length < result.lieNumber ) {
//表格类型新增列数
for ( let i = ( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tableth.length ; i < result.lieNumber ; i + + ) {
( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tableth.push ( ' ' )
if ( ( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tabletr ! = undefined ) {
( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tabletr.forEach ( element = > {
element . tabletd . push ( '' )
} ) ;
}
}
} else {
//表格类型减少列数
for ( let i = ( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tableth.length ; i > result . lieNumber ; i -- ) {
( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tableth.splice ( i - 1 , 1 )
if ( ( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tabletr ! = undefined ) {
( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tabletr.forEach ( ( element ) = > {
element . tabletd . splice ( element . tabletd . length - 1 , 1 )
} ) ;
}
}
}
} else if ( ( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .level = = 2 ) {
//多行文本编辑行列
if ( ( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tableth.length < result.hNumber ) {
for ( let i = ( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tableth.length ; i < result.hNumber ; i + + ) {
( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tableth.push ( [ { body : ' ' , head : ' ' } ] )
}
} else {
for ( let i = ( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tableth.length ; i > result . hNumber ; i -- ) {
( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tableth.splice ( i - 1 , 1 )
}
}
( num . length < 3 ? this.planTemplateData [ num [ 0 ] ] .attribute [ num [ 1 ] ] : this.planTemplateData [ num [ 0 ] ] .building [ num [ 1 ] ] .body [ num [ 2 ] ] .attinf [ num [ 3 ] ] ) .tableth.forEach ( ( element , index , value ) = > {
if ( value [ index ] . length < result.lieNumber ) {
for ( let a = value [ index ] . length ; a < result.lieNumber ; a + + ) {
value [ index ] . push ( { body : '' , head : '' } )
}
} else {
for ( let a = value [ index ] . length ; a > result . lieNumber ; a -- ) {
value [ index ] . splice ( index - 1 , 1 )
}
}
} ) ;
}
console . log ( this . planTemplateData )
}
} ) ;
}
//新建内容向上排序
upPai ( zi , attributei ) {
var temp
if ( attributei != 0 ) {
for ( let index = attributei - 1 ; index >= 0 ; index -- ) {
temp = this . planTemplateData [ zi ] . attribute [ index ]
this . planTemplateData [ zi ] . attribute [ index ] = this . planTemplateData [ zi ] . attribute [ attributei ]
this . planTemplateData [ zi ] . attribute [ attributei ] = temp
return
}
}
}
//新建内容向下排序
downPai ( zi , attributei ) {
var temp
if ( attributei != this . planTemplateData [ zi ] . attribute . length - 1 ) {
for ( let index = attributei + 1 ; index < this . planTemplateData [ zi ] . attribute . length ; index ++ ) {
temp = this . planTemplateData [ zi ] . attribute [ index ]
this . planTemplateData [ zi ] . attribute [ index ] = this . planTemplateData [ zi ] . attribute [ attributei ]
this . planTemplateData [ zi ] . attribute [ attributei ] = temp
return
}
}
}
//单位概况左侧建筑点击事件
buildingName
@ -1236,61 +1363,117 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
// console.log(item, this.clicki)
}
//单位概况增加一行
unitadd ( surveyName , attacki , i ) {
let index = this . getArrayIndex ( this . planTemplateData , '单位概况' )
unitadd ( surveyName , attacki , i , fileNum? :number ) {
let index = this . getArrayIndex ( this . planTemplateData , '单位概况' )
this . addNumber ++
if ( surveyName == '进攻通道' ) {
if ( this . planTemplateData [ index ] . building [ attacki ] . body [ 4 ] . attinf [ i ] . tabletr == undefined ) {
this . planTemplateData [ index ] . building [ attacki ] . body [ 4 ] . attinf [ i ] . tabletr = [ ]
}
this . planTemplateData [ index ] . building [ attacki ] . body [ 4 ] . attinf [ i ] . tabletr . push ( { tabletd : [ ] } )
for ( var j = 0 ; j < this . planTemplateData [ index ] . building [ attacki ] . body [ 4 ] . attinf [ i ] . tableth . length ; j ++ ) {
if ( this . planTemplateData [ index ] . building [ attacki ] . body [ 4 ] . attinf [ i ] . tabletr != undefined ) {
this . planTemplateData [ index ] . building [ attacki ] . body [ 4 ] . attinf [ i ] . tabletr [ this . planTemplateData [ index ] . building [ attacki ] . body [ 4 ] . attinf [ i ] . tabletr . length - 1 ] . tabletd . push ( '' )
}
else {
this . planTemplateData [ index ] . building [ attacki ] . body [ 4 ] . attinf [ i ] . tabletr [ this . addNumber ] . tabletd . push ( '' )
this . planTemplateData [ index ] . building [ attacki ] . body . forEach ( ( value , bodyi , arr ) = > {
if ( surveyName == arr [ bodyi ] . surveyName ) {
if ( arr [ bodyi ] . zdy == undefined ) {
if ( surveyName == '进攻通道' ) {
if ( this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf [ i ] . tabletr == undefined ) {
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf [ i ] . tabletr = [ ]
}
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf [ i ] . tabletr . push ( { tabletd : [ ] } )
for ( var j = 0 ; j < this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf [ i ] . tableth . length ; j ++ ) {
if ( this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf [ i ] . tabletr != undefined ) {
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf [ i ] . tabletr [ this . planTemplateData [ index ] . building [ attacki ] . body [ 4 ] . attinf [ i ] . tabletr . length - 1 ] . tabletd . push ( '' )
}
else {
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf [ i ] . tabletr [ this . addNumber ] . tabletd . push ( '' )
}
}
// console.log(this.planTemplateData)
}
else if ( surveyName == '功能分区' ) {
// console.log(attacki)
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf . push ( { name : '' , value : '' } )
} else if ( surveyName == '重点部位' ) {
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf . push ( { heafName : '' , body : [ { name : '重点部位名称' , value : '' } , { name : '重点部位所在位置' , value : '' } , { name : '建筑结构' , value : '' } , { name : '使用性质' , value : '' } , { name : '主要危险性' , value : '' } ] } )
}
else if ( surveyName == '单位基本信息' || surveyName == '建筑信息' ) {
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf . push ( { propertyName : '' , value : '' , completed :true , zdy :true } )
} else if ( surveyName == '四周毗邻' ) {
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf . push ( { name : '' , value : '' , completed :true , zdy :false } )
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf . push ( { name : '' , value : '' , completed :true , zdy :true } )
} else if ( surveyName == '消防设施' ) {
if ( fileNum == 0 ) {
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf [ i ] . facilityItems . push ( { name : '' , value : '' , completed :true , zdy :true } )
} else {
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf . push ( { propertyName : '' , value : '' , completed :true , zdy :true , facilityItems : [ ] } )
}
}
} else {
this . addAttribute ( surveyName , attacki , i , 1 , surveyName )
}
}
} )
console . log ( this . planTemplateData )
}
//单位概况自定义表格新增一行
unitNewadd ( . . . num :number [ ] ) {
console . log ( num )
if ( this . planTemplateData [ num [ 0 ] ] . building [ num [ 1 ] ] . body [ num [ 2 ] ] . attinf [ num [ 3 ] ] . tableth == undefined ) {
//this.planTemplateData[key].attribute[i].tabletr = []
const config = new MatSnackBarConfig ( ) ;
config . verticalPosition = 'top' ;
config . duration = 3000
this . snackBar . open ( '请先编辑列!' , '确定' , config ) ;
} else {
if ( this . planTemplateData [ num [ 0 ] ] . building [ num [ 1 ] ] . body [ num [ 2 ] ] . attinf [ num [ 3 ] ] . tabletr == undefined ) {
this . planTemplateData [ num [ 0 ] ] . building [ num [ 1 ] ] . body [ num [ 2 ] ] . attinf [ num [ 3 ] ] . tabletr = [ ]
}
this . planTemplateData [ num [ 0 ] ] . building [ num [ 1 ] ] . body [ num [ 2 ] ] . attinf [ num [ 3 ] ] . tabletr . push ( { tabletd : [ ] } )
for ( var j = 0 ; j < this . planTemplateData [ num [ 0 ] ] . building [ num [ 1 ] ] . body [ num [ 2 ] ] . attinf [ num [ 3 ] ] . tableth . length ; j ++ ) {
if ( this . planTemplateData [ num [ 0 ] ] . building [ num [ 1 ] ] . body [ num [ 2 ] ] . attinf [ num [ 3 ] ] . tabletr != undefined ) {
this . planTemplateData [ num [ 0 ] ] . building [ num [ 1 ] ] . body [ num [ 2 ] ] . attinf [ num [ 3 ] ] . tabletr [ this . planTemplateData [ num [ 0 ] ] . building [ num [ 1 ] ] . body [ num [ 2 ] ] . attinf [ num [ 3 ] ] . tabletr . length - 1 ] . tabletd . push ( '' )
}
else {
this . planTemplateData [ num [ 0 ] ] . building [ num [ 1 ] ] . body [ num [ 2 ] ] . attinf [ num [ 3 ] ] . tabletr [ this . addNumber ] . tabletd . push ( '' )
}
// console.log(this.planTemplateData)
}
else if ( surveyName == '功能分区' ) {
// console.log(attacki)
this . planTemplateData [ index ] . building [ attacki ] . body [ 6 ] . attinf . push ( { name : '' , value : '' } )
} else if ( surveyName == '重点部位' ) {
this . planTemplateData [ index ] . building [ attacki ] . body [ 5 ] . attinf . push ( { heafName : '' , body : [ { name : '重点部位名称' , value : '' } , { name : '重点部位所在位置' , value : '' } , { name : '建筑结构' , value : '' } , { name : '使用性质' , value : '' } , { name : '主要危险性' , value : '' } ] } )
}
//this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]].push()
}
//单位概况删除一行
unitDel ( surveyName , attacki , i ) {
unitDel ( surveyName , attacki , i , fileNum? :number ) {
let index = this . getArrayIndex ( this . planTemplateData , '单位概况' )
const config = new MatSnackBarConfig ( ) ;
config . verticalPosition = 'top' ;
config . duration = 3000
let isTrue = confirm ( '您确定要删除该条信息吗' )
if ( surveyName == '进攻通道' ) {
if ( isTrue ) {
if ( this . planTemplateData [ index ] . building [ attacki ] . body [ 4 ] . attinf [ i ] . tabletr != undefined ) {
this . planTemplateData [ index ] . building [ attacki ] . body [ 4 ] . attinf [ i ] . tabletr . splice ( this . planTemplateData [ index ] . building [ attacki ] . body [ 4 ] . attinf [ i ] . tabletr . length - 1 , 1 )
this . addNumber --
if ( this . planTemplateData [ index ] . building [ attacki ] . body [ 4 ] . attinf [ i ] . tabletr . length == 0 ) {
this . addNumber = - 1
this . planTemplateData [ index ] . building [ attacki ] . body . forEach ( ( value , bodyi , arr ) = > {
if ( surveyName == arr [ bodyi ] . surveyName ) {
if ( surveyName == '进攻通道' ) {
if ( isTrue ) {
if ( this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf [ i ] . tabletr != undefined ) {
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf [ i ] . tabletr . splice ( this . planTemplateData [ index ] . building [ attacki ] . body [ 4 ] . attinf [ i ] . tabletr . length - 1 , 1 )
this . addNumber --
if ( this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf [ i ] . tabletr . length == 0 ) {
this . addNumber = - 1
}
} else {
this . snackBar . open ( '请先增加一行!' , '确定' , config ) ;
}
}
} else {
this . snackBar . open ( '请先增加一行!' , '确定' , config ) ;
} else if ( surveyName == '功能分区' || surveyName == '重点部位' || surveyName == '单位基本信息' || surveyName == '建筑信息' || surveyName == '消防设施' ) {
if ( isTrue ) {
if ( surveyName == '消防设施' && fileNum != undefined ) {
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf [ i ] . facilityItems . splice ( fileNum , 1 )
} else {
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf . splice ( i , 1 )
}
}
} else if ( surveyName == '四周毗邻' ) {
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf . splice ( i , 1 )
this . planTemplateData [ index ] . building [ attacki ] . body [ bodyi ] . attinf . splice ( i - 1 , 1 )
}
}
} else if ( surveyName == '功能分区' ) {
if ( isTrue ) {
this . planTemplateData [ index ] . building [ attacki ] . body [ 6 ] . attinf . splice ( i , 1 )
}
} else if ( surveyName == '重点部位' ) {
if ( isTrue ) {
this . planTemplateData [ index ] . building [ attacki ] . body [ 5 ] . attinf . splice ( i , 1 )
}
}
} ) ;
}
//分段上传
@ -1403,13 +1586,13 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
oldData = false
clickoldData() {
this . oldData = ! this . oldData
}
//新增功能(社会联动等引用)
searchType = '0'
//打开自定义新增具体内容
tuTrue = false
addAttribute ( groupName , key ) {
addAttribute ( groupName , attacki? :any , i? :any , fileNum? :any , surveyName? :string ) {
let index = this . getArrayIndex ( this . planTemplateData , '单位概况' )
const dialogRef = this . dialog . open ( disaster , { //调用open方法打开对话框并且携带参数过去
width : '340px' ,
height : '450px' ,
@ -1419,24 +1602,29 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
dialogRef . afterClosed ( ) . subscribe ( result = > {
console . log ( result )
if ( result != undefined ) {
this . planTemplateData . forEach ( ( value , index , array ) = > {
if ( array [ index ] . groupName == groupName ) {
if ( array [ index ] . attribute == undefined ) {
array [ index ] . attribute = [ ]
array [ index ] . attribute . push ( result )
} else {
array [ index ] . attribute . push ( result )
}
if ( result . level == 2 ) {
for ( var i = 0 ; i < result.hNumber ; i + + ) {
array [ index ] . attribute [ array [ index ] . attribute . length - 1 ] . tableth . push ( [ { head : '' , body : '' } ] )
for ( var j = 0 ; j < result.lieNumber - 1 ; j + + ) {
array [ index ] . attribute [ array [ index ] . attribute . length - 1 ] . tableth [ i ] . push ( { head : '' , body : '' } )
if ( surveyName == undefined ) {
this . planTemplateData . forEach ( ( value , index , array ) = > {
if ( array [ index ] . groupName == groupName ) {
if ( array [ index ] . attribute == undefined ) {
array [ index ] . attribute = [ ]
array [ index ] . attribute . push ( result )
} else {
array [ index ] . attribute . push ( result )
}
if ( result . level == 2 ) {
for ( var i = 0 ; i < result.hNumber ; i + + ) {
array [ index ] . attribute [ array [ index ] . attribute . length - 1 ] . tableth . push ( [ { head : '' , body : '' } ] )
for ( var j = 0 ; j < result.lieNumber - 1 ; j + + ) {
array [ index ] . attribute [ array [ index ] . attribute . length - 1 ] . tableth [ i ] . push ( { head : '' , body : '' } )
}
}
}
}
}
} )
} )
}
else {
this . planTemplateData [ index ] . building [ attacki ] . body [ i ] . attinf . push ( result )
}
if ( result . level == '4' ) {
this . tuTrue = true
this . getAllBuildings ( )
@ -1543,6 +1731,45 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
e . target . value = ''
} )
}
//消防设施新增一条数据
zdyXf ( groupName ) {
const dialogRef = this . dialog . open ( disaster , { //调用open方法打开对话框并且携带参数过去
width : '340px' ,
height : '450px' ,
disableClose :true ,
data :this.planTemplateData
} ) ;
dialogRef . afterClosed ( ) . subscribe ( result = > {
console . log ( result )
if ( result != undefined ) {
this . planTemplateData . forEach ( ( value , index , array ) = > {
if ( array [ index ] . groupName == groupName ) {
if ( array [ index ] . attribute == undefined ) {
array [ index ] . attribute = [ ]
array [ index ] . attribute . push ( result )
} else {
array [ index ] . attribute . push ( result )
}
if ( result . level == 2 ) {
for ( var i = 0 ; i < result.hNumber ; i + + ) {
array [ index ] . attribute [ array [ index ] . attribute . length - 1 ] . tableth . push ( [ { head : '' , body : '' } ] )
for ( var j = 0 ; j < result.lieNumber - 1 ; j + + ) {
array [ index ] . attribute [ array [ index ] . attribute . length - 1 ] . tableth [ i ] . push ( { head : '' , body : '' } )
}
}
}
}
} )
if ( result . level == '4' ) {
this . tuTrue = true
this . getAllBuildings ( )
this . getSitePlan ( )
this . getRealPicture ( )
}
}
console . log ( this . planTemplateData )
} ) ;
}
}
@ -1717,10 +1944,42 @@ export class disaster{
tableth :this.level == 1 || this . level == 2 ? [ ] : this . level == 3 ? '' : tree ,
lieNumber :this.lieNumber ,
hNumber :this.hNumber ,
imgArr : [ ]
imgArr : [ ] ,
zdy :true
}
this . dialogRef . close ( attrubute ) ;
}
}
}
//修改表格,都行文本行列
@Component ( {
selector : 'updataHl' ,
templateUrl : './updatal.html' ,
styleUrls : [ './addKeyname.scss' ]
} )
export class updataHl {
constructor ( private http : HttpClient , public dialogRef : MatDialogRef < updataHl > , @Inject ( MAT_DIALOG_DATA ) public data , public snackBar : MatSnackBar ) { }
ngOnInit ( ) : void {
JSON . parse ( JSON . stringify ( this . data ) )
this . level = Number ( this . data . level )
console . log ( this . data )
}
level //类型
headName = this . data . headName //表头名称
lieNumber = this . data . zdy != undefined ? 0 :this.data.lieNumber //最小列数
hNumber = this . data . zdy != undefined ? 0 :this.data.hNumber //行数
//取消按钮
close ( ) {
this . dialogRef . close ( ) ;
}
//确定按钮
newdisaster ( ) {
console . log ( this . data )
let result = {
lieNumber :this.level == 2 ? this . data . tableth [ 0 ] . length :this.data.tableth.length ,
hNumber :this.data.tableth.length
}
this . dialogRef . close ( result ) ;
}
}