|
@@ -1,24 +1,49 @@
|
|
|
<template>
|
|
|
<div :class="['report', { 'is-print': viewType === 'print' }]">
|
|
|
- <ReportCover :paper="sasPaper" />
|
|
|
- <ReportCompare :paper="sasPaper" />
|
|
|
- <ReportSummary :paper="sasPaper" />
|
|
|
- <ReportScore :course="sasCourse" :scoreGap="scoreGap" />
|
|
|
- <ReportScoreGroup :course="sasCourse" :scoreGap="scoreGap" />
|
|
|
- <ReportQuestion :questions="paperQuestions" />
|
|
|
- <ReportDifficulty />
|
|
|
- <ReportDiscrimination />
|
|
|
+ <ReportCover :paper="sasPaper" :hasCompareProject="hasCompareProject" />
|
|
|
+ <ReportCompare v-if="hasCompareProject" :paper="sasPaper" />
|
|
|
+ <ReportSummary
|
|
|
+ v-if="sasPaper"
|
|
|
+ :paper="sasPaper"
|
|
|
+ :partNo="partNos.summary"
|
|
|
+ />
|
|
|
+ <ReportScore
|
|
|
+ :course="sasCourse"
|
|
|
+ :scoreGap="scoreGap"
|
|
|
+ :partNo="partNos.score"
|
|
|
+ />
|
|
|
+ <ReportScoreGroup
|
|
|
+ :course="sasCourse"
|
|
|
+ :scoreGap="scoreGap"
|
|
|
+ :partNo="partNos.scoreGroup"
|
|
|
+ />
|
|
|
+ <ReportQuestion
|
|
|
+ v-if="paperQuestions.length"
|
|
|
+ :questions="paperQuestions"
|
|
|
+ :partNo="partNos.question"
|
|
|
+ />
|
|
|
+ <ReportDifficulty
|
|
|
+ v-if="paperQuestions.length"
|
|
|
+ :questions="paperQuestions"
|
|
|
+ :partNo="partNos.difficulty"
|
|
|
+ />
|
|
|
+ <ReportDiscrimination
|
|
|
+ v-if="paperQuestions.length"
|
|
|
+ :questions="paperQuestions"
|
|
|
+ :partNo="partNos.discrimination"
|
|
|
+ />
|
|
|
<ReportQuestionGroup
|
|
|
+ v-if="sasPaper && paperQuestions.length"
|
|
|
:questions="paperQuestions"
|
|
|
- :startScore="sasPaper.startScore"
|
|
|
- :totalScore="sasPaper.totalScore"
|
|
|
+ :paper="sasPaper"
|
|
|
+ :partNo="partNos.questionGroup"
|
|
|
/>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import {
|
|
|
- getPaperQuestionGroups,
|
|
|
+ getPaper,
|
|
|
getPaperQuestions,
|
|
|
getSasPaper,
|
|
|
} from "@/api/paperAnalysisPage";
|
|
@@ -34,13 +59,7 @@ import ReportDifficulty from "./ReportDifficulty.vue";
|
|
|
import ReportDiscrimination from "./ReportDiscrimination.vue";
|
|
|
import { RANGE_POINT_TYPE } from "@/constants/constants";
|
|
|
|
|
|
-import {
|
|
|
- // Paper,
|
|
|
- SASPaper,
|
|
|
- SASQuestion,
|
|
|
- SasCourse,
|
|
|
- RangeConfig,
|
|
|
-} from "@/types";
|
|
|
+import { SASPaper, SASQuestion, SasCourse, RangeConfig } from "@/types";
|
|
|
import { useRoute } from "vue-router";
|
|
|
import { computed, onMounted } from "vue";
|
|
|
|
|
@@ -56,21 +75,50 @@ const compareProjectId = +route.params.compareProjectId;
|
|
|
const viewType = route.params.viewType;
|
|
|
|
|
|
let paperQuestions = $ref<SASQuestion[]>([]);
|
|
|
+let partNos = $shallowRef({
|
|
|
+ summary: "二",
|
|
|
+ score: "三",
|
|
|
+ scoreGroup: "四",
|
|
|
+ question: "五",
|
|
|
+ difficulty: "六",
|
|
|
+ discrimination: "七",
|
|
|
+ questionGroup: "八",
|
|
|
+});
|
|
|
|
|
|
const hasCompareProject = computed(() => !!compareProjectId);
|
|
|
-console.log(hasCompareProject);
|
|
|
|
|
|
onMounted(async () => {
|
|
|
await fetchData();
|
|
|
+
|
|
|
+ if (!hasCompareProject.value) {
|
|
|
+ partNos = {
|
|
|
+ summary: "一",
|
|
|
+ score: "二",
|
|
|
+ scoreGroup: "三",
|
|
|
+ question: "四",
|
|
|
+ difficulty: "五",
|
|
|
+ discrimination: "六",
|
|
|
+ questionGroup: "七",
|
|
|
+ };
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
+function numberPrecision(num: number) {
|
|
|
+ return Math.round(num * 100) / 100;
|
|
|
+}
|
|
|
+
|
|
|
async function fetchData() {
|
|
|
- // await fetchPaper();
|
|
|
- await fetchPaperQuestions();
|
|
|
+ await fetchPaper();
|
|
|
await fetchSasPaper();
|
|
|
+ await fetchPaperQuestions();
|
|
|
await fetchSasCourse();
|
|
|
}
|
|
|
|
|
|
+async function fetchPaper() {
|
|
|
+ const res = await getPaper(paperId);
|
|
|
+ courseId = res.data.courseId;
|
|
|
+}
|
|
|
+
|
|
|
async function fetchPaperQuestions() {
|
|
|
const res = await getPaperQuestions(paperId);
|
|
|
paperQuestions = res.data.map((q) => {
|
|
@@ -80,11 +128,11 @@ async function fetchPaperQuestions() {
|
|
|
q.difficulityGroupLevel = JSON.parse(
|
|
|
<string>(<unknown>q.difficulityGroupLevel) || "[]"
|
|
|
);
|
|
|
- q.avgScore = Math.round(q.avgScore * 100) / 100;
|
|
|
- q.stdev = Math.round(q.stdev * 100) / 100;
|
|
|
- q.coefficient = Math.round(q.coefficient * 100) / 100;
|
|
|
- q.difficulty = Math.round(q.difficulty * 100) / 100;
|
|
|
- q.discrimination = Math.round(q.discrimination * 100) / 100;
|
|
|
+ q.avgScore = numberPrecision(q.avgScore);
|
|
|
+ q.stdev = numberPrecision(q.stdev);
|
|
|
+ q.coefficient = numberPrecision(q.coefficient);
|
|
|
+ q.difficulty = numberPrecision(q.difficulty);
|
|
|
+ q.discrimination = numberPrecision(q.discrimination);
|
|
|
return q;
|
|
|
});
|
|
|
}
|
|
@@ -98,6 +146,13 @@ async function fetchSasPaper() {
|
|
|
<string>(<unknown>res.data.discriminationLevel) || "[]"
|
|
|
);
|
|
|
sasPaper = res.data;
|
|
|
+ scoreGap = getScoreGap(sasPaper.totalScore);
|
|
|
+
|
|
|
+ sasPaper.avgScore = numberPrecision(sasPaper.avgScore);
|
|
|
+ sasPaper.stdev = numberPrecision(sasPaper.stdev);
|
|
|
+ sasPaper.coefficient = numberPrecision(sasPaper.coefficient);
|
|
|
+ sasPaper.difficulty = numberPrecision(sasPaper.difficulty);
|
|
|
+ sasPaper.reliability1 = numberPrecision(sasPaper.reliability1);
|
|
|
}
|
|
|
|
|
|
async function fetchSasCourse() {
|
|
@@ -128,7 +183,6 @@ async function fetchSasCourse() {
|
|
|
return acc;
|
|
|
});
|
|
|
sasCourse.scoreRangeTotal = acc;
|
|
|
- let scoreGap = 10;
|
|
|
|
|
|
sasCourse.segements = [];
|
|
|
const validSeg = Math.round(sasCourse.totalScore / scoreGap);
|
|
@@ -139,13 +193,17 @@ async function fetchSasCourse() {
|
|
|
row[1] = sasCourse.scoreRange
|
|
|
.slice(row[0], nextScore * scoreGap)
|
|
|
.reduce((p, c) => p + c, 0);
|
|
|
- row[2] = row[1] / sasCourse.scoreRangeAcc[sasCourse.totalScore];
|
|
|
+ row[2] = numberPrecision(
|
|
|
+ (100 * row[1]) / sasCourse.scoreRangeAcc[sasCourse.totalScore]
|
|
|
+ );
|
|
|
const endGap =
|
|
|
nextScore * scoreGap - 1 >= sasCourse.totalScore
|
|
|
? sasCourse.totalScore
|
|
|
: nextScore * scoreGap - 1;
|
|
|
row[3] = sasCourse.scoreRangeAcc[endGap];
|
|
|
- row[4] = row[3] / sasCourse.scoreRangeAcc[sasCourse.totalScore];
|
|
|
+ row[4] = numberPrecision(
|
|
|
+ (100 * row[3]) / sasCourse.scoreRangeAcc[sasCourse.totalScore]
|
|
|
+ );
|
|
|
sasCourse.segements.push(row);
|
|
|
}
|
|
|
if (validSeg * scoreGap === sasCourse.totalScore) {
|
|
@@ -155,7 +213,7 @@ async function fetchSasCourse() {
|
|
|
sasCourse.scoreRange[sasCourse.totalScore] /
|
|
|
sasCourse.scoreRangeAcc[sasCourse.totalScore],
|
|
|
sasCourse.scoreRangeAcc[sasCourse.totalScore],
|
|
|
- 1,
|
|
|
+ 100,
|
|
|
]);
|
|
|
}
|
|
|
|
|
@@ -175,7 +233,7 @@ async function fetchSasCourse() {
|
|
|
nextRange.baseScore + nextRange.adjustScore
|
|
|
)
|
|
|
.reduce((p, c) => p + c, 0) || 0;
|
|
|
- row[2] = row[1] / sasCourse.scoreRangeTotal;
|
|
|
+ row[2] = numberPrecision((100 * row[1]) / sasCourse.scoreRangeTotal);
|
|
|
row[3] =
|
|
|
sasCourse.scoreRangeAcc[
|
|
|
nextRange.baseScore + nextRange.adjustScore - 1
|
|
@@ -186,7 +244,7 @@ async function fetchSasCourse() {
|
|
|
) {
|
|
|
row[3] = sasCourse.scoreRangeAcc[sasCourse.scoreRangeAcc.length - 1];
|
|
|
}
|
|
|
- row[4] = row[3] / sasCourse.scoreRangeTotal;
|
|
|
+ row[4] = numberPrecision((100 * row[3]) / sasCourse.scoreRangeTotal);
|
|
|
|
|
|
sasCourse.rangeSegements.push(row);
|
|
|
}
|
|
@@ -200,4 +258,16 @@ async function fetchSasCourse() {
|
|
|
}${rangeConfig.adjustScore > 0 ? "+" : ""}${rangeConfig.adjustScore})-`;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+function getScoreGap(totalScore: number) {
|
|
|
+ if (totalScore <= 150) {
|
|
|
+ return 10;
|
|
|
+ } else if (totalScore > 150 && totalScore <= 300) {
|
|
|
+ return 20;
|
|
|
+ } else if (totalScore > 300 && totalScore <= 450) {
|
|
|
+ return 30;
|
|
|
+ } else {
|
|
|
+ return 50;
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|