完善权限的管理和校验
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
style="width: 250px"
|
||||
@search="handleSearch"
|
||||
/>
|
||||
<a-button type="primary" @click="showAddModal">
|
||||
<a-button v-if="hasPermission('product:create')" type="primary" @click="showAddModal">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
@@ -58,10 +58,11 @@
|
||||
|
||||
<template v-else-if="column.key === 'actions'">
|
||||
<a-space>
|
||||
<a-button type="link" size="small" @click="showEditModal(record)">
|
||||
<a-button v-if="hasPermission('product:edit')" type="link" size="small" @click="showEditModal(record)">
|
||||
编辑
|
||||
</a-button>
|
||||
<a-popconfirm
|
||||
v-if="hasPermission('product:delete')"
|
||||
title="确定要删除这个商品吗?"
|
||||
@confirm="handleDelete(record)"
|
||||
>
|
||||
@@ -246,6 +247,7 @@ import type { FormInstance, UploadProps } from 'ant-design-vue'
|
||||
import { PlusOutlined } from '@ant-design/icons-vue'
|
||||
import { DEFAULT_PRODUCT_IMAGE } from '@/constants'
|
||||
import { adminProductApi, type Product, adminShopApi, type Shop, adminFileApi, type ObjectStorageFileVO, adminTagApi, adminArtistApi, adminCouponApi } from '@/api/admin'
|
||||
import { usePermission } from '@/utils/permission'
|
||||
|
||||
const loading = ref(false)
|
||||
const searchText = ref('')
|
||||
@@ -270,6 +272,7 @@ const imageUrls = ref<Record<number, string[]>>({})
|
||||
const imageIdCache = ref<Record<string, string>>({})
|
||||
const isAdmin = ref(false)
|
||||
const formRef = ref<any>(null)
|
||||
const { hasPermission } = usePermission()
|
||||
|
||||
const pagination = reactive({
|
||||
current: 1,
|
||||
|
||||
Reference in New Issue
Block a user