<template>
  <table class="table table-bordered datapanel" v-if="liclist.length>0">
    <thead class="text-left">
    <tr>
      <th><nobr>权限描述</nobr></th>
    </tr>
    </thead>
    <tbody>
    <tr v-for="lic in liclist">
      <td>{{lic.describe}}</td>
    </tr>
    </tbody>
  </table>
</template>

<script>
  import {HttpResetClass} from 'vue-client'
  let getLics = async function (self) {
    let http = new HttpResetClass()
    let data = {
      source: 'this.getPowers()',
      userid: self.id
    }
    let ret = await http.load('POST', '/rs/search',data, {resolveMsg:null, rejectMsg: '获取权限数据'})
    if(ret.data.length>0){
      self.liclist=ret.data
      self.$emit('ready')
    }
  }

  export default {
    title: '权限显示',
    props: ['id'],
    ready() {
      this.initData()
    },
    data() {
      return {
        liclist:[],
      }
    },
    methods: {
      async initData (flag) {
        // 获取该资源所属权限
        await getLics(this)
      }
    },
    watch: {
      'id' () {
        this.initData()
      },
    },
    events: {
    }
  }
</script>
