Browse Source

Merge branch 'master' of http://121.4.203.192:9000/mingxue/front

shilipojs 2 years ago
parent
commit
7fdf5988c5

+ 20 - 1
src/components/MxTable/index.vue

@@ -74,6 +74,10 @@ export default {
     }
     }
   },
   },
   props: {
   props: {
+    keepScroll: {
+      type: Boolean,
+      default: false
+    },
     border: {
     border: {
       type: Boolean,
       type: Boolean,
       default: false
       default: false
@@ -97,7 +101,22 @@ export default {
   },
   },
   data() {
   data() {
     return {
     return {
-      properties: {}
+      cacheScrollLeft: 0,
+      cacheScrollTop: 0
+    }
+  },
+  activated() {
+    if (this.keepScroll && (this.cacheScrollLeft || this.cacheScrollTop)) {
+      this.$nextTick(()=>{
+        this.$refs.table.bodyWrapper.scrollLeft = this.cacheScrollLeft
+        this.$refs.table.bodyWrapper.scrollTop = this.cacheScrollTop
+      })
+    }
+  },
+  deactivated() {
+    if (this.keepScroll) {
+      this.cacheScrollLeft = this.$refs.table.bodyWrapper.scrollLeft
+      this.cacheScrollTop = this.$refs.table.bodyWrapper.scrollTop
     }
     }
   },
   },
   methods: {
   methods: {

+ 9 - 7
src/views/elective/generation/components/elective-generation-commands.vue

@@ -7,7 +7,9 @@
     </div>
     </div>
     <div>
     <div>
       <el-button v-if="showFastPush" type="primary" @click="flushIntoDM">提前进入{{ nextStepName }}</el-button>
       <el-button v-if="showFastPush" type="primary" @click="flushIntoDM">提前进入{{ nextStepName }}</el-button>
-      <el-button v-if="showForceAdjustSend" type="primary" @click="jumpForceAdjust">进入{{ generation.options.forceAdjust.title }}</el-button>
+      <el-button v-if="showForceAdjustSend" type="primary" @click="jumpForceAdjust">
+        进入{{ generation.options.forceAdjust.title }}
+      </el-button>
       <el-button v-else-if="showSend" type="primary" @click="pushGeneration">发送</el-button>
       <el-button v-else-if="showSend" type="primary" @click="pushGeneration">发送</el-button>
       <el-button v-if="showRankBalance" type="primary" @click="jumpRankBalance">排名均衡</el-button>
       <el-button v-if="showRankBalance" type="primary" @click="jumpRankBalance">排名均衡</el-button>
       <el-button v-if="showClassDispatch" type="primary" @click="terminateAndJumpDispatch">选科分班</el-button>
       <el-button v-if="showClassDispatch" type="primary" @click="terminateAndJumpDispatch">选科分班</el-button>
@@ -89,8 +91,8 @@ export default {
     }
     }
   },
   },
   methods: {
   methods: {
-    notifyRootRefresh() {
-      this.refreshData()
+    notifyRootRefresh(syncStep = false) {
+      this.refreshData(syncStep)
     },
     },
     applyAlgorithm() {
     applyAlgorithm() {
       // 暂时只支持一种算法,不排队以后会支持多种
       // 暂时只支持一种算法,不排队以后会支持多种
@@ -105,7 +107,7 @@ export default {
     },
     },
     flushIntoDM() {
     flushIntoDM() {
       flushIntoGenerationDM().finally(() => {
       flushIntoGenerationDM().finally(() => {
-        this.notifyRootRefresh()
+        this.notifyRootRefresh(true)
       })
       })
     },
     },
     pushGeneration() {
     pushGeneration() {
@@ -117,17 +119,17 @@ export default {
       const setting = await this.$refs.settingForm.validate()
       const setting = await this.$refs.settingForm.validate()
       setting.roundId = this.status.roundId
       setting.roundId = this.status.roundId
       pushGenerationSetting(setting).finally(() => {
       pushGenerationSetting(setting).finally(() => {
-        this.notifyRootRefresh()
+        this.notifyRootRefresh(true)
       })
       })
     },
     },
     jumpForceAdjust() {
     jumpForceAdjust() {
       jumpGenerationForceAdjust().finally(() => {
       jumpGenerationForceAdjust().finally(() => {
-        this.notifyRootRefresh()
+        this.notifyRootRefresh(true)
       })
       })
     },
     },
     async jumpRankBalance() {
     async jumpRankBalance() {
       jumpGenerationRankBalance().finally(() => {
       jumpGenerationRankBalance().finally(() => {
-        this.notifyRootRefresh()
+        this.notifyRootRefresh(true)
       })
       })
     },
     },
     async terminateAndJumpDispatch() {
     async terminateAndJumpDispatch() {

+ 1 - 1
src/views/elective/generation/components/elective-generation-flow-log.vue

@@ -41,7 +41,7 @@ export default {
         const key = keyPrefix + group.groupId
         const key = keyPrefix + group.groupId
         columns[key] = { label: group.groupName, minWidth: '160px', slot: 'group-flow', slotHeader: 'group-header' }
         columns[key] = { label: group.groupName, minWidth: '160px', slot: 'group-flow', slotHeader: 'group-header' }
         // match major
         // match major
-        const groupMajors = (this.matchedMajors?.majors
+        const groupMajors = (this.matchedMajors?.marjors
           ?.filter(m => m['matchedGroupIds'].some(id => id == group.groupId)) || [])
           ?.filter(m => m['matchedGroupIds'].some(id => id == group.groupId)) || [])
           .groupBy(m => m.collegeName)
           .groupBy(m => m.collegeName)
         if (groupMajors.length) majors[key] = groupMajors
         if (groupMajors.length) majors[key] = groupMajors

+ 5 - 1
src/views/elective/generation/components/elective-generation-steps.vue

@@ -95,7 +95,6 @@ export default {
       }
       }
 
 
       if (!this.modelValue) {
       if (!this.modelValue) {
-        console.log(this.steps.findIndex(item => item.value == defaultOpt.value) + 1)
         this.activeStep = this.steps.findIndex(item => item.value == defaultOpt.value) + 1
         this.activeStep = this.steps.findIndex(item => item.value == defaultOpt.value) + 1
         this.$emit('change', defaultOpt.key)
         this.$emit('change', defaultOpt.key)
       }
       }
@@ -119,6 +118,11 @@ export default {
       } else {
       } else {
         this.generation.hiddenGenerations.remove(step.value)
         this.generation.hiddenGenerations.remove(step.value)
       }
       }
+    },
+    syncStepWithCurrent() {
+      if (this.generation.active >= this.generation.current) return
+      const currentStep = this.steps.find(s => s.value == this.generation.current)
+      this.handleStepChange(currentStep)
     }
     }
   }
   }
 }
 }

+ 1 - 1
src/views/elective/generation/components/elective-generation-table.vue

@@ -1,5 +1,5 @@
 <template>
 <template>
-  <mx-table ref="table" :prop-defines="resolvedTable.columns" :rows="resolvedTable.rows" border>
+  <mx-table ref="table" :prop-defines="resolvedTable.columns" :rows="resolvedTable.rows" border keep-scroll>
     <template #elective-cell="{value, label, prop, key}">
     <template #elective-cell="{value, label, prop, key}">
       <el-tooltip :disabled="!isCellQueryable(value, prop)" effect="light">
       <el-tooltip :disabled="!isCellQueryable(value, prop)" effect="light">
         <div slot="content">
         <div slot="content">

+ 2 - 2
src/views/elective/generation/detail.vue

@@ -216,7 +216,7 @@ export default {
     getGroupHeaderDescription(groupId) {
     getGroupHeaderDescription(groupId) {
       const statistic = this.detailWrapper.groupDescriptors.find(d => d.groupId == groupId)
       const statistic = this.detailWrapper.groupDescriptors.find(d => d.groupId == groupId)
       if (!statistic?.descriptors?.length) return {}
       if (!statistic?.descriptors?.length) return {}
-      const descriptors = statistic.descriptors.reverse()
+      const descriptors = statistic.descriptors //.reverse()
       return {
       return {
         text: descriptors.map(d => d.value).join('/'),
         text: descriptors.map(d => d.value).join('/'),
         descriptions: descriptors
         descriptions: descriptors
@@ -224,7 +224,7 @@ export default {
     },
     },
     getGroupDescription(row, groupId) {
     getGroupDescription(row, groupId) {
       const matchedMajors = (this.majorsMap[row['studentId']]
       const matchedMajors = (this.majorsMap[row['studentId']]
-        ?.majors?.filter(m => m['matchedGroupIds'].some(id => id == groupId)) || [])
+        ?.marjors?.filter(m => m['matchedGroupIds'].some(id => id == groupId)) || [])
         .groupBy(m => m.collegeName)
         .groupBy(m => m.collegeName)
       const current = this.prevData.activeGeneration
       const current = this.prevData.activeGeneration
       const options = Object.values(this.options)
       const options = Object.values(this.options)

+ 6 - 2
src/views/elective/generation/index.vue

@@ -6,7 +6,7 @@
     </el-card>
     </el-card>
     <el-card v-if="electiveStatus" class="mt20">
     <el-card v-if="electiveStatus" class="mt20">
       <template #header>
       <template #header>
-        <elective-generation-steps v-model="activeStep" :generation="generation"></elective-generation-steps>
+        <elective-generation-steps ref="step" v-model="activeStep" :generation="generation"></elective-generation-steps>
       </template>
       </template>
       <elective-generation-master :generation="generation">
       <elective-generation-master :generation="generation">
         <template #header-prefix>
         <template #header-prefix>
@@ -91,7 +91,7 @@ export default {
   },
   },
   provide() {
   provide() {
     return {
     return {
-      refreshData: this.handleQuery
+      refreshData: this.refreshData
     }
     }
   },
   },
   methods: {
   methods: {
@@ -115,6 +115,10 @@ export default {
       } finally {
       } finally {
         this.loading = false
         this.loading = false
       }
       }
+    },
+    async refreshData(syncStep) {
+      await this.handleQuery()
+      if (syncStep) this.$refs.step.syncStepWithCurrent()
     }
     }
   }
   }
 }
 }