<!--
  @description: 专家-退出审核
  @Modifier: wxy
  @routerPath:
  @date: 2020/8/12-13:27
-->
<template>
  <div>
    <section class="title title_border">
      <i class="iconfont icon-fanhui pointer" @click="back" />
      专家退出审核
    </section>
    <div class="p0-16">
      <el-form ref="forms" :model="formData" :rules="rules" :inline-message="true">
        <p class="page-title">
          1.申请原因
        </p>
        <table class="from_table">
          <!--专家姓名--->
          <tr>
            <td>专家名称</td>
            <td>
              <el-input v-model="this.$route.params.realName" class="input_width" disabled />
            </td>
          </tr>
          <!--退出原因-->
          <tr>
            <td>
              <el-form-item label="退出原因 " prop="reason" />
            </td>
            <td>
              <el-input
                v-model.trim="formData.reason"
                type="textarea"
                maxlength="50"
                style="width: 100%;"
                placeholder="退出原因"
                class="show-word-limit-padding"
              />
            </td>
          </tr>
        </table>
        <p class="page-title">
          2.审核意见
        </p>
        <table class="from_table">
          <tr>
            <td>
              <el-form-item label="审核意见" prop="leaveDescription" />
            </td>
            <td>
              <el-input
                v-model.trim="formData.leaveDescription"
                type="textarea"
                maxlength="50"
                style="width: 100%;"
                placeholder="审核意见"
                class="show-word-limit-padding"
              />
            </td>
          </tr>
        </table>
      </el-form>
      <div class="but_footer">
        <div class="but_footer-h">
          <div class="but_footer-but">
            <el-button type="primary" @click="auditResult('forms','01')">
              审核通过
            </el-button>
            <el-button @click="auditResult('forms','02')">
              审核不通过
            </el-button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
/* 接口*/
import {
  auditQuitApplyExpertInfo
} from '@/api/expert/expertscloud' //  专家成果接口
export default {
  data() {
    return {
      formData: {
        auditStatus: '', // 审核状态
        reason: '', // 退出原因
        leaveDescription: '', // 审核意见
        id: this.$route.params.id
      },
      rules: {
        reason: [
          { required: true, message: '退出原因不能为空', trigger: 'blur' }
        ] // 退出原因
      }
    }
  },
  computed: {
  },
  methods: {
    back() {
      this.$router.push({
        name: 'expertQuitAudit'
      })
    },
    //  提交审核
    auditResult(formName, type) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          if (type === '02' && !this.formData.leaveDescription) {
            this.$message({
              type: 'warning',
              message: '审核意见不能为空'
            })
            return false
          }
          const text = type === '01' ? '确认审核通过？' : '确认审核不通过？'
          this.$confirm(text, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            confirmButtonClass: 'confirmBtn',
            cancelButtonClass: 'cancelBtn',
            type: 'warning'
          }).then(() => {
            this.formData.auditStatus = type
            auditQuitApplyExpertInfo(this.formData).then(res => {
              //  this.$router.replace('/extractAdmin/extractAdminList')
            })
          }).catch(() => {
          })
        } else {
          return false
        }
      })
    }
  }
}
</script>

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