
<!--
  @description: 批量审核-弹框
  @Modifier：wxy
  @routerPath:
  @date：  2020-07-08 15:00:28
-->
<template>
  <el-dialog
    v-dialogDrag
    :visible.sync="dialogData.dialog"
    :close-on-click-modal="false"
    :lock-scroll="false"
    title="批量审核"
    width="860px"
    custom-class="el-dialog_table"
  >
    <div class="el-dialog-p0">
      <el-form ref="formData" :model="formData" :inline-message="true">
        <table class="from_table">
          <tr>
            <td>
              <el-form-item label="审核意见" prop="auditReason" />
            </td>
            <td>
              <el-input
                v-model="formData.auditNotPassReason"
                :autosize="{ minRows: 4, maxRows: 4 }"
                type="textarea"
                maxlength="1000"
                show-word-limit
                style="width: 96%"
              />
            </td>
          </tr>
        </table>
      </el-form>
      <div class="but_footer">
        <div class="but_footer-h">
          <div class="but_footer-but">
            <el-button type="primary" @click="auditSignUp('01')">
              审核通过
            </el-button>
            <el-button @click="auditSignUp('02')">
              审核不通过
            </el-button>
          </div>
        </div>
      </div>
    </div>
  </el-dialog>
</template>

<script>
/* api接口*/
import { auditProcurementOrderInfo } from '@/api/procurement/procurementContract'
export default {
  name: 'PatchAuditDialog',
  mixins: [],
  props: {
    dialogData: {
      type: Object,
      default: function() {
        return
      }
    },
    orderIds: {
      type: String,
      default: function() {
        return ''
      }
    }
  },
  data() {
    return {
      formData: {
        auditNotPassReason: '' // 审核意见
      }
    }
  },
  watch: {
    'dialogData.dialog'(val) {
      if (val) {
        this.formData.auditNotPassReason = ''
      }
    }
  },
  created() {

  },
  methods: {
    auditSignUp(status) {
      if (status === '02' && this.formData.auditReason === '') {
        this.$message({
          type: 'warning',
          message: '请填写审核意见'
        })
      } else {
        const text = status === '01' ? '确定审核通过？' : '确定不通过审核？'
        this.$confirm(text, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          confirmButtonClass: 'confirmBtn',
          cancelButtonClass: 'cancelBtn'
        }).then(() => {
          this.formData.auditStatus = status
          this.formData.orderIds = this.orderIds
          auditProcurementOrderInfo(this.formData).then(res => {
            this.dialogData.dialog = false
            this.$emit('initData')
            this.$router.push({
              path: '/procurement/procurementOrderAuditList'

            })
          })
        }).catch(() => {
        })
      }
    }
  }
}
</script>

<style scoped lang="less">
</style>
