<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"
      @sort-change="sortChange"
    >
      <template slot="customName" slot-scope="scope">
        <router-link to="" tag="a" class="a-link" v-if="scope.row.customId&&scope.row.customName">{{ scope.row.customName }}</router-link>
        <div v-else>{{ scope.row.customName || '--' }}</div>
      </template>
      <template slot="use" slot-scope="scope">
        <router-link to="" tag="a" class="a-link" v-if="scope.row.useId&&scope.row.use">{{ scope.row.use }}</router-link>
        <div v-else>{{ scope.row.use || '--' }}</div>
      </template>
    </tables>
  </div>
</template>

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

  },
  data() {
    return {
      queryParams: {
        cid: this.companyId,
        pageNum: 1,
        pageSize: 10
      },
      forData: [
        {label: '项目名称', prop: 'customName', minWidth: '560', slot: true},
        {label: '中标时间', prop: 'way', minWidth: '100', sortable: true},
        {label: '中标企业', prop: 'use', minWidth: '320', slot: true},
        {label: '中标金额（万元）', prop: 'way', minWidth: '140', sortable: true},
        {label: '下浮率（%）', prop: 'way', minWidth: '120', sortable: true},
        {label: '项目经理 / 负责人', prop: 'way', minWidth: '130'},
        {label: '中标地区', prop: 'way', minWidth: '160'},
        {label: '工期（天）', prop: 'way', minWidth: '110', sortable: true},
        {label: '业绩类别', prop: 'way', minWidth: '110'}
      ],
      formData: [
        { type: 1, fieldName: 'region', value: '', placeholder: '项目地区', options: []},
        { type: 1, fieldName: 'time', value: '', placeholder: '中标时间', options: []},
        { type: 1, fieldName: 'amount', value: '', placeholder: '中标金额', options: []},
        { type: 3, fieldName: 'keys', value: '', placeholder: '输入关键词查询', options: []},
      ],
      //列表
      tableLoading:false,
      tableData:[],
      tableDataTotal:0
    }
  },
  computed: {
  },
  created() {
    this.handleOption()
    this.handleQuery()
  },
  methods: {
    handleOption(){
      getOption().then((res) => {
        this.setFormData('region', [
          { name: '类别1', value: '1' },
          { name: '类别2', value: '2' },
          { name: '类别3', value: '3' },
          { name: '类别4', value: '4' }
        ])
        this.setFormData('time', [
          { name: '类别1', value: '1' },
          { name: '类别2', value: '2' },
          { name: '类别3', value: '3' },
          { name: '类别4', value: '4' }
        ])
        this.setFormData('amount', [
          { name: '类别1', value: '1' },
          { name: '类别2', value: '2' },
          { name: '类别3', value: '3' },
          { name: '类别4', value: '4' }
        ])
      })
    },
    handleQuery(params) {
      this.tableLoading = true
      let param = params?params:this.queryParams
      getList(param).then((res) => {
        this.tableLoading = false
        this.tableData = [
          {
            customId: '1',
            customName:'滨州医学院口腔医学大楼铝合金门窗供货及安装',
            use:'城镇住宅用地',
            type:'房地产业',
            way:'挂牌出让',
            count:4
          }
        ]
        this.tableDataTotal = 100
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.detail-container{
  background: #ffffff;
  border-radius: 4px;
  padding: 16px;
}
</style>
