<template>
  <div>
    <div style="display:flex;align-items:center">
<!--      <el-input
          placeholder="请输入搜索内容"
          suffix-icon="el-icon-search"
          v-model="params.content.where.condition"
          style="width:200px"
          size="small"
          class="input-with-select inline-16"
          @keyup.native.enter="listData()"
          @clear="listData()"
          clearable>
      </el-input>-->
      <!-- <auth v-if="tool.checkAuth($route.name,'reportCenterAuth')" class="inline-16" @onSuccess="listData()"></auth> -->
    </div>
    <div style="margin-top: 15px">
      <tableLayout :layout="tablecols" :data="list" :opwidth="200" :custom="true"  :height="tableHieght" >
        <template v-slot:customcol="scope">
          <div v-if="scope.column.columnname === 'province'">
            <p>{{ scope.column.data.province + '-' + scope.column.data.city + '-' + scope.column.data.county}}</p>
          </div>
          <div v-else-if="!scope.column.data[scope.column.columnname] && scope.column.columnname != 'operation'">--</div>
          <div v-else>{{scope.column.data[scope.column.columnname]}}</div>
        </template>
        <template v-slot:opreation="scope">
          <el-popconfirm v-if="tool.checkAuth($route.name,'reportCenterAuthDelete')" title="确定删除当前权限吗？" @confirm="deleteRow(scope.data.sys_reportid)">
            <el-button slot="reference" size="mini" type="text">删 除</el-button>
          </el-popconfirm>
        </template>
      </tableLayout>
    </div>
    <div style="margin-top:16px;text-align:right">
      <el-pagination
          background
          small
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="params.content.pageNumber"
          :page-size="params.content.pageSize"
          layout="total, prev, pager, next, jumper"
          :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
import auth from './auth_list3'
export default {
  name: '',
  components:{auth},
  data() {
    return {
      tablecols:[],
      list:[],
      params: {
          "id": "20230302135404",
          "content": {
              "roleid":276,
              "pageNumber":1,
              "pageSize":20
          }
      },
      total:0
    };
  },
  computed:{
  },
  watch:{
  },
  created () {
    this.listData()
    this.tablecols = this.tool.tabelCol(this.$route.name).userCenter.tablecols
    console.log(this.tablecols);
    
  },
  methods: {
    async listData () {
      this.params.content.roleid = this.$route.query.id
      let res = await this.$api.requested(this.params)
      this.list = res.data
      this.total = res.total
      console.log(this.list);
    },
    async deleteRow (id) {
      let res = await this.$api.requested({
        "id":20221213141701,
        "content": {
          roleid:this.$route.query.id,
          sys_reportids:[id]
        }
      })
      this.tool.showMessage(res,() => {
        this.listData()
      })
    },
    onSuccess () {

    },
    handleSizeChange(val) {
      // console.log(`每页 ${val} 条`);
      this.params.content.pageSize = val
      this.listData()
    },
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`);
      this.params.content.pageNumber = val
      this.listData()
    },
  },
};
</script>

<style scoped>

</style>
