 <!--
  @description:中标结果公示发布列表
  @Modifier: 肖文龙
  @Modifier: hfx联调 2020/2/19-09:54
  @routerPath: /bidding/resultBulletinPublish
  @date: 2020/2/7 9:43
-->
<template>
  <table-crud
    ref="tableCrud"
    :search-form="searchForm"
    search-label-width="100px"
    @on-load="loadData"
  >
    <template v-slot:header>
      中标结果公示发布列表
    </template>
    <template v-slot:search="search">
      <el-form-item ref="title" label="中标结果公示" prop="title">
        <el-input v-model.trim="searchForm.title" placeholder="中标结果公示" width="228px" @keyup.enter.native="search.onSearch" />
      </el-form-item>
      <el-form-item ref="tenderName" label="招标项目名称" prop="tenderName">
        <el-input v-model.trim="searchForm.tenderName" placeholder="招标项目名称" width="228px" @keyup.enter.native="search.onSearch" />
      </el-form-item>
    </template>
    <template v-slot:GXTable>
      <el-table
        ref="smallTable"
        v-loading="loading"
        :data="tableData"
      >
        <el-table-column
          type="index"
          label="序号"
          width="60px"
          align="center"
        />
        <el-table-column
          header-align="center"
          prop="title"
          label="中标结果公示"
          min-width="230"
        />
        <el-table-column
          prop="bulletinPublishTime"
          align="center"
          label="发布时间"
          width="140"
        />
        <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="状态"
          prop="auditStatus"
          align="center"
          width="100"
        >
          <template slot-scope="scope">
            <span v-if="scope.row.publishStatus==='00'" class="status2">未发布</span>
            <span v-if="scope.row.publishStatus==='01'" class="status1">已发布</span>
          </template>
        </el-table-column>
        <el-table-column
          label="操作"
          align="center"
          width="90"
        >
          <template slot-scope="scope">
            <el-link
              v-if="scope.row.publishStatus=== null || scope.row.publishStatus==='00'"
              type="primary"
              @click="sendBulletin(scope.row)"
            >
              [发布]
            </el-link>
            <el-link
              v-if="scope.row.publishStatus==='01'"
              type="primary"
              @click="examineBulletin(scope.row)"
            >
              [查看]
            </el-link>
          </template>
        </el-table-column>
      </el-table>
    </template>
  </table-crud>
</template>

<script>
/* 接口*/
import { getPublishResultBulletinListPages } from '@/api/bidding/bidCalibration'// 结果公示发布列表
export default {
  name: 'BulletinAllList',
  data() {
    return {
      loading: true,
      // 搜索
      searchForm: {
        tenderName: '', // 项目名称
        title: '' // 公告标题
      },
      tableData: []
    }
  },
  methods: {
    // 获取数据
    loadData(params, callback) {
      getPublishResultBulletinListPages(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        callback(response.data.total)
      }).catch(() => {
        this.loading = false
      })
    },
    // 发布公告
    sendBulletin(row) {
      this.$router.push({
        path: '/bidding/publishResultBulletin',
        query: {
          winBidResultBulletinId: row.id // 结果公示id
        }
      })
    },
    // 查看结果公示
    examineBulletin(row) {
      this.$router.push({
        path: '/bidding/publishResultBulletinDetail',
        query: {
          winBidResultBulletinId: row.id // 结果公示id
        }
      })
    }
  }
}
</script>

<style lang="less" scoped>

</style>
