<template>
  <el-dialog
    title="选择新班级"
    :visible.sync="dialogVisible"
    width="50%"
  >
    <div>
      <el-radio-group v-model="value">
        <el-radio class="mb10" border v-for="item in classes.classList" :label="item.classId">{{item.className}}</el-radio>
      </el-radio-group>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" @click="confirm">确 定</el-button>
    </span>
  </el-dialog>
</template>
<script>
import MxClassTreeTranslateMixin from '@/components/Cache/modules/mx-classTree-translate-mixin'

export default{
  props: {
    year: Number
  },
  mixins: [MxClassTreeTranslateMixin],
  data() {
    return {
      dialogVisible: false,
      value:'',
      activeClass:'' // 当前选中的
      // dispatch               // 分班数据
    }
  },
  computed: {
    classes() {
      if (this)
      return this.classTree.find(item => item.year == this.year)
    }
  },
  methods: {
    confirm() {
      this.activeClass.newClassId =  this.value
      this.activeClass.newClassName =  this.getClassName(this.value)
      this.activeClass.newMasterId =  this.activeClass.prevMasterId
      this.activeClass.newMasterName =  this.activeClass.prevMasterName
      this.dialogVisible = false
    },
    init(row){
      this.dialogVisible = true
      this.activeClass= row
      // console.log(row)
      this.value = row.newClassId || row.prevClassId
    }
  }
}
</script>
<style>

</style>
