fetch(modify):完善按钮权限
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m25s

This commit is contained in:
sexygoat
2026-02-03 17:20:50 +08:00
parent de9753f42d
commit 192c6f1d26
22 changed files with 885 additions and 232 deletions

View File

@@ -18,7 +18,7 @@
@refresh="handleRefresh"
>
<template #left>
<ElButton type="primary" @click="showDialog('add')">新增套餐</ElButton>
<ElButton type="primary" @click="showDialog('add')" v-permission="'package:add'">新增套餐</ElButton>
</template>
</ArtTableHeader>
@@ -176,6 +176,7 @@
import type { PackageResponse, SeriesSelectOption } from '@/types/api'
import type { SearchFormItem } from '@/types'
import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth'
import ArtButtonTable from '@/components/core/forms/ArtButtonTable.vue'
import { formatDateTime } from '@/utils/business/format'
import {
@@ -196,6 +197,8 @@
defineOptions({ name: 'PackageList' })
const { hasAuth } = useAuth()
const dialogVisible = ref(false)
const loading = ref(false)
const submitLoading = ref(false)
@@ -438,6 +441,7 @@
activeText: '上架',
inactiveText: '下架',
inlinePrompt: true,
disabled: !hasAuth('package:update_away'),
'onUpdate:modelValue': (val: string | number | boolean) =>
handleShelfStatusChange(row, val ? 1 : 2)
})
@@ -456,6 +460,7 @@
activeText: getStatusText(CommonStatus.ENABLED),
inactiveText: getStatusText(CommonStatus.DISABLED),
inlinePrompt: true,
disabled: !hasAuth('package:update_status'),
'onUpdate:modelValue': (val: string | number | boolean) =>
handleStatusChange(row, val as number)
})
@@ -473,16 +478,27 @@
width: 150,
fixed: 'right',
formatter: (row: PackageResponse) => {
return h('div', { style: 'display: flex; gap: 8px;' }, [
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
}),
h(ArtButtonTable, {
type: 'delete',
onClick: () => deletePackage(row)
})
])
const buttons = []
if (hasAuth('package:edit')) {
buttons.push(
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
})
)
}
if (hasAuth('package:delete')) {
buttons.push(
h(ArtButtonTable, {
type: 'delete',
onClick: () => deletePackage(row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])