shilipojs 3 éve
szülő
commit
b19c590074

+ 46 - 62
src/views/system/user/profile/components/ai-analysis-dialog.vue

@@ -6,9 +6,9 @@
     :close-on-click-modal ="false"
     width="80%"
   >
-    <p class="mb10 fx-row jc-between">当前Generation   {{current}} <el-button type="primary">整体报告</el-button></p>
+    <p class="mb10"><el-button type="primary">整体报告</el-button></p>
 
-    <mx-table :propDefines="formatTable.cols" :rows="formatTable.rows">
+    <mx-table :propDefines="propDefines" :rows="formatRows">
       <template #subjects="{row}">
         <el-row>
           <el-col :span="8" v-for="subject in row.subjects">
@@ -35,61 +35,43 @@
     <span slot="footer" class="dialog-footer">
         <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
     </span>
-    <single-subject-report :prevPreferences="prevPreferences"  :reportInfo="tableInfo.rows" :currentGroup="currentReportName" ref="SingleSubjectReport"></single-subject-report>
+<!--    <single-subject-report :prevPreferences="prevPreferences"  :reportInfo="tableInfo.rows" :currentGroup="currentReportName" ref="SingleSubjectReport"></single-subject-report>-->
   </el-dialog>
 </template>
 <script>
-import config from '@/common/mx-config'
 import SingleSubjectReport from './single-subject-report'
+import BackTrackingAiResolverMixins from './ai-round-select-resolvers/backTracking-ai-resolver-mixins'
 export default {
   components:{
     SingleSubjectReport
   },
   props: {
-    prevPreferences: {
-      type:Array,
-      default: []
-    }
+    generation: Object
   },
+  mixins: [BackTrackingAiResolverMixins],
   data() {
     return{
       dialogVisible:false,
+      formatRows: [],
       tableInfo: {},
       currentReportName: '',
-      current: ''
     }
   },
   computed: {
-    steps() {
-      return config.electiveGenerationOptions
-    },
-    formatTable() {
-      if(!Object.keys(this.tableInfo).length) return {}
-      const cols = {
+    resolveTablePrefix() {
+      return {
         groupName: {
-          label: '科目组合',
-          width: '80',
-          slot:'group'
+          label: '选科组合'
         },
         scoreSumGroup: {
-          label: '组合成绩',
-          width: '80'
-        },
-        groupIndicator: {
-          label: '剩余计划',
-          width: '80'
-        },
-        bestInIndicator: {
-          label: '组合成绩最高人数'
-        },
-        rankInBest: {
-          label: '组合成绩最高人数排名'
-        },
-        rankInDisenroll: {
-          label: '补录人数排名'
+          label: '组合成绩'
         },
+      }
+    },
+    resolveTableSuffix() {
+      return{
         subjects: {
-          label: '已选专业',
+          label: '自选专业',
           slot: 'subjects',
           width: '150'
         },
@@ -98,34 +80,38 @@ export default {
           slot: 'colleges',
           width: '250'
         },
-        report: {
+        signUp: {
           label: '报告',
-          slot:'report'
-        },
+          slot: 'report',
+          width: '100',
+          fixed: 'right',
+        }
       }
-      // 剩余指标累计
-      const groupIndicatorAll = this.tableInfo.rows.reduce((prev,current)=> {
-        console.log(current.groupIndicator )
-        return prev + current.groupIndicator
-      },0)
-      const rows = this.tableInfo.rows.map(item => {
-        return {
-          groupName: item.groupName,
-          isRecommend: item.isRecommend,
-          rankInDisenroll: item.rankInDisenroll ? `${item.rankInDisenroll}/${groupIndicatorAll}`  : '/',
-          rankInBest: item.rankInBest ? `${item.rankInBest}/${item.bestInIndicator}` : '/',
-          bestInIndicator: item.bestInIndicator || '/',
-          groupIndicator: item.groupIndicator,
-          scoreSumGroup: item.scoreSumGroup,
-          groupId: item.groupId,
-          subjects: item.subjects,
-          allowSelect: item.allowSelect,
-          colleges: item.colleges
+    },
+    formatTable() {
+      if (!this.formatRows) return {}
+      const options = this.generation.options
+      console.log(this.generation)
+      if (!options || !this.generation.active) return {}
+      const optValues = Object.values(options)
+      const dynamicColumns = {}
+      for (let gen = options.primary.value; gen <= this.generation.active; gen++) {
+        const opt = optValues.find(opt => opt.value == gen)
+        const resolverKey = opt.key + 'Resolver'
+        const resolver = this[resolverKey]
+        if (typeof resolver === 'function') {
+          const genColumns = resolver(gen, this.generation.active)
+          Object.assign(dynamicColumns, genColumns)
         }
-      })
+      }
+      console.log(dynamicColumns)
+      return dynamicColumns
+    },
+    propDefines() {
       return {
-        cols,
-        rows
+        ...this.resolveTablePrefix,
+        ...this.formatTable,
+        ...this.resolveTableSuffix,
       }
     }
   },
@@ -134,11 +120,9 @@ export default {
       this.currentReportName = row.groupName
       this.$refs.SingleSubjectReport.dialogVisible = true
     },
-    open(tableInfo,currentGeneration) {
-      this.current = currentGeneration
+    open(rows) {
       this.dialogVisible = true
-      console.log(this.$store.getters.currentUser)
-      this.tableInfo = tableInfo
+      this.formatRows = rows
     },
     handleClose() {
 

+ 35 - 0
src/views/system/user/profile/components/ai-round-select-resolvers/backTracking-ai-resolver-mixins.js

@@ -0,0 +1,35 @@
+export default {
+  methods: {
+    backTrackingResolver(gen,active) {
+      console.log(gen)
+      const models = this.generation.activeModels.find(item => item.generation == gen).models
+      console.log(active)
+      this.formatRows.forEach(item => {
+        const currentGroup = models.find(group => group.groupId == item.groupId)
+        console.log(currentGroup)
+        const groupIndicatorAll = models.reduce((prev,current)=> {
+          const groupIndicator = currentGroup.groupIndicator >= 0 ? currentGroup.groupIndicator :  0
+          return prev +current.groupIndicator
+        },0)
+        item.groupIndicator = currentGroup.groupIndicator
+        item.supplyBestIndicator = currentGroup.bestInIndicator || '/'
+        item.supplyRankInBest = currentGroup.rankInBest ? `${currentGroup.rankInBest}/${currentGroup.bestInIndicator}` : '/'
+        item.supplyRankInDisenroll = currentGroup.rankInDisenroll ? `${currentGroup.rankInDisenroll}/${groupIndicatorAll}`  : '/'
+      })
+  return {
+        groupIndicator:{
+          label:'超缺'
+        },
+        supplyBestIndicator:{
+          label:'补录组合成绩最高人数'
+        },
+        supplyRankInBest:{
+          label:'补录组合成绩最高人数排名'
+        },
+        supplyRankInDisenroll:{
+          label:'补录人数排名'
+        }
+      }
+    }
+  }
+}

+ 6 - 14
src/views/system/user/profile/components/report-table.vue

@@ -2,7 +2,7 @@
   <div>
     <div class="mb10 fx-row fx-end-base">
       <div>
-        <el-button v-if="aiShow" type="primary" @click="toAiAnalysis">AI分析</el-button>
+        <el-button v-if="aiButtonShow" type="primary" @click="toAiAnalysis">AI分析</el-button>
         <el-button>选科历史记录</el-button>
       </div>
     </div>
@@ -95,7 +95,7 @@
     <esign-dialog ref="esignDialog"></esign-dialog>
     <choose-subject-dialog ref="chooseDialog"></choose-subject-dialog>
     <select-subject-report-dialog ref="reportDialog"></select-subject-report-dialog>
-    <Ai-dialog ref="aiDialog" :prevPreferences="prevPreferences"></Ai-dialog>
+    <Ai-dialog ref="aiDialog" :generation="generation" :prevPreferences="prevPreferences"></Ai-dialog>
   </div>
 </template>
 <script>
@@ -167,10 +167,9 @@ export default {
         (this.generation.current == 5 && this.generation.active == 5)||
         (this.generation.current == 5 && this.generation.active == 7)
     },
-    aiShow() {
-      const active = this.generation.active
-      if (active == 3 || active == 5 ) return true
-      return false
+    aiButtonShow() {
+      const aiButtonShow = !this.generation.activeOpt?.decisionMaking && this.generation.activeOpt?.key != 'primary'
+      return aiButtonShow
     },
     resolveTablePrefix() {
       return {
@@ -239,7 +238,6 @@ export default {
           Object.assign(dynamicColumns, genColumns)
         }
       }
-      console.log('resolveDynamicTable', dynamicColumns)
       return dynamicColumns
     },
     // 初始化 rows 填充固定数据
@@ -254,7 +252,6 @@ export default {
         row.subjects = this.optionalMajors.filter(college => {
           if (college.matchedGroupIds.indexOf(row.groupId) != -1) return college.majorCategoryName
         }).map(item => item.majorCategoryName)
-        console.log(row.subjects)
         row.colleges = this.optionalMajors.filter(college => {
           if (college.matchedGroupIds.indexOf(row.groupId) != -1) return college.majorCategoryName
         }).map(item => {
@@ -293,11 +290,9 @@ export default {
       this.$refs.reportDialog.open()
     },
     toAiAnalysis() {
-      //
-      const currentGeneration = 1
       // AI 分析 跳转
       console.log(this.formatRows)
-      this.$refs.aiDialog.open(this.formatRows, currentGeneration)
+      this.$refs.aiDialog.open(this.formatRows)
     },
     commit() {
       console.log(this.selectedList)
@@ -318,12 +313,10 @@ export default {
       const count = this.formatRows.reduce((prev, cur) => {
         return prev += cur.selected ? 1 : 0
       },0)
-      console.log(count)
       if (count >= preferenceCount) {
         this.$message.warning(`最多选择${preferenceCount}个志愿`)
         return
       }
-      console.log(row)
       row.selected = true
       this.selectedList.push(row)
       this.$refs.drage.init(this.selectedList)
@@ -338,7 +331,6 @@ export default {
         const start = this.selectedList.indexOf(this.selectedList.find((selected) => {
           return selected.groupId == row.groupId
         }))
-        console.log(start)
         this.selectedList.splice(start, 1)
 
       }).catch(() => {

+ 0 - 3
src/views/system/user/profile/components/round-select-resolvers/backTracking-resolver-mixins.js

@@ -4,11 +4,8 @@ export default {
       const models = this.generation.activeModels.find(item => item.generation == gen).models
       const generation = this.generation.activeModels.find(item => item.generation == gen).generation
 
-      console.log('primary',models)
-      console.log('primary',generation)
       this.formatRows.forEach(item => {
         const currentGroup = models.find(group => group.groupId == item.groupId)
-        console.log(currentGroup)
         item.rankInIndicator = currentGroup.rankInIndicator
         item.rankInDisenroll = currentGroup.rankInDisenroll
       })

+ 1 - 2
src/views/system/user/profile/components/round-select-resolvers/backTrackingDM-resolver-mixins.js

@@ -4,8 +4,7 @@ export default {
       const models = this.generation.activeModels.find(item => item.generation == gen).models
       const generation = this.generation.activeModels.find(item => item.generation == gen).generation
 
-      console.log('primary',models)
-      console.log('primary',generation)
+
       this.formatRows.forEach(item => {
         const currentGroup = models.find(group => group.groupId == item.groupId)
         console.log(currentGroup.groupApprovedCount)

+ 0 - 2
src/views/system/user/profile/components/round-select-resolvers/finalAdjust-resolver-mixins.js

@@ -4,8 +4,6 @@ export default {
       const models = this.generation.activeModels.find(item => item.generation == gen).models
       const generation = this.generation.activeModels.find(item => item.generation == gen).generation
 
-      console.log('primary',models)
-      console.log('primary',generation)
       // this.formatRows.forEach(item => {
       //   const currentGroup = models.find(group => group.groupId == item.groupId)
       //   console.log(currentGroup.groupApprovedCount)

+ 1 - 2
src/views/system/user/profile/components/round-select-resolvers/finalAdjustDM-resolver-mixins.js

@@ -3,8 +3,7 @@ export default {
     finalAdjustDMResolver(gen) {
       const models = this.generation.activeModels.find(item => item.generation == gen).models
       const generation = this.generation.activeModels.find(item => item.generation == gen).generation
-      console.log('primary',models)
-      console.log('primary',generation)
+
       this.formatRows.forEach(item => {
         const currentGroup = models.find(group => group.groupId == item.groupId)
 

+ 2 - 2
src/views/system/user/profile/components/round-select-resolvers/forceAdjust-resolver-mixins.js

@@ -3,8 +3,8 @@ export default {
     forceAdjustResolver(gen) {
       const models = this.generation.activeModels.find(item => item.generation == gen).models
       const generation = this.generation.activeModels.find(item => item.generation == gen).generation
-      console.log('primary',models)
-      console.log('primary',generation)
+
+
       this.formatRows.forEach(item => {
         const currentGroup = models.find(group => group.groupId == item.groupId)
 

+ 2 - 3
src/views/system/user/profile/components/round-select-resolvers/primary-resolver-mixins.js

@@ -3,13 +3,12 @@ export default {
     primaryResolver(gen,active) {
       const models = this.generation.activeModels.find(item => item.generation == gen).models
       const generation = this.generation.activeModels.find(item => item.generation == gen).generation
-      console.log('primary',models)
-      console.log('primary',generation)
+
       this.formatRows.forEach(item => {
         // item.applyCount = `${item.actualCount}/${item.personCount}`
         // item.rankInGroup = item.rankInGroup
         const currentGroup = models.find(group => group.groupId == item.groupId)
-        console.log(currentGroup)
+
         item.applyCount = `${currentGroup.actualCount} /${currentGroup.personCount}`
         item.rankInGroup = currentGroup.rankInGroup
         item.rankInGrade = currentGroup.rankInGrade

+ 1 - 2
src/views/system/user/profile/components/round-select-resolvers/primaryDM-resolver-mixins.js

@@ -3,8 +3,7 @@ export default {
     primaryDMResolver(gen,active) {
       const models = this.generation.activeModels.find(item => item.generation == gen).models
       const generation = this.generation.activeModels.find(item => item.generation == gen).generation
-      console.log('primaryDM',generation)
-      console.log('primaryDM',models)
+
 
       this.formatRows.forEach(item => {
         // item.applyCount = `${item.actualCount}/${item.personCount}`