<template>
  <div class="corePersonnel">
    <head-form
      title="城投拿地"
      :form-data="formData"
      :query-params="queryParams"
      :total="tableDataTotal"
      :isExcel="true"
      @handle-search="handleSearch"
    />

    <tables
      :tableLoading="tableLoading"
      :tableData="tableData"
      :forData="forData"
      :tableDataTotal="tableDataTotal"
      :queryParams="queryParams"
      @handle-current-change="handleCurrentChange"
    >
      <template slot="projectName" slot-scope="scope">
        <router-link :to="`/radar/Land/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>
    </tables>

  </div>
</template>

<script>
import {
  landTransactionPage,
  landUse
} from '@/api/detail/party-a/urbanLnvestment'
import mixin from '../mixins/mixin'
export default {
  name: 'landAcquisition',
  mixins: [mixin],
  components: {

  },
  props: ['companyId'],
  data() {
    return {
      queryParams: {
        cid: this.companyId,//3068
        sort: 3,
        pageNum: 1,
        pageSize: 10
      },
      forData: [
        {label: '项目名称', prop: 'projectName', width: '508', slot: true},
        {label: '土地用途', prop: 'landUse', width: '120'},
        {label: '行业分类', prop: 'industry', width: '120'},
        {label: '供地方式', prop: 'supplyLandWay', width: '120'},
        {label: '土地坐落', prop: 'landAddr', width: '150'},
        {label: '成交金额（万元）', prop: 'transactionPrice', width: '130'},
        {label: '总面积（㎡）', prop: 'acreage', width: '120'},
        {label: '批准单位', prop: 'authority', width: '120'},
        {label: '签订日期', prop: 'contractSignTime', width: '120'}
      ],
      formData: [
        { type: 4, fieldName: 'landUse', value: '', placeholder: '土地用途', options: []},
        { type: 3, fieldName: 'keys', value: '', placeholder: '请输入关键词'},
      ],
      //列表
      tableLoading:false,
      tableData:[],
      tableDataTotal:0,
    }
  },
  created() {
    this.handleQuery()
    this.getlandUse()
  },
  computed: {

  },
  methods: {
    handleQuery(params) {
      let data = params ? params : this.queryParams
      this.tableLoading = true
      landTransactionPage(data).then(res=>{
        this.tableData = res.rows
        this.tableDataTotal = res.total
        this.tableLoading = false
      })
    },
    //土地用途
    getlandUse(){
      landUse({cid: this.queryParams.cid}).then(res=>{
        let data = res.data
        if(data.length > 0){
          for (var i=0;i<data.length;i++){
            this.formData[0].options.push({
              name: data[i].landUse + '（' + data[i].count + '）',
              value: data[i].landUse,
            })
          }
        }
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.corePersonnel{
  background: #ffffff;
  border-radius: 4px;
  padding: 16px;
  .query-box{
    margin: 10px 0 20px;
  }
}
</style>
