|
|
|
@ -419,16 +419,15 @@ export default { |
|
|
|
|
let totalScore = 0 |
|
|
|
|
let alreadyScore = 0 |
|
|
|
|
paper.forEach(e => { |
|
|
|
|
questionCount += +e.questionNum // 试卷目标总题数 |
|
|
|
|
if (!isNaN(e.questionNum)) questionCount += +e.questionNum // 试卷目标总题数 |
|
|
|
|
if (e.examQuestions) { |
|
|
|
|
alreadyQuesCount += e.examQuestions.length // 已添加总题数 |
|
|
|
|
totalScore = Decimal(totalScore).add(+e.targetScore || 0).toNumber() // 试卷目标总分 |
|
|
|
|
if (!isNaN(e.targetScore)) totalScore = Decimal(totalScore).add(+e.targetScore || 0).toNumber() // 试卷目标总分 |
|
|
|
|
e.examQuestions.forEach(n => { |
|
|
|
|
alreadyScore = Decimal(alreadyScore).add(+n.score || 0).toNumber() // 已分配总分值 |
|
|
|
|
if (!isNaN(n.score)) alreadyScore = Decimal(alreadyScore).add(+n.score || 0).toNumber() // 已分配总分值 |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
console.log("🚀 ~ overview ~ alreadyScore:", alreadyScore, totalScore) |
|
|
|
|
return { |
|
|
|
|
questionCount, |
|
|
|
|
alreadyQuesCount, |
|
|
|
@ -715,7 +714,7 @@ export default { |
|
|
|
|
getQuesAlreadyScore (item) { |
|
|
|
|
let total = 0 |
|
|
|
|
item.examQuestions.forEach(e => { |
|
|
|
|
total = Decimal(total).add(+e.score).toNumber() |
|
|
|
|
if (!isNaN(e.score)) total = Decimal(total).add(+e.score).toNumber() |
|
|
|
|
}) |
|
|
|
|
item.curQuesTotalScore = total |
|
|
|
|
return total |
|
|
|
@ -911,7 +910,12 @@ export default { |
|
|
|
|
loop1: |
|
|
|
|
for (const i in paper) { |
|
|
|
|
const e = paper[i] |
|
|
|
|
const chineseNum = this.arabicToChinese(+i + 1) |
|
|
|
|
const chineseNum = Util.arabicToChinese(+i + 1) |
|
|
|
|
if (!e.outlineName) { |
|
|
|
|
Util.warningMsg(`第${chineseNum}大题请输入大题名称`) |
|
|
|
|
invalid = 1 |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
if (!e.questionType) { |
|
|
|
|
Util.warningMsg('请选择题型') |
|
|
|
|
invalid = 1 |
|
|
|
@ -922,11 +926,6 @@ export default { |
|
|
|
|
invalid = 1 |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
if (!e.outlineName) { |
|
|
|
|
Util.warningMsg(`第${chineseNum}大题请输入大题名称`) |
|
|
|
|
invalid = 1 |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
if (!e.targetScore) { |
|
|
|
|
Util.warningMsg('请输入目标分值') |
|
|
|
|
invalid = 1 |
|
|
|
@ -949,8 +948,8 @@ export default { |
|
|
|
|
const { fillScores } = n |
|
|
|
|
if (fillScores) { |
|
|
|
|
for (const e of fillScores) { |
|
|
|
|
if (e.val === '' || e.val === undefined || e.val === null) { |
|
|
|
|
Util.warningMsg(`第${chineseNum}大题的第${this.arabicToChinese(+j + 1)}小题填空分数未填写完成,请重新修改`) |
|
|
|
|
if (e.val === '' || e.val === null || isNaN(e.val)) { |
|
|
|
|
Util.warningMsg(`第${chineseNum}大题的第${Util.arabicToChinese(+j + 1)}小题填空分数请填写数字`) |
|
|
|
|
invalid = 1 |
|
|
|
|
break loop1 |
|
|
|
|
} |
|
|
|
@ -965,6 +964,15 @@ export default { |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
for (const j in e.examQuestions) { |
|
|
|
|
const n = e.examQuestions[j] |
|
|
|
|
if (n.score === '' || n.score === null || isNaN(n.score)) { |
|
|
|
|
Util.warningMsg(`第${chineseNum}大题的第${Util.arabicToChinese(+j + 1)}小题分数请填写数字`) |
|
|
|
|
invalid = 1 |
|
|
|
|
break loop1 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (+e.targetScore !== e.curQuesTotalScore) { |
|
|
|
|
// 该大题里的小题总分需等于目标分值 |
|
|
|
|
Util.warningMsg(`第${chineseNum}大题的小题总分跟目标分值不一致,请重新修改`) |
|
|
|
|