<template>
  <el-dialog
    title="审核驳回"
    :visible.sync="RejectVisible"
    width="30%"
    :before-close="close"
  >
    <div>
      <el-form
        :model="ruleForm"
        :rules="rules"
        ref="ruleForm"
        label-width="100px"
        label-position="top"
      >
        <el-form-item label="驳回原因" prop="reject_reason">
          <el-select
            v-model="ruleForm.reject_reason"
            placeholder="请选择驳回原因"
            size="small"
          >
            <el-option
              v-for="(item, index) in RejectReason"
              :key="index"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="说明">
          <el-input
            type="textarea"
            :rows="5"
            v-model="ruleForm.reject_explain"
          ></el-input>
        </el-form-item>
      </el-form>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="close" size="small">取 消</el-button>
      <el-button type="primary" size="small" @click="confirm">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  props: {
    RejectVisible: {
      type: Boolean,
      default: () => {
        return false;
      },
    },
    RejectReason: {
      type: Array,
      default: () => {
        return [];
      },
    },
  },
  components: {},
  data() {
    return {
      ruleForm: {
        reject_reason: "",
        reject_explain: "",
      },
      rules: {
        reject_reason: [
          { required: true, message: "请选择原因", trigger: "blur" },
        ],
      },
    };
  },
  methods: {
    close() {
      this.$emit("RejectDialogClose");
    },
    confirm() {
      this.$refs.ruleForm.validate((valid) => {
        if (!valid) return;
        this.$emit("RejectDialogcnfirm", this.ruleForm);
      });
    },
  },
};
</script>

<style scoped lang='scss'>
::v-deep .el-form-item {
  margin-bottom: 5px !important;
}
::v-deep .el-form-item__label {
  font-size: 14px;
  font-weight: normal;
  padding: 0px !important;
}
::v-deep .el-dialog__title {
  font-weight: bold;
}
::v-deep .el-dialog__body {
  padding: 0 20px 20px;
}
::v-deep .el-form-item__error {
  padding-top: 0px;
}
</style>