|
@@ -1,22 +1,28 @@
|
|
<template>
|
|
<template>
|
|
<div :class="['report', { 'is-print': viewType === 'print' }]">
|
|
<div :class="['report', { 'is-print': viewType === 'print' }]">
|
|
- <ReportCover :coverInfo="courseInfo" />
|
|
|
|
- <ReportCompare />
|
|
|
|
- <ReportSummary />
|
|
|
|
- <ReportScore />
|
|
|
|
- <ReportScoreGroup />
|
|
|
|
- <ReportQuestion />
|
|
|
|
|
|
+ <ReportCover :paper="sasPaper" />
|
|
|
|
+ <ReportCompare :paper="sasPaper" />
|
|
|
|
+ <ReportSummary :paper="sasPaper" />
|
|
|
|
+ <ReportScore :course="sasCourse" :scoreGap="scoreGap" />
|
|
|
|
+ <ReportScoreGroup :course="sasCourse" :scoreGap="scoreGap" />
|
|
|
|
+ <ReportQuestion :questions="paperQuestions" />
|
|
<ReportDifficulty />
|
|
<ReportDifficulty />
|
|
<ReportDiscrimination />
|
|
<ReportDiscrimination />
|
|
<ReportQuestionGroup
|
|
<ReportQuestionGroup
|
|
- :questions="questions"
|
|
|
|
- :startScore="courseInfo.startScore"
|
|
|
|
- :totalScore="courseInfo.totalScore"
|
|
|
|
|
|
+ :questions="paperQuestions"
|
|
|
|
+ :startScore="sasPaper.startScore"
|
|
|
|
+ :totalScore="sasPaper.totalScore"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
|
+import {
|
|
|
|
+ getPaperQuestionGroups,
|
|
|
|
+ getPaperQuestions,
|
|
|
|
+ getSasPaper,
|
|
|
|
+} from "@/api/paperAnalysisPage";
|
|
|
|
+import { getSasCourseList } from "@/api/allAnalysisPage";
|
|
import ReportCover from "./ReportCover.vue";
|
|
import ReportCover from "./ReportCover.vue";
|
|
import ReportCompare from "./ReportCompare.vue";
|
|
import ReportCompare from "./ReportCompare.vue";
|
|
import ReportSummary from "./ReportSummary.vue";
|
|
import ReportSummary from "./ReportSummary.vue";
|
|
@@ -26,19 +32,172 @@ import ReportQuestion from "./ReportQuestion.vue";
|
|
import ReportQuestionGroup from "./ReportQuestionGroup.vue";
|
|
import ReportQuestionGroup from "./ReportQuestionGroup.vue";
|
|
import ReportDifficulty from "./ReportDifficulty.vue";
|
|
import ReportDifficulty from "./ReportDifficulty.vue";
|
|
import ReportDiscrimination from "./ReportDiscrimination.vue";
|
|
import ReportDiscrimination from "./ReportDiscrimination.vue";
|
|
-import { SASQuestion } from "@/types";
|
|
|
|
|
|
+import { RANGE_POINT_TYPE } from "@/constants/constants";
|
|
|
|
+
|
|
|
|
+import {
|
|
|
|
+ // Paper,
|
|
|
|
+ SASPaper,
|
|
|
|
+ SASQuestion,
|
|
|
|
+ SasCourse,
|
|
|
|
+ RangeConfig,
|
|
|
|
+} from "@/types";
|
|
import { useRoute } from "vue-router";
|
|
import { useRoute } from "vue-router";
|
|
|
|
+import { computed, onMounted } from "vue";
|
|
|
|
+
|
|
|
|
+let courseId = $ref(undefined as unknown as number);
|
|
|
|
+let sasPaper = $ref<SASPaper>({} as SASPaper);
|
|
|
|
+let sasCourse = $ref<SasCourse>({} as SasCourse);
|
|
|
|
+let scoreGap = $ref(0);
|
|
|
|
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
-let viewType = route.params.viewType;
|
|
|
|
|
|
+const projectId = +route.params.projectId;
|
|
|
|
+const paperId = +route.params.paperId;
|
|
|
|
+const compareProjectId = +route.params.compareProjectId;
|
|
|
|
+const viewType = route.params.viewType;
|
|
|
|
+
|
|
|
|
+let paperQuestions = $ref<SASQuestion[]>([]);
|
|
|
|
+
|
|
|
|
+const hasCompareProject = computed(() => !!compareProjectId);
|
|
|
|
+console.log(hasCompareProject);
|
|
|
|
+
|
|
|
|
+onMounted(async () => {
|
|
|
|
+ await fetchData();
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+async function fetchData() {
|
|
|
|
+ // await fetchPaper();
|
|
|
|
+ await fetchPaperQuestions();
|
|
|
|
+ await fetchSasPaper();
|
|
|
|
+ await fetchSasCourse();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+async function fetchPaperQuestions() {
|
|
|
|
+ const res = await getPaperQuestions(paperId);
|
|
|
|
+ paperQuestions = res.data.map((q) => {
|
|
|
|
+ q.difficulityLevel = JSON.parse(
|
|
|
|
+ <string>(<unknown>q.difficulityLevel) || "[]"
|
|
|
|
+ );
|
|
|
|
+ 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;
|
|
|
|
+ return q;
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+async function fetchSasPaper() {
|
|
|
|
+ const res = await getSasPaper(paperId);
|
|
|
|
+ res.data.difficulityLevel = JSON.parse(
|
|
|
|
+ <string>(<unknown>res.data.difficulityLevel) || "[]"
|
|
|
|
+ );
|
|
|
|
+ res.data.discriminationLevel = JSON.parse(
|
|
|
|
+ <string>(<unknown>res.data.discriminationLevel) || "[]"
|
|
|
|
+ );
|
|
|
|
+ sasPaper = res.data;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+async function fetchSasCourse() {
|
|
|
|
+ const res = await getSasCourseList({
|
|
|
|
+ projectId,
|
|
|
|
+ courseId,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ sasCourse = res.data[0];
|
|
|
|
+
|
|
|
|
+ sasCourse.scoreRange = Object.values(
|
|
|
|
+ // eslint-disable-next-line
|
|
|
|
+ JSON.parse(<string>(<unknown>sasCourse.scoreRange) || "{}")
|
|
|
|
+ );
|
|
|
|
+ sasCourse.rangeConfig = JSON.parse(
|
|
|
|
+ <string>(<unknown>sasCourse.rangeConfig) || "0"
|
|
|
|
+ ) || [
|
|
|
|
+ {
|
|
|
|
+ type: "ZERO",
|
|
|
|
+ baseScore: 0,
|
|
|
|
+ adjustScore: 0,
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ let acc = 0;
|
|
|
|
+ if (Array.isArray(sasCourse.scoreRange))
|
|
|
|
+ sasCourse.scoreRangeAcc = sasCourse.scoreRange.map((_v, i, a) => {
|
|
|
|
+ acc += a[i];
|
|
|
|
+ return acc;
|
|
|
|
+ });
|
|
|
|
+ sasCourse.scoreRangeTotal = acc;
|
|
|
|
+ let scoreGap = 10;
|
|
|
|
+
|
|
|
|
+ sasCourse.segements = [];
|
|
|
|
+ const validSeg = Math.round(sasCourse.totalScore / scoreGap);
|
|
|
|
+ for (let score = 0; score < validSeg; score++) {
|
|
|
|
+ const row = [];
|
|
|
|
+ row[0] = score * scoreGap;
|
|
|
|
+ let nextScore = score + 1 > validSeg ? sasCourse.totalScore : score + 1;
|
|
|
|
+ row[1] = sasCourse.scoreRange
|
|
|
|
+ .slice(row[0], nextScore * scoreGap)
|
|
|
|
+ .reduce((p, c) => p + c, 0);
|
|
|
|
+ row[2] = 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];
|
|
|
|
+ sasCourse.segements.push(row);
|
|
|
|
+ }
|
|
|
|
+ if (validSeg * scoreGap === sasCourse.totalScore) {
|
|
|
|
+ sasCourse.segements.push([
|
|
|
|
+ sasCourse.totalScore,
|
|
|
|
+ sasCourse.scoreRange[sasCourse.totalScore],
|
|
|
|
+ sasCourse.scoreRange[sasCourse.totalScore] /
|
|
|
|
+ sasCourse.scoreRangeAcc[sasCourse.totalScore],
|
|
|
|
+ sasCourse.scoreRangeAcc[sasCourse.totalScore],
|
|
|
|
+ 1,
|
|
|
|
+ ]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sasCourse.rangeSegements = [];
|
|
|
|
+ for (let i = 0; i < sasCourse.rangeConfig.length; i++) {
|
|
|
|
+ const range = sasCourse.rangeConfig[i]!;
|
|
|
|
+ const nextRange =
|
|
|
|
+ i === sasCourse.rangeConfig.length - 1
|
|
|
|
+ ? { baseScore: sasCourse.totalScore, adjustScore: 0 }
|
|
|
|
+ : sasCourse.rangeConfig[i + 1];
|
|
|
|
+ const row = [];
|
|
|
|
+ row[0] = scoreTitle(range);
|
|
|
|
+ row[1] =
|
|
|
|
+ sasCourse.scoreRange
|
|
|
|
+ .slice(
|
|
|
|
+ range.baseScore + range.adjustScore,
|
|
|
|
+ nextRange.baseScore + nextRange.adjustScore
|
|
|
|
+ )
|
|
|
|
+ .reduce((p, c) => p + c, 0) || 0;
|
|
|
|
+ row[2] = row[1] / sasCourse.scoreRangeTotal;
|
|
|
|
+ row[3] =
|
|
|
|
+ sasCourse.scoreRangeAcc[
|
|
|
|
+ nextRange.baseScore + nextRange.adjustScore - 1
|
|
|
|
+ ] || 0;
|
|
|
|
+ if (
|
|
|
|
+ nextRange.baseScore + nextRange.adjustScore >=
|
|
|
|
+ sasCourse.scoreRangeAcc.length
|
|
|
|
+ ) {
|
|
|
|
+ row[3] = sasCourse.scoreRangeAcc[sasCourse.scoreRangeAcc.length - 1];
|
|
|
|
+ }
|
|
|
|
+ row[4] = row[3] / sasCourse.scoreRangeTotal;
|
|
|
|
+
|
|
|
|
+ sasCourse.rangeSegements.push(row);
|
|
|
|
+ }
|
|
|
|
|
|
-let courseInfo = {
|
|
|
|
- examName: "",
|
|
|
|
- schoolName: "",
|
|
|
|
- courseName: "",
|
|
|
|
- startScore: 0,
|
|
|
|
- totalScore: 150,
|
|
|
|
-};
|
|
|
|
|
|
+ function scoreTitle(rangeConfig: RangeConfig) {
|
|
|
|
+ if (!rangeConfig) return false;
|
|
|
|
+ if (rangeConfig.type === "ZERO") return "0-";
|
|
|
|
|
|
-let questions: SASQuestion[] = $ref([]);
|
|
|
|
|
|
+ return `${rangeConfig.baseScore + rangeConfig.adjustScore}(${
|
|
|
|
+ RANGE_POINT_TYPE[rangeConfig.type]
|
|
|
|
+ }${rangeConfig.adjustScore > 0 ? "+" : ""}${rangeConfig.adjustScore})-`;
|
|
|
|
+ }
|
|
|
|
+}
|
|
</script>
|
|
</script>
|