<template>
  <el-dialog
    title="班主任分班"
    :visible.sync="show"
    width="30%"
  >
    <div class="block">
      <p class="mb10">请设置班主任分配的生效日期</p>
      <el-date-picker
        v-model="settings.activeDate"
        type="date"
        value-format="yyyy-MM-dd"
        placeholder="选择日期">
      </el-date-picker>
    </div>
    <span slot="footer" class="dialog-footer">
       <el-button @click="show = false">取 消</el-button>
       <el-button type="primary" @click="onConfirm">确 定</el-button>
     </span>
  </el-dialog>
</template>
<script>
  import { lockPublishTeachers } from '@/api/webApi/elective/dispatch'

  export default {
    data(){
      return {
        show:false,
        value: '',
        settings: {}
      }
    },
    methods: {
      init() {
        console.log('dialog---init', this)
      },
      onConfirm() {
        if(!this.settings.activeDate){
          this.$message.warning('生效日期不能为空')
          return
        }
        this.lock()
      },
      lock() {
        lockPublishTeachers({
          ...this.settings
        }).then(res => {
          this.show = false
          this.success()
        }).finally(_ => {
          this.show = false
        })
      }
    }
  }
</script>
<style>

</style>
