<template>
  <div>
    <tableDetail :layout="tablecols" :data="list" :opwidth="200" :custom="true">
      <template v-slot:customcol="scope">
        <div >{{scope.column.data[scope.column.columnname]||scope.column.columnname ==='operation'?scope.column.data[scope.column.columnname] : '--'}}</div>
      </template>
    </tableDetail>
    <div  class="container normal-panel" style="text-align:right">
      <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[20, 50, 100, 200]"
          :page-size="100"
          layout="total,sizes, prev, pager, next, jumper"
          :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
export default {
  name: "erpInfo",
  data(){
    return {
      param:{
        "id": 2025070309465702,
        "content": {
          "ownertable": "sa_logistics",
          "ownerid": "71147",
          "pageNumber": 1,
          "pageSize": 20
        },
      },
      tablecols:[],
      list:[],
      currentPage:0,
      total:0
    }
  },
  methods:{
    async listData(){
      this.param.content.ownerid = this.$route.query.id
      const res = await this.$api.requested(this.param)
      this.list = res.data
      this.total = res.total
      this.currentPage = res.pageNumber
    },
    handleSizeChange(val) {
      // console.log(`每页 ${val} 条`);
      this.param.content.pageSize = val
      this.listData()
    },
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`);
      this.param.content.pageNumber = val
      this.listData()
    },
  },
  mounted() {
    this.listData()
  },
  created() {
    this.tablecols = this.tool.tabelCol(this.$route.name).erpInfoTable.tablecols
  }
}
</script>

<style scoped>

</style>
