Forráskód Böngészése

选科分班完善

shilipojs 2 éve
szülő
commit
1d430b761e

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

@@ -29,11 +29,11 @@ export function saveSettings(query,data) {
 }
 
 // 应用分班配置
-export function applySettings(params) {
+export function applySettings(data) {
   return request({
     url: '/front/elective/classes/settings/apply',
     method: 'post',
-    params
+    data
   })
 }
 

+ 46 - 0
src/views/elective/dispatch/components/class-adjust-dialog.vue

@@ -0,0 +1,46 @@
+<template>
+  <el-dialog
+    title="班级调整"
+    :visible.sync="show"
+    :close-on-click-modal="false"
+    width="70%"
+  >
+    <class-adjust class="adjust" v-if="show" :group="group" :settings="settings"></class-adjust>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="close">取 消</el-button>
+        <el-button type="primary" @click="confirm">确 定</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+import ClassAdjust from './class-adjust'
+
+export default {
+   components: {ClassAdjust},
+   data() {
+     return {
+       show: false,
+       settings: [],
+       group: {}
+     }
+   },
+  methods: {
+    open(row, settings) {
+      this.group = row
+      this.settings = settings
+      this.show = true
+    },
+    close() {
+      this.show = false
+    },
+    confirm(){
+      this.show = false
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 8 - 39
src/views/elective/dispatch/components/class-adjust.vue

@@ -1,14 +1,7 @@
 <template>
-  <el-dialog
-    title="班级调整"
-    :visible.sync="show"
-    :close-on-click-modal="false"
-    width="70%"
-  >
     <el-form ref="form" :model="form" label-width="50px" label-position="right">
       <el-row>
         <el-row>
-
           <el-col class="flex-center-column" :span="12">
             <el-form-item>
               <mx-select @change="getStudents('from',$event)" :span="12" :list="display" v-model="fromClassId"
@@ -41,11 +34,6 @@
         </el-col>
       </el-row>
     </el-form>
-    <span slot="footer" class="dialog-footer">
-    <el-button @click="close">取 消</el-button>
-    <el-button type="primary" @click="confirm">确 定</el-button>
-  </span>
-  </el-dialog>
 </template>
 
 <script>
@@ -55,11 +43,18 @@ import MxSelect from '@/components/mx-select/mx-select'
 import ClassTable from './class-table'
 
 export default {
-  name: 'class-adjust',
   components: {
     MxSelect,
     ClassTable
   },
+  props: {
+    group: {
+      type: Object
+    },
+    settings: {
+      type: Array
+    }
+  },
   inject: ['refreshData'],
   mixins: [MxClassTreeTranslateMixin],
   data() {
@@ -69,15 +64,10 @@ export default {
       studentsTableRight: [],
       fromClassId: '',
       toClassId: '',
-      group: '',
-      settings: [],
       selectedLeft: [],
       selectedRight: [],
-      show: false,
     }
   },
-  created() {
-  },
   computed: {
     tranRight() {
       if (!this.selectedLeft.length) return []
@@ -106,19 +96,6 @@ export default {
   },
   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
     },
     getTranLeft() {
@@ -178,7 +155,6 @@ export default {
       this.$nextTick(()=> {
         this.show = false
         // 注销数据
-        this.format()
         this.refreshData()
       })
 
@@ -215,13 +191,6 @@ export default {
         this.$message.warning('需要选择两个班级')
         return
       }
-    },
-    open(row, settings) {
-      console.log(row)
-      console.log(settings)
-      this.group = row
-      this.settings = settings
-      this.show = true
     }
   }
 }

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

@@ -47,13 +47,13 @@
       </template>
     </mx-table>
     <edit-group :year="round.year" ref="editDialog"></edit-group>
-    <class-adjust ref="adjustDialog"></class-adjust>
+    <class-adjust-dialog ref="adjustDialog"></class-adjust-dialog>
   </el-row>
 </template>
 <script>
 import MxClassTreeTranslateMixin from '@/components/Cache/modules/mx-classTree-translate-mixin.js'
 import MxSelectTranslateMixin from '@/components/Cache/modules/mx-select-translate-mixin.js'
-import ClassAdjust from './class-adjust'
+import ClassAdjustDialog from './class-adjust-dialog'
 import SetClasscount from './set-classcount'
 import EditGroup from './edit-group'
 import MxTransferMixin from '@/components/mx-transfer-mixin.js'
@@ -62,7 +62,7 @@ export default {
   components: {
     EditGroup,
     SetClasscount,
-    ClassAdjust
+    ClassAdjustDialog
   },
   mixins: [MxClassTreeTranslateMixin, MxSelectTranslateMixin, MxTransferMixin],
   props: {
@@ -78,6 +78,7 @@ export default {
   data() {
     return {
       modifyGroupSettings: [],
+      classAdjustShow: false,
       dataList: [],
       propDefines: {
         groupName: {
@@ -99,7 +100,7 @@ export default {
           label: '班级名称',
           slot: 'className'
         },
-        expectedCount: {
+        actualCount: {
           label: '人数'
         },
         proportion: {
@@ -125,7 +126,8 @@ export default {
         groupName: this.translateGroup(rg.groupId),
         number: this.round.enrollGroupCount[rg.groupId] || 0, // 录取人数
         classCount: rg.classCount, // 班级数
-        expectedCount: this.settings.filter(item => item.groupId == rg.groupId).map(item => item.expectedCount).toString(),
+        actualCount: this.settings.filter(item => item.groupId == rg.groupId).map(item => item.actualCount).toString(),
+        proportion: this.settings.filter(item => item.groupId == rg.groupId).map(item => `${item.actualCountInMale}/${item.actualCountInFemale}`).toString(),
         groupClass: this.settings
           .filter(item => item.groupId == rg.groupId)
           .map(item => {
@@ -162,7 +164,10 @@ export default {
         this.$message.warning('未分班不可调整')
         return
       }
-      this.$refs.adjustDialog.open(row, this.settings.filter(item => item.groupId == row.groupId))
+      this.$nextTick(_ => {
+        this.$refs.adjustDialog.open(row, this.settings.filter(item => item.groupId == row.groupId))
+      })
+
     },
     toDetail(row, classId = '') {
       const filterSettings = this.settings.filter(item => item.groupId == row.groupId)

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

@@ -8,7 +8,7 @@
       >
         <el-table-column
           label="序号"
-          prop="sortIndex"
+          type="index"
           width="100"
         >
         </el-table-column>
@@ -30,7 +30,7 @@
           label="人数"
         >
           <template slot-scope="scope">
-              <el-input-number :min="1" :max="roundGroup.number?setPubMax(scope.$index):Infinity" v-model="scope.row.expectedCount" @change="countEdit(scope.row,scope.$index)" ></el-input-number>
+              <el-input-number :min="1" :max="roundGroup.number?setPubMax(scope.$index):Infinity" v-model="scope.row.actualCount" @change="countEdit(scope.row,scope.$index)" ></el-input-number>
           </template>
         </el-table-column>
       </el-table>
@@ -90,7 +90,7 @@ export default {
         let maxQuantit = this.roundGroup.number
         this.settingContainer.forEach((item, index) => {
           if (index !== data) {
-            allSelect += item.expectedCount
+            allSelect += item.actualCount
           }
         })
         return maxQuantit-allSelect
@@ -118,8 +118,8 @@ export default {
         // 结束拖拽后的回调函数
         onEnd({ newIndex, oldIndex }) {
           console.log('拖动了行,当前序号:' + newIndex);
-          const currentRow = that.tableData.splice(oldIndex, 1)[0];
-          that.tableData.splice(newIndex, 0, currentRow);
+          const currentRow = that.formatSetting.splice(oldIndex, 1)[0];
+          that.formatSetting.splice(newIndex, 0, currentRow);
         }
       })
     },
@@ -187,6 +187,7 @@ export default {
         roundId:this.roundId,
         mode:this.mode,
         groupId:this.roundGroup.groupId,
+        settings:this.settingContainer
       }).then(res => {
         console.log(res)
       })
@@ -195,7 +196,7 @@ export default {
       console.log(this.settingContainer)
       // 应用分班配置
       // 保存settings
-      this.saveSettings()
+      this.applySettings()
     }
   }
 }