<template>
  <div class="detail-container">
    <head-form
      title="招标计划"
      :form-data="formData"
      :query-params="queryParams"
      :isExcel="true"
      :total="tableDataTotal"
    />

    <tables
      :indexFixed="true"
      :defaultSort="defaultSort"
      :tableLoading="tableLoading"
      :tableData="tableData"
      :forData="forData"
      :tableDataTotal="tableDataTotal"
      :queryParams="queryParams"
      @handle-current-change="handleCurrentChange"
      @sort-change="sortChange"
    >
      <template slot="projectName" slot-scope="scope">
        <router-link :to="`/radar/Bidding/details/${scope.row.id}`" tag="a" class="a-link" v-if="scope.row.id&&scope.row.projectName " v-html="scope.row.projectName"></router-link>
        <div v-else v-html="scope.row.projectName  || '--'"></div>
      </template>
      <template slot="province" slot-scope="scope">
        {{scope.row.province}}{{`${scope.row.city?'-'+scope.row.city:''}`}}{{`${scope.row.area?'-'+scope.row.area:''}`}}
      </template>
    </tables>

  </div>
</template>

<script>
import mixin from '../mixins/mixin'
import {bidPlanPage} from '@/api/detail/party-a/opport'
export default {
  name: 'Biddingplan',
  props: ['companyId'],
  mixins: [mixin],
  components: {
  },
  data() {
    return {
      queryParams: {
        cid: this.companyId,
        sort: 3,
        pageNum: 1,
        pageSize: 20
      },
      defaultSort: {prop: 'issueTime', order: 'descending'},
      forData: [
        {label: '项目名称', prop: 'projectName', minWidth: '400', slot: true},
        {label: '发布日期', prop: 'issueTime', sortable: 'custom', descending: '3', ascending: '4', width: '120'},
        {label: '合同预估金额（万元）', prop: 'planTenderAmount', sortable: 'custom', descending: '1', ascending: '2', width: '160'},
        {label: '资金来源', prop: 'projecetCapitalSource', minWidth: '100'},
        {label: '项目地区', prop: 'province', minWidth: '110', slot: true},
        {label: '项目类型', prop: 'buildingProjectType', minWidth: '100'},
        {label: '标的物类型', prop: 'objectType', minWidth: '100'},
        {label: '预计招标日期', prop: 'planTenderDateStart', sortable: 'custom', descending: '15', ascending: '16', minWidth: '110'}
      ],
      formData: [],
      //列表
      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 bidPlanPage(param)
      this.tableLoading = false
      if(res.code==200){
        this.tableData = res.rows
      }
      this.tableDataTotal = res.total
    }
  }
}
</script>
<style lang="scss" scoped>
.detail-container{
  background: #ffffff;
  border-radius: 4px;
  padding: 16px;
}
</style>
