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

@@ -17,7 +17,7 @@
@refresh="handleRefresh"
>
<template #left>
<ElButton @click="showDialog('add')">新增账号</ElButton>
<ElButton @click="showDialog('add')" v-permission="'account:add'">新增账号</ElButton>
</template>
</ArtTableHeader>
@@ -117,6 +117,7 @@
import { ElMessageBox, ElMessage } from 'element-plus'
import type { FormRules } from 'element-plus'
import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth'
import ArtButtonTable from '@/components/core/forms/ArtButtonTable.vue'
import { AccountService } from '@/api/modules/account'
import { RoleService } from '@/api/modules/role'
@@ -128,6 +129,8 @@
defineOptions({ name: 'Account' }) // 定义组件名称,用于 KeepAlive 缓存控制
const { hasAuth } = useAuth()
const dialogType = ref('add')
const dialogVisible = ref(false)
const roleDialogVisible = ref(false)
@@ -375,20 +378,36 @@
width: 200,
fixed: 'right',
formatter: (row: any) => {
return h('div', { style: 'display: flex; gap: 8px;' }, [
h(ArtButtonTable, {
icon: '&#xe72b;',
onClick: () => showRoleDialog(row)
}),
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
}),
h(ArtButtonTable, {
type: 'delete',
onClick: () => deleteAccount(row)
})
])
const buttons = []
if (hasAuth('account:patch_role')) {
buttons.push(
h(ArtButtonTable, {
icon: '&#xe72b;',
onClick: () => showRoleDialog(row)
})
)
}
if (hasAuth('account:edit')) {
buttons.push(
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
})
)
}
if (hasAuth('account:delete')) {
buttons.push(
h(ArtButtonTable, {
type: 'delete',
onClick: () => deleteAccount(row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])

View File

@@ -19,7 +19,7 @@
@refresh="handleRefresh"
>
<template #left>
<ElButton @click="showDialog('add')">新增企业客户</ElButton>
<ElButton @click="showDialog('add')" v-permission="'enterprise_customer:add'">新增企业客户</ElButton>
</template>
</ArtTableHeader>
@@ -213,6 +213,7 @@
import type { EnterpriseItem, 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 CustomerAccountDialog from '@/components/business/CustomerAccountDialog.vue'
import { formatDateTime } from '@/utils/business/format'
@@ -220,6 +221,8 @@
defineOptions({ name: 'EnterpriseCustomer' })
const { hasAuth } = useAuth()
const router = useRouter()
const dialogVisible = ref(false)
@@ -450,28 +453,49 @@
width: 340,
fixed: 'right',
formatter: (row: EnterpriseItem) => {
return h('div', { style: 'display: flex; gap: 8px;' }, [
h(ArtButtonTable, {
text: '编辑',
iconClass: BgColorEnum.SECONDARY,
onClick: () => showDialog('edit', row)
}),
h(ArtButtonTable, {
text: '查看客户',
iconClass: BgColorEnum.PRIMARY,
onClick: () => viewCustomerAccounts(row)
}),
h(ArtButtonTable, {
text: '卡授权',
iconClass: BgColorEnum.PRIMARY,
onClick: () => manageCards(row)
}),
h(ArtButtonTable, {
text: '修改密码',
iconClass: BgColorEnum.WARNING,
onClick: () => showPasswordDialog(row)
})
])
const buttons = []
if (hasAuth('enterprise_customer:edit')) {
buttons.push(
h(ArtButtonTable, {
text: '编辑',
iconClass: BgColorEnum.SECONDARY,
onClick: () => showDialog('edit', row)
})
)
}
if (hasAuth('enterprise_customer:look_customer')) {
buttons.push(
h(ArtButtonTable, {
text: '查看客户',
iconClass: BgColorEnum.PRIMARY,
onClick: () => viewCustomerAccounts(row)
})
)
}
if (hasAuth('enterprise_customer:card_authorization')) {
buttons.push(
h(ArtButtonTable, {
text: '卡授权',
iconClass: BgColorEnum.PRIMARY,
onClick: () => manageCards(row)
})
)
}
if (hasAuth('enterprise_customer:update_pwd')) {
buttons.push(
h(ArtButtonTable, {
text: '修改密码',
iconClass: BgColorEnum.WARNING,
onClick: () => showPasswordDialog(row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])

View File

@@ -18,7 +18,7 @@
@refresh="handleRefresh"
>
<template #left>
<ElButton @click="showDialog('add')">新增平台账号</ElButton>
<ElButton @click="showDialog('add')" v-permission="'platform_account:add'">新增平台账号</ElButton>
</template>
</ArtTableHeader>
@@ -164,6 +164,7 @@
import { FormInstance, ElMessage, ElMessageBox, ElTag, ElSwitch } from 'element-plus'
import type { FormRules } from 'element-plus'
import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth'
import ArtButtonTable from '@/components/core/forms/ArtButtonTable.vue'
import { AccountService, RoleService, ShopService } from '@/api/modules'
import type { SearchFormItem } from '@/types'
@@ -173,6 +174,8 @@
defineOptions({ name: 'PlatformAccount' }) // 定义组件名称,用于 KeepAlive 缓存控制
const { hasAuth } = useAuth()
const dialogType = ref('add')
const dialogVisible = ref(false)
const roleDialogVisible = ref(false)
@@ -443,24 +446,45 @@
width: 240,
fixed: 'right',
formatter: (row: PlatformAccount) => {
return h('div', { style: 'display: flex; gap: 8px;' }, [
h(ArtButtonTable, {
icon: '&#xe72b;',
onClick: () => showRoleDialog(row)
}),
h(ArtButtonTable, {
icon: '&#xe722;',
onClick: () => showPasswordDialog(row)
}),
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
}),
h(ArtButtonTable, {
type: 'delete',
onClick: () => deleteAccount(row)
})
])
const buttons = []
if (hasAuth('platform_account:patch_role')) {
buttons.push(
h(ArtButtonTable, {
icon: '&#xe72b;',
onClick: () => showRoleDialog(row)
})
)
}
if (hasAuth('platform_account:update_psd')) {
buttons.push(
h(ArtButtonTable, {
icon: '&#xe722;',
onClick: () => showPasswordDialog(row)
})
)
}
if (hasAuth('platform_account:edit')) {
buttons.push(
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
})
)
}
if (hasAuth('platform_account:delete')) {
buttons.push(
h(ArtButtonTable, {
type: 'delete',
onClick: () => deleteAccount(row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])

View File

@@ -17,7 +17,7 @@
@refresh="handleRefresh"
>
<template #left>
<ElButton @click="showDialog('add')">新增代理账号</ElButton>
<ElButton @click="showDialog('add')" v-permission="'shop_account:add'">新增代理账号</ElButton>
</template>
</ArtTableHeader>
@@ -125,6 +125,7 @@
import { FormInstance, ElMessage, ElMessageBox, ElSwitch, ElSelect, ElOption } from 'element-plus'
import type { FormRules } from 'element-plus'
import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth'
import ArtButtonTable from '@/components/core/forms/ArtButtonTable.vue'
import { AccountService, ShopService } from '@/api/modules'
import type { SearchFormItem } from '@/types'
@@ -134,6 +135,8 @@
defineOptions({ name: 'ShopAccount' }) // 定义组件名称,用于 KeepAlive 缓存控制
const { hasAuth } = useAuth()
const dialogType = ref('add')
const dialogVisible = ref(false)
const passwordDialogVisible = ref(false)
@@ -342,16 +345,27 @@
width: 120,
fixed: 'right',
formatter: (row: PlatformAccount) => {
return h('div', { style: 'display: flex; gap: 8px;' }, [
h(ArtButtonTable, {
icon: '&#xe722;',
onClick: () => showPasswordDialog(row)
}),
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
})
])
const buttons = []
if (hasAuth('shop_account:update_psd')) {
buttons.push(
h(ArtButtonTable, {
icon: '&#xe722;',
onClick: () => showPasswordDialog(row)
})
)
}
if (hasAuth('shop_account:edit')) {
buttons.push(
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])

View File

@@ -102,6 +102,7 @@
import type { FormInstance, FormRules } from 'element-plus'
import type { SearchFormItem } from '@/types'
import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth'
import { formatDateTime } from '@/utils/business/format'
import ArtButtonTable from '@/components/core/forms/ArtButtonTable.vue'
import type {
@@ -113,6 +114,7 @@
defineOptions({ name: 'AuthorizationRecords' })
const { hasAuth } = useAuth()
const router = useRouter()
const loading = ref(false)
const detailDialogVisible = ref(false)
@@ -297,16 +299,25 @@
width: 150,
fixed: 'right',
formatter: (row: AuthorizationItem) => {
return h('div', { style: 'display: flex; gap: 8px;' }, [
const buttons = []
buttons.push(
h(ArtButtonTable, {
text: '详情',
onClick: () => viewDetail(row)
}),
h(ArtButtonTable, {
type: 'edit',
onClick: () => showRemarkDialog(row)
})
])
)
if (hasAuth('authorization_records:update_remark')) {
buttons.push(
h(ArtButtonTable, {
type: 'edit',
onClick: () => showRemarkDialog(row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])

View File

@@ -21,13 +21,23 @@
type="primary"
@click="handleBatchAllocate"
:disabled="!selectedDevices.length"
v-permission="'devices:batch_allocation'"
>
批量分配
</ElButton>
<ElButton @click="handleBatchRecall" :disabled="!selectedDevices.length">
<ElButton
@click="handleBatchRecall"
:disabled="!selectedDevices.length"
v-permission="'devices:batch_recycle'"
>
批量回收
</ElButton>
<ElButton type="info" @click="handleBatchSetSeries" :disabled="!selectedDevices.length">
<ElButton
type="info"
@click="handleBatchSetSeries"
:disabled="!selectedDevices.length"
v-permission="'devices:batch_setting'"
>
批量设置套餐系列
</ElButton>
</template>
@@ -546,6 +556,7 @@
} 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 ArtMenuRight from '@/components/core/others/ArtMenuRight.vue'
import type { MenuItemType } from '@/components/core/others/ArtMenuRight.vue'
@@ -555,6 +566,7 @@
defineOptions({ name: 'DeviceList' })
const { hasAuth } = useAuth()
const router = useRouter()
const loading = ref(false)
const allocateLoading = ref(false)
@@ -1064,16 +1076,29 @@
width: 200,
fixed: 'right',
formatter: (row: Device) => {
return h('div', { style: 'display: flex; gap: 0; align-items: center;' }, [
h(ArtButtonTable, {
text: '查看卡片',
onClick: () => handleViewCards(row)
}),
h(ArtButtonTable, {
text: '更多操作',
onContextmenu: (e: MouseEvent) => showDeviceOperationMenu(e, row.device_no)
})
])
const buttons = []
if (hasAuth('devices:look_binding')) {
buttons.push(
h(ArtButtonTable, {
text: '查看卡片',
onClick: () => handleViewCards(row)
})
)
}
// Show "更多操作" only if user has at least one operation permission
const hasAnyOperationPermission = hasAuth('devices:delete')
if (hasAnyOperationPermission) {
buttons.push(
h(ArtButtonTable, {
text: '更多操作',
onContextmenu: (e: MouseEvent) => showDeviceOperationMenu(e, row.device_no)
})
)
}
return h('div', { style: 'display: flex; gap: 0; align-items: center;' }, buttons)
}
}
])
@@ -1602,32 +1627,39 @@
}
// 设备操作菜单项配置
const deviceOperationMenuItems = computed((): MenuItemType[] => [
{
key: 'reboot',
label: '重启设备'
},
{
key: 'reset',
label: '恢复出厂'
},
{
key: 'speed-limit',
label: '设置限速'
},
{
key: 'switch-card',
label: '切换SIM卡'
},
{
key: 'set-wifi',
label: '设置WiFi'
},
{
key: 'delete',
label: '删除设备'
const deviceOperationMenuItems = computed((): MenuItemType[] => {
const items: MenuItemType[] = [
{
key: 'reboot',
label: '重启设备'
},
{
key: 'reset',
label: '恢复出厂'
},
{
key: 'speed-limit',
label: '设置限速'
},
{
key: 'switch-card',
label: '切换SIM卡'
},
{
key: 'set-wifi',
label: '设置WiFi'
}
]
if (hasAuth('devices:delete')) {
items.push({
key: 'delete',
label: '删除设备'
})
}
])
return items
})
// 显示设备操作菜单
const showDeviceOperationMenu = (e: MouseEvent, deviceNo: string) => {

View File

@@ -18,7 +18,12 @@
@refresh="handleRefresh"
>
<template #left>
<ElButton type="primary" :icon="Upload" @click="importDialogVisible = true">
<ElButton
type="primary"
:icon="Upload"
@click="importDialogVisible = true"
v-permission="'device_task:bulk_import'"
>
批量导入设备
</ElButton>
</template>
@@ -215,6 +220,7 @@
import type { UploadInstance } from 'element-plus'
import type { SearchFormItem } from '@/types'
import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth'
import { formatDateTime } from '@/utils/business/format'
import ArtButtonTable from '@/components/core/forms/ArtButtonTable.vue'
import { StorageService } from '@/api/modules/storage'
@@ -222,6 +228,7 @@
defineOptions({ name: 'DeviceTask' })
const { hasAuth } = useAuth()
const loading = ref(false)
const tableRef = ref()
const uploadRef = ref<UploadInstance>()

View File

@@ -22,6 +22,7 @@
type="success"
:disabled="selectedCards.length === 0"
@click="showAllocateDialog"
v-permission="'iot_card:batch_allocation'"
>
批量分配
</ElButton>
@@ -29,6 +30,7 @@
type="warning"
:disabled="selectedCards.length === 0"
@click="showRecallDialog"
v-permission="'iot_card:batch_recycle'"
>
批量回收
</ElButton>
@@ -36,10 +38,17 @@
type="primary"
:disabled="selectedCards.length === 0"
@click="showSeriesBindingDialog"
v-permission="'iot_card:batch_setting'"
>
批量设置套餐系列
</ElButton>
<ElButton type="info" @contextmenu.prevent="showMoreMenu">更多操作</ElButton>
<ElButton
v-if="hasAuth('iot_card:batch_recharge') || hasAuth('iot_card:network_distribution') || hasAuth('iot_card:network_recycle') || hasAuth('iot_card:change_package')"
type="info"
@contextmenu.prevent="showMoreMenu"
>
更多操作
</ElButton>
</template>
</ArtTableHeader>
@@ -595,6 +604,7 @@
import QRCode from 'qrcode'
import type { SearchFormItem } from '@/types'
import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth'
import { formatDateTime } from '@/utils/business/format'
import ArtMenuRight from '@/components/core/others/ArtMenuRight.vue'
import type { MenuItemType } from '@/components/core/others/ArtMenuRight.vue'
@@ -611,6 +621,7 @@
defineOptions({ name: 'StandaloneCardList' })
const { hasAuth } = useAuth()
const router = useRouter()
const loading = ref(false)
const allocateDialogVisible = ref(false)
@@ -1513,28 +1524,44 @@
}
// 更多操作菜单项配置
const moreMenuItems = computed((): MenuItemType[] => [
{
key: 'distribution',
label: '网卡分销'
},
{
key: 'recharge',
label: '批量充值'
},
{
key: 'recycle',
label: '网卡回收'
},
{
const moreMenuItems = computed((): MenuItemType[] => {
const items: MenuItemType[] = []
if (hasAuth('iot_card:network_distribution')) {
items.push({
key: 'distribution',
label: '网卡分销'
})
}
if (hasAuth('iot_card:batch_recharge')) {
items.push({
key: 'recharge',
label: '批量充值'
})
}
if (hasAuth('iot_card:network_recycle')) {
items.push({
key: 'recycle',
label: '网卡回收'
})
}
items.push({
key: 'download',
label: '批量下载'
},
{
key: 'changePackage',
label: '变更套餐'
})
if (hasAuth('iot_card:change_package')) {
items.push({
key: 'changePackage',
label: '变更套餐'
})
}
])
return items
})
// 卡操作菜单项配置
const cardOperationMenuItems = computed((): MenuItemType[] => [

View File

@@ -18,7 +18,12 @@
@refresh="handleRefresh"
>
<template #left>
<ElButton type="primary" :icon="Upload" @click="importDialogVisible = true">
<ElButton
type="primary"
:icon="Upload"
@click="importDialogVisible = true"
v-permission="'lot_task:bulk_import'"
>
批量导入IoT卡
</ElButton>
</template>
@@ -212,6 +217,7 @@
import type { UploadInstance } from 'element-plus'
import type { SearchFormItem } from '@/types'
import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth'
import { formatDateTime } from '@/utils/business/format'
import ArtButtonTable from '@/components/core/forms/ArtButtonTable.vue'
import { StorageService } from '@/api/modules/storage'
@@ -220,6 +226,7 @@
defineOptions({ name: 'IotCardTask' })
const { hasAuth } = useAuth()
const loading = ref(false)
const tableRef = ref()
const uploadRef = ref<UploadInstance>()

View File

@@ -19,7 +19,7 @@
@refresh="handleRefresh"
>
<template #left>
<ElButton @click="showDialog('add')">新增运营商</ElButton>
<ElButton @click="showDialog('add')" v-permission="'carrier:add'">新增运营商</ElButton>
</template>
</ArtTableHeader>
@@ -104,6 +104,7 @@
import type { Carrier, CarrierType } 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 {
@@ -116,6 +117,7 @@
defineOptions({ name: 'CarrierManagement' })
const { hasAuth } = useAuth()
const dialogVisible = ref(false)
const loading = ref(false)
const submitLoading = ref(false)
@@ -258,6 +260,7 @@
activeText: getStatusText(CommonStatus.ENABLED),
inactiveText: getStatusText(CommonStatus.DISABLED),
inlinePrompt: true,
disabled: !hasAuth('carrier:update_status'),
'onUpdate:modelValue': (val: string | number | boolean) =>
handleStatusChange(row, val as number)
})
@@ -275,16 +278,27 @@
width: 150,
fixed: 'right',
formatter: (row: any) => {
return h('div', { style: 'display: flex; gap: 8px;' }, [
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
}),
h(ArtButtonTable, {
type: 'delete',
onClick: () => deleteCarrier(row)
})
])
const buttons = []
if (hasAuth('carrier:edit')) {
buttons.push(
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
})
)
}
if (hasAuth('carrier:delete')) {
buttons.push(
h(ArtButtonTable, {
type: 'delete',
onClick: () => deleteCarrier(row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])

View File

@@ -232,6 +232,7 @@
WithdrawalRequestItem
} from '@/types/api/commission'
import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth'
import ArtButtonTable from '@/components/core/forms/ArtButtonTable.vue'
import { formatDateTime, formatMoney } from '@/utils/business/format'
import {
@@ -243,6 +244,8 @@
defineOptions({ name: 'AgentCommission' })
const { hasAuth } = useAuth()
const route = useRoute()
// 主表格状态
@@ -380,10 +383,16 @@
width: 120,
fixed: 'right',
formatter: (row: ShopCommissionSummaryItem) => {
return h(ArtButtonTable, {
icon: '&#xe72b;',
onClick: () => showDetail(row)
})
const buttons = []
if (hasAuth('agent_commission:detail')) {
buttons.push(
h(ArtButtonTable, {
icon: '&#xe72b;',
onClick: () => showDetail(row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])

View File

@@ -106,7 +106,7 @@
style="margin-top: 20px"
>
<template #left>
<ElButton type="primary" @click="showWithdrawalDialog">发起提现</ElButton>
<ElButton type="primary" @click="showWithdrawalDialog" v-permission="'my_commission:add'">发起提现</ElButton>
</template>
</ArtTableHeader>
@@ -296,10 +296,13 @@
} from '@/config/constants/commission'
import type { SearchFormItem } from '@/types'
import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth'
import { formatDateTime, formatMoney } from '@/utils/business/format'
defineOptions({ name: 'MyCommission' })
const { hasAuth } = useAuth()
// 标签页
const activeTab = ref('commission')

View File

@@ -80,7 +80,7 @@
@refresh="handleRefresh"
>
<template #left>
<ElButton type="primary" @click="showDialog">新增配置</ElButton>
<ElButton type="primary" @click="showDialog" v-permission="'withdrawal_settings:add'">新增配置</ElButton>
</template>
</ArtTableHeader>
@@ -155,10 +155,13 @@
import type { FormInstance, FormRules } from 'element-plus'
import type { WithdrawalSettingItem } from '@/types/api/commission'
import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth'
import { formatDateTime, formatMoney, formatFeeRate } from '@/utils/business/format'
defineOptions({ name: 'CommissionWithdrawalSettings' })
const { hasAuth } = useAuth()
const dialogVisible = ref(false)
const loading = ref(false)
const submitLoading = ref(false)

View File

@@ -18,7 +18,7 @@
@refresh="handleRefresh"
>
<template #left>
<ElButton @click="showCreateDialog">{{ t('orderManagement.createOrder') }}</ElButton>
<ElButton @click="showCreateDialog" v-permission="'orders:add'">{{ t('orderManagement.createOrder') }}</ElButton>
</template>
</ArtTableHeader>
@@ -275,12 +275,14 @@
} 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'
defineOptions({ name: 'OrderList' })
const { t } = useI18n()
const { hasAuth } = useAuth()
const loading = ref(false)
const createLoading = ref(false)

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)
}
}
])

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)
}
}
])

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_series:add'">新增套餐系列</ElButton>
</template>
</ArtTableHeader>
@@ -98,6 +98,7 @@
import type { PackageSeriesResponse } 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 {
@@ -110,6 +111,8 @@
defineOptions({ name: 'PackageSeries' })
const { hasAuth } = useAuth()
const dialogVisible = ref(false)
const loading = ref(false)
const submitLoading = ref(false)
@@ -229,6 +232,7 @@
activeText: getStatusText(CommonStatus.ENABLED),
inactiveText: getStatusText(CommonStatus.DISABLED),
inlinePrompt: true,
disabled: !hasAuth('package_series:update_status'),
'onUpdate:modelValue': (val: string | number | boolean) =>
handleStatusChange(row, val as number)
})
@@ -252,16 +256,27 @@
width: 150,
fixed: 'right',
formatter: (row: PackageSeriesResponse) => {
return h('div', { style: 'display: flex; gap: 8px;' }, [
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
}),
h(ArtButtonTable, {
type: 'delete',
onClick: () => deleteSeries(row)
})
])
const buttons = []
if (hasAuth('package_series:edit')) {
buttons.push(
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
})
)
}
if (hasAuth('package_series:delete')) {
buttons.push(
h(ArtButtonTable, {
type: 'delete',
onClick: () => deleteSeries(row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])

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="'series_assign:add'">新增系列分配</ElButton>
</template>
</ArtTableHeader>
@@ -266,6 +266,7 @@
} 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 {
@@ -277,6 +278,8 @@
defineOptions({ name: 'SeriesAssign' })
const { hasAuth } = useAuth()
const dialogVisible = ref(false)
const loading = ref(false)
const submitLoading = ref(false)
@@ -511,6 +514,7 @@
activeText: getStatusText(CommonStatus.ENABLED),
inactiveText: getStatusText(CommonStatus.DISABLED),
inlinePrompt: true,
disabled: !hasAuth('series_assign:update_status'),
'onUpdate:modelValue': (val: string | number | boolean) =>
handleStatusChange(row, val as number)
})
@@ -528,16 +532,27 @@
width: 150,
fixed: 'right',
formatter: (row: ShopSeriesAllocationResponse) => {
return h('div', { style: 'display: flex; gap: 8px;' }, [
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
}),
h(ArtButtonTable, {
type: 'delete',
onClick: () => deleteAllocation(row)
})
])
const buttons = []
if (hasAuth('series_assign:edit')) {
buttons.push(
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
})
)
}
if (hasAuth('series_assign:delete')) {
buttons.push(
h(ArtButtonTable, {
type: 'delete',
onClick: () => deleteAllocation(row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])

View File

@@ -17,7 +17,7 @@
@refresh="handleRefresh"
>
<template #left>
<ElButton @click="showDialog('add')">新增店铺</ElButton>
<ElButton @click="showDialog('add')" v-permission="'shop:add'">新增店铺</ElButton>
</template>
</ArtTableHeader>
@@ -310,6 +310,7 @@
} from 'element-plus'
import type { FormRules } from 'element-plus'
import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth'
import ArtButtonTable from '@/components/core/forms/ArtButtonTable.vue'
import ArtMenuRight from '@/components/core/others/ArtMenuRight.vue'
import type { MenuItemType } from '@/components/core/others/ArtMenuRight.vue'
@@ -323,6 +324,8 @@
defineOptions({ name: 'Shop' })
const { hasAuth } = useAuth()
const dialogType = ref('add')
const dialogVisible = ref(false)
const customerAccountDialogVisible = ref(false)
@@ -606,16 +609,28 @@
width: 200,
fixed: 'right',
formatter: (row: ShopResponse) => {
return h('div', { style: 'display: flex; gap: 8px;' }, [
h(ArtButtonTable, {
text: '查看客户',
onClick: () => viewCustomerAccounts(row)
}),
h(ArtButtonTable, {
text: '更多操作',
onContextmenu: (e: MouseEvent) => showShopOperationMenu(e, row)
})
])
const buttons = []
if (hasAuth('shop:look_customer')) {
buttons.push(
h(ArtButtonTable, {
text: '查看客户',
onClick: () => viewCustomerAccounts(row)
})
)
}
// 只要有编辑或删除权限之一,就显示更多操作按钮
if (hasAuth('shop:edit') || hasAuth('shop:delete')) {
buttons.push(
h(ArtButtonTable, {
text: '更多操作',
onContextmenu: (e: MouseEvent) => showShopOperationMenu(e, row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])
@@ -874,20 +889,30 @@
}
// 店铺操作菜单项配置
const shopOperationMenuItems = computed((): MenuItemType[] => [
{
const shopOperationMenuItems = computed((): MenuItemType[] => {
const items: MenuItemType[] = []
items.push({
key: 'defaultRoles',
label: '默认角色'
},
{
key: 'edit',
label: '编辑'
},
{
key: 'delete',
label: '删除'
})
if (hasAuth('shop:edit')) {
items.push({
key: 'edit',
label: '编辑'
})
}
])
if (hasAuth('shop:delete')) {
items.push({
key: 'delete',
label: '删除'
})
}
return items
})
// 显示店铺操作右键菜单
const showShopOperationMenu = (e: MouseEvent, row: ShopResponse) => {

View File

@@ -17,7 +17,7 @@
@refresh="handleRefresh"
>
<template #left>
<ElButton @click="showDialog('add')">新增权限</ElButton>
<ElButton @click="showDialog('add')" v-permission="'permission:add'">新增权限</ElButton>
</template>
</ArtTableHeader>
@@ -125,6 +125,7 @@
import type { CreatePermissionParams, PermissionTreeNode } 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 {
PermissionType,
@@ -138,6 +139,8 @@
defineOptions({ name: 'Permission' })
const { hasAuth } = useAuth()
// 搜索表单初始值
const initialSearchState = {
perm_name: '',
@@ -299,16 +302,27 @@
width: 120,
fixed: 'right',
formatter: (row: PermissionTreeNode) => {
return h('div', { style: 'display: flex; gap: 8px;' }, [
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
}),
h(ArtButtonTable, {
type: 'delete',
onClick: () => deletePermission(row)
})
])
const buttons = []
if (hasAuth('permission:edit')) {
buttons.push(
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
})
)
}
if (hasAuth('permission:delete')) {
buttons.push(
h(ArtButtonTable, {
type: 'delete',
onClick: () => deletePermission(row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])