瀏覽代碼

分班:分班详情

shilipojs 3 年之前
父節點
當前提交
d21c9f51a1

+ 12 - 131
mock/modules/elective-dispatch.js

@@ -2,146 +2,27 @@ const Mock = require('mockjs')
 
 
 module.exports = [
 module.exports = [
   {
   {
-    url: '/mock/front/report/getCurrentRound',
+    url: '/mock/front/dispatch/getClass',
     type:'get',
     type:'get',
     response: config => {
     response: config => {
       return {
       return {
         code: 200,
         code: 200,
         msg: 'success',
         msg: 'success',
-        data: {
-          year: 2021,
-          roundId: 1,
-          roundName: '第X次选科',
-          groupIds:  '1,2,3',
-          roundGroups: [
-            {
-              "id": 32,
-              "schoolId": 31,
-              "roundId": 14,
-              "modelId": 0,
-              "groupId": 1,
-              "personCount": 0,
-              "classCount": 5,
-              "limitPerson": 0,
-              "rankOut": 0
-            },
-            {
-              "id": 33,
-              "schoolId": 31,
-              "roundId": 14,
-              "modelId": 0,
-              "groupId": 2,
-              "personCount": 0,
-              "classCount": 4,
-              "limitPerson": 0,
-              "rankOut": 0
-            },
-            {
-              "id": 34,
-              "schoolId": 31,
-              "roundId": 14,
-              "modelId": 0,
-              "groupId": 3,
-              "personCount": 0,
-              "classCount": 0,
-              "limitPerson": 0,
-              "rankOut": 0
-            }
-          ],
-          enrollGroupCount:{
-            '1': 250, // 录取人数
-            '2': 122,
-            '3': 100
+        data:
+          [{
+            classId: 1,
+            className:202,
+          },{
+            classId: 2,
+            className:203,
           },
           },
-          allowDispatch: true,
-          dispatchCompleted: false
-        }
-      }
-    }
-  },
-
-  {
-    url: '/mock/front/report/getDispatchResult',
-    type:'get',
-    response: config => {
-      return {
-        code: 200,
-        msg: 'success',
-        data: [{
-          roundId: 1, // 轮次ID
-          groupId: 1, // 组合ID
-          classId: 201, // 班级
-          students: [
-            {
-              studentId: 1,
-              studentName: '张飞',
-              sex: 0,
-              rankInGroup: 1// 组合内排名
-            },
-            {
-              studentId: 2,
-              studentName: '刘备',
-              sex: 0,
-              rankInGroup: 2// 组合内排名
-            },
             {
             {
-              studentId: 3,
-              studentName: '关羽',
-              sex: 0,
-              rankInGroup: 3// 组合内排名
-            },
-            {
-              studentId: 4,
-              studentName: '陈菲菲',
-              sex: 1,
-              rankInGroup: 4// 组合内排名
-            },
-            {
-              studentId: 5,
-              studentName: '欧李',
-              sex: 1,
-              rankInGroup: 5// 组合内排名
+              classId: 3,
+              className:204,
             }
             }
           ]
           ]
-        }, {
-            roundId: 1, // 轮次ID
-            groupId: 1, // 组合ID
-            classId: 202, // 班级
-            students: [
-              {
-                studentId: 6,
-                studentName: '曹操',
-                sex: 0,
-                rankInGroup: 1// 组合内排名
-              },
-              {
-                studentId: 7,
-                studentName: '吴飞',
-                sex: 0,
-                rankInGroup: 2// 组合内排名
-              },
-              {
-                studentId: 8,
-                studentName: '海清',
-                sex: 1,
-                rankInGroup: 3// 组合内排名
-              },
-              {
-                studentId: 9,
-                studentName: '张扬',
-                sex: 1,
-                rankInGroup: 4// 组合内排名
-              },
-              {
-                studentId: 10,
-                studentName: '张燕',
-                sex: 1,
-                rankInGroup: 5// 组合内排名
-              }
-            ]
-          },
-        ]
+
       }
       }
     }
     }
-  }
+  },
 ]
 ]

+ 1 - 1
src/api/webApi/elective/dispatch.js

@@ -64,7 +64,7 @@ export function lockDispatch(params) {
   })
   })
 }
 }
 
 
-export function getCurrentRound(params) {
+export function getClass(params) {
   return request({
   return request({
     url: '/mock/front/report/getCurrentRound',
     url: '/mock/front/report/getCurrentRound',
     method: 'get',
     method: 'get',

+ 26 - 0
src/components/MxCondition/condition-object/condition-dispatch-class.js

@@ -0,0 +1,26 @@
+import conditionObjectBase from '../condition-object-base.js'
+import { getClass } from '@/api/webApi/elective/dispatch.js'
+export default {
+  ...conditionObjectBase,
+  dependentKeys: ['localGroupId'],
+  key: 'class',
+  title: '班级',
+  isDependencyReady(params) {
+    return params.groupId
+  },
+  getList: function(param) {
+    return new Promise((resolve, reject) => {
+      getClass().then(res => {
+        console.log(res.data)
+        resolve(res.data)
+      })
+      .catch(e => reject(e))
+    })
+  },
+  getCode: function(item) {
+    return item.classId
+  },
+  getLabel: function(item) {
+    return item.className
+  }
+}

+ 8 - 0
src/router/index.js

@@ -763,6 +763,14 @@ export const constantRoutes = [{
         meta: {
         meta: {
           title: '选科测评报告'
           title: '选科测评报告'
         }
         }
+      },
+      {
+        path: '/elective/dispatch/detail',
+        component: (resolve) => require(['@/views/elective/dispatch/detail'], resolve),
+        name: 'DispatchDetail',
+        meta: {
+          title: '分班详情'
+        }
       }
       }
       ]
       ]
   }
   }

+ 20 - 2
src/views/elective/dispatch/components/class-adjust.vue

@@ -42,7 +42,7 @@
       </el-row>
       </el-row>
     </el-form>
     </el-form>
     <span slot="footer" class="dialog-footer">
     <span slot="footer" class="dialog-footer">
-    <el-button @click="show = false">取 消</el-button>
+    <el-button @click="close">取 消</el-button>
     <el-button type="primary" @click="confirm">确 定</el-button>
     <el-button type="primary" @click="confirm">确 定</el-button>
   </span>
   </span>
   </el-dialog>
   </el-dialog>
@@ -100,6 +100,23 @@ export default {
     }
     }
   },
   },
   methods: {
   methods: {
+    close() {
+      this.show =false,
+        this.format()
+    },
+    format(){
+      this.form = {}
+      this.studentsTableLeft =[]
+      this.studentsTableRight =[]
+      this.fromClassId = ''
+      this.toClassId = ''
+      this.group = ''
+      this.settings = []
+      this.selectedLeft = []
+      this.selectedRight = []
+      this.show =false
+      this.tranRight = []
+    },
     getTranLeft() {
     getTranLeft() {
       // 获取左tran实际的数据
       // 获取左tran实际的数据
       // 母框去重右框
       // 母框去重右框
@@ -123,6 +140,7 @@ export default {
         students: students,
         students: students,
         toClazzId: clazzId
         toClazzId: clazzId
       }).then(res => {
       }).then(res => {
+        if(res.code == 200) this.$message.success(res.msg)
         console.log(res)
         console.log(res)
       })
       })
     },
     },
@@ -156,7 +174,7 @@ export default {
       this.$nextTick(()=> {
       this.$nextTick(()=> {
         this.show = false
         this.show = false
         // 注销数据
         // 注销数据
-        Object.assign(this.$data,this.$options.data());
+        this.format()
         this.refreshData()
         this.refreshData()
       })
       })
 
 

+ 1 - 0
src/views/elective/dispatch/components/class-table.vue

@@ -31,6 +31,7 @@
         prop="rankInGroup"
         prop="rankInGroup"
         label="排名"
         label="排名"
         type="index"
         type="index"
+        sortable
       >
       >
       </el-table-column>
       </el-table-column>
     </el-table>
     </el-table>

+ 11 - 5
src/views/elective/dispatch/components/dispatch-table.vue

@@ -34,6 +34,7 @@
           plain
           plain
           icon="el-icon-edit"
           icon="el-icon-edit"
           size="mini"
           size="mini"
+          @click="toDetail(row)"
         >详情
         >详情
         </el-button>
         </el-button>
       </template>
       </template>
@@ -47,7 +48,8 @@ import MxClassTreeTranslateMixin from '@/components/Cache/modules/mx-classTree-t
 import MxSelectTranslateMixin from '@/components/Cache/modules/mx-select-translate-mixin.js'
 import MxSelectTranslateMixin from '@/components/Cache/modules/mx-select-translate-mixin.js'
 import ClassAdjust from './class-adjust'
 import ClassAdjust from './class-adjust'
 import SetClasscount from './set-classcount'
 import SetClasscount from './set-classcount'
-import EditGroup from './editGroup'
+import EditGroup from './edit-group'
+import MxTransferMixin from '@/components/mx-transfer-mixin.js'
 
 
 export default {
 export default {
   components: {
   components: {
@@ -55,7 +57,7 @@ export default {
     SetClasscount,
     SetClasscount,
     ClassAdjust,
     ClassAdjust,
   },
   },
-  mixins: [MxClassTreeTranslateMixin, MxSelectTranslateMixin],
+  mixins: [MxClassTreeTranslateMixin, MxSelectTranslateMixin,MxTransferMixin],
   props: {
   props: {
     loading: {
     loading: {
       type: Boolean,
       type: Boolean,
@@ -73,7 +75,6 @@ export default {
   data() {
   data() {
     return {
     return {
       modifyGroupSettings: [],
       modifyGroupSettings: [],
-      settingList: [],
       dataList: [],
       dataList: [],
       propDefines: {
       propDefines: {
         groupName: {
         groupName: {
@@ -117,11 +118,10 @@ export default {
       // if (!this.settings.length) return []
       // if (!this.settings.length) return []
       if (!this.round.groupList) return []
       if (!this.round.groupList) return []
       const rows = this.round.roundGroups.map(rg => ({
       const rows = this.round.roundGroups.map(rg => ({
-
           groupId: rg.groupId,
           groupId: rg.groupId,
           roundId: this.round.roundId,
           roundId: this.round.roundId,
           groupName: this.translateGroup(rg.groupId),
           groupName: this.translateGroup(rg.groupId),
-          number: this.round.enrollGroupCount[rg.groupId] || 200, // 录取人数
+          number: this.round.enrollGroupCount[rg.groupId] || 0, // 录取人数
           classCount: rg.classCount, // 班级数
           classCount: rg.classCount, // 班级数
           expectedCount: this.settings.filter(item => item.groupId == rg.groupId).map(item => item.expectedCount).toString(),
           expectedCount: this.settings.filter(item => item.groupId == rg.groupId).map(item => item.expectedCount).toString(),
           groupClass: this.settings
           groupClass: this.settings
@@ -153,6 +153,12 @@ export default {
       }
       }
       this.$refs.adjustDialog.open(row,this.settings.filter(item => item.groupId == row.groupId))
       this.$refs.adjustDialog.open(row,this.settings.filter(item => item.groupId == row.groupId))
     },
     },
+    toDetail(row) {
+      const params = {groupId: row.groupId,groupIds: (this.round.groupIds &&this.round.groupIds.split(','))||[]}
+      const path = '/elective/dispatch/detail'
+      console.log('prev transfer', row, this.round)
+      this.transferTo(path, params)
+    },
     editCount(row) {
     editCount(row) {
       // 设定分配人数
       // 设定分配人数
       const filter = this.settings.filter(item => item.groupId == row.groupId)
       const filter = this.settings.filter(item => item.groupId == row.groupId)

+ 0 - 0
src/views/elective/dispatch/components/editGroup.vue → src/views/elective/dispatch/components/edit-group.vue


+ 6 - 2
src/views/elective/dispatch/components/set-classcount.vue

@@ -9,7 +9,6 @@
           label="序号"
           label="序号"
           prop="sortIndex"
           prop="sortIndex"
           width="100"
           width="100"
-          sortable
         >
         >
         </el-table-column>
         </el-table-column>
         <el-table-column
         <el-table-column
@@ -104,8 +103,13 @@ export default {
     },
     },
     init(roundGroup,settingContainer) {
     init(roundGroup,settingContainer) {
       this.roundGroup = roundGroup
       this.roundGroup = roundGroup
-      this.settingContainer = settingContainer
       this.roundId = roundGroup.roundId
       this.roundId = roundGroup.roundId
+      if( settingContainer.length > 0) {
+        this.settingContainer = settingContainer.filter(item => item.groupId == roundGroup.groupId)
+        console.log(this.settingContainer)
+        return
+      }
+      // 没有setting就初始化人数
       const remainder = roundGroup.number % roundGroup.classCount // 余数
       const remainder = roundGroup.number % roundGroup.classCount // 余数
       const divide = Math.floor(roundGroup.number / roundGroup.classCount) // 向下取整的除数
       const divide = Math.floor(roundGroup.number / roundGroup.classCount) // 向下取整的除数
       this.settingContainer = settingContainer.filter(item => item.groupId == roundGroup.groupId).map((item,index)  => {
       this.settingContainer = settingContainer.filter(item => item.groupId == roundGroup.groupId).map((item,index)  => {

+ 56 - 0
src/views/elective/dispatch/detail.vue

@@ -0,0 +1,56 @@
+<template>
+  <!-- 分班完成的详情 -->
+  <div class="app-container">
+    <el-card class="box-card" style="margin-bottom: 10px;">
+      <mx-condition :query-params="queryParams" :require-fields="requireFields" :local-data="groupSource"
+                    @query="handleGroupQuery" class="mb10"
+      ></mx-condition>
+    </el-card>
+
+  </div>
+</template>
+<!--:setting-model="settingModel" :group-model-index="groupModelIndex"-->
+<!--:group-model="groupModel" :default-group-id="scoreQueryGroupId"-->
+<script>
+import MxSelectTranslateMixin from '@/components/Cache/modules/mx-select-translate-mixin.js'
+import MxCondition from '@/components/MxCondition/mx-condition'
+import MxTransferMixin from '@/components/mx-transfer-mixin.js'
+
+export default {
+  mixins: [MxTransferMixin, MxSelectTranslateMixin],
+  components: { MxCondition },
+  name: 'dispatch-detail',
+  data() {
+    return {
+      requireFields: ['localGroupId','class'],
+      queryParams: null
+    }
+  },
+  computed: {
+    groupSource() {
+      if (!this.listGroupsOptions.length) return {}
+      if (!this.prevData.groupIds?.length) return {}
+      console.log('computed groupSource exec')
+      const source = {
+        groups: this.prevData.groupIds.map(groupId => {
+          return {
+            groupName: this.translateGroup(groupId),
+            groupId: groupId
+          }
+        })
+      }
+      this.$nextTick(_ => this.queryParams = { localGroupId: this.prevData.groupId })
+      return source
+    }
+  },
+  methods: {
+    handleGroupQuery() {
+
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 0 - 2
src/views/elective/dispatch/index.vue

@@ -35,8 +35,6 @@ export default {
       refreshData: this.handleQuery
       refreshData: this.handleQuery
     }
     }
   },
   },
-  created() {
-  },
   methods: {
   methods: {
     handleQuery() {
     handleQuery() {
       this.getRound()
       this.getRound()

+ 1 - 0
src/views/permission/components/round-score-query.vue

@@ -105,6 +105,7 @@ export default {
   },
   },
   computed: {
   computed: {
     groupSource() {
     groupSource() {
+      console.log(this.settingModel.roundGroups)
       return { groups: this.settingModel.roundGroups }
       return { groups: this.settingModel.roundGroups }
     },
     },
     groupQuery() {
     groupQuery() {