Browse Source

选科报名原型修改-----补录、调剂动态增加字段;AI分析

shilipojs 3 years ago
parent
commit
81bbe2d7f5

+ 27 - 5
doc/Mind/PrimaryElective.cs

@@ -75,6 +75,9 @@ namespace mxdemo.Mind
       public int majorCategoryCode; // 专业编码
       public  List<int> matchedGroupIds; // // 匹配哪几个组合?
     }
+
+
+
     // 学生这里无论什么时间得到的都是最终结果,不需要中间快照,以此区分校长的选科数据。
     // 校长的选科数据,初选时与学生相同;补录时也需要这份数据、但也需要初选与补录的差异部分;排名均衡同理
     public class ElectiveSelectModel
@@ -84,10 +87,8 @@ namespace mxdemo.Mind
         public int classCount; // 班级数
         public int personCount; // 限制人数
 
-        public int personInTime; // 实时人数
         public int rankInGroup; // 选科实时排名
         public int rankInGrade; // 选科全校排名
-
         public bool allowSelect; // 是否可以报名
         public string disabledReason; // 不可报名时的原因
 
@@ -95,6 +96,16 @@ namespace mxdemo.Mind
         public int selectedRank; // 多志愿时的排序
     }
 
+    public class ElectiveSelectGroupStatistics {
+      public string name; // stat column name
+      public ElectiveGeneration.ElectiveGroupGenerationStatistic[] groupDescriptors;
+    }
+    ;
+    public class ElectiveSelectModelWrapper {
+      public ElectiveSelectModel[] models;
+      ElectiveSelectGroupStatistics[] statColumns;
+    }
+
     // 自选专业
     public class ElectiveOptionalMajor
     {
@@ -124,7 +135,7 @@ namespace mxdemo.Mind
         ElectiveSetting getStudentSelected();
 
         // 学生获取选科状态数据,得到是每个组合最终状态和结果
-        List<ElectiveSelectModel> getPrimaryElectives();
+        ElectiveSelectModelWrapper getStudentElectiveModels();
 
         // 学生获取自选专业及匹配情况
         List<ElectiveOptionalMajor> getOptionalMajors();
@@ -138,7 +149,18 @@ namespace mxdemo.Mind
         // 取消报名
         void cancelPrimaryElective(ElectiveSelectModel model);
 
-        // 返回学生测评推荐专业 (只用于展示作用,起到提供建议作用)
-        void cancelPrimaryElective(ElectiveSelectModel model);
+        // 返回学生测评推荐专业以及匹配情况
+        List<RecommendMajor> getRecommendMajor();
+        /**
+          AI分析
+          需要的字段:
+           score   组合成绩
+           remainingPlan   剩余计划
+           highestScoreCount  组合成绩最高人数
+           highestScoreRank 组合成绩最高人数排名
+           supplyRank   补录人数排名
+           supplyCount  补录人数
+        */
+        List<ElectiveSelectGroupStatistics> getAIAnalysis()
     }
 }

+ 139 - 107
mock/modules/elective-subject.js

@@ -2,58 +2,6 @@
 const Mock = require('mockjs')
 
 module.exports = [
-  {
-    url: '/mock/front/elective/optionalMajors',
-    type:'get',
-    response: config => {
-      return {
-        code: 200,
-        msg: 'success',
-        data:[
-          {
-            collegeId: 1,
-            collegeName: '北京大学',
-            majorCategoryName: '计算机技术',  // 专业类别
-            majorCategoryCode: '1',  // 专业编码
-            majors: [],          // 类别下分类
-            limitationA: '',
-            limitationB: '',
-            matchedGroupIds: [3,2], // 匹配哪几个组合?
-          },
-          {
-            collegeId: 2,
-            collegeName: '湖南大学',
-            majorCategoryName: '医学',  // 专业类别
-            majorCategoryCode: '2',  // 专业编码
-            majors: [],          // 类别下分类
-            limitationA: '',
-            limitationB: '',
-            matchedGroupIds: [2], // 匹配哪几个组合?
-          },
-          {
-            collegeId: 3,
-            collegeName: '中南大学',
-            majorCategoryName: '法学',  // 专业类别
-            majorCategoryCode: '3',  // 专业编码
-            majors: [],          // 类别下分类
-            limitationA: '',
-            limitationB: '',
-            matchedGroupIds: [1,2], // 匹配哪几个组合?
-          },
-          {
-            collegeId: 3,
-            collegeName: '中南大学',
-            majorCategoryName: '土木工程',  // 专业类别
-            majorCategoryCode: 'a',  // 专业编码
-            majors: [],          // 类别下分类
-            limitationA: '',
-            limitationB: '',
-            matchedGroupIds: [1], // 匹配哪几个组合?
-          }
-        ]
-      }
-    }
-  },
   {
     url: '/mock/front/elective/optionalMajors',
     type:'get',
@@ -148,66 +96,150 @@ module.exports = [
     }
   },
   {
-    url: '/mock/front/elective/primaryElectives',
+    url: '/mock/front/elective/studentElectiveModels',
     type:'get',
     response: config => {
       return {
         code: 200,
         msg: 'success',
-        data:[
-          {
-            groupId: 1, // 组合
-            groupName: '物化生', // 名称
-            classCount: 5,  // 班级数
-            personCount: 200,  // 限制人数
-            personInTime: 100,  // 实时人数
-            rankInGroup: 53, // 选科实时排名
-            rankInGrade: 64, // 选科全校排名
-            allowSelect: true, // 是否可以报名
-            disabledReason: '不知道', // 不可报名时的原因
-            selected:  false, // 报名状态
-            selectedRank:  1, // 多志愿时的排序
-          },
-          {
-            groupId: 2, // 组合
-            groupName: '物化政', // 名称
-            classCount: 4,  // 班级数
-            personCount: 180,  // 限制人数
-            personInTime: 60,  // 实时人数
-            rankInGroup: 32, // 选科实时排名
-            rankInGrade: 67, // 选科全校排名
-            allowSelect: true, // 是否可以报名
-            disabledReason: '不知道', // 不可报名时的原因
-            selected:  false, // 报名状态
-            selectedRank:  2, // 多志愿时的排序
-          },
-          {
-            groupId: 3, // 组合
-            groupName: '历化政', // 名称
-            classCount: 3,  // 班级数
-            personCount: 180,  // 限制人数
-            personInTime: 60,  // 实时人数
-            rankInGroup: 32, // 选科实时排名
-            rankInGrade: 67, // 选科全校排名
-            allowSelect: true, // 是否可以报名
-            disabledReason: '不知道', // 不可报名时的原因
-            selected:  false, // 报名状态
-            selectedRank:  2, // 多志愿时的排序
-          },
-          {
-            groupId: 4, // 组合
-            groupName: '历化地', // 名称
-            classCount: 4,  // 班级数
-            personCount: 180,  // 限制人数
-            personInTime: 60,  // 实时人数
-            rankInGroup: 32, // 选科实时排名
-            rankInGrade: 67, // 选科全校排名
-            allowSelect: true, // 是否可以报名
-            disabledReason: '不知道', // 不可报名时的原因
-            selected:  false, // 报名状态
-            selectedRank:  2, // 多志愿时的排序
-          },
-        ]
+        data:{
+          models: [
+            {
+              groupId: 1, // 组合
+              groupName: '物化生', // 名称
+              classCount: 5,  // 班级数
+              personCount: 200,  // 限制人数
+              personInTime: 100,  // 实时人数
+              rankInGroup: 53, // 选科实时排名
+              rankInGrade: 64, // 选科全校排名
+              allowSelect: true, // 是否可以报名
+              disabledReason: '不知道', // 不可报名时的原因
+              selected:  false, // 报名状态
+              selectedRank:  1, // 多志愿时的排序
+            },
+            {
+              groupId: 2, // 组合
+              groupName: '物化政', // 名称
+              classCount: 4,  // 班级数
+              personCount: 180,  // 限制人数
+              personInTime: 60,  // 实时人数
+              rankInGroup: 32, // 选科实时排名
+              rankInGrade: 67, // 选科全校排名
+              allowSelect: true, // 是否可以报名
+              disabledReason: '不知道', // 不可报名时的原因
+              selected:  false, // 报名状态
+              selectedRank:  2, // 多志愿时的排序
+            },
+            {
+              groupId: 3, // 组合
+              groupName: '历化政', // 名称
+              classCount: 3,  // 班级数
+              personCount: 180,  // 限制人数
+              personInTime: 60,  // 实时人数
+              rankInGroup: 32, // 选科实时排名
+              rankInGrade: 67, // 选科全校排名
+              allowSelect: true, // 是否可以报名
+              disabledReason: '不知道', // 不可报名时的原因
+              selected:  false, // 报名状态
+              selectedRank:  2, // 多志愿时的排序
+            },
+            {
+              groupId: 4, // 组合
+              groupName: '历化地', // 名称
+              classCount: 4,  // 班级数
+              personCount: 180,  // 限制人数
+              personInTime: 60,  // 实时人数
+              rankInGroup: 32, // 选科实时排名
+              rankInGrade: 67, // 选科全校排名
+              allowSelect: true, // 是否可以报名
+              disabledReason: '不知道', // 不可报名时的原因
+              selected:  false, // 报名状态
+              selectedRank:  2, // 多志愿时的排序
+            },
+          ],
+          statColumns: [
+            {
+              name: '补录选科人数比',
+              groupDescriptors: [
+                {
+                  groupId: 1,
+                  descriptors: [
+                    {
+                      key: '',
+                      value: 80,
+                      description: '补录确定人数'
+                    },
+                    {
+                      key: '',
+                      value: 200,
+                      description: '补录人数'
+                    }
+                  ]
+                },
+                {
+                  groupId: 2,
+                  descriptors: [
+                    {
+                      key: '',
+                      value: 60,
+                      description: '补录确定人数'
+                    },
+                    {
+                      key: '',
+                      value: 200,
+                      description: '补录人数'
+                    }
+                  ]
+                },
+                {
+                  groupId: 3,
+                  descriptors: [
+                    {
+                      key: '',
+                      value: 100,
+                      description: '补录确定人数'
+                    },
+                    {
+                      key: '',
+                      value: 200,
+                      description: '补录人数'
+                    }
+                  ]
+                },
+                {
+                  groupId: 4,
+                  descriptors: [
+                    {
+                      key: '',
+                      value: 115,
+                      description: '补录确定人数'
+                    },
+                    {
+                      key: '',
+                      value: 200,
+                      description: '补录人数'
+                    }
+                  ]
+                },
+                {
+                  groupId: 5,
+                  descriptors: [
+                    {
+                      key: '',
+                      value: 126,
+                      description: '补录确定人数'
+                    },
+                    {
+                      key: '',
+                      value: 200,
+                      description: '补录人数'
+                    }
+                  ]
+                },
+              ]
+            }
+          ]
+        }
       }
     }
   },

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

@@ -11,16 +11,16 @@ export function getOptionalMajors(params) {
 }
 
 // 学生获取选科状态数据,得到是每个组合最终状态和结果
-export function getPrimaryElectives(params) {
+export function getStudentElectiveModels(params) {
   return request({
-    url: '/mock/front/elective/primaryElectives',
+    url: '/mock/front/elective/studentElectiveModels',
     method: 'get',
     params
   })
 }
 
 // 学生获取评测推荐专业
-export function getEvaluationMajors(params) {
+export function getRecommendMajor(params) {
   return request({
     url: '/mock/front/elective/evaluationMajors',
     method: 'get',
@@ -31,3 +31,5 @@ export function getEvaluationMajors(params) {
 
 
 
+
+

+ 74 - 71
src/views/system/user/profile/components/report-table.vue

@@ -3,18 +3,18 @@
     <template #header>
       <div class="fx-row fx-bet-cen">
         选科报名表
-      <el-button>选科历史记录</el-button>
+        <el-button>选科历史记录</el-button>
       </div>
     </template>
-    <mx-table :propDefines="propDefines" :rows="formatList">
+    <mx-table :propDefines="formatTable.cols" :rows="formatTable.rows">
       <template #temp="{row}">
         <span class="btn-blue mr5" @click="toSelectSub(row)">选择</span>
         <span class="btn-green">查看记录</span>
         <!--        <el-button>查看</el-button>-->
       </template>
       <template #proportion="{row}">
-        <span :style="{color: row.personInTime > row.personCount ? 'red' : '#42b983'}">{{row.personInTime}}</span>
-        <span >/{{row.personCount}}</span>
+        <span :style="{color: row.personInTime > row.personCount ? 'red' : '#42b983'}">{{ row.personInTime }}</span>
+        <span>/{{ row.personCount }}</span>
       </template>
       <template #signUp="{row}">
         <span class="btn-red" v-if="row.selected" @click="toUnSelect(row)">取消报名</span>
@@ -23,20 +23,22 @@
       <template #subjects="{row}">
         <el-row>
           <el-col :span="8" v-for="subject in row.subjects">
-            <el-tag type="success" class="mr10 mb10" >{{ subject[0] }}</el-tag>
+            <el-tag type="success" class="mr10 mb10">{{ subject[0] }}</el-tag>
           </el-col>
         </el-row>
       </template>
       <template #colleges="{row}">
         <el-row>
           <el-col :span="12" v-for="college in row.colleges">
-            <el-tag type="success" class="mb10">{{ college.major[0] }}</el-tag>:
+            <el-tag type="success" class="mb10">{{ college.major[0] }}</el-tag>
+            :
             <span>{{ college.college }}</span>
           </el-col>
         </el-row>
       </template>
     </mx-table>
-    <p>您的选科志愿: <span v-for="(item,index) in selectedList" >{{item.groupName}}{{index+1 < selectedList.length ? '、' : '' }}</span></p>
+    <p>您的选科志愿: <span v-for="(item,index) in selectedList"
+    >{{ item.groupName }}{{ index + 1 < selectedList.length ? '、' : '' }}</span></p>
     <!-- 拖拽 -->
     <test-drage ref="drage" :sortList="selectedList"></test-drage>
     <el-button @click="commit" type="primary">提交</el-button>
@@ -56,10 +58,9 @@
 </template>
 <script>
 import MxSelectTranslate from '@/components/Cache/modules/mx-select-translate-mixin.js'
-import { formatSubject } from '@/utils/index'
-import TestDrage  from './test-drage'
-import VueEsign from  '@/components/VueEsign/index'
-import ChooseSubjectDialog from  './choose-subject-dialog'
+import TestDrage from './test-drage'
+import VueEsign from '@/components/VueEsign/index'
+import ChooseSubjectDialog from './choose-subject-dialog'
 
 export default {
   components: {
@@ -67,14 +68,48 @@ export default {
     VueEsign,
     ChooseSubjectDialog
   },
-  mixins:[MxSelectTranslate],
+  mixins: [MxSelectTranslate],
   data() {
     return {
-      list: [],
       preferenceCount: 3,
       optionalMajors: [],
       dialogVisible: false,
-      propDefines: {
+      modelsWrapper: {},
+      selectedList: []
+    }
+  },
+  computed: {
+    formatTable() {
+      if (!this.modelsWrapper.models) return {}
+      if (!this.optionalMajors) return {}
+      // 行
+      const rows = this.modelsWrapper.models.map(item => {
+        item.allowSelect = item.allowSelect ? '报名中' : '无法报名'
+        item.subjects = this.optionalMajors.filter(college => {
+          if (college.matchedGroupIds.indexOf(item.groupId) != -1) return college.majorCategoryName
+        }).map(item => item.majorCategoryName)
+        item.colleges = this.optionalMajors.filter(college => {
+          if (college.matchedGroupIds.indexOf(item.groupId) != -1) return college.majorCategoryName
+        }).map(item => {
+          return {
+            college: item.collegeName,
+            major: item.majorCategoryName
+          }
+        })
+        return item
+      })
+
+      // 列
+      const statCols = {}
+      this.modelsWrapper.statColumns.map((column, index) => {
+        const prop = 'statistic_' + index
+        statCols[prop] = { label: column.name }
+        rows.forEach((row) => {
+          const descriptors = column.groupDescriptors.find(desc => desc.groupId == row.groupId) || []
+          row[prop] = `${descriptors.descriptors[0].value} / ${descriptors.descriptors[1].value}`
+        })
+      })
+      const cols = {
         index: {
           type: 'index',
           label: '编号'
@@ -98,6 +133,7 @@ export default {
         rankInGrade: {
           label: '选科全校排名'
         },
+        ...statCols,
         allowSelect: {
           label: '报名状态'
         },
@@ -119,55 +155,35 @@ export default {
         signUp: {
           label: '操作',
           slot: 'signUp',
-          width:'100',
+          width: '100',
           fixed: 'right'
         }
-      },
-      selectedList: []
-    }
-  },
-  computed: {
-    formatList() {
-      if (!this.list.length) return []
-      if (!this.optionalMajors.length) return []
-      // 格式化
-      return this.list.map(item => {
-        item.allowSelect = item.allowSelect ? '报名中' : '无法报名'
-        item.subjects = this.optionalMajors.filter(college => {
-          if (college.matchedGroupIds.indexOf(item.groupId) != -1) return college.majorCategoryName
-        }).map(item => item.majorCategoryName)
-        item.colleges = this.optionalMajors.filter(college => {
-          if (college.matchedGroupIds.indexOf(item.groupId) != -1) return college.majorCategoryName
-        }).map(item => {
-          return {
-            college: item.collegeName,
-            major: item.majorCategoryName
-          }
-        })
-        // 增加 course0 course1
-        item.course0 = this.translateCourse0(item.groupId)
-        item.course1 = this.translateCourse1(item.groupId)
-        return item
-      })
+      }
+      return {
+        rows,
+        cols
+      }
     }
 
   },
   methods: {
     commit() {
       console.log(this.selectedList)
-      const real = this.selectedList.filter(item=> {return item.selected  == true})
-      if(real.length < this.preferenceCount) {
+      const real = this.selectedList.filter(item => {
+        return item.selected == true
+      })
+      if (real.length < this.preferenceCount) {
         this.$message.warning(`您要选择${this.preferenceCount}个志愿`)
         return
       }
       this.dialogVisible = true
     },
     toSelect(row) {
-      const count = this.list.reduce((prev,cur) => {
+      const count = this.modelsWrapper.models.reduce((prev, cur) => {
         return prev += cur.selected ? 1 : 0
-      },0)
+      }, 0)
       console.log(count)
-      if(count >= this.preferenceCount) {
+      if (count >= this.preferenceCount) {
         this.$message.warning(`最多选择${this.preferenceCount}个志愿`)
         return
       }
@@ -184,50 +200,37 @@ export default {
         row.selected = false
         this.selectedList.splice(
           this.selectedList.indexOf(this.selectedList.find((selected) => {
-              return selected.groupId === row.groupId }
+                return selected.groupId === row.groupId
+              }
             )
-          ), 1);
+          ), 1)
         this.$refs.drage.init(this.selectedList)
       }).catch(() => {
         this.$message({
           type: 'info',
           message: '已取消'
-        });
-      });
+        })
+      })
     },
-    toSelectSub(row)  {
-      // // 首选科目
-      // const groupArr = row.groupName.split('').map(item => {
-      //   return formatSubject(item)
-      // })
-      // const firstSub =  groupArr[0] // 首选科目
-      // const lastSub = groupArr.splice(1, 2) // 次选科目
-      // console.log(groupArr)
-      // console.log(firstSub)
-      // console.log(lastSub)
+    toSelectSub(row) {
       // 打开选科弹窗
-      this.$refs.chooseDialog.open(row.course0,row.course1)
+      const course0 = this.translateCourse0(row.groupId)
+      const course1 = this.translateCourse1(row.groupId)
+      this.$refs.chooseDialog.open(course0, course1)
     },
     init(list) {
       console.log(list)
-
-      console.log(formatSubject('物'))
-      this.list = list
+      this.modelsWrapper = list
     },
     initOption(optionalMajors) {
       console.log(optionalMajors)
       this.optionalMajors = optionalMajors
     }
-    // async getOptionalMajors() {
-    //   const res = await getOptionalMajors()
-    //   this.optionalMajors = res.data
-    //   console.log(res)
-    // }
   }
 }
 </script>
 <style scoped>
-.cell .el-tag{
+.cell .el-tag {
   margin-right: 5px;
 }
 </style>

+ 14 - 10
src/views/system/user/profile/round-select.vue

@@ -25,9 +25,9 @@
       </el-row>
     </el-card>
     <!--  自选专业 推荐专业  -->
-    <select-subject class="mt20" :evaluationMajors="evaluationMajors" :optionalMajors="optionalMajors" :list="reportList"></select-subject>
+    <select-subject class="mt20" :evaluationMajors="evaluationMajors" :optionalMajors="optionalMajors" :list="reportInfo.models"></select-subject>
     <!--  选科报名表  -->
-    <report-table class="mt20"  ref="reportRef" :list="reportList"></report-table>
+    <report-table class="mt20"  ref="reportRef" ></report-table>
     <test-summary></test-summary>
     <el-card shadow="hover" class="mt20">
       <template #header>意向选科</template>
@@ -105,7 +105,11 @@ import TestResult from '@/views/elective/test/components/test-result'
 import TestSummary from '@/views/elective/test/components/test-summary'
 import SelectSubject from '@/views/system/user/profile/components/select-subject'
 import ReportTable from '@/views/system/user/profile/components/report-table'
-import { getOptionalMajors, getPrimaryElectives, getEvaluationMajors } from '@/api/webApi/elective/ selected-subject'
+import {
+  getOptionalMajors,
+  getRecommendMajor,
+  getStudentElectiveModels
+} from '@/api/webApi/elective/ selected-subject'
 
 export default {
   components: { SelectSubject, TestSummary, TestResult, TestEntry,ReportTable },
@@ -118,7 +122,7 @@ export default {
         src: '9fca0b997b8346ce8c3ce69feaf89294',
         aliIdType: 2
       },
-      reportList: [],
+      reportInfo: [],
       optionalMajors: [],
       evaluationMajors: [],
       form: {
@@ -149,17 +153,17 @@ export default {
 
     this.getOptionalMajors()
     this.getReportList()
-    this.getEvaluationMajors()
+    this.getRecommendMajor()
   },
   methods: {
-    async getEvaluationMajors() {
-      const res = await getEvaluationMajors()
+    async getRecommendMajor() {
+      const res = await getRecommendMajor()
       this.evaluationMajors= res.data
     },
     async getReportList() {
-      const res = await getPrimaryElectives()
-      this.reportList = res.data
-      this.$refs.reportRef.init(this.reportList)
+      const res = await getStudentElectiveModels()
+      this.reportInfo = res.data
+      this.$refs.reportRef.init(this.reportInfo)
     },
     async getOptionalMajors() {
       const res = await getOptionalMajors()