<!--
  @description: 采购计划审核
  @author: lxl change by haofengxian
  @date： 2020-11-6 10:32
-->
<template>
  <el-dialog
    :visible.sync="dialogBackData.dialogVilideBack"
    :before-close="handleClose"
    title="重新执行采购"
    custom-class="el-dialog_table"
    width="700px"
  >
    <el-form
      ref="formData"
      label-position="left"
      :rules="rules"
      :model="formData"
      :inline-message="true"
    >
      <table class="from_table" style="marginBottom:10px">
        <tr>
          <td>
            <el-form-item
              label="退回原因:"
              prop="auditReason"
            />
          </td>
          <td>
            <gx-input
              v-model.trim="formData.auditReason"
              gx-maxlength="varchar500"
              show-word-limit
              :autosize="{ minRows: 3, maxRows: 3 }"
              class="show-word-limit-padding"
              type="textarea"
              style="width:30vw"
            />
          </td>
        </tr>
      </table>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="ensure('formData')">
        确 定
      </el-button>
      <el-button @click="dialogBackData.dialogVilideBack=false">
        取 消
      </el-button>
    </div>
  </el-dialog>
</template>
<script>
import { characters1_50 } from '@/assets/js/validate' // 公用验证
export default {
  name: 'ProcurementPlanAuditSendBackDialog',
  components: {
  },
  props: {
    dialogBackData: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      formData: {
        auditReason: '' // 退回原因
      },
      rules: {
        auditReason: [{ required: true, validator: characters1_50, trigger: 'blur' }]
      }
    }
  },
  created() {
  },
  methods: {
    ensure(formName) {
      const params = {
        inp: this.formData.auditReason,
        flg: false,
        code: '02' // 退回参数
      }
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.$emit('onEnters', params)
        } else {
          this.$message.warning('请注意页面提示')
          return false
        }
      })
    },
    handleClose() {
      this.dialogBackData.dialogVilideBack = false
    }
  }
}
</script>
<style scoped>
</style>
