<template>
  <div class="echarts-table-body fl">
    <ps-table
      :pageObj="pageObj"
      :data="dataList"
      style="width: 100%"
      :isPagination="true"
      :height="model.height"
      border
    >
      <el-table-column
        :formatter="$common.checkTableValFormat"
        :prop="item.props"
        :label="item.labels"
        v-for="(item, index) in tableColumn"
        :key="index"
      >
        <!-- <template slot-scope="scope">
        {{scope.row[item.props] | checkValFormat}}
      </template> -->
      </el-table-column>
    </ps-table>
  </div>
</template>

<script>
// 该文件作为全项目模板文件，处理name:"xxxxx"为目标文件名
export default {
  name: "tableEcharts",
  props: {
    model: {},
  },
  data() {
    return {
      pageObj: {
        pageSize: 10,
        pageNumber: 1,
        total: 0,
        changeSize: (c, p) => this.operaChangeSize(c, p),
        changePage: (c, p) => this.operaChangePage(c, p),
      },
      dataList: [],
      totalSize: 0,
      tableColumn: [],
    };
  },
  created() { },
  mounted() { },
  methods: {
    operaTableInit() {
      console.log(this.model);
      this.pageObj.pageNumber = this.model.pageNum;
      this.pageObj.pageSize = this.model.pageSize;
      this.dataList = this.model.tableList;
      this.pageObj.total = this.model.totalSize;
      this.tableColumn = this.model.tableCloumn;
      console.log(this.model.tableObj);
      this.$emit("loadEnd", false);
    },
    operaChangeSize(c, p) {
      console.log(c, p + "-----------------------------------------1");
      this.pageObj.pageNumber = 1;
      this.$emit(
        "pageNumSizeChange",
        JSON.stringify({ ...this.pageObj, pageNumber: 1, pageSize: p })
      );
    },
    operaChangePage(c, p) {
      console.log(c, p + "-----------------------------------------2");
      // this.pageObj.pageSize = p;
      this.$emit(
        "pageNumSizeChange",
        JSON.stringify({
          ...this.pageObj,
          pageNumber: c,
          pageSize: this.pageObj.pageSize,
        })
      );
    },
  },
};
</script>

<style>
.echarts-table-body {
  /* padding-top: 0.15rem;
  padding-right: 0.15rem;
  padding-left: 0.15rem; */
  margin-top: 20px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}
</style>
