
<template>
  <el-card>
    <div class="search-box">
      <el-select
        v-model="cId"
        filterable
        placeholder="公司名称"
        style="width:240px"
      >
        <el-option
          v-for=" item in companys"
          :key="item.cId"
          :label="item.qymc"
          :value="item.cId"
        />
      </el-select>
      <el-button
        type="primary"
        style="margin-left: 10px;"
        size="mini"
        @click="search"
      >查询</el-button>
    </div>
    <div class="cont">
      <el-table
        :data="tableData"
        stripe
        style="width: 100%"
      >
        <el-table-column
          prop="date"
          label="日期"
          width="180"
        />
        <el-table-column
          prop="name"
          label="姓名"
          width="180"
        />
        <el-table-column
          prop="address"
          label="地址"
        />
      </el-table>
    </div>
  </el-card>
</template>
<script>
import { getAllReportcompanys, getReceiveUnitListByList } from '@/api'
export default {
  name: 'ReceiveUnit',
  data() {
    return {
      cId: undefined,
      companys: [],
      tableData: []
    }
  },
  created() {
    this.init()
  },
  methods: {
    init() {
      this.getAllReportcompanys()
    },
    search() {
      this.getReceiveUnitListByList()
    },
    getAllReportcompanys() {
      getAllReportcompanys().then((result) => {
        this.companys = result.data
      })
    },
    getReceiveUnitListByList() {
      getReceiveUnitListByList({
        cId: this.cId
      }).then((result) => {
        this.tableData = result.data
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.cont{
  margin-top: 15px;
  min-height: 81vh;
  overflow-y: auto;
}
</style>
