Bladeren bron

+ accumulate + fixed table columns

hare8999@163.com 3 jaren geleden
bovenliggende
commit
43070977d4

+ 74 - 15
mock/modules/elective-generation.js

@@ -1,7 +1,7 @@
 const Mock = require('mockjs')
 const Random = Mock['Random']
 
-const mockGeneration = 3 // primary
+const mockGeneration = 8 // primary
 const mockGroups = [1, 2, 3, 4, 5, 6]
 const mockPreferenceCount = 3 // 1 or 3 // 1志愿/3志愿
 
@@ -49,7 +49,7 @@ module.exports = [
               const groupDefines = [
                 {
                   category: 'actualCount',
-                  displayName: '实际人数',
+                  displayName: '已报名',
                   values: mockGroups.map(groupId => ({
                     groupId: groupId,
                     value: Random.integer(120, 400),
@@ -64,7 +64,7 @@ module.exports = [
               const nonGroupDefines = [
                 {
                   category: 'unfinishedCount',
-                  displayName: '未完成人数',
+                  displayName: '未报名',
                   values: [{
                     groupId: 0,
                     value: Random.integer(0, 10),
@@ -88,6 +88,63 @@ module.exports = [
             results.push(primary)
             break
           default:
+            const accumulateDefine = {
+              generations: [2,4,6,7],
+              factory: ()=>[
+                {
+                  category: 'approvedCount',
+                  displayName: '正常录取',
+                  values: mockGroups.map(groupId => ({
+                    groupId: groupId,
+                    value: Random.integer(120, 400),
+                    color: '',
+                    bold: false,
+                    star: false,
+                    queryCode: 'abc',
+                    disabled: false
+                  }))
+                },
+                {
+                  category: 'forcedCount',
+                  displayName: '调剂录取',
+                  values: mockGroups.map(groupId => ({
+                    groupId: groupId,
+                    value: Random.integer(120, 400),
+                    color: '',
+                    bold: false,
+                    star: false,
+                    queryCode: 'abc',
+                    disabled: false
+                  }))
+                },
+                {
+                  category: 'esignedCount',
+                  displayName: '已签人数',
+                  values: mockGroups.map(groupId => ({
+                    groupId: groupId,
+                    value: Random.integer(120, 400),
+                    color: '',
+                    bold: false,
+                    star: false,
+                    queryCode: 'abc',
+                    disabled: false
+                  }))
+                },
+                {
+                  category: 'esigningCount',
+                  displayName: '待签人数',
+                  values: mockGroups.map(groupId => ({
+                    groupId: groupId,
+                    value: Random.integer(120, 400),
+                    color: '',
+                    bold: false,
+                    star: false,
+                    queryCode: 'abc',
+                    disabled: false
+                  }))
+                }
+              ]
+            }
             const commonDefines = [
               {
                 generations: [2],
@@ -164,7 +221,7 @@ module.exports = [
                 factory: () => [
                   {
                     category: 'matchedApproved',
-                    displayName: '可调剂已填人数',
+                    displayName: '可调剂已填',
                     values: mockGroups.map(groupId => ({
                       groupId: groupId,
                       value: Random.integer(120, 400),
@@ -177,7 +234,7 @@ module.exports = [
                   },
                   {
                     category: 'matchedRejected',
-                    displayName: '可调剂拒绝人数',
+                    displayName: '可调剂拒绝',
                     values: mockGroups.map(groupId => ({
                       groupId: groupId,
                       value: Random.integer(120, 400),
@@ -190,7 +247,7 @@ module.exports = [
                   },
                   {
                     category: 'matchedNonaction',
-                    displayName: '可调剂未完成人数',
+                    displayName: '可调剂未',
                     values: mockGroups.map(groupId => ({
                       groupId: groupId,
                       value: Random.integer(120, 400),
@@ -203,7 +260,7 @@ module.exports = [
                   },
                   {
                     category: 'nonmatchedApproved',
-                    displayName: '不可调剂已填人数',
+                    displayName: '不可调剂已填',
                     values: mockGroups.map(groupId => ({
                       groupId: groupId,
                       value: Random.integer(120, 400),
@@ -216,7 +273,7 @@ module.exports = [
                   },
                   {
                     category: 'nonmatchedRejected',
-                    displayName: '不可调剂拒绝人数',
+                    displayName: '不可调剂拒绝',
                     values: mockGroups.map(groupId => ({
                       groupId: groupId,
                       value: Random.integer(120, 400),
@@ -229,7 +286,7 @@ module.exports = [
                   },
                   {
                     category: 'nonmatchedNonaction',
-                    displayName: '不可调剂未完成人数',
+                    displayName: '不可调剂未',
                     values: mockGroups.map(groupId => ({
                       groupId: groupId,
                       value: Random.integer(120, 400),
@@ -247,7 +304,7 @@ module.exports = [
                 factory: () => [
                   {
                     category: 'approvedCount',
-                    displayName: '补录录取人数',
+                    displayName: '补录录取',
                     values: mockGroups.map(groupId => ({
                       groupId: groupId,
                       value: Random.integer(120, 400),
@@ -260,7 +317,7 @@ module.exports = [
                   },
                   {
                     category: 'forcedCount',
-                    displayName: '调剂录取人数',
+                    displayName: '调剂录取',
                     values: mockGroups.map(groupId => ({
                       groupId: groupId,
                       value: Random.integer(120, 400),
@@ -304,7 +361,7 @@ module.exports = [
                 factory: () => [
                   {
                     category: 'approvedCount',
-                    displayName: '补录录取人数',
+                    displayName: '补录录取',
                     values: mockGroups.map(groupId => ({
                       groupId: groupId,
                       value: Random.integer(120, 400),
@@ -317,7 +374,7 @@ module.exports = [
                   },
                   {
                     category: 'forcedCount',
-                    displayName: '调剂录取人数',
+                    displayName: '调剂录取',
                     values: mockGroups.map(groupId => ({
                       groupId: groupId,
                       value: Random.integer(120, 400),
@@ -335,7 +392,7 @@ module.exports = [
                 factory: () => [
                   {
                     category: 'forcedCount',
-                    displayName: '调剂录取人数',
+                    displayName: '调剂录取',
                     values: mockGroups.map(groupId => ({
                       groupId: groupId,
                       value: Random.integer(120, 400),
@@ -350,11 +407,13 @@ module.exports = [
               }
             ]
             const defines = commonDefines.find(d => d.generations.includes(generation))
+            const inAccDef = accumulateDefine.generations.includes(generation)
             if (defines) {
               results.push({
                 roundId: 1,
                 generation: copyGeneration,
-                categories: defines.factory()
+                categories: defines.factory(),
+                accumulates: inAccDef ? accumulateDefine.factory() : undefined
               })
             }
             break

+ 2 - 1
src/views/elective/generation/components/elective-generation-master.vue

@@ -45,8 +45,9 @@ export default {
     },
     accumulates() {
       // summary - accumulate for display in charts
-      return this.generation.summary.find(item => item.generation == this.generation.active && item.accumulates?.length)
+      const generationData = this.generation.summary.find(item => item.generation == this.generation.active && item.accumulates?.length)
         || this.generation.summary.find(item => item.generation == this.generation.active - 1)
+      return generationData?.accumulates
     },
     chartBinding() {
       return {

+ 11 - 3
src/views/elective/generation/components/elective-generation-table.vue

@@ -52,7 +52,15 @@ export default {
         }
       })
       // accumulate data
-
+      if (this.chartBinding.generation.active > this.chartBinding.generation.options.primaryDM.value
+        && this.chartBinding.chartData?.length) {
+        const prefix = 'accumulate_'
+        const ext = {
+          roundId: this.chartBinding.generation.status.roundId,
+          generation: this.chartBinding.generation.current
+        }
+        this.chartBinding.chartData.forEach(acc => this.resolveTableGeneration(ext, acc, columns, rows, mergedColumns, prefix, true))
+      }
       // completed
       this.$refs.table.scrollToRight()
       return {
@@ -71,14 +79,14 @@ export default {
     }
   },
   methods: {
-    resolveTableGeneration(ext, data, columnsRef, rowsRef, mergedColumnsRef, prefix = '') {
+    resolveTableGeneration(ext, data, columnsRef, rowsRef, mergedColumnsRef, prefix = '', fixed = false) {
       // resolve core
       const prop = prefix + ext.generation + '_' + data.category
       const name = data.displayName
       const shouldMerge = data.values.length != rowsRef.length
         || data.values.some(v => v.groupId == 0)
 
-      columnsRef[prop] = { label: name, slot: 'elective-cell' }
+      columnsRef[prop] = { label: name, slot: 'elective-cell', fixed: fixed }
       if (!shouldMerge) {
         data.values.forEach(val => {
           const row = rowsRef.find(row => row.groupId == val.groupId)

+ 1 - 0
src/views/elective/generation/index.vue

@@ -76,6 +76,7 @@ export default {
   },
   methods: {
     handleInvalid() {
+      this.activeStep = ''
       this.electiveStatus = null
       this.electiveSummary = []
     },