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 3bf3704..b1cbe14 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 @@ -617,8 +617,6 @@ export class CreateTestScoreComponent implements OnInit { examScore:any = 0//整个试卷的总分 - - //计算分数 calculateScore(key){ //key代表第几个建筑 @@ -638,6 +636,7 @@ export class CreateTestScoreComponent implements OnInit { x += i.score }) } + element.planScore = x examScore2 += Number(x) }) this.examScore = examScore + examScore2 diff --git a/src/app/student/examination-details/examination-details.component.html b/src/app/student/examination-details/examination-details.component.html index 94bf9a0..97f2d70 100644 --- a/src/app/student/examination-details/examination-details.component.html +++ b/src/app/student/examination-details/examination-details.component.html @@ -3,10 +3,13 @@
-
单位列表
总分:
+
单位列表
总分: + +
单位名称
总分
-
{{item.companyInfo.name}}
+
{{item.companyInfo.name}}
+
{{item.score}}+{{item.planScore || 0}}
diff --git a/src/app/student/examination-details/examination-details.component.ts b/src/app/student/examination-details/examination-details.component.ts index cfff501..4dcc752 100644 --- a/src/app/student/examination-details/examination-details.component.ts +++ b/src/app/student/examination-details/examination-details.component.ts @@ -15,6 +15,7 @@ export class ExaminationDetailsComponent implements OnInit { async ngOnInit(): Promise { await this.getTestInfo() + this.getUnitPlans()//将试卷的预案考题放进数据中 } paperData:any //试卷信息 @@ -37,7 +38,7 @@ export class ExaminationDetailsComponent implements OnInit { this.paperCompanyData = JSON.parse( JSON.stringify(data.paperDataInfo) ) //具体考卷 this.selectPaper = this.paperCompanyData[0] || {id:null} //当前选择考卷 this.handlePaperData() - resolve(1) + resolve() }) }) @@ -57,8 +58,47 @@ export class ExaminationDetailsComponent implements OnInit { } //获得单位预案设定 - getUnitPlans(){ - + async getUnitPlans(){ + for (let index = 0; index < this.paperCompanyData.length; index++) { + const item = this.paperCompanyData[index]; + let params = { + paperId : item.paperId, + companyId : item.companyInfo.id + } + await new Promise((resolve,reject)=>{ + this.http.get(`/api/PaperPlans`,{params:params}).subscribe(data => { + item.planList = [] + item.planList = data + resolve() + }) + }) + } + this.calculateScore() } + examScore:any = 0//整个试卷的总分 + //计算分数 + calculateScore(){ + let examScore = 0 + let examScore2 = 0 + this.paperCompanyData.forEach(item => { + //计算每个单位基本信息部分总分 + item.score = item.basicInfoScore + item.adjoinScore + item.importLocationScore + item.functionalDivisionScore + item.facilityScore + //计算整个试卷基本信息总分 + examScore += item.score + //计算整个试卷预案试题总分 + let x = 0 + if(item.planList){ + item.planList.forEach(i => { + x += i.score + }) + } + item.planScore = x + examScore2 += x + }) + //计算总分 + this.examScore = examScore + examScore2 + console.log(678,this.paperCompanyData) + } + }