Blame view

antis-ncc-admin/src/views/basic/profile/components/Authorize.vue 1.8 KB
38be6674   wwk   “zuxin”
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
  <template>
    <div class="authorize">
      <el-tabs v-model="activeTab" class="NCC-el_tabs">
        <el-tab-pane label="菜单权限" name="module"></el-tab-pane>
        <el-tab-pane label="按钮权限" name="button"></el-tab-pane>
        <el-tab-pane label="列表权限" name="column"></el-tab-pane>
        <el-tab-pane label="表单权限" name="form"></el-tab-pane>
        <el-tab-pane label="数据权限" name="resource"></el-tab-pane>
        <el-tree :data="treeData" :props="defaultProps" default-expand-all highlight-current
          ref="treeBox" :expand-on-click-node="false" class="NCC-common-el-tree" node-key="id"
          v-loading="loading">
          <span class="custom-tree-node" slot-scope="{ node, data }">
            <i :class="data.icon"></i>
            <span class="text">{{node.label}}</span>
          </span>
        </el-tree>
      </el-tabs>
    </div>
  </template>
  
  <script>
  
  import { AuthorizeList } from '@/api/permission/userSetting'
  export default {
    data() {
      return {
        treeData: [],
        info: [],
        activeTab: 'module',
        defaultProps: {
          children: 'children',
          label: 'fullName'
        },
        loading: false
      }
    },
    watch: {
      activeTab(val) {
        this.treeData = this.info[val]
      }
    },
    created() {
      this.getList()
    },
    methods: {
      getList() {
        this.loading = true
        AuthorizeList().then(res => {
          this.info = res.data;
          this.treeData = this.info.module
          this.loading = false
        })
      },
    }
  }
  </script>
  <style lang="scss" scoped>
  .authorize {
    height: 100%;
    overflow: hidden;
    >>> .el-tabs__nav-scroll {
      padding-top: 0 !important;
    }
    >>> .el-tabs__content {
      overflow: auto;
      overflow-x: hidden;
      .el-tab-pane {
        height: auto !important;
      }
      .NCC-common-el-tree {
        padding: 0;
      }
    }
  }
  </style>