123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- <template>
- <el-row>
- <mx-table :propDefines="propDefines" :rows="displayRows">
- <template #classCount="{row,$index}">
- <el-input-number size="small" v-model="row.classCount" @change="classCountChange(row,$index)" :min="0"
- :disabled="row.classCount != 0" label="label"
- ></el-input-number>
- </template>
- <!-- 人数设定 -->
- <template #countSet="{row}">
- <el-button
- type="success"
- plain
- icon="el-icon-edit"
- size="mini"
- @click="editCount(row)"
- >设定
- </el-button>
- </template>
- <!-- 分班编辑-->
- <template #edit="{row}">
- <el-button
- type="success"
- plain
- icon="el-icon-edit"
- size="mini"
- @click="editClass(row)"
- >编辑
- </el-button>
- </template>
- <!-- 班级调整 -->
- <template #adjust="{row}">
- <el-button
- type="success"
- plain
- icon="el-icon-edit"
- size="mini"
- @click="adjust"
- >调整
- </el-button>
- </template>
- </mx-table>
- <choose-class :year="round.year" :roundId="round.roundId" ref="editClassDialog"></choose-class>
- <set-classcount ref="setClassDialog"></set-classcount>
- <class-adjust ref="adjustDialog"></class-adjust>
- </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 ChooseClass from './choose-class'
- import ClassAdjust from './class-adjust'
- import SetClasscount from './set-classcount'
- export default {
- components: {
- ChooseClass,
- SetClasscount,
- ClassAdjust,
- },
- mixins: [MxClassTreeTranslateMixin, MxSelectTranslateMixin],
- props: {
- round: {
- type: Object,
- default: {},
- },
- settings: {
- type: Array,
- default: [],
- }
- },
- data() {
- return {
- settingList: [],
- dataList: [],
- propDefines: {
- groupName: {
- label: '组合'
- },
- number: {
- label: '录取人数'
- },
- classCount: {
- label: '班级数',
- slot: 'classCount'
- },
- edit: {
- label: '分班编辑',
- slot: 'edit'
- },
- groupClass: {
- label: '班级名称'
- },
- countSet: {
- label: '人数设定',
- slot: 'countSet'
- },
- expectedCount: {
- label: '人数'
- },
- adjust: {
- label: '操作',
- slot: 'adjust'
- }
- }
- }
- },
- computed: {
- displayRows() {
- if (!this.classTree.length) return []
- if (!this.listGroupsOptions.length) return []
- // if (!this.settings.length) return []
- if (!this.round.groupList) return []
- const rows = this.round.groupList.map(rg => ({
- groupId: rg.groupId,
- roundId: this.round.roundId,
- groupName: rg.name,
- number: this.round.enrollGroupCount[rg.groupId] || 200, // 录取人数
- classCount: rg.classCount || 5, // 班级数
- expectedCount: this.settings.filter(item => item.groupId == rg.groupId).map(item => item.expectedCount).toString(),
- groupClass: this.settings
- .filter(item => item.groupId == rg.groupId)
- .map(item => this.getClassName(item.classId)).toString()
- }))
- console.log('displayRows computed:', rows)
- return rows
- }
- },
- created() {
- },
- methods: {
- adjust() {
- this.$refs.adjustDialog.open()
- },
- editCount(row) {
- // 设定分配人数
- const filter = this.settings.filter(item => item.groupId == row.groupId)
- if (filter.length == 0) {
- this.$message.warning('班级未编辑')
- return
- }
- // if(){
- // this.$message.warning('需要选择')
- // }
- this.$refs.setClassDialog.open(row, this.settings)
- },
- classCountChange(newVal, index) {
- this.round.groupList[index] = newVal
- },
- editClass(row) {
- // 分配班级
- if (!row.classCount) {
- this.$message.warning('班级数为0时不可分班')
- return
- }
- // 获取分班配置
- // getSettings({
- // roundId: row.roundId
- // }).then(res => {
- // this.$refs.editClassDialog.open(row, res.data)
- // })
- this.$refs.editClassDialog.open(row, this.settings)
- }
- }
- }
- </script>
- <style scoped>
- </style>
|