zhangjie há 2 anos atrás
pai
commit
5cca89ec5c

+ 37 - 2
src/features/allAnalysis/AllAnalysis2.vue

@@ -1,13 +1,15 @@
 <template>
   <div>
     <div class="tw-bg-white tw-p-5 tw-rounded-xl tw-mb-5">
-      <ProjectSelect v-model:value="projectId" :projectId="projectId" />
+      <a-input v-model:value="curProject.name" disabled style="width: 200px" />
       <span class="tw-mr-4"></span>
       <ProjectCourseSelect v-model:value="courseId" :projectId="projectId" />
       <span class="tw-mr-4"></span>
       <a-button class="query-btn" @click="search">查询</a-button>
       <span class="tw-mr-4"></span>
       <a-button @click="exportExcel">导出excel</a-button>
+      <span class="tw-mr-4"></span>
+      <a-button @click="exportReport">导出报告</a-button>
 
       <div class="tw-float-right tw-flex tw-gap-2">
         <!-- <a-button @click="goProjectPapers(projectId)"> 试卷列表 </a-button> -->
@@ -54,6 +56,8 @@
         <ScoreFirstTryRate :courseId="courseId" />
       </div>
     </div>
+
+    <SelectProject ref="selectProjectRef" @confirm="projectSelected" />
   </div>
 </template>
 
@@ -64,10 +68,14 @@ import { onMounted } from "vue";
 import { useRoute } from "vue-router";
 import router from "@/router";
 import { getSasPaperList } from "@/api/allAnalysisPage";
+import { getProjectList } from "@/api/projectManagementPage";
 // import EventBus from "@/plugins/eventBus";
 import ScoreRate from "./ScoreRate.vue";
 import ScoreFirstTryRate from "./ScoreFirstTryRate.vue";
-import { SASPaper } from "@/types";
+import SelectProject from "../paperAnalysis/SelectProject.vue";
+import { message } from "ant-design-vue";
+
+import { SASPaper, Project } from "@/types";
 
 type PaginationType = {
   current: number;
@@ -91,6 +99,8 @@ store.currentLocation = "项目管理 / 项目列表 / 结果查询";
 let courseId = $ref(undefined as unknown as number);
 const route = useRoute();
 const projectId = +route.params.projectId;
+let curProject = $ref<Project>({} as Project);
+let compareProjectId = $ref<number>();
 
 let activeTab = $ref("1");
 
@@ -244,6 +254,7 @@ const columns = [
 
 onMounted(async () => {
   // rootOrgId = store.userInfo.rootOrgId;
+  await getProject();
   await search();
   // if (sessionStorage.getItem("allAnalysisReload")) {
   //   activeTab = "2";
@@ -292,4 +303,28 @@ async function tableChange(
 //     },
 //   });
 // }
+
+let selectProjectRef = $ref(null);
+
+async function getProject() {
+  const res = await getProjectList({
+    id: projectId,
+    rootOrgId: -1,
+    pageNo: 1,
+    pageSize: 1,
+  });
+  curProject = res.data.content[0];
+}
+function exportReport() {
+  if (curProject && curProject.needCompute) {
+    void message.info("有数据更新请重新计算");
+    return;
+  }
+  // @ts-ignore
+  // eslint-disable-next-line @typescript-eslint/no-unsafe-call
+  selectProjectRef.showModal();
+}
+function projectSelected(projectId: number) {
+  compareProjectId = projectId;
+}
 </script>

+ 12 - 9
src/features/paperAnalysis/PaperAnalysis.vue

@@ -1,12 +1,7 @@
 <template>
   <div>
     <div class="tw-bg-white tw-p-5 tw-rounded-xl tw-mb-5">
-      <ProjectSelect
-        v-model:value="projectId"
-        disabled
-        :projectId="projectId"
-        @change="projectChange"
-      />
+      <a-input v-model:value="curProject.name" disabled style="width: 200px" />
       <span class="tw-mr-4"></span>
       <ProjectCourseSelect
         v-model:value="courseId"
@@ -44,7 +39,7 @@
         >
       </div>
 
-      <div class="tw-my-4"></div>
+      <a-divider />
 
       <div v-if="activeTab === '1'">
         <QuestionBianPai :questions="paperQuestions" />
@@ -104,6 +99,7 @@ import {
   getPaperQuestions,
   getSasPaper,
 } from "@/api/paperAnalysisPage";
+import { getProjectList } from "@/api/projectManagementPage";
 import QuestionBianPai from "./QuestionBianPai.vue";
 import QuestionAttr from "./QuestionAttr.vue";
 import QuestionDifficultyGroup from "./QuestionDifficultyGroup.vue";
@@ -199,13 +195,20 @@ async function fetchData() {
 }
 
 onMounted(async () => {
+  await getProject();
   await search();
 });
 
 let selectProjectRef = $ref(null);
 
-function projectChange(val: Project) {
-  curProject = val;
+async function getProject() {
+  const res = await getProjectList({
+    id: projectId,
+    rootOrgId: -1,
+    pageNo: 1,
+    pageSize: 1,
+  });
+  curProject = res.data.content[0];
 }
 function toViewReport() {
   if (curProject && curProject.needCompute) {

+ 4 - 1
src/features/paperAnalysis/QuestionTypeDifficulty.vue

@@ -1,6 +1,9 @@
 <template>
   <div>
-    <a-button @click="importModalVisible = true">题型分布设置</a-button>
+    <div>
+      <span>设置:</span>
+      <a-button @click="importModalVisible = true">题型分布设置</a-button>
+    </div>
 
     <div v-if="props.questions.some((q) => q.type === 'TYPE1')">
       <div class="tw-flex tw-justify-between tw-items-center tw-my-4">

+ 4 - 1
src/features/paperAnalysis/QuestionTypeDiscrimination.vue

@@ -1,6 +1,9 @@
 <template>
   <div>
-    <a-button @click="importModalVisible = true">题型分布设置</a-button>
+    <div>
+      <span>设置:</span>
+      <a-button @click="importModalVisible = true">题型分布设置</a-button>
+    </div>
 
     <div v-if="props.questions.some((q) => q.type === 'TYPE1')">
       <div class="tw-flex tw-justify-between tw-items-center tw-my-4">

+ 18 - 8
src/features/report/ReportMain.vue

@@ -72,7 +72,7 @@ import { RANGE_POINT_TYPE } from "@/constants/constants";
 
 import { SASPaper, SASQuestion, SasCourse, RangeConfig } from "@/types";
 import { useRoute } from "vue-router";
-import { computed, onMounted, nextTick, reactive } from "vue";
+import { computed, onMounted, nextTick } from "vue";
 import { useMainStore } from "@/store";
 const store = useMainStore();
 
@@ -99,7 +99,7 @@ let comparePapers = $ref<SASPaper[]>([]);
 let compareCourses = $ref<SasCourse[]>([]);
 
 let paperQuestions = $ref<SASQuestion[]>([]);
-let partNos = reactive({
+let partNos = $shallowRef({
   summary: "二",
   score: "三",
   scoreGroup: "四",
@@ -109,7 +109,12 @@ let partNos = reactive({
   questionGroup: "八",
 });
 
-const hasCompareProject = computed(() => !!compareProjectId);
+const hasCompareProject = computed(
+  () =>
+    !!compareProjectId &&
+    comparePapers.length === 2 &&
+    compareCourses.length === 2
+);
 
 onMounted(async () => {
   if (props.paperId) {
@@ -127,11 +132,9 @@ onMounted(async () => {
     if (!key) return;
     let keyVal = window.atob(key);
     let user = JSON.parse(keyVal);
-    console.log(user);
-
     store.setUserInfo(user);
   }
-  // http://192.168.10.128:3030/web/report/print/4/101/1?eyJpZGVudGl0eSI6IiRVU0VSX1NFU1NJT05fLTEiLCJ0b2tlbiI6IkM4Y2pWTERnNWFGSVFDV29SR3czMHBSQ0d1d1UxWnM1In0=
+  // http://localhost:3030/web/report/print/4/101/1?eyJpZGVudGl0eSI6IiRVU0VSX1NFU1NJT05fLTEiLCJ0b2tlbiI6Ik5nektJWkJSTDh6WTdIUlVXOGkxaXNtSzhPeVpNMGZ4In0=
 
   await fetchData();
 
@@ -178,10 +181,16 @@ async function fetchData() {
   await fetchPaperQuestions();
   await fetchSasCourse();
 
-  if (hasCompareProject.value) {
+  if (compareProjectId) {
     await fetchComparePaperData();
     await fetchCompareCourseData();
-  } else {
+  }
+
+  if (
+    compareProjectId ||
+    comparePapers.length !== 2 ||
+    compareCourses.length !== 2
+  ) {
     partNos = {
       summary: "一",
       score: "二",
@@ -191,6 +200,7 @@ async function fetchData() {
       discrimination: "六",
       questionGroup: "七",
     };
+    console.log(partNos);
   }
 }