<template>
  <el-dropdown @command="handleAssignPrivCommand">
    <el-button @click="assignPrivClickHandler('catalog')" :disabled="!catalogId" :priv="'com.zving.cms.Catalog.AssignPriv.'+catalogId">
        <i class="fa fa-folder-open-o"></i>分配权限<i class="fa fa-caret-down" aria-hidden="true"></i>
    </el-button>
    <el-dropdown-menu slot="dropdown" :style="{'font-size':'14px'}">
        <el-dropdown-item command="catalog"><i class="fa fa-folder-open-o"></i>栏目权限</el-dropdown-item>
        <el-dropdown-item command="content"><i class="fa fa-folder-open-o"></i>内容权限</el-dropdown-item>
    </el-dropdown-menu>
    <priv-dialog
      :show.sync="privilegeDlg.isShowModal"
      :ID="catalogId"
      :priv-type="privilegeDlg.privType">
    </priv-dialog>
  </el-dropdown>
</template>
<script>
import PrivDialog from './privOwnerTabs.vue'
export default {
  components: {
    'priv-dialog': PrivDialog
  },
  props: {
    catalogId: {
      type: [Number, String],
      default: 0,
      required: true
    }
  },
  data() {
    return {
      privilegeDlg: { isShowModal: false, privType: '' } //  权限分配
    }
  },
  methods: {
    //  分配权限下拉点击事件
    handleAssignPrivCommand(command) {
      this.assignPrivClickHandler(command)
    },
    assignPrivClickHandler(command) {
      this.privilegeDlg.isShowModal = true
      this.privilegeDlg.privType = command
    }
  }
}
</script>
<style>
</style>
