|
@@ -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() {
|