Blame view

src/views/org/dataPrivilegeManageList.vue 3.24 KB
8592fee7   wuxw   开发排版功能
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
124
125
126
127
128
129
130
131
  <template>
    <div class="data-privilege-container">
      <el-row class="data-privilege-wrapper">
        <el-col :span="4" class="left-panel">
          <data-privilege-div ref="dataPrivilegeDiv" @switch-data-privilege="handleSwitchDataPrivilege" />
        </el-col>
        <el-col :span="20" class="right-panel">
          <el-card class="box-card">
            <div slot="header" class="text-left">
              <h5>{{ $t('dataPrivilege.title') }}: {{ currentDataPrivilege.name }}</h5>
              <p>{{ currentDataPrivilege.description }}</p>
            </div>
            <div class="tab-wrapper">
              <el-tabs v-model="activeTab" @tab-click="handleTabClick(activeTab)">
                <el-tab-pane :label="$t('dataPrivilege.unitAuth')" name="dataPrivilegeUnit">
                  <data-privilege-unit v-if="activeTab === 'dataPrivilegeUnit'" ref="dataPrivilegeUnit"
                    />
                </el-tab-pane>
                <el-tab-pane :label="$t('dataPrivilege.staffRelation')" name="dataPrivilegeStaff">
                  <data-privilege-staff v-if="activeTab === 'dataPrivilegeStaff'" ref="dataPrivilegeStaff"
                    />
                </el-tab-pane>
              </el-tabs>
            </div>
          </el-card>
        </el-col>
      </el-row>
  
  
    </div>
  </template>
  
  <script>
  import DataPrivilegeDiv from '@/components/org/dataPrivilegeDiv'
  import DataPrivilegeUnit from '@/components/org/dataPrivilegeUnit'
  import DataPrivilegeStaff from '@/components/org/dataPrivilegeStaff'
  
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'DataPrivilegeManageList',
    components: {
      DataPrivilegeDiv,
      DataPrivilegeUnit,
      DataPrivilegeStaff,
    },
    data() {
      return {
        activeTab: 'dataPrivilegeUnit',
        currentDataPrivilege: {
          dpId: '',
          name: '',
          description: ''
        },
        communityId: ''
      }
    },
    created() {
      this.communityId = getCommunityId()
    },
    methods: {
      handleSwitchDataPrivilege(data) {
        this.currentDataPrivilege = { ...data }
        this.handleTabClick(this.activeTab)
      },
      handleTabClick(tab) {
        this.activeTab = tab
        setTimeout(() => {
          this.$refs[tab].open(this.currentDataPrivilege.dpId)
        }, 100)
      },
      handleRefresh() {
        this.$refs.dataPrivilegeDiv.loadData()
        if (this.activeTab === 'unit') {
          this.$refs.dataPrivilegeUnit && this.$refs.dataPrivilegeUnit.loadData()
        } else {
          this.$refs.dataPrivilegeStaff && this.$refs.dataPrivilegeStaff.loadData()
        }
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .data-privilege-container {
    padding: 0;
    margin: 0;
    height: 100%;
  
    .data-privilege-wrapper {
      height: 100%;
  
      .left-panel {
        padding-right: 0;
        height: 100%;
      }
  
      .right-panel {
        padding-left: 10px;
        height: 100%;
  
        .box-card {
          height: 100%;
  
          .clearfix {
            h5 {
              margin: 0 0 10px 0;
              font-size: 16px;
            }
  
            p {
              margin: 0;
              color: #999;
            }
          }
  
          .line-x {
            height: 1px;
            background-color: #e6e6e6;
            margin: 15px 0;
          }
  
          .tab-wrapper {
            height: calc(100% - 80px);
            overflow: auto;
          }
        }
      }
    }
  }
  </style>