|
@@ -1,90 +1,97 @@
|
|
|
<template>
|
|
|
<el-row>
|
|
|
- <mx-table :propDefines="propDefines" :rows="round">
|
|
|
- <template #group="{row}">
|
|
|
- <span>{{ listGroupsOptions.filter(item => item.value == row.groupId)[0].text}}</span>
|
|
|
- </template>
|
|
|
- <template #edit>
|
|
|
+ <mx-table :propDefines="propDefines" :rows="displayRows">
|
|
|
+ <template #edit="{row}">
|
|
|
<el-button
|
|
|
type="success"
|
|
|
plain
|
|
|
icon="el-icon-edit"
|
|
|
size="mini"
|
|
|
- @click="edit"
|
|
|
- >编辑
|
|
|
+ @click="edit(row)"
|
|
|
+ >编辑
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</mx-table>
|
|
|
+ <choose-class ref="dialog" @confirm="confirm"></choose-class>
|
|
|
</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 MxClassTreeTranslateMixin from '@/components/Cache/modules/mx-classTree-translate-mixin.js'
|
|
|
+import MxSelectTranslateMixin from '@/components/Cache/modules/mx-select-translate-mixin.js'
|
|
|
+import { getCurrentRound } from '@/api/webApi/elective/dispatch'
|
|
|
+import ChooseClass from './choose-class'
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ ChooseClass
|
|
|
+ },
|
|
|
mixins: [MxClassTreeTranslateMixin, MxSelectTranslateMixin],
|
|
|
props: {
|
|
|
- round: {
|
|
|
- type: Object,
|
|
|
- default: {},
|
|
|
- },
|
|
|
- allowDispatch: {
|
|
|
- type: Boolean,
|
|
|
- default: false,
|
|
|
- },
|
|
|
+ // round: {
|
|
|
+ // type: Object,
|
|
|
+ // default: {},
|
|
|
+ // }
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ round: null,
|
|
|
settingList: [],
|
|
|
propDefines: {
|
|
|
- groupId: {
|
|
|
- label: "组合",
|
|
|
- slot: 'group'
|
|
|
+ groupName: {
|
|
|
+ label: '组合'
|
|
|
},
|
|
|
number: {
|
|
|
- label: "人数",
|
|
|
+ label: '人数'
|
|
|
},
|
|
|
- classNum: {
|
|
|
- label: "班级数",
|
|
|
+ classCount: {
|
|
|
+ label: '班级数'
|
|
|
},
|
|
|
edit: {
|
|
|
- label: "分班编辑",
|
|
|
- slot: "edit",
|
|
|
+ label: '分班编辑',
|
|
|
+ slot: 'edit'
|
|
|
},
|
|
|
classNames: {
|
|
|
- label: "班级名称",
|
|
|
- },
|
|
|
- },
|
|
|
- };
|
|
|
+ label: '班级名称'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
+ allowDispatch() {
|
|
|
+ return this.round.allowDispatch
|
|
|
+ },
|
|
|
displayRows() {
|
|
|
- console.log(this.classTree)
|
|
|
- if (!this.classTree.length) return [];
|
|
|
- if (!this.settingList.length) return [];
|
|
|
+ if (!this.classTree.length) return []
|
|
|
+ //if (!this.settingList.length) return []
|
|
|
+ if (!this.listGroupsOptions.length) return []
|
|
|
+ if (!this.round) return []
|
|
|
//
|
|
|
-
|
|
|
- },
|
|
|
- },
|
|
|
- created() {
|
|
|
- if (!this.allowDispatch) {
|
|
|
- this.$message.error("当前不能进行分班逻辑");
|
|
|
- return;
|
|
|
+ const rows = this.round.roundGroups.map(rg => ({
|
|
|
+ groupId: rg.groupId,
|
|
|
+ groupName: this.translateGroup(rg.groupId),
|
|
|
+ number: this.round.enrollGroupCount[rg.groupId],
|
|
|
+ classCount: rg.classCount
|
|
|
+ }))
|
|
|
+ console.log('displayRows computed:', rows)
|
|
|
+ return rows
|
|
|
}
|
|
|
},
|
|
|
- watch: {
|
|
|
- round: {
|
|
|
- handler: function (val, oldVal) {
|
|
|
- console.log(val);
|
|
|
- console.log(oldVal);
|
|
|
- },
|
|
|
- deep: true,
|
|
|
- },
|
|
|
+ created() {
|
|
|
+ this.loadRoundStatus()
|
|
|
},
|
|
|
methods: {
|
|
|
- edit() {},
|
|
|
- },
|
|
|
-};
|
|
|
+ async loadRoundStatus() {
|
|
|
+ const res = await getCurrentRound()
|
|
|
+ this.$set(this, 'round', res.data)
|
|
|
+ },
|
|
|
+ edit(params) {
|
|
|
+ if (!params.classCount) return
|
|
|
+ this.$refs.dialog.init(params)
|
|
|
+ },
|
|
|
+ confirm(list) {
|
|
|
+ console.log(list)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
<style scoped>
|
|
|
</style>
|