fix:本月已用流量和运营商周期月内已用流量代理企业不展示,其他账号新增权限
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
# Change: 为资产卡信息月内流量字段增加权限控制
|
||||
|
||||
## Why
|
||||
|
||||
资产信息页卡信息中的“本月已用流量”和“运营商周期月内已用流量”属于敏感用量字段,需要统一通过同一个权限编码控制可见性,并对代理账号和企业账号强制隐藏。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 为资产信息页卡信息中的“本月已用流量”增加权限控制。
|
||||
- 为资产信息页卡信息中的“运营商周期月内已用流量”增加相同权限控制。
|
||||
- 两个字段统一使用权限编码 `asset_info:view_card_month_usage`。
|
||||
- 当当前登录账号 `user_type` 为 `3` 代理账号或 `4` 企业账号时,即使拥有权限也不显示这两个字段。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs:
|
||||
- `asset-card-usage-field-permission`
|
||||
- Affected code:
|
||||
- `src/views/asset-management/asset-information/components/BasicInfoCard.vue`
|
||||
- 角色/权限树配置中与 `asset_info:view_card_month_usage` 相关的注册位置
|
||||
@@ -0,0 +1,37 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Asset Card Month Usage Field Permission
|
||||
|
||||
The asset information page SHALL gate the card information fields `本月已用流量` and `运营商周期月内已用流量` with the same permission code `asset_info:view_card_month_usage`.
|
||||
|
||||
The asset information page MUST hide both fields for logged-in accounts whose `user_type` is `3` (代理账号) or `4` (企业账号), regardless of whether the account has `asset_info:view_card_month_usage`.
|
||||
|
||||
#### Scenario: Show both fields when platform user has permission
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 不是 `3` 也不是 `4`
|
||||
- **AND** 用户拥有 `asset_info:view_card_month_usage`
|
||||
- **WHEN** 页面渲染资产信息的卡信息区域
|
||||
- **THEN** 页面 MUST 显示 `本月已用流量`
|
||||
- **AND** 页面 MUST 显示 `运营商周期月内已用流量`
|
||||
|
||||
#### Scenario: Hide both fields when permission is missing
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 不是 `3` 也不是 `4`
|
||||
- **AND** 用户不拥有 `asset_info:view_card_month_usage`
|
||||
- **WHEN** 页面渲染资产信息的卡信息区域
|
||||
- **THEN** 页面 MUST NOT 显示 `本月已用流量`
|
||||
- **AND** 页面 MUST NOT 显示 `运营商周期月内已用流量`
|
||||
|
||||
#### Scenario: Hide both fields for agent accounts
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 是 `3`
|
||||
- **WHEN** 页面渲染资产信息的卡信息区域
|
||||
- **THEN** 页面 MUST NOT 显示 `本月已用流量`
|
||||
- **AND** 页面 MUST NOT 显示 `运营商周期月内已用流量`
|
||||
|
||||
#### Scenario: Hide both fields for enterprise accounts
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 是 `4`
|
||||
- **WHEN** 页面渲染资产信息的卡信息区域
|
||||
- **THEN** 页面 MUST NOT 显示 `本月已用流量`
|
||||
- **AND** 页面 MUST NOT 显示 `运营商周期月内已用流量`
|
||||
@@ -0,0 +1,6 @@
|
||||
## 1. Implementation
|
||||
|
||||
- [x] 1.1 在资产信息页卡信息中为“本月已用流量”接入 `asset_info:view_card_month_usage` 权限
|
||||
- [x] 1.2 在资产信息页卡信息中为“运营商周期月内已用流量”接入同一个 `asset_info:view_card_month_usage` 权限
|
||||
- [x] 1.3 确保 `user_type` 为 `3` 代理账号或 `4` 企业账号时隐藏上述两个字段
|
||||
- [x] 1.4 完成 OpenSpec 严格校验
|
||||
@@ -51,10 +51,10 @@
|
||||
</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
|
||||
<ElDescriptionsItem label="本月已用流量">{{
|
||||
<ElDescriptionsItem v-if="canShowCardMonthUsage" label="本月已用流量">{{
|
||||
formatDataSize(cardInfo?.current_month_usage_mb || 0)
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="运营商周期月内已用流量">{{
|
||||
<ElDescriptionsItem v-if="canShowCardMonthUsage" label="运营商周期月内已用流量">{{
|
||||
formatDataSize(cardInfo?.last_gateway_reading_mb || 0)
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="实名时间">{{
|
||||
@@ -479,6 +479,7 @@
|
||||
import { CopyDocument } from '@element-plus/icons-vue'
|
||||
import { useAssetFormatters } from '../composables/useAssetFormatters'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
|
||||
// Props
|
||||
@@ -583,6 +584,9 @@
|
||||
})
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const CARD_MONTH_USAGE_PERMISSION = 'asset_info:view_card_month_usage'
|
||||
|
||||
const realnamePolicyPermission = computed(() => {
|
||||
return props.cardInfo?.asset_type === 'card'
|
||||
@@ -600,6 +604,11 @@
|
||||
|
||||
const canShowPolling = computed(() => hasAuth(pollingPermission.value))
|
||||
|
||||
const canShowCardMonthUsage = computed(() => {
|
||||
const userType = Number(userStore.info.user_type ?? 0)
|
||||
return ![3, 4].includes(userType) && hasAuth(CARD_MONTH_USAGE_PERMISSION)
|
||||
})
|
||||
|
||||
// Emits
|
||||
interface Emits {
|
||||
(e: 'update:pollingEnabled', value: boolean): void
|
||||
|
||||
Reference in New Issue
Block a user