zhangjie 1 rok pred
rodič
commit
72201c5912

+ 6 - 0
src/features/allAnalysis/AllAnalysis.vue

@@ -257,6 +257,12 @@ onMounted(async () => {
 });
 
 async function goPaperAnalysis(record: SASPaper) {
+  store.setPaperAnalysisDetail({
+    projectName: curProject.name,
+    paperType: record.paperType,
+    courseCode: record.courseCode,
+    courseName: record.courseName,
+  });
   await router.push(`/project/${projectId}/paperAnalysis/${record.paperId}`);
 }
 

+ 20 - 26
src/features/paperAnalysis/PaperAnalysis.vue

@@ -1,7 +1,11 @@
 <template>
   <div class="paper-analysis">
     <a-card>
-      <template #title> {{}} </template>
+      <template #title>
+        {{ store.paperAnalysisDetail.courseName }}({{
+          store.paperAnalysisDetail.courseCode
+        }})
+      </template>
       <template #extra>
         <a-button type="primary" @click="toViewReport">
           <template #icon>
@@ -14,10 +18,10 @@
 
       <a-form class="tiny" :labelCol="{ style: { width: '72px' } }">
         <a-form-item label="项目名称">
-          <span>{{ curProject.name }}</span>
+          <span>{{ store.paperAnalysisDetail.projectName }}</span>
         </a-form-item>
         <a-form-item label="试卷类型">
-          <span>{{ paperType }}</span>
+          <span>{{ store.paperAnalysisDetail.paperType }}</span>
         </a-form-item>
       </a-form>
     </a-card>
@@ -59,15 +63,6 @@
       </a-tabs>
     </div>
 
-    <div v-if="activeTab === '7'">
-      <!-- TODO: -->
-      <PaperReport
-        :projectId="projectId"
-        viewType="view"
-        :paperId="paperId"
-        :compareProjectId="compareProjectId"
-      />
-    </div>
     <SelectProject
       ref="selectProjectRef"
       :disableIds="[projectId]"
@@ -79,8 +74,8 @@
 <script setup lang="ts">
 import { useMainStore } from "@/store";
 import { goBack } from "@/utils/utils";
-import { watch, onMounted, nextTick } from "vue";
-import { useRoute } from "vue-router";
+import { watch, onMounted } from "vue";
+import { useRoute, useRouter } from "vue-router";
 import {
   getPaper,
   getPaperQuestionGroups,
@@ -95,7 +90,6 @@ import QuestionTypeDifficulty from "./QuestionTypeDifficulty.vue";
 import QuestionTypeDiscrimination from "./QuestionTypeDiscrimination.vue";
 import ScoreRate from "../allAnalysis/ScoreRate.vue";
 import SelectProject from "./SelectProject.vue";
-import PaperReport from "../report/ReportMain.vue";
 import { Paper, SASQuestion, SASQuestionGroup, Project } from "@/types";
 import { message } from "ant-design-vue";
 
@@ -105,8 +99,8 @@ store.currentLocation = "项目列表 / 查询结果 / 详情";
 let activeTab = $ref("5");
 let courseId = $ref(undefined as unknown as number);
 let startScore = $ref(undefined as unknown as number);
-let paperType = $ref(undefined as undefined | string);
 const route = useRoute();
+const router = useRouter();
 const projectId = +route.params.projectId;
 const paperId = +route.params.paperId;
 
@@ -117,7 +111,6 @@ let pageNo = $ref(1);
 let paperQuestions = $ref<SASQuestion[]>([]);
 let paperQuestionGroups = $ref<SASQuestionGroup[]>([]);
 let curProject = $ref<Project>({} as Project);
-let compareProjectId = $ref<number[]>([]);
 // let sasPaper = $ref<SASPaper>({} as SASPaper);
 
 async function search() {
@@ -129,9 +122,6 @@ watch(() => [pageNo, pageSize], fetchData);
 
 async function fetchData() {
   const res = await getPaper(paperId);
-  // console.log(res);
-  paperType = res.data.paperType;
-  // paperName = res.data.paperName;
   courseId = res.data.courseId;
   paper = res.data;
 
@@ -202,12 +192,16 @@ function toViewReport() {
   // eslint-disable-next-line @typescript-eslint/no-unsafe-call
   selectProjectRef.showModal();
 }
-function projectSelected(projectId: number[]) {
-  compareProjectId = projectId;
-  activeTab = "";
-
-  nextTick(() => {
-    activeTab = "7";
+function projectSelected(pids: number[]) {
+  console.log(pids);
+
+  router.push({
+    name: "ProjectPaperReport",
+    params: {
+      projectId: projectId,
+      paperId,
+      compareProjectId: pids.join(),
+    },
   });
 }
 </script>

+ 57 - 0
src/features/paperAnalysis/PaperReport.vue

@@ -0,0 +1,57 @@
+<template>
+  <a-card>
+    <template #title>
+      {{ store.paperAnalysisDetail.courseName }}({{
+        store.paperAnalysisDetail.courseCode
+      }})
+    </template>
+    <template #extra>
+      <a-button type="primary" @click="toDownloadReport">
+        <template #icon>
+          <svg-icon name="download" color="#fff"></svg-icon>
+        </template>
+        报告下载
+      </a-button>
+      <a-button @click="goBack">返回</a-button>
+    </template>
+
+    <a-form class="tiny" :labelCol="{ style: { width: '72px' } }">
+      <a-form-item label="项目名称">
+        <span>{{ store.paperAnalysisDetail.projectName }}</span>
+      </a-form-item>
+      <a-form-item label="试卷类型">
+        <span>{{ store.paperAnalysisDetail.paperType }}</span>
+      </a-form-item>
+    </a-form>
+  </a-card>
+  <a-card title="报告预览">
+    <ReportMain
+      viewType="view"
+      :projectId="projectId"
+      :paperId="paperId"
+      :compareProjectId="compareProjectId"
+    />
+  </a-card>
+</template>
+
+<script setup lang="ts">
+import { goBack } from "@/utils/utils";
+import { useMainStore } from "@/store";
+import ReportMain from "../report/ReportMain.vue";
+import { useRoute } from "vue-router";
+
+const store = useMainStore();
+store.currentLocation = "项目列表 / 查询结果 / 详情 / 报告预览";
+
+const route = useRoute();
+
+const projectId = +route.params.projectId;
+const paperId = +route.params.paperId;
+const compareProjectId = (route.params.compareProjectId as string)
+  .split(",")
+  .map((item) => Number(item));
+
+function toDownloadReport() {
+  // TODO:下载
+}
+</script>

+ 0 - 1
src/features/paperAnalysis/SelectProject.vue

@@ -14,7 +14,6 @@
           :disableIds="props.disableIds"
           :max-count="4"
           placeholder="请选择对比项目"
-          style="width: 400px"
         />
       </a-form-item>
     </a-form>

+ 6 - 0
src/router/index.ts

@@ -26,6 +26,7 @@ import ProjectCompareManagement from "@/features/projectCompareManagement/Projec
 import ProjectCompareDetail2 from "@/features/projectCompareDetail/ProjectCompareDetail2.vue";
 import TaskManagement from "@/features/taskManagement/TaskManagement.vue";
 // report
+import PaperReport from "@/features/paperAnalysis/PaperReport.vue";
 import ReportMain from "@/features/report/ReportMain.vue";
 
 const routes = [
@@ -106,6 +107,11 @@ const routes = [
         component: PaperAnalysis,
         name: "PaperAnalysis",
       },
+      {
+        path: ":projectId/paperAnalysis/:paperId/report/:compareProjectId?",
+        component: PaperReport,
+        name: "ProjectPaperReport",
+      },
       {
         path: "allAnalysis/:projectId",
         component: AllAnalysis,

+ 11 - 0
src/store/main.ts

@@ -19,6 +19,12 @@ const useMainStore = defineStore("main", {
         role: "" as RoleCode,
       },
       currentLocation: "",
+      paperAnalysisDetail: {
+        projectName: "",
+        paperType: "",
+        courseCode: "",
+        courseName: "",
+      },
     };
   },
   getters: {
@@ -49,6 +55,11 @@ const useMainStore = defineStore("main", {
       setToken(res.token);
       setSessionId(res.identity);
     },
+    setPaperAnalysisDetail(res: any) {
+      this.$patch({
+        paperAnalysisDetail: res,
+      });
+    },
     resetInfo() {
       this.$reset();
     },