<!--
  @description: 评审结果-重新授权评审弹框
  @author: yf
  @routerPath:
  @date: 2020-8-24 17:28:58
-->
<template>
  <div>
    <el-dialog
      v-dialogDrag
      :visible.sync="dialogData.dialog"
      :close-on-click-modal="false"
      title="重新授权评审"
      width="500px"
      custom-class="el-dialog__body-p0"
    >
      <div class="main mb10">
        <table
          :data="dialogData.tableData"
          highlight-current-row
          class="from_table"
        >
          <tr>
            <td>申请专家</td>
            <td>{{ dialogData.tableData.expertName }}</td>
          </tr>
          <tr>
            <td>申请步骤</td>
            <td>{{ dialogData.tableData.taskName }}</td>
          </tr>
          <tr>
            <td>申请原因</td>
            <td>{{ dialogData.tableData.applicateReason }}</td>
          </tr>
        </table>
      </div>
      <div slot="footer" class="dialog-footer" style="text-align: center">
        <el-button :loading="confirmLoading" type="primary" @click="submit('01')">
          同意
        </el-button>
        <el-button @click="submit('02')">
          不同意
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
/* api接口*/
import { transactProcedureAudit } from '@/api/procurement/procurementEvaluation'
export default {
  props: {
    // 弹框展示状态
    dialogData: {
      type: Object,
      default: function() {
        return {
          dialog: false,
          tableData: {
            expertName: '', // 申请专家
            taskName: '', // 申请步骤
            applicateReason: '' // 申请原因
          }
        }
      }
    },
    getTenderBase: {
      type: Object,
      default: function() {
        return {}
      }
    }
  },
  data() {
    return {
      confirmLoading: false // btnLoading

    }
  },
  methods: {
    // 提交
    submit(val) {
      const data = this.assemblyData(val)
      this.confirmLoading = true // btnLoading
      transactProcedureAudit(data).then(res => {
        this.confirmLoading = false // btnLoading
        this.dialogData.dialog = false
        this.$emit('initData')
      }).catch(() => {
        this.confirmLoading = false // btnLoading
      })
    },
    // 封装数据
    assemblyData(val) {
      const data = {
        packId: this.getTenderBase.packId,
        evalExpertId: this.dialogData.tableData.evalExpertId,
        auditStatus: val,
        driverId: this.dialogData.tableData.driverId,
        taskNo: this.dialogData.tableData.taskNo
      }
      return data
    }
  }
}

</script>
<style scoped>
</style>

