fix: 修复审计员首页用户数空白的问题 (#894)

Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
fit2bot
2021-07-13 16:24:58 +08:00
committed by GitHub
parent fef38ea007
commit 4fb8e4073c
3 changed files with 16 additions and 15 deletions

View File

@@ -4,15 +4,15 @@
<span class="header-title">{{ title }}</span>
<span class="pull-right right-side">
<slot name="header-right">
<el-tag :type="rightSideLabel.type || 'success'" effect="dark" size="mini">{{ rightSideLabel.title }}</el-tag>
<el-tag :type="rightSideLabel.type || 'success'" effect="dark" size="mini">
{{ rightSideLabel.title }}
</el-tag>
</slot>
</span>
</div>
<slot>
<h1 class="no-margins">
<span v-if="body.noLink">
{{ body.count }}
</span>
<span v-if="body.disabled" class="disabled-link">{{ body.count }}</span>
<router-link v-else :to="body.route">
<span>{{ body.count }}</span>
</router-link>
@@ -77,4 +77,8 @@ export default {
.no-margins {
margin: 0 !important;
}
.disabled-link {
color: #428bca;
}
</style>

View File

@@ -20,7 +20,9 @@ const getDefaultState = () => {
orgs: [],
perms: 0b00000000,
MFAVerifyAt: null,
isSuperAdmin: false
isSuperAdmin: false,
hasAdminPerm: false,
hasAuditPerm: false
}
}
@@ -53,12 +55,15 @@ const mutations = {
},
SET_ROLES(state, roles) {
state.roles = roles
// rolec.PERM_ADMIN &
},
SET_SYS_ROLE(state, role) {
state.sysRole = role
},
SET_PERMS(state, perms) {
state.perms = perms
state.hasAdmin = (perms & rolec.PERM_ADMIN) === rolec.PERM_ADMIN
state.hasAudit = (perms & rolec.PERM_AUDIT) === rolec.PERM_AUDIT
},
SET_CURRENT_ORG(state, org) {
saveCurrentOrgToCookie(org)

View File

@@ -8,8 +8,6 @@
<script>
import SummaryCard from '@/components/SummaryCard'
import rolc from '@/utils/role'
import { mapGetters } from 'vuex'
export default {
name: 'ResourceSummary',
@@ -25,12 +23,6 @@ export default {
}
},
computed: {
...mapGetters([
'currentOrgRoles'
]),
isOrgAuditor() {
return rolc.getRolesDisplay(this.currentOrgRoles).includes('OrgAuditor') || rolc.getRolesDisplay(this.currentOrgRoles).includes('Auditor')
},
summaryItems() {
return [
{
@@ -43,7 +35,7 @@ export default {
route: `/users/users`,
count: this.counter.total_count_users,
comment: 'All users',
noLink: this.isOrgAuditor
disabled: !this.$store.state.users.hasAdmin
}
},
{
@@ -56,7 +48,7 @@ export default {
route: `/assets/assets`,
count: this.counter.total_count_assets,
comment: 'All assets',
noLink: this.isOrgAuditor
disabled: !this.$store.state.users.hasAdmin
}
},
{