<!--
  @description: 申请退款-输入驳回原因
  @Modifier: sunxinman
    @Modifier: sunxinman/haofengxian
  @date: 2020/03/31-15:50
-->
<template>
  <el-dialog
    v-dialogDrag
    :visible.sync="dialogData.dialog"
    :close-on-click-modal="false"
    :title="title"
    width="700px"
    custom-class="el-dialog__body-p0"
    top="calc((100vh - 611px) / 2)"
  >
    <section class="main">
      <!-- 表单 -->
      <el-form ref="formData" :model="data" :rules="rules" label-width="100px" class="demo-ruleForm">
        <el-form-item label="驳回原因" prop="projectManagerid">
          <el-input
            v-model="data.projectManagerid"
            :autosize="{ minRows: 4, maxRows: 4 }"
            type="textarea"
            maxlength="4000"
            show-word-limit
          />
        </el-form-item>
      </el-form>
    </section>
    <!--底部操作按钮-->
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" @click="ensure('formData')">提 交</el-button>
      <el-button @click="dialogData.dialog = false">取 消</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  name: 'RejectReasonDialog',
  props: {
    // 弹框展示状态
    dialogData: {
      type: Object,
      default: function() {

      }
    }
  },
  data() {
    return {
      title: '提示', // 标题
      data: {
        projectManagerid: ''
      },
      rules: {
        projectManagerid: [{ required: true, message: '不能为空', trigger: 'blur' }]
      }
    }
  },
  watch: {
    // 监听-弹框展示状态
    'dialogData.dialog'(val) {
      if (val) {
        // 弹框已打开
      }
    }
  },
  methods: {
    // 提交
    ensure(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.dialogData.dialog = false
        } else {
          return false
        }
      })
    }
  }
}
</script>

<style scoped lang="less">

</style>
