<!--
  @description:招标终止发布列表
  @Modifier: 肖文龙
  @routerPath:
  @date: 2020/12/21
-->
<template>
  <div>
    <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" />
        </el-form-item>
        <el-form-item ref="tenderName" label="招标项目名称" prop="tenderName">
          <el-input v-model.trim="searchForm.tenderName" placeholder="招标项目名称" width="228px" />
        </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
            label="终止公告"
            header-align="center"
            prop="title"
            min-width="230"
          />
          <el-table-column
            prop="bulletinPublishTime"
            align="center"
            label="发布时间"
            width="160"
          />
          <el-table-column
            header-align="center"
            prop="tenderName"
            label="招标项目名称"
            min-width="230"
          />
          <el-table-column
            header-align="center"
            label="包编号"
            prop="packNo"
            align="left"
            min-width="200"
          />
          <el-table-column
            label="状态"
            prop="publishStatus"
            align="center"
            width="110"
          >
            <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="80"
          >
            <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>
  </div>
</template>

<script>
/* 接口*/
import { releaseStopBulletinList } from '@/api/bidding/stopbiddingRecord'// 公告发布列表
export default {
  name: 'StopbiddingPublishList',
  data() {
    return {
      loading: true,
      // 搜索
      searchForm: {
        tenderName: '', // 项目名称
        title: '' // 公告标题
      },
      tableData: []
    }
  },
  created() {
  },
  methods: {
    // 获取数据
    loadData(params, callback) {
      releaseStopBulletinList(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        callback(response.data.total)
      })
    },
    // 发布公告
    sendBulletin(row) {
      this.$router.push({
        name: 'stopbiddingPublish-add',
        params: {
          stopBulletinId: row.stopBulletinId// 终止公告id
        }
      })
    },
    // 查看公告
    examineBulletin(row) {
      this.$router.push({
        name: 'stopbiddingPublish-detail',
        params: {
          stopBulletinId: row.stopBulletinId// 终止公告id
        }
      })
    }
  }
}
</script>

<style lang="less" scoped>

</style>
