<template>
  <div>
    <el-dialog title="批量审批" :visible.sync="isShow" :show-close="false" width="400px" :close-on-click-modal="false">
      <el-form
        ref="examineForm"
        :model="examineForm"
        :rules="examineFormRules"
        label-position="left"
        label-width="80px"
      >
        <el-form-item label="审批状态" prop="status">
          <el-radio-group v-model="examineForm.status">
            <el-radio :label="'OK'">通过</el-radio>
            <el-radio :label="'FAIL'">驳回</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="审批备注" prop="remark">
          <el-input
            type="textarea"
            :autosize="{ minRows: 2, maxRows: 4 }"
            placeholder="请输入审批备注"
            v-model="examineForm.remark"
          >
          </el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancelForm">取 消</el-button>
        <el-button type="primary" @click="submitForm">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'EditDateDialog',
  props: {
    isShow: {
      type: Boolean,
      default: false
    },
    examineForm: {
      type: Object,
      default: {
        date: ''
      }
    }
  },
  data() {
    return {
      examineFormRules: {
        status: [{ required: true, message: '请选择审批状态', trigger: 'change' }]
      }
    }
  },
  methods: {
    cancelForm() {
      this.$emit('update:isShow', false)
      this.$refs.examineForm.resetFields()
    },

    submitForm() {
      this.$refs.examineForm.validate(valid => {
        if (valid) {
          this.$emit('submit')
          this.$refs.examineForm.resetFields()
        }
      })
    }
  }
}
</script>

<style></style>
