perf: 修改 v4 表现

This commit is contained in:
ibuler 2024-04-28 19:10:22 +08:00
parent e7986b57b2
commit a1fcdb39b9
7 changed files with 60 additions and 40 deletions

View File

@ -11,6 +11,7 @@
<el-col v-for="(d, index) in totalData" :key="index" :span="8"> <el-col v-for="(d, index) in totalData" :key="index" :span="8">
<el-card <el-card
:body-style="{ 'text-align': 'center', 'padding': '20px' }" :body-style="{ 'text-align': 'center', 'padding': '20px' }"
:class="{'is-disabled': isDisabled(d)}"
class="my-card" class="my-card"
shadow="hover" shadow="hover"
@click.native="onView(d)" @click.native="onView(d)"
@ -65,6 +66,7 @@
import TableAction from '@/components/Table/ListTable/TableAction' import TableAction from '@/components/Table/ListTable/TableAction'
import { Pagination } from '@/components' import { Pagination } from '@/components'
import Icon from '@/components/Widgets/Icon/index.vue' import Icon from '@/components/Widgets/Icon/index.vue'
import { mapGetters } from 'vuex'
const defaultFirstPage = 1 const defaultFirstPage = 1
@ -109,6 +111,7 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters(['hasValidLicense']),
tableUrl() { tableUrl() {
return this.tableConfig.url || '' return this.tableConfig.url || ''
} }
@ -117,6 +120,9 @@ export default {
this.getList() this.getList()
}, },
methods: { methods: {
isDisabled(item) {
return item.edition === 'enterprise' && !this.hasValidLicense
},
capitalize(str) { capitalize(str) {
return str.charAt(0).toUpperCase() + str.slice(1) return str.charAt(0).toUpperCase() + str.slice(1)
}, },
@ -189,6 +195,9 @@ export default {
) )
}, },
onView(obj) { onView(obj) {
if (this.isDisabled(obj)) {
return
}
const viewFunc = this.tableConfig.onView || this.defaultPerformView const viewFunc = this.tableConfig.onView || this.defaultPerformView
viewFunc(obj) viewFunc(obj)
}, },
@ -217,10 +226,33 @@ export default {
.my-card { .my-card {
margin: 0 0 20px 0; margin: 0 0 20px 0;
position: relative; position: relative;
cursor: pointer;
&.is-disabled {
opacity: 0.6;
cursor: not-allowed;
}
&:hover {
.closeIcon {
visibility: visible;
}
}
.closeIcon {
float: right;
display: block;
visibility: hidden;
i {
font-size: 20px;
cursor: pointer;
}
}
} }
.my-divider { .my-divider {
margin: 10px 0 margin: 10px 0;
} }
.image { .image {
@ -230,6 +262,7 @@ export default {
display: block; display: block;
margin: 50% auto; margin: 50% auto;
} }
span { span {
font-size: 36px; font-size: 36px;
color: black; color: black;
@ -254,25 +287,6 @@ export default {
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
} }
.closeIcon {
float: right;
display: block;
visibility: hidden;
i {
font-size: 20px;
cursor: pointer;
}
}
.my-card:hover {
cursor: pointer;
}
.my-card:hover .closeIcon {
visibility: visible;
}
.enterprise { .enterprise {
position: absolute; position: absolute;
right: -1px; right: -1px;
@ -281,7 +295,7 @@ export default {
color: #fff; color: #fff;
padding: 3px 8px 4px 9px; padding: 3px 8px 4px 9px;
font-size: 13px; font-size: 13px;
border-radius: 3px 3px 3px 10px; border-radius: 3px 3px 3px 8px;
} }
.tag-zone { .tag-zone {
@ -296,5 +310,4 @@ export default {
text-align: left; text-align: left;
height: 100%; height: 100%;
} }
</style> </style>

View File

@ -1,6 +1,5 @@
import i18n from '@/i18n/i18n' import i18n from '@/i18n/i18n'
import empty from '@/layout/empty' import empty from '@/layout/empty'
import store from '@/store'
export default [ export default [
{ {
@ -121,16 +120,13 @@ export default [
meta: { meta: {
title: i18n.t('Automations'), title: i18n.t('Automations'),
name: 'Automations', name: 'Automations',
permissions: [], permissions: []
licenseRequired: true
} }
}, },
{ {
path: 'account-push', path: 'account-push',
component: empty, component: empty,
hidden: () => { hidden: true,
return store.getters.hasValidLicense
},
redirect: '', redirect: '',
name: 'AccountPush', name: 'AccountPush',
meta: { meta: {

View File

@ -1,6 +1,5 @@
import i18n from '@/i18n/i18n' import i18n from '@/i18n/i18n'
import empty from '@/layout/empty' import empty from '@/layout/empty'
import store from '@/store'
const globalSubmenu = () => import('@/layout/globalOrg.vue') const globalSubmenu = () => import('@/layout/globalOrg.vue')
@ -11,15 +10,14 @@ export default [
component: () => import('@/views/acl/index.vue'), component: () => import('@/views/acl/index.vue'),
meta: { meta: {
title: i18n.t('ACLs'), title: i18n.t('ACLs'),
permissions: [], permissions: []
licenseRequired: true
} }
}, },
{ {
path: 'cmd-acls', path: 'cmd-acls',
component: empty, component: empty,
redirect: '', redirect: '',
hidden: () => store.getters.hasValidLicense, hidden: true,
meta: { meta: {
title: i18n.t('CommandFilterAclList'), title: i18n.t('CommandFilterAclList'),
app: 'acls', app: 'acls',

View File

@ -465,3 +465,9 @@ $tooltip-arrow-color: #c2d1e1;
color: #1c84c6; color: #1c84c6;
} }
} }
.el-tooltip__popper.is-dark {
background: rgba(58, 60, 62, 0.9) !important;
color: #FFF;
line-height: 1.5;
}

View File

@ -33,6 +33,7 @@ export default {
name: 'AccountChangeSecretList', name: 'AccountChangeSecretList',
comment: this.$t('ChangeCredentialsHelpText'), comment: this.$t('ChangeCredentialsHelpText'),
icon: 'change-password', icon: 'change-password',
edition: 'enterprise',
tags: ['ansible'] tags: ['ansible']
}, },
{ {
@ -41,6 +42,7 @@ export default {
name: 'AccountGatherList', name: 'AccountGatherList',
comment: this.$t('GatherAccountsHelpText'), comment: this.$t('GatherAccountsHelpText'),
icon: 'gather-account', icon: 'gather-account',
edition: 'enterprise',
tags: ['ansible'] tags: ['ansible']
}, },
{ {
@ -49,6 +51,7 @@ export default {
name: 'AccountBackupList', name: 'AccountBackupList',
comment: this.$t('BackupAccountsHelpText'), comment: this.$t('BackupAccountsHelpText'),
icon: 'backup-account', icon: 'backup-account',
edition: 'enterprise',
tags: ['email', 'SFTP'] tags: ['email', 'SFTP']
} }
], ],

View File

@ -33,6 +33,7 @@ export default {
name: 'AssetAclList', name: 'AssetAclList',
comment: this.$t('AssetLoginACLHelpText'), comment: this.$t('AssetLoginACLHelpText'),
icon: 'assets', icon: 'assets',
edition: 'enterprise',
tags: ['asset'] tags: ['asset']
}, },
{ {
@ -41,6 +42,7 @@ export default {
name: 'ConnectMethodAclList', name: 'ConnectMethodAclList',
comment: this.$t('ConnectMethodACLHelpText'), comment: this.$t('ConnectMethodACLHelpText'),
icon: 'client', icon: 'client',
edition: 'enterprise',
tags: ['client', 'cli'] tags: ['client', 'cli']
}, },
{ {
@ -49,6 +51,7 @@ export default {
name: 'UserLoginAclList', name: 'UserLoginAclList',
comment: this.$t('UserLoginACLHelpText'), comment: this.$t('UserLoginACLHelpText'),
icon: 'login', icon: 'login',
edition: 'enterprise',
tags: ['login'] tags: ['login']
} }
], ],

View File

@ -1,13 +1,14 @@
<template> <template>
<TabPage :active-menu.sync="config.activeMenu" :submenu="config.submenu"> <TabPage :active-menu.sync="config.activeMenu" :submenu="config.submenu">
<template #badge>
<el-badge <el-badge
v-if="props.tab === 'AssignedTicketList'" v-if="props.tab === 'AssignedTicketList'"
slot="badge"
v-slot="props" v-slot="props"
:value="getBadgeValue(props)" :value="getBadgeValue(props)"
size="mini" size="mini"
type="primary" type="primary"
/> />
</template>
<keep-alive> <keep-alive>
<component :is="config.activeMenu" /> <component :is="config.activeMenu" />
</keep-alive> </keep-alive>