Blame view

src/views/role/roleList.vue 2.63 KB
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
  <template>
    <div class="role-container">
      <el-row>
        <el-col :span="4" class="role-left">
          <role-div @switch-role="handleSwitchRole" />
        </el-col>
        <el-col :span="20" class="role-right">
          <div class="role-content">
            <div class="role-title">{{ currentRole.name }}</div>
            <el-divider />
            <div class="role-menu">
              <el-button :type="activeTab === 'privilege' ? 'primary' : ''" @click="changeTab('privilege')">
                {{ $t('role.privilege') }}
              </el-button>
              <el-button :type="activeTab === 'community' ? 'primary' : ''" @click="changeTab('community')">
                {{ $t('role.community') }}
              </el-button>
              <el-button :type="activeTab === 'staff' ? 'primary' : ''" @click="changeTab('staff')">
                {{ $t('role.staff') }}
              </el-button>
            </div>
  
            <div v-if="activeTab === 'privilege'">
              <privilege-tree :pg-id="currentRole.pgId" />
            </div>
  
            <div v-if="activeTab === 'community'">
              <role-community :pg-id="currentRole.pgId" />
            </div>
  
            <div v-if="activeTab === 'staff'">
              <role-staff :pg-id="currentRole.pgId" />
            </div>
          </div>
        </el-col>
      </el-row>
    </div>
  </template>
    
  <script>
  import RoleDiv from '@/components/role/RoleDiv'
  import PrivilegeTree from '@/components/role/PrivilegeTree'
  import RoleCommunity from '@/components/role/RoleCommunity'
  import RoleStaff from '@/components/role/RoleStaff'
  
  export default {
    name: 'RoleList',
    components: {
      RoleDiv,
      PrivilegeTree,
      RoleCommunity,
      RoleStaff
    },
    data() {
      return {
        activeTab: 'privilege',
        currentRole: {
          pgId: ''
        }
      }
    },
    methods: {
      handleSwitchRole(role) {
        this.currentRole = role
        this.changeTab('privilege')
      },
      changeTab(tabName) {
        this.activeTab = tabName
      }
    }
  }
  </script>
    
  <style lang="scss" scoped>
  .role-container {
  
  
    .role-left {
      padding: 0px;
      margin: 0px;
    }
  
    .role-right {
      padding: 0px;
      margin-top: 10px;
  
      .el-divider--horizontal {
        display: block;
        height: 1px;
        width: 100%;
        margin: 0px 0;
      }
    }
  
    .role-content {
      margin-top: 0px;
      margin-left: 20px;
      background: #fff;
      border-radius: 4px;
  
  
      .role-title {
        font-size: 18px;
        line-height: 48px;
        text-align: left;
        margin-left: 15px;
      }
  
      .role-context {
        color: #666;
      }
  
      .role-menu {
        text-align: left;
        margin-left: 15px;
        .el-button {
          margin-top: 15px;
         
        }
      }
    }
  }
  </style>