diff --git a/src/app/examiner/create-test-score/create-test-score.component.html b/src/app/examiner/create-test-score/create-test-score.component.html index 03965ee..7299db5 100644 --- a/src/app/examiner/create-test-score/create-test-score.component.html +++ b/src/app/examiner/create-test-score/create-test-score.component.html @@ -272,12 +272,12 @@ 设置分数 操作 - + {{item.name}} - {{item.or}} - {{item.time}} - {{item.isOpen}} - {{item.level}} + {{item.creatorName}} + {{item.modifiedTime | date:'yyyy-MM-dd'}} + {{item.openRange}} + {{item.planLevel | planlevel}} diff --git a/src/app/examiner/create-test-score/create-test-score.component.ts b/src/app/examiner/create-test-score/create-test-score.component.ts index f8af142..07bf7ad 100644 --- a/src/app/examiner/create-test-score/create-test-score.component.ts +++ b/src/app/examiner/create-test-score/create-test-score.component.ts @@ -23,6 +23,25 @@ export class CreateTestScoreComponent implements OnInit { this.selectedTab = index } ngOnInit(): void { + for (let y = 0, length = this.unitId.length; y < length; y++){ + let element = this.unitId[y] + element.score = 0 + element.basicInfoScore = 0 + element.basicInfoItemScore = 0 + element.basicInfoNodes = [] + element.aroundScore = 0 + element.aroundItemScore = 0 + element.aroundNodes = [] + element.keySiteScore = 0 + element.keySiteItemScore = 0 + element.keySiteNodes = [] + element.funDivScore = 0 + element.funDivItemScore = 0 + element.funDivNodes = [] + element.fireFacScore = 0 + element.fireFacItemScore = 0 + element.fireFacNodes = [] + } this.getUnitData().then(()=>{ this.getAround().then(()=>{ this.getKeySite().then(()=>{ @@ -32,21 +51,12 @@ export class CreateTestScoreComponent implements OnInit { }) }) }) - // Promise.all([this.getUnitData(),this.getAround(),this.getKeySite(),this.getFunDiv()]).then(()=>{ - // this.getFireFac() - // }) } //当前选中的单位 selectedUnitIndex = 0 clickUnitName(key){ this.selectedUnitIndex = key } - - //上个页面传过来的单位数据 - // unitId:any = [{name:'最最最最最',id:'5fb76c42919f2b44e464016f'}, - // {name:'华南城集团有限公司',id:'5ee19fe06f91049f5e23e937'}, - // {name:'贵港油库',id:'5fa35d68f8eb762cb03c662e'} - // ] unitId:any = JSON.parse(sessionStorage.getItem('checkedWork')) //获取单位基本信息 @@ -54,9 +64,7 @@ export class CreateTestScoreComponent implements OnInit { let that = this for (let y = 0, length = this.unitId.length; y < length; y++){ let element = this.unitId[y] - element.score = 0 - element.basicInfoScore = 0 - element.basicInfoItemScore = 0 + let result1 = await new Promise((resolve, reject) => { this.http.get(`/api/Companies/${element.id}`).subscribe((data:any)=>{ let unitData = { @@ -85,7 +93,7 @@ export class CreateTestScoreComponent implements OnInit { name: '单位地址',key: element.id+'单位地址',isLeaf:true,value:data.address }) : null - element.basicInfoNodes = [] + element.basicInfoNodes.push(unitData) resolve(1) @@ -191,9 +199,7 @@ export class CreateTestScoreComponent implements OnInit { let that = this for (let y = 0, length = this.unitId.length; y < length; y++){ let element = this.unitId[y] - element.aroundScore = 0 - element.aroundItemScore = 0 - element.aroundNodes = [] + //获得当前单位的单位毗邻 let id = {companyId:element.id} let result1 = await new Promise((resolve, reject) => { @@ -275,9 +281,7 @@ export class CreateTestScoreComponent implements OnInit { for (let y = 0, length = this.unitId.length; y < length; y++){ console.log("xiba") let element = this.unitId[y] - element.keySiteScore = 0 - element.keySiteItemScore = 0 - element.keySiteNodes = [] + //获得单位重点部位 let id = {companyId:element.id} @@ -354,9 +358,7 @@ export class CreateTestScoreComponent implements OnInit { let that = this for (let y = 0, length = this.unitId.length; y < length; y++){ let element = this.unitId[y] - element.funDivScore = 0 - element.funDivItemScore = 0 - element.funDivNodes = [] + let id = {companyId:element.id} //单位功能分区 let result1 = await new Promise((resolve, reject) => { @@ -432,9 +434,7 @@ export class CreateTestScoreComponent implements OnInit { getFireFac(){ let that = this this.unitId.forEach((element,index) =>{ - element.fireFacScore = 0 - element.fireFacItemScore = 0 - element.fireFacNodes = [] + let companyId = element.id //获取单位级别消防设施 this.http.get(`/api/Companies/${companyId}`).subscribe((data:any)=>{ @@ -550,20 +550,29 @@ export class CreateTestScoreComponent implements OnInit { calculateScore(key){ //key代表第几个建筑 //计算整个单位的总分 - + // console.log(this.unitId[key].basicInfoScore) + // console.log(this.unitId[key].aroundScore) + // console.log(this.unitId[key].keySiteScore) + // console.log(this.unitId[key].funDivScore) + // console.log(this.unitId[key].fireFacScore) this.unitId[key].score = this.unitId[key].basicInfoScore + this.unitId[key].aroundScore + this.unitId[key].keySiteScore + this.unitId[key].funDivScore + this.unitId[key].fireFacScore - - //计算整个试卷的总分 + //计算整个试卷的总分 - let examScore = 0 - this.unitId.forEach(element => { - examScore += element.score - }) - let examScore2 = 0 - this.planDatas.forEach(element => { - examScore2 += Number(element.score) - }) - this.examScore = examScore + examScore2 + let examScore = 0 + this.unitId.forEach(element => { + examScore += element.score + }) + let examScore2 = 0 + this.unitId.forEach(element => { + let x = 0 + if(element.planList){ + element.planList.forEach(i => { + x += i.score + }) + } + examScore2 += Number(x) + }) + this.examScore = examScore + examScore2 } //tree的选择事件 @@ -721,19 +730,33 @@ export class CreateTestScoreComponent implements OnInit { }); dialogRef.afterClosed().subscribe(result => { - console.log('The dialog was closed'); + if(result){ + if(this.unitId[this.selectedUnitIndex].planList){ + this.unitId[this.selectedUnitIndex].planList.push(result) + }else{ + this.unitId[this.selectedUnitIndex].planList = [] + this.unitId[this.selectedUnitIndex].planList.push(result) + } + } }); } //每条预案分数增加在试卷分数 planItemScore(item){ //计算整个试卷的总分 + console.log(item) let examScore = 0 this.unitId.forEach(element => { examScore += element.score }) let examScore2 = 0 - this.planDatas.forEach(element => { - examScore2 += Number(element.score) + this.unitId.forEach(element => { + let x = 0 + if(element.planList){ + element.planList.forEach(i => { + x += i.score + }) + } + examScore2 += Number(x) }) this.examScore = examScore + examScore2 } @@ -1029,7 +1052,7 @@ export class CreateTestScoreComponent implements OnInit { }); dialogRef.afterClosed().subscribe(result => { - console.log('The dialog was closed'); + }); } @@ -1069,7 +1092,13 @@ export class AddPlanDialog { }); dialogRef.afterClosed().subscribe(result => { - this.dialogRef.close(); + if(result){ + console.log(1111111,result) + this.dialogRef.close(result); + }else{ + this.dialogRef.close(); + } + }); } } @@ -1118,7 +1147,7 @@ export class AddPlanTwoDialog { confirm(){ if(this.planType){//如果选择的是已存在预案 if(this.selectedRadioData){ - this.dialogRef.close(); + this.dialogRef.close(this.selectedRadioData); sessionStorage.setItem('companyName',this.data.companyData.companyData.name) sessionStorage.setItem('planId',this.selectedRadioData.id) sessionStorage.setItem('buildingTypeId',this.data.companyData.companyData.buildingTypes[0].id)