Browse Source

[完善]保存消防每层设施的会话存储

master
邵佳豪 4 years ago
parent
commit
baa3a53353
  1. 2
      src/app/ui/collection-tools/collection-tools.component.ts
  2. 18
      src/app/ui/collection-tools/examinationQuestions.ts

2
src/app/ui/collection-tools/collection-tools.component.ts

@ -1326,7 +1326,7 @@ export class CollectionToolsComponent implements OnInit {
floorData:this.selectingSitePlan
}
let data = { treeData: treeData,oldRealData:this.storeyData ,buildFloorData:buildFloorData}
// let dialogRef = this.dialog.open(examinationQuestions,{data});
let dialogRef = this.dialog.open(examinationQuestions,{data});
}
//上传考题

18
src/app/ui/collection-tools/examinationQuestions.ts

@ -26,7 +26,7 @@ export class examinationQuestions {
ngOnInit(): void {
this.renderData = this.data.treeData
if(JSON.parse(sessionStorage.getItem('tree型数据')) && JSON.parse(sessionStorage.getItem('tree型数据'))[this.data.buildFloorData.floorData.id]){
console.log(123,JSON.parse(sessionStorage.getItem('tree型数据'))[this.data.buildFloorData.floorData.id])
// console.log(123,JSON.parse(sessionStorage.getItem('tree型数据'))[this.data.buildFloorData.floorData.id])
this.defaultCheckedKeys = JSON.parse(sessionStorage.getItem('tree型数据'))[this.data.buildFloorData.floorData.id]
}
this.data.treeData.forEach(element => {
@ -96,32 +96,38 @@ export class examinationQuestions {
let data = JSON.parse(sessionStorage.getItem("试卷id"))
if(data && data.length != 0){
console.log(1)
let ind = null
data.forEach((item,index) => {
if(item.key == obj.key){
ind = index
ind = index + 1
}
})
if(ind){
if(checkList.length != 0){
data[ind].children = checkList
data[ind - 1].children = checkList
}else{
data.splice(ind,1)
data.splice(ind - 1,1)
}
}else{
data.push(obj)
}
sessionStorage.setItem("试卷id",JSON.stringify(data))
}else{
console.log(2)
data = []
data[0] = obj
console.log(123,data)
sessionStorage.setItem("试卷id",JSON.stringify(data))
}
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('当层消防设施考题设置完成','确定',config);
// this.dialogRef.close()
}
}

Loading…
Cancel
Save