feat: 证书管理 加入权限

This commit is contained in:
jackhoo_98 2023-03-01 11:37:26 +08:00
parent 8972c003ba
commit ec89aaae88
2 changed files with 34 additions and 42 deletions

View File

@ -144,7 +144,7 @@ const columns = [
search: { search: {
type: 'string', type: 'string',
}, },
// width: 200, ellipsis: true,
}, },
{ {
title: '请求方法', title: '请求方法',

View File

@ -13,45 +13,40 @@
:params="params" :params="params"
> >
<template #headerTitle> <template #headerTitle>
<a-button type="primary" @click="handlAdd" <PermissionButton
><AIcon type="PlusOutlined" />新增</a-button type="primary"
@click="handlAdd"
hasPermission="link/Certificate:add"
> >
<template #icon><AIcon type="PlusOutlined" /></template>
新增
</PermissionButton>
</template> </template>
<template #type="slotProps"> <template #type="slotProps">
<span>{{ slotProps.type.text }}</span> <span>{{ slotProps.type.text }}</span>
</template> </template>
<template #action="slotProps"> <template #action="slotProps">
<a-space :size="16"> <a-space>
<a-tooltip <template
v-for="i in getActions(slotProps)" v-for="i in getActions(slotProps)"
:key="i.key" :key="i.key"
v-bind="i.tooltip"
> >
<a-popconfirm <PermissionButton
v-if="i.popConfirm" :disabled="i.disabled"
v-bind="i.popConfirm" :popConfirm="i.popConfirm"
> :tooltip="{
<a-button ...i.tooltip,
:disabled="i.disabled" }"
style="padding: 0" style="padding: 0px"
type="link" @click="i.onClick"
><AIcon :type="i.icon"
/></a-button>
</a-popconfirm>
<a-button
style="padding: 0"
type="link" type="link"
v-else :hasPermission="'link/Certificate:' + i.key"
@click="i.onClick && i.onClick(slotProps)"
> >
<a-button <template #icon
:disabled="i.disabled"
style="padding: 0"
type="link"
><AIcon :type="i.icon" ><AIcon :type="i.icon"
/></a-button> /></template>
</a-button> </PermissionButton>
</a-tooltip> </template>
</a-space> </a-space>
</template> </template>
</JTable> </JTable>
@ -62,7 +57,9 @@
import type { ActionsType } from '@/components/Table/index'; import type { ActionsType } from '@/components/Table/index';
import { query, remove } from '@/api/link/certificate'; import { query, remove } from '@/api/link/certificate';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { useMenuStore } from 'store/menu';
const menuStory = useMenuStore();
const tableRef = ref<Record<string, any>>({}); const tableRef = ref<Record<string, any>>({});
const router = useRouter(); const router = useRouter();
const params = ref<Record<string, any>>({}); const params = ref<Record<string, any>>({});
@ -119,7 +116,7 @@ const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
} }
return [ return [
{ {
key: 'eye', key: 'view',
text: '查看', text: '查看',
tooltip: { tooltip: {
title: '查看', title: '查看',
@ -130,7 +127,7 @@ const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
}, },
}, },
{ {
key: 'edit', key: 'update',
text: '编辑', text: '编辑',
tooltip: { tooltip: {
title: '编辑', title: '编辑',
@ -157,24 +154,19 @@ const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
}; };
const handlAdd = () => { const handlAdd = () => {
router.push({ menuStory.jumpPage(
path: `/iot/link/certificate/detail/:id`, `link/Certificate/Detail`,
query: { view: false }, { id: ':id' },
}); { view: false },
);
}; };
const handlEye = (id: string) => { const handlEye = (id: string) => {
router.push({ menuStory.jumpPage(`link/Certificate/Detail`, { id }, { view: true });
path: `/iot/link/certificate/detail/${id}`,
query: { view: true },
});
}; };
const handlEdit = (id: string) => { const handlEdit = (id: string) => {
router.push({ menuStory.jumpPage(`link/Certificate/Detail`, { id }, { view: false });
path: `/iot/link/certificate/detail/${id}`,
query: { view: false },
});
}; };
const handlDelete = async (id: string) => { const handlDelete = async (id: string) => {