<!--
  @description: 招标文件审核/资审文件文件审核列表
  @Modifier: haoFx
  @routerPath: /projectManagement/bidDocFileAudit-list
  @date: 2019/11/20-19:05
-->
<template>
  <table-crud
    ref="tableCrud"
    :search-form="searchForm"
    :tabs="auditStatusList"
    search-label-width="100px"
    @on-load="loadData"
  >
    <template v-slot:header>
      {{ fileQualificationTitle }}审核列表
    </template>
    <template v-slot:search="">
      <el-form-item :label="fileQualificationTitle" prop="title">
        <el-input v-model.trim="searchForm.title" :placeholder="fileQualificationTitle" style="width:268px" />
      </el-form-item>
      <el-form-item label="招标项目名称" prop="tenderName">
        <el-input v-model.trim="searchForm.tenderName" placeholder="招标项目名称" style="width:268px" />
      </el-form-item>
    </template>
    <template v-slot:GXTable>
      <el-table
        ref="smallTable"
        v-loading="loading"
        :data="tableData"
      >
        <el-table-column
          type="index"
          label="序号"
          align="center"
          width="60"
        />
        <el-table-column
          :label="fileQualificationTitle"

          header-align="center"
          prop="title"
          min-width="230"
        />
        <el-table-column

          header-align="center"
          prop="tenderName"
          label="招标项目名称"
          min-width="230"
        />
        <el-table-column
          header-align="center"
          label="包编号"
          prop="packNos"
          align="left"
          min-width="200"
        />
        <el-table-column label="操作" align="center" width="80">
          <template slot-scope="scope">
            <el-link
              v-if="auditStatus === '00'"
              type="primary"
              @click="audit(scope.row)"
            >
              [审核]
            </el-link>
            <el-link
              v-if="auditStatus === '01'"
              type="primary"
              @click="audit(scope.row)"
            >
              [查看]
            </el-link>
          </template>
        </el-table-column>
      </el-table>
    </template>
  </table-crud>
</template>
<script>
/* api*/
import { listWaitAuditTenderDocPages } from '@api/bidding/tenderDoc'
/* 混入方法*/
import { ListMixin } from '@/mixins/ListMixin'
import { tenderDoc } from './../mixins/tenderDoc'// 文件类型
import { initGroupMixin } from '@/mixins/initGroupMixin' // 公共tabs切换页数据list
export default {
  name: 'BidDocFileAuditList',
  components: {
  },
  mixins: [ListMixin, tenderDoc, initGroupMixin],
  data() {
    return {
      loading: false,
      searchForm: {
        auditStatus: '', // 审批状态 00审核中,02驳回,01通过
        tenderName: '', // 项目名称
        tenderNo: '', // 项目编号
        title: '' // 标题
      },
      tableData: [], // 列表
      auditStatus: '' // 00待审核 01已审核
    }
  },
  watch: {
    $route() {
      this.initBulletinType(this.$route.meta) // 字典信息区分-招标文件/资审文件方法
      this.$refs.tableCrud.onSearchChange()
    }
  },
  created() {
    this.initBulletinType(this.$route.meta) // 字典信息区分-招标文件/资审文件方法
  },
  methods: {
    // 审核
    audit(row) {
      // 同一个页面不同router
      if (this.routerFileQualificationType === '01') { // 招标文件
        this.$router.push({
          path: '/projectManagement/tenderDocFileAudit-detail',
          query: {
            backType: '02', // 文件类型
            auditStatus: this.auditStatus, // 审核状态00待审核 01已审核
            procfileId: row.procfileId// 文件Id
          }
        })
      } else {
        this.$router.push({
          path: '/projectManagement/tenderInformationDocFileAudit-detail',
          query: {
            backType: '03', // 文件类型
            auditStatus: this.auditStatus, // 审核状态00待审核 01已审核
            procfileId: row.procfileId// 文件Id
          }
        })
      }
    },
    // 获取招标文件列表数据
    loadData(params, callback, tabData) {
      this.auditStatus = tabData.typecode // 审核状态
      params.auditStatus = tabData.typecode
      params.fileQualificationType = this.routerFileQualificationType
      listWaitAuditTenderDocPages(params).then(response => {
        this.tableData = response.data.records
        callback(response.data.total)
      }).catch(() => {

      })
    }
  }
}
</script>

<style lang="less">

</style>
