shilipojs 2 rokov pred
rodič
commit
b56875a56d

+ 12 - 11
src/api/webApi/elective/dispatch.js

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

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

@@ -5,7 +5,7 @@
     :close-on-click-modal="false"
     width="70%"
   >
-    <class-adjust class="adjust" v-if="show" :group="group" :settings="settings"></class-adjust>
+    <class-adjust :show.sync="show" ref="classAdjust" 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>
@@ -35,7 +35,7 @@ export default {
       this.show = false
     },
     confirm(){
-      this.show = false
+      this.$refs.classAdjust.confirm()
     }
   }
 }

+ 7 - 9
src/views/elective/dispatch/components/class-adjust.vue

@@ -114,9 +114,9 @@ export default {
         if (this.tranRight.findIndex(r => r == item.key) != -1) return item
       })
     },
-    saveResultDispatch(clazzId,students) {
+    async saveResultDispatch(clazzId,students) {
       // 分派转移
-      resultDispatch({
+      await resultDispatch({
         roundId: this.group.roundId,
         students: students,
         toClazzId: clazzId
@@ -148,18 +148,16 @@ export default {
         return
       }
       // 2.分别调用调换接口
+      // console.log(left)// 左边的学生放入左边表格
+      // console.log(right)// 右边的学生放入右边表格
       if (left.length) this.saveResultDispatch(this.fromClassId,left)
-      console.log(left)// 左边的学生放入左边表格
-      console.log(right)// 右边的学生放入右边表格
       if (right.length) this.saveResultDispatch(this.toClassId,right)
-      this.$nextTick(()=> {
-        this.show = false
-        // 注销数据
+      this.$emit('update:show', false)
+      // 刷新
+      this.$nextTick(_ => {
         this.refreshData()
       })
 
-      // 2.分别调用调换接口
-
     },
     studentSelected(list, type) {
       // 1 添加至母框

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

@@ -85,8 +85,6 @@ export default {
       // 验证
       const flag =this.$refs.setClassDialog.valid()
       if(flag) this.show = false
-
-
     }
   }
 }

+ 15 - 20
src/views/elective/dispatch/components/set-classcount.vue

@@ -63,7 +63,7 @@
 <script>
 import Sortable from 'sortablejs'
 import MxClassTreeTranslateMixin from '@/components/Cache/modules/mx-classTree-translate-mixin.js'
-import { saveSettings, applySettings } from '@/api/webApi/elective/dispatch'
+import {  applySettings } from '@/api/webApi/elective/dispatch'
 export default {
   name: 'set-classcount',
   mixins: [MxClassTreeTranslateMixin],
@@ -103,6 +103,7 @@ export default {
           expectedCount: item.expectedCount,
           classId: item.classId,
           className: this.getClassName(item.classId),
+          actualCount: item.actualCount
         }
       })
     },
@@ -118,13 +119,13 @@ export default {
         // 结束拖拽后的回调函数
         onEnd({ newIndex, oldIndex }) {
           console.log('拖动了行,当前序号:' + newIndex);
-          const currentRow = that.formatSetting.splice(oldIndex, 1)[0];
-          that.formatSetting.splice(newIndex, 0, currentRow);
+          const currentRow = that.settingContainer.splice(oldIndex, 1)[0];
+          that.settingContainer.splice(newIndex, 0, currentRow);
         }
       })
     },
     countEdit(newVal,index){
-      this.settingContainer[index].expectedCount = newVal.expectedCount
+      this.settingContainer[index].actualCount = newVal.actualCount
     },
     init(roundGroup,settingContainer) {
       console.log(roundGroup,settingContainer)
@@ -159,7 +160,7 @@ export default {
       // 验证
       // 累计人数
       const count =this.formatSetting.reduce((pre, cur) => {
-          return pre + cur.expectedCount
+          return pre + cur.actualCount
       }, 0)
       if(count != this.roundGroup.number) {
         this.$message.warning('还有学生未分班')
@@ -169,27 +170,21 @@ export default {
       this.confirm()
       return true
     },
-    saveSettings() {
-      saveSettings(
-        {roundId: this.roundId }, this.settingContainer ).then(res => {
-        if (res.code == 200) {
-          this.$message.success(res.msg)
-        }
-        this.$nextTick(_ => {
-          this.applySettings()
-        })
-      }).finally(res => {
-        this.refreshData()
-      })
-    },
+    // 合并了saveSettings
     applySettings() {
+      this.settingContainer = this.settingContainer.map(item => {
+        item.expectedCount = item.actualCount
+        return item
+      })
       applySettings({
         roundId:this.roundId,
         mode:this.mode,
         groupId:this.roundGroup.groupId,
-        settings:this.settingContainer
-      }).then(res => {
+      },this.settingContainer
+      ).then(res => {
         console.log(res)
+      }).finally(_ => {
+        this.refreshData()
       })
     },
     confirm() {