fix: 真流量虚流量权限
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m42s

This commit is contained in:
sexygoat
2026-05-14 10:52:11 +08:00
parent 1690252740
commit 38cf7d12e9
29 changed files with 859 additions and 198 deletions

View File

@@ -63,8 +63,8 @@
<ElTableColumn label="流量" min-width="450">
<template #default="scope">
<div class="traffic-progress">
<template v-if="isAdminOrPlatform">
<div class="progress-text">
<template v-if="isAdminOrPlatform && shouldShowAdminTrafficBreakdown">
<div v-if="canViewCurrentPackageRealUsage" class="progress-text">
<span class="used"
>已使用真流量: {{ formatDataSize(scope.row.real_used_mb || 0) }}</span
>
@@ -81,6 +81,7 @@
>
</div>
<ElProgress
v-if="canViewCurrentPackageRealUsage"
style="margin-top: 4px"
:percentage="
getUsageProgress(scope.row.real_used_mb || 0, scope.row.real_total_mb || 0)
@@ -91,7 +92,11 @@
)
"
/>
<div class="progress-text" style="margin-top: 8px">
<div
v-if="canViewCurrentPackageVirtualUsage"
class="progress-text"
:style="{ marginTop: canViewCurrentPackageRealUsage ? '8px' : '0' }"
>
<span class="used"
>已使用虚流量: {{ formatDataSize(scope.row.virtual_used_mb || 0) }}</span
>
@@ -99,7 +104,7 @@
>停机阈值: {{ formatDataSize(scope.row.virtual_total_mb || 0) }}</span
>
</div>
<div class="progress-wrapper">
<div v-if="canViewCurrentPackageVirtualUsage" class="progress-wrapper">
<div class="progress-track">
<ElProgress
style="margin-top: 4px"
@@ -142,7 +147,7 @@
</span>
</div>
</template>
<template v-else>
<template v-else-if="!isAdminOrPlatform">
<div class="progress-text">
<span class="used"
>已使用: {{ formatDataSize(getDisplayedUsedMb(scope.row)) }}</span
@@ -271,9 +276,19 @@
const { hasAuth } = useAuth()
const userStore = useUserStore()
const { info: userInfo } = storeToRefs(userStore)
const canViewCurrentPackageRealUsage = computed(() =>
hasAuth('asset_info:view_current_package_real_usage')
)
const canViewCurrentPackageVirtualUsage = computed(() =>
hasAuth('asset_info:view_current_package_virtual_usage')
)
const isAdminOrPlatform = computed(
() => userInfo.value.user_type === 1 || userInfo.value.user_type === 2
)
const shouldShowAdminTrafficBreakdown = computed(() => {
if (!isAdminOrPlatform.value) return true
return canViewCurrentPackageRealUsage.value || canViewCurrentPackageVirtualUsage.value
})
// 退款申请对话框
const createRefundDialogVisible = ref(false)