Browse Source

elective report + flow table

hare8999@163.com 2 years ago
parent
commit
cbdbafc1d8

+ 8 - 0
src/api/webApi/elective/generation.js

@@ -124,6 +124,14 @@ export function searchElectiveGenerationDetails(params) {
   })
 }
 
+export function searchElectiveGenerationDetailsBySelf(params) {
+  return request({
+    url: '/front/elective/generation/searchElectiveGenerationDetailsBySelf',
+    method: 'get',
+    params
+  })
+}
+
 // 班级放榜查询
 // 重用getElectiveGenerationDetails, query=active=传入generation
 export function getClassGenerationDetails(params) {

+ 37 - 2
src/views/elective/report/components/elective-flow-table.vue

@@ -1,10 +1,45 @@
 <template>
-
+  <elective-generation-flow-log :groups="roundGroups" :histories="detail.histories" :matched-majors="majors"/>
 </template>
 
 <script>
+import ElectiveGenerationFlowLog from '@/views/elective/generation/components/elective-generation-flow-log'
+import { searchElectiveGenerationDetailsBySelf } from '@/api/webApi/elective/generation'
+
 export default {
-  name: 'elective-flow-table'
+  name: 'elective-flow-table',
+  components: { ElectiveGenerationFlowLog },
+  inject: ['getGeneration', 'getOptionalMajors'],
+  data() {
+    return {
+      detail: { histories: [] }
+    }
+  },
+  computed: {
+    generation() {
+      return this.getGeneration()
+    },
+    roundGroups() {
+      return this.generation?.roundGroups || []
+    },
+    majors() {
+      const optionalMajors = this.getOptionalMajors() || []
+      return { marjors: optionalMajors } // mock structure
+    }
+  },
+  watch: {
+    'roundGroups': function(newVal) {
+      if (newVal?.length) this.loadElectiveFlowHistory()
+    }
+  },
+  methods: {
+    loadElectiveFlowHistory() {
+      searchElectiveGenerationDetailsBySelf({ roundId: this.generation.status.roundId })
+        .then(res => {
+          this.detail = res.data.first()
+        })
+    }
+  }
 }
 </script>
 

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

@@ -12,6 +12,7 @@
       <el-divider><h1>选科成绩表</h1></el-divider>
       <group-score-table></group-score-table>
       <el-divider><h1>选科进程表</h1></el-divider>
+      <elective-flow-table></elective-flow-table>
     </div>
   </div>
 </template>
@@ -24,11 +25,12 @@ import RoundSelect from '@/views/system/user/profile/round-select'
 import MajorMatchOptional from '@/views/elective/report/components/major-match-optional'
 import MajorIntroduceBatch from '@/views/elective/report/components/major-introduce-batch'
 import GroupScoreTable from '@/views/elective/report/components/group-score-table'
+import ElectiveFlowTable from '@/views/elective/report/components/elective-flow-table'
 
 export default {
   name: 'report-index',
   extends: RoundSelect,
-  components: { GroupScoreTable, MajorIntroduceBatch, MajorMatchOptional, RoundSelect, GroupSubjectQuery, ElectiveTestReports },
+  components: { ElectiveFlowTable, GroupScoreTable, MajorIntroduceBatch, MajorMatchOptional, RoundSelect, GroupSubjectQuery, ElectiveTestReports },
   data() {
     // TODO: 报告应该与学年和轮次相关,先暂时渲染出最近的轮次数据
     return {