<template>
  <div class="detail-container">
    <head-form
      title="开标记录"
      :form-data="formData"
      :query-params="queryParams"
      :total="tableDataTotal"
      :isExcel="true"
      @handle-search="handleSearch"
    />

    <tables
      :indexFixed="true"
      :tableLoading="tableLoading"
      :tableData="tableData"
      :forData="forData"
      :tableDataTotal="tableDataTotal"
      :queryParams="queryParams"
      @handle-current-change="handleCurrentChange"
    >
      <template slot="name" slot-scope="scope">
        <router-link to="" tag="a" class="a-link" v-if="scope.row.id&&scope.row.name" v-html="scope.row.name"></router-link>
        <div v-else v-html="scope.row.name || '--'"></div>
      </template>
      <template slot="source" slot-scope="scope">
        <span class="a-link" v-if="scope.row.url&&scope.row.source" @click="handlePic(scope.row.url)" style="cursor: pointer;">{{ scope.row.source }}</span>
        <div v-else>{{ scope.row.source || '--' }}</div>
      </template>
    </tables>
  </div>
</template>

<script>
import mixin from '../mixins/mixin'
import {tenderPage} from '@/api/detail/party-a/dealings'
export default {
  name: 'Bidrecords',
  props: ['companyId'],
  mixins: [mixin],
  components: {

  },
  data() {
    return {
      queryParams: {
        cid: this.companyId,
        pageNum: 1,
        pageSize: 10
      },
      forData: [
        {label: '项目名称', prop: 'name', minWidth: '320', slot: true},
        {label: '本企业投标报价（万元）', prop: 'tenderOffer', minWidth: '160'},
        {label: '发布日期', prop: 'publishTime', minWidth: '100'},
        {label: '项目地区', prop: 'province', minWidth: '160'},
        {label: '信息来源', prop: 'source', minWidth: '280', slot: true}
      ],
      formData: [
        { type: 3, fieldName: 'keys', value: '', placeholder: '输入项目名称查询', options: []},
      ],
      //列表
      tableLoading:false,
      tableData:[],
      tableDataTotal:0
    }
  },
  computed: {
  },
  created() {
    this.handleQuery()
  },
  methods: {
    async handleQuery(params) {
      this.tableLoading = true
      let param = params?params:this.queryParams
      let res = await tenderPage(param)
      this.tableLoading = false
      if(res.code==200){
        this.tableData = res.rows
      }
      this.tableDataTotal = res.total
    },
    handlePic(url){
      window.open(url, "_blank")
    }
  }
}
</script>
<style lang="scss" scoped>
.detail-container{
  background: #ffffff;
  border-radius: 4px;
  padding: 16px;
}
</style>
