<template>
  <div>
    <el-form :model="quitForm" ref="quitForm" :rules="quitRules">
      <el-form-item prop="disposeContent">
        <el-input type="textarea" v-model.trim="quitForm.disposeContent" placeholder="请填写处理意见"></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer" style="text-align: right;">
      <el-button @click="$emit('close')">取 消</el-button>
      <el-button type="primary" @click="submit">确 定</el-button>
    </div>
  </div>
</template>
<script>
import { teacherAttendanceUpdate } from '../api'
export default {
  props: ['detail'],
  data() {
    return {
      quitForm: {
        reason: null,
      },
      quitRules: {
        reason: [{ required: true, message: "请填写退团退费原因" }],
      },
    }
  },
  methods: {
    submit() {
      this.$refs.quitForm.validate(async valid => {
        if (valid) {
          try {
            await teacherAttendanceUpdate({
              id: this.detail.teacherAttendanceId,
              ...this.quitForm
            })
            this.$emit('close')
            this.$emit('submited')
            this.$message.success("提交成功")
          } catch (error) {}
        }
      })
    }
  }
}
</script>
