<!--
  @description:计划管理员-待审批-审批分组信息
  @Modifier: 肖文龙
  @routerPath:/intensiveEvaluation/intensiveevalAudit-add
  @date: 2020年3月16日20:30:59
-->
<template>
  <div class="p0-16">
    <section class="title clearfix">
      <div class="title-back pointer" @click="back">
        <i class="iconfont icon-fanhui mr10" />集约化评标分组计划
      </div>
    </section>
    <el-tabs v-model="activeName">
      <el-tab-pane label="分组信息" name="first" />
      <el-tab-pane label="集约化评标计划" name="second" />
      <el-tab-pane label="审批意见" name="last" />
    </el-tabs>
    <div>
      <!--分组信息-->
      <intensiveevalGroupInfo v-show="activeName==='first'" ref="evaluationGroupInfo" />
      <!--集约化评标计划-->
      <intensiveevalGroupPlanContent v-show="activeName==='second'" />
      <!--审批意见-->
      <approvalOpinionDetail v-show="activeName==='last'" />
    </div>
    <!--可编辑状态时-->
    <div>
      <!--审批意见-->
      <div class="page-title">
        执行审批
      </div>
      <el-form ref="formData" :model="formData" :rules="rules">
        <table class="tableData">
          <tr class="singleRow">
            <td>
              <span class="red-star">*</span>
              审批意见
            </td>
            <td>
              <el-form-item
                ref="tenderNo"
                prop="tenderNo"
              >
                <el-input
                  v-model="formData.tenderNo"
                  :autosize="{ minRows: 8, maxRows: 8}"
                  type="textarea"
                  show-word-limit
                  maxlength="4000"
                  placeholder="最多允许输入4000个汉字(8000字符)"
                />
              </el-form-item>
            </td>
          </tr>
        </table>
      </el-form>
      <!--保存按钮-->
      <div class="but_footer">
        <div class="but_footer-h" />
        <div class="but_footer-but">
          <el-button type="primary" @click="submit('01')">
            审批通过
          </el-button>
          <el-button @click="submit('02')">
            审批不通过
          </el-button>
          <el-button>加签</el-button>
          <el-button>后置加签执行董事</el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
/* api*/
import { groupListAudit } from '@/api/intensiveeval/intensiveeval'
/* 公共方法*/
import { characters1_50 } from '@/assets/js/validate'// 校验
import { validFn } from '@assets/js/utils'// 校验
/* 组件*/
import intensiveevalGroupInfo from '@/views/intensiveeval/intensiveevalPlan/intensiveevalGroup/intensiveevalGroupEditView/intensiveevalGroupInfo/intensiveevalGroupInfo-editView'// 分组信息
import intensiveevalGroupPlanContent from '@/views/intensiveeval/intensiveevalPlan/intensiveevalGroup/intensiveevalGroupEditView/intensiveevalGroupPlan/intensiveevalGroupPlanContent/intensiveevalGroupPlanContent'// 集约化评标计划
import approvalOpinionDetail from '@/views/intensiveeval/intensiveevalPlan/intensiveevalGroup/intensiveevalGroupEditView/approvalOpinion/approvalOpinion-detail'// 审批意见
export default {
  name: 'IntensiveevalAuditEditView',
  components: {
    intensiveevalGroupInfo,
    intensiveevalGroupPlanContent,
    approvalOpinionDetail
  },
  data() {
    return {
      isEdit: this.$route.meta.isEdit, // 是否为编辑 布尔值
      activeName: 'first', // tabs索引
      /* 审批信息*/
      formData: {
        tenderNo: ''// 审批意见
      },
      // 校验
      rules: {
        tenderNo: [{ required: true, validator: characters1_50, trigger: 'blur' }] // 审批意见
      }
    }
  },
  methods: {
    // 返回按钮
    back() {
      this.$router.push({ path: '/intensiveeval/intensiveevalAudit-list' })
    },
    // 提交
    submit(auditStatus) {
      this.$refs.formData.validate((valid, field) => {
        if (valid) {
          this.$confirm('是否提交审批信息?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            confirmButtonClass: 'confirmBtn',
            cancelButtonClass: 'cancelBtn',
            type: 'warning'
          }).then(() => {
            const data = {
              auditStatus: auditStatus, // 审核状态 00审核中,01通过,02驳回;
              groupIds: this.$route.query.groupId// 分组id集合
            }
            groupListAudit(data).then(res => {
              this.$message({
                type: 'success',
                message: '提交成功!'
              })
              this.$router.push({ path: '/intensiveeval/intensiveevalAudit-list' })
            })
          })
        } else {
          validFn(field, this)// 校验》跳转到为通过的参数地点
        }
      })
    }
  }
}
</script>
<style lang="less" scoped>

</style>
