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 floorData:this.selectingSitePlan
} }
let data = { treeData: treeData,oldRealData:this.storeyData ,buildFloorData:buildFloorData} 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 { ngOnInit(): void {
this.renderData = this.data.treeData this.renderData = this.data.treeData
if(JSON.parse(sessionStorage.getItem('tree型数据')) && JSON.parse(sessionStorage.getItem('tree型数据'))[this.data.buildFloorData.floorData.id]){ 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.defaultCheckedKeys = JSON.parse(sessionStorage.getItem('tree型数据'))[this.data.buildFloorData.floorData.id]
} }
this.data.treeData.forEach(element => { this.data.treeData.forEach(element => {
@ -96,32 +96,38 @@ export class examinationQuestions {
let data = JSON.parse(sessionStorage.getItem("试卷id")) let data = JSON.parse(sessionStorage.getItem("试卷id"))
if(data && data.length != 0){ if(data && data.length != 0){
console.log(1)
let ind = null let ind = null
data.forEach((item,index) => { data.forEach((item,index) => {
if(item.key == obj.key){ if(item.key == obj.key){
ind = index ind = index + 1
} }
}) })
if(ind){ if(ind){
if(checkList.length != 0){ if(checkList.length != 0){
data[ind].children = checkList data[ind - 1].children = checkList
}else{ }else{
data.splice(ind,1) data.splice(ind - 1,1)
} }
}else{ }else{
data.push(obj) data.push(obj)
} }
sessionStorage.setItem("试卷id",JSON.stringify(data)) sessionStorage.setItem("试卷id",JSON.stringify(data))
}else{ }else{
console.log(2)
data = [] data = []
data[0] = obj data[0] = obj
console.log(123,data)
sessionStorage.setItem("试卷id",JSON.stringify(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