Selaa lähdekoodia

report print & electve test report hidden when no-result

hare8999@163.com 2 vuotta sitten
vanhempi
commit
ef153772b8

+ 1 - 0
public/collectImgNew/style.css

@@ -1,4 +1,5 @@
 .fx-row.fx-bet-cen.pl12.pr12.relative,
+.print-hidden,
 .navbar {
   display: none !important;
 }

+ 10 - 3
src/api/webApi/elective/selected-subject.js

@@ -9,6 +9,7 @@ export function getOptionalMajors(params) {
     params
   })
 }
+
 // 学生获取评测推荐专业
 export function getRecommendMajor(params) {
   return request({
@@ -31,7 +32,7 @@ export function getPrimaryElectivesModels(params) {
 export function getStudentSelected() {
   return request({
     url: '/front/elective/enroll/getStudentSelected',
-    method: 'get',
+    method: 'get'
   })
 }
 
@@ -54,7 +55,6 @@ export function submitElectiveModels(data) {
   })
 }
 
-
 // 学生报名签名
 export function saveEsign(data) {
   return request({
@@ -73,7 +73,14 @@ export function rejectRecommend(data) {
   })
 }
 
-
+// 报告
+export function getSelectedBookReport(params) {
+  return request({
+    url: 'front/report/getSelectedBookReport',
+    method: 'get',
+    params
+  })
+}
 
 
 

+ 5 - 0
src/common/mx-const.js

@@ -95,6 +95,11 @@ export default {
       question: 1,
       video: 2,
       courseware: 3
+    },
+    electiveReportType: {
+      student: 1,
+      teacher: 2,
+      master: 3
     }
   }
 }

+ 17 - 2
src/views/elective/report/components/elective-test-reports.vue

@@ -1,5 +1,6 @@
 <template>
-  <div>
+  <div v-if="hasFinalResult" class="elective-test-container">
+    <el-divider class="new-page"><h1>选科测评报告</h1></el-divider>
     <div v-for="test in testResults" :key="test.key" class="print-page elective-report-card">
       <index-card :title="test.title">
         <test-report :category="test.key" :source="test.result" readonly></test-report>
@@ -23,11 +24,25 @@ import MajorMatchEvaluation from '@/views/elective/report/components/major-match
 export default {
   name: 'elective-test-reports',
   extends: TestSummary, // NOTE: 这里直接继承了TestSummary页面的关键能力
-  components: { MajorMatchEvaluation, TestReport, IndexCard }
+  components: { MajorMatchEvaluation, TestReport, IndexCard },
+  computed: {
+    hasFinalResult() {
+      return this.summary?.selectedList?.length || false
+    }
+  }
 }
 </script>
 
 <style scoped>
+/deep/ .elective-test-container > .el-divider {
+  margin: 40px 0;
+}
+
+h1 {
+  font-size: 36px;
+  margin: 0;
+}
+
 .elective-report-card > /deep/ .el-card__body {
   padding: 0;
 }

+ 19 - 1
src/views/elective/report/index.vue

@@ -1,10 +1,13 @@
 <template>
   <div class="app-container">
     <div class="elective-report-container">
+      <!--   print-hidden定义在PDF生成程序中   -->
+      <div v-if="electiveVisible" class="print-hidden text-right mb10">
+        <el-button type="primary" icon="el-icon-printer" @click="handlePrint">打印</el-button>
+      </div>
       <div class="width100">
         <el-image :src="require('@/assets/images/elective/elective_report_cover.png')"></el-image>
       </div>
-      <el-divider class="new-page"><h1>选科测评报告</h1></el-divider>
       <elective-test-reports></elective-test-reports>
       <el-divider><h1>选科大数据分析</h1></el-divider>
       <group-subject-query class="print-page"></group-subject-query>
@@ -26,6 +29,7 @@
 
 <script>
 
+import consts from '@/common/mx-const'
 import ElectiveTestReports from '@/views/elective/report/components/elective-test-reports'
 import GroupSubjectQuery from '@/views/permission/components/group-subject-query'
 import RoundSelect from '@/views/system/user/profile/round-select'
@@ -35,6 +39,7 @@ import GroupScoreTable from '@/views/elective/report/components/group-score-tabl
 import ElectiveFlowTable from '@/views/elective/report/components/elective-flow-table'
 import ElectiveEnrollAnalysis from '@/views/elective/report/components/elective-enroll-analysis'
 import ElectiveAiAnalysis from '@/views/elective/report/components/elective-ai-analysis'
+import { getSelectedBookReport } from '@/api/webApi/elective/selected-subject'
 
 export default {
   name: 'report-index',
@@ -65,6 +70,19 @@ export default {
       getOptionalMajors: () => this.optionalMajors,
       getEvaluationMajors: () => this.evaluationMajors
     }
+  },
+  methods: {
+    handlePrint() {
+      if (!this.generation?.status?.roundId) return
+      getSelectedBookReport({
+        roundId: this.generation.status.roundId,
+        reportType: consts.enum.electiveReportType.student
+      }).then(res => {
+        if (res.data?.url) {
+          this.$router.push({ path: '/elective/report/flip', query: { path: res.data.url } })
+        }
+      })
+    }
   }
 }
 </script>