<template>
  <div class="container normal-panel">
    <tableLayout :layout="tablecols" :data="list" :opwidth="200" :custom="true" :height="tableHieght">
      <template v-slot:customcol="scope">
        <p>{{scope.column.data[scope.column.columnname]}}</p>
      </template>
      <template v-slot:opreation="scope">
        <slot name="edit" :data="scope.data"></slot>
        <slot name="del" :data="scope.data"></slot>
      </template>
    </tableLayout>
    <div  style="margin-top:16px;text-align:right">
      <el-pagination
          background
          small
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-size="param.content.pageSize"
          layout="total, prev, pager, next, jumper"
          :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
export default {
  name: "detailsList",
  props:["id"],
  data(){
    return {
      tableHieght:560,
      tablecols:[],
      list:[],
      total:0,
      currentPage:0,
      // param:{
      //   "classname": "sysmanage.develop.optiontype.optiontype",
      //   "method": "optiontypeselect",
      //   "content": {
      //     "pageNumber": 1,
      //     "pageSize": 20,
      //     "typename": '',
      //     "parameter": {
      //       "siteid": "YOSTEST2"
      //     }
      //   }
      // }
      param:{
        "pageNumber": 1,
        "pageSize": 20,
        "id": 20220901092501,
        "content": {
          "optiontypeid":''
        }
      }
    }
  },
  methods:{
    async detailsList(){
      console.log("输出")
      console.log(this.id)
      this.param.content.optiontypeid = this.id
      console.log(this.param.content.optiontypeid)
      const res = await this.$api.requested(this.param)
      console.log(res)
      this.list = res.data
      this.total = res.total
      this.currentPage = res.pageNumber
    },
    handleSizeChange(val) {
      // console.log(`每页 ${val} 条`);
      this.param.content.pageSize = val
      this.queryOptions()
    },
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`);
      this.param.content.pageNumber = val
      this.queryOptions()
    },
  },
  mounted() {

  },
  watch:{
    id:function (val){
      console.log("输出")
      console.log(val)
      if (val != ''){
        this.detailsList()
      }
    }
  },
  created() {
    this.tablecols = this.tool.tabelCol(this.$route.name).optionDetailsTable.tablecols
  }
}
</script>

<style scoped>

</style>