This commit is contained in:
@@ -28,8 +28,7 @@
|
||||
type="primary"
|
||||
link
|
||||
class="package-name-link"
|
||||
@click="handleShowDailyRecords(scope.row)"
|
||||
v-permission="'package_usage:daily_records'"
|
||||
@click="handlePackageNameClick(scope.row)"
|
||||
>
|
||||
{{ scope.row.package_name }}
|
||||
</ElButton>
|
||||
@@ -105,18 +104,6 @@
|
||||
{{ formatDateTime(scope.row.expires_at) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="操作" width="100" fixed="right">
|
||||
<template #default="scope">
|
||||
<ElButton
|
||||
type="primary"
|
||||
link
|
||||
@click="handleShowDailyRecords(scope.row)"
|
||||
v-permission="'package_usage:daily_records'"
|
||||
>
|
||||
流量详单
|
||||
</ElButton>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
<ElPagination
|
||||
v-model:current-page="pagination.page"
|
||||
@@ -146,10 +133,14 @@
|
||||
ElEmpty,
|
||||
ElPagination
|
||||
} from 'element-plus'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
import { useAssetFormatters } from '../composables/useAssetFormatters'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import type { AssetPackageUsageRecord } from '@/types/api'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
|
||||
// Props 使用 API 类型
|
||||
type PackageInfo = AssetPackageUsageRecord
|
||||
@@ -207,6 +198,15 @@
|
||||
getProgressColorByPercentage
|
||||
} = useAssetFormatters()
|
||||
|
||||
// 套餐名称点击
|
||||
const handlePackageNameClick = (packageRow: PackageInfo) => {
|
||||
if (!hasAuth('package_usage:daily_records')) {
|
||||
ElMessage.warning('您没有查看流量详单的权限')
|
||||
return
|
||||
}
|
||||
emit('showDailyRecords', { packageRow })
|
||||
}
|
||||
|
||||
// 显示流量详单
|
||||
const handleShowDailyRecords = (packageRow: PackageInfo) => {
|
||||
emit('showDailyRecords', { packageRow })
|
||||
|
||||
@@ -68,11 +68,11 @@
|
||||
set: (value) => emit('update:modelValue', value)
|
||||
})
|
||||
|
||||
const currentMode = computed(() => props.currentMode ?? 0)
|
||||
const currentMode = computed(() => Number(props.currentMode) ?? 0)
|
||||
|
||||
watch(visible, (newVal) => {
|
||||
if (newVal) {
|
||||
form.switch_mode = props.currentMode ?? 0
|
||||
form.switch_mode = Number(props.currentMode) ?? 0
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user