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_assign:add'">新增分配</ElButton>
</template>
</ArtTableHeader>
@@ -174,6 +174,7 @@
import type { ShopPackageAllocationResponse, PackageResponse, ShopResponse } 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 {
@@ -185,6 +186,8 @@
defineOptions({ name: 'PackageAssign' })
const { hasAuth } = useAuth()
const dialogVisible = ref(false)
const costPriceDialogVisible = ref(false)
const loading = ref(false)
@@ -386,6 +389,7 @@
activeText: getStatusText(CommonStatus.ENABLED),
inactiveText: getStatusText(CommonStatus.DISABLED),
inlinePrompt: true,
disabled: !hasAuth('package_assign:update_status'),
'onUpdate:modelValue': (val: string | number | boolean) =>
handleStatusChange(row, val as number)
})
@@ -403,20 +407,36 @@
width: 230,
fixed: 'right',
formatter: (row: ShopPackageAllocationResponse) => {
return h('div', { style: 'display: flex; gap: 8px;' }, [
h(ArtButtonTable, {
text: '修改成本价',
onClick: () => showCostPriceDialog(row)
}),
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
}),
h(ArtButtonTable, {
type: 'delete',
onClick: () => deleteAllocation(row)
})
])
const buttons = []
if (hasAuth('package_assign:update_cost')) {
buttons.push(
h(ArtButtonTable, {
text: '修改成本价',
onClick: () => showCostPriceDialog(row)
})
)
}
if (hasAuth('package_assign:edit')) {
buttons.push(
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
})
)
}
if (hasAuth('package_assign:delete')) {
buttons.push(
h(ArtButtonTable, {
type: 'delete',
onClick: () => deleteAllocation(row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])