Browse Source

elective report - add entry with condition

hare8999@163.com 1 year ago
parent
commit
62577952b7

+ 4 - 17
src/views/elective/report/components/elective-enroll-analysis.vue

@@ -21,13 +21,8 @@ import { classesResult } from '@/api/webApi/elective/dispatch'
 
 export default {
   name: 'elective-enroll-analysis',
-  inject: ['getGeneration', 'getOptionalMajors'],
+  inject: ['getGeneration', 'getOptionalMajors', 'getDispatchInfo'],
   components: { EnrollReport },
-  data() {
-    return {
-      dispatchInfo: {}
-    }
-  },
   computed: {
     generation() {
       return this.getGeneration() || {}
@@ -35,20 +30,12 @@ export default {
     optionalMajors() {
       return this.getOptionalMajors() || []
     },
+    dispatchInfo() {
+      return this.getDispatchInfo() || {}
+    },
     showESign() {
       return !!this.dispatchInfo?.eSignImage
     }
-  },
-  watch: {
-    'generation': function(newVal) {
-      if (newVal?.status?.roundId) this.loadDispatchInfo()
-    }
-  },
-  methods: {
-    loadDispatchInfo() {
-      const { year, roundId } = this.generation.status
-      classesResult({ year, roundId }).then(res => this.dispatchInfo = res.rows.first() || {})
-    }
   }
 }
 </script>

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

@@ -74,7 +74,8 @@ export default {
     return {
       getGeneration: () => this.generation,
       getOptionalMajors: () => this.optionalMajors,
-      getEvaluationMajors: () => this.evaluationMajors
+      getEvaluationMajors: () => this.evaluationMajors,
+      getDispatchInfo: () => this.dispatchInfo,
     }
   },
   methods: {

+ 17 - 4
src/views/system/user/profile/round-select.vue

@@ -22,8 +22,8 @@
           <!--<el-link type="primary" icon="el-icon-video-play" underline @click="helpVideo.visible=true">介绍视频</el-link>-->
           <!--、-->
           咨询客服或拨打电话4001797985
-          <div v-if="reportVisible" class="mt15">
-            <el-button type="primary" @click="$router.push({name: 'ElectiveReportIndex'})">查看报告</el-button>
+          <div v-if="true" class="mt15">
+            <el-button :type="reportVisible?'primary':'info'" @click="goReportDemo">查看选科整体报告</el-button>
           </div>
         </el-col>
       </el-row>
@@ -73,6 +73,7 @@ import {
   getStudentElectiveModels,
   getStudentSelected
 } from '@/api/webApi/elective/selected-subject'
+import {classesResult} from "@/api/webApi/elective/dispatch";
 
 export default {
   mixins: [TransferMixin, ElectiveToolsMixin],
@@ -102,7 +103,9 @@ export default {
       selectObj: null,
       stepOptions: config.electiveGenerationOptions,
       activeStep: '',
-      generationModels: []
+      generationModels: [],
+      //
+      dispatchInfo: null
     }
   },
   computed: {
@@ -111,7 +114,8 @@ export default {
     },
     reportVisible() {
       // TODO: 这里需要确认一下,选科结束后虽然能看到大部分报告内容,但可能是缺少签名与分班信息
-      return this.electiveVisible && this.selectObj.currentGeneration >= this.stepOptions.terminate
+      return this.electiveVisible && this.dispatchInfo?.statusText == '分班完成' &&
+        this.selectObj.currentGeneration >= this.stepOptions.terminate.value
     },
     emptyTitle() {
       if (!this.activeOpt) return
@@ -184,6 +188,10 @@ export default {
     }
   },
   methods: {
+    loadDispatchInfo() {
+      const { year, roundId } = this.generation.status
+      classesResult({ year, roundId }).then(res => this.dispatchInfo = res.rows.first())
+    },
     refreshData() {
       try {
         this.loading = true
@@ -222,10 +230,15 @@ export default {
           this.loadStudentElectiveModels()
           this.getOptionalMajors()
           this.getRecommendMajor()
+          this.loadDispatchInfo()
         }
       })
     },
     goReportDemo() {
+      if (!this.reportVisible) {
+        this.$message.error('需要选科结束且完成分班后才可能查看整体报告')
+        return
+      }
       const path = '/elective/report/index'
       this.transferTo(path)
     },