<template>
  <div class="detail-container">
    <head-form
      title="专项债项目"
      :form-data="formData"
      :query-params="queryParams"
      :total="tableDataTotal"
      :isExcel="true"
      @handle-search="handleSearch"
    />

    <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="" 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>
    </tables>

  </div>
</template>

<script>
import mixin from '../mixins/mixin'
import {specialDebtProjectPage} from '@/api/detail/party-a/opport'
export default {
  name: 'Bond',
  props: ['companyId'],
  mixins: [mixin],
  components: {
  },
  data() {
    return {
      queryParams: {
        cid: this.companyId,
        sort: 1,
        pageNum: 1,
        pageSize: 20
      },
      defaultSort: {prop: 'projectTotalInvestment', order: 'descending'},
      forData: [
        {label: '项目名称', prop: 'projectName', minWidth: '300', slot: true},
        {label: '项目总投资（亿元）', prop: 'projectTotalInvestment', sortable: 'custom', descending: '1', ascending: '2', width: '150'},
        {label: '项目资本金（亿元）', prop: 'projectCapital', sortable: 'custom', descending: '17', ascending: '18', width: '150'},
        {label: '专项债用作资本金（亿元）', prop: 'specialBondCapital', sortable: 'custom', descending: '19', ascending: '20', width: '200'}
      ],
      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 specialDebtProjectPage(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>
