<template>
  <div>
    <div v-for="(item, key) in Alltable" :key="key" class="wholeTable">
      <el-table v-loading="tableLoading" size="mini" :data="item.tableData" fit border ref="tableForEach"
        :max-height="Alltable.length==1?600:360" @selection-change="handleSelectionChange($event, item)"
        tooltip-effect="dark">
        <el-table-column type="selection" width="55" align="center">
        </el-table-column>
        <el-table-column v-for="(ele, index) in JSON.parse(item.tableShow)" :key="index" :prop="ele.columnName"
          :min-width="ele.width"  :width="ele.width" :label="ele.columnChnName" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            <span v-if="ele.columnName === 'fonds_no'">
              {{ (fondsList.filter(f => f.fondscode === scope.row[ele.columnName])[0] || {}).codeName }}
            </span>
            <span v-if="ele.columnName !== 'fonds_no'">{{ scope.row[ele.columnName] }}</span>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination @current-change="handleCurrentChange($event, item, key)"
        @size-change="handleSizeChange($event, item, key)" layout="total, prev, pager, next, sizes"
        :page-size="item.pagination.pageSize" :page-sizes="[10, 20, 30, 50,100,500,1000]"
        :current-page="item.pagination.pageNum" :total="item.pagination.total">
      </el-pagination>
    </div>
  </div>
</template>
<script>
import { message } from "@/utils/common";
import localStronge from "@/api/localData";
export default {
  props: {
    fondsList: {
      type: Array,
      default: () => [],
    },
    treeRow: {
      type: Object,
      default: () => {},
    },
    Alltable: {
      type: Array,
      default: () => [],
    },
    treeType: {
      type: String,
      default: () => "",
    },
    tableLoading: {
      type: Boolean,
      default: () => false,
    },
  },
  data() {
    return {};
  },
  methods: {
    //每页换个数
    handleSizeChange(val, item, key) {
      item.pagination.pageSize = val;
      item.pagination.pageNum = 1;
      this.$emit("handleNodeClick", this.treeRow);
    },
    //换页
    handleCurrentChange(val, item, key) {
      item.pagination.pageNum = val;
      this.$emit("handleNodeClick", this.treeRow);
    },
    handleSelectionChange(event, item) {
      item.selectTable = event;
    },
  },
};
</script>
<style lang="scss" scoped>
.wholeTable {
  margin-bottom: 40px;

  .searcAllflase {
    background-color: #fff;
    overflow: hidden;
    border-radius: 5px;
    height: 46px;
    text-align: left;

    .search {
      background-color: #fff;
      height: 30px;
      line-height: 30px;
      display: flex;
      margin: 8px 0px;
    }
  }

  .searcAll {
    text-align: left;
    background-color: #fff;
    border-radius: 5px;
    overflow: hidden;

    .search {
      height: 30px;
      line-height: 30px;
      display: flex;
      margin: 8px 0px;
    }
  }

  .searchBtn {
    height: 35px;
    text-align: right;
    padding: 5px 10px 10px 0;
    background-color: #fff;
  }

  .btnClass {
    background-color: #fff;
    padding: 10px 0 10px 10px;
    margin-bottom: 5px;
    border-radius: 5px;
    text-align: left;
  }
}
</style>
