<template>
  <div class="app-container 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="projectName" slot-scope="scope">
        <router-link to="" tag="a" class="a-link">{{scope.row.projectName}}</router-link>
        <div class="tags" v-if="scope.row.tag">
          <span class="tag style1">{{scope.row.tag}}</span>
        </div>
      </template>
    </tables>
  </div>
</template>

<script>
import mixin from '../mixins/mixin'
import {getList, getOption} from '@/api/detail/party-a/overview'
export default {
  name: 'Branch',
  props: ['companyId'],
  mixins: [mixin],
  data() {
    return {
      queryParams: {
        companyId: this.companyId,
        pageNum: 1,
        pageSize: 10
      },
      forData: [
        {label: '被投资企业名称', prop: 'projectName', slot: true},
        {label: '负责人', prop: 'type'},
        {label: '成立日期', prop: 'date'}
      ],
      formData: [
        { type: 1, fieldName: 'zbgg', value: '', placeholder: '招标公告', options: []
        }
      ],
      //列表
      tableLoading:false,
      tableData:[],
      tableDataTotal:0,
    }
  },
  created() {
    this.handleOption()
    this.handleQuery()
  },
  methods: {
    handleOption(){
      getOption().then((res) => {
        this.setFormData('zbgg', [
          { 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 = [
          {
            projectId: '1',
            tag: '在业',
            projectName:'滨州医学院口腔医学大楼铝合金门窗供货及安装',
            use:'城镇住宅用地',
            type:'房地产业',
            way:'挂牌出让',
            state:'重庆',
            money:'11234万元',
            scale:'222平米',
            unit:'江苏省住房和城乡建设厅',
            date:'2015-08-06',
          }
        ]
        this.tableDataTotal = 100
      })
    }
  }
}
</script>

<style lang="scss" scoped>
  .detail-container{
    margin: 0;
    padding: 16px;
    background: #FFFFFF;
    border-radius: 4px;
    .tags{
      .tag{
        display: inline-block;
        border-radius: 2px;
        padding: 1px 7px;
        margin: 4px 8px 0 0;
        &.style1{
          background: #E4F3FD;
          color: #41A1FD;
        }
      }
    }
  }
</style>
