补充权限控制
This commit is contained in:
@@ -128,7 +128,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
function refreshGrid() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
|
||||
@@ -7,7 +7,8 @@ import type { SystemDictDataApi } from '#/api/system/dict_data';
|
||||
import { z } from '#/adapter/form';
|
||||
import { getDictTypeList } from '#/api/system/dict_type';
|
||||
import { $t } from '#/locales';
|
||||
import {format_datetime} from "#/utils/date";
|
||||
import { format_datetime } from '#/utils/date';
|
||||
import { op } from '#/utils/permission';
|
||||
|
||||
/**
|
||||
* 获取编辑表单的字段配置。如果没有使用多语言,可以直接export一个数组常量
|
||||
@@ -88,7 +89,7 @@ export function useSchema(): VbenFormSchema[] {
|
||||
label: '危险',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
@@ -191,13 +192,8 @@ export function useColumns(
|
||||
},
|
||||
name: 'CellOperation',
|
||||
options: [
|
||||
'edit', // 默认的编辑按钮
|
||||
{
|
||||
code: 'delete', // 默认的删除按钮
|
||||
disabled: (row: SystemDictDataApi.SystemDictData) => {
|
||||
return !!(row.children && row.children.length > 0);
|
||||
},
|
||||
},
|
||||
op('system:dict_data:edit', 'edit'),
|
||||
op('system:dict_data:delete', 'delete'),
|
||||
],
|
||||
},
|
||||
field: 'operation',
|
||||
|
||||
@@ -133,7 +133,11 @@ function refreshGrid() {
|
||||
<FormModal @success="refreshGrid" />
|
||||
<Grid table-title="字典数据">
|
||||
<template #toolbar-tools>
|
||||
<Button type="primary" @click="onCreate">
|
||||
<Button
|
||||
type="primary"
|
||||
@click="onCreate"
|
||||
v-permission="'system:dict_data:create'"
|
||||
>
|
||||
<Plus class="size-5" />
|
||||
{{ $t('ui.actionTitle.create', [$t('system.dict_data.name')]) }}
|
||||
</Button>
|
||||
|
||||
@@ -7,6 +7,7 @@ import type { SystemDictTypeApi } from '#/api/system/dict_type';
|
||||
import { z } from '#/adapter/form';
|
||||
import { $t } from '#/locales';
|
||||
import { format_datetime } from '#/utils/date';
|
||||
import {op} from "#/utils/permission";
|
||||
|
||||
/**
|
||||
* 获取编辑表单的字段配置。如果没有使用多语言,可以直接export一个数组常量
|
||||
@@ -123,17 +124,12 @@ export function useColumns(
|
||||
},
|
||||
name: 'CellOperation',
|
||||
options: [
|
||||
'edit', // 默认的编辑按钮
|
||||
op('system:dict_type:edit', 'edit'),
|
||||
{
|
||||
code: 'view', // 新增查看详情按钮(可自定义code)
|
||||
text: '数据', // 按钮文本(国际化)
|
||||
},
|
||||
{
|
||||
code: 'delete', // 默认的删除按钮
|
||||
disabled: (row: SystemDictTypeApi.SystemDictType) => {
|
||||
return !!(row.children && row.children.length > 0);
|
||||
},
|
||||
},
|
||||
op('system:dict_type:delete', 'delete'),
|
||||
],
|
||||
},
|
||||
field: 'operation',
|
||||
|
||||
@@ -146,7 +146,11 @@ function refreshGrid() {
|
||||
<FormModal @success="refreshGrid" />
|
||||
<Grid table-title="字典列表">
|
||||
<template #toolbar-tools>
|
||||
<Button type="primary" @click="onCreate">
|
||||
<Button
|
||||
type="primary"
|
||||
@click="onCreate"
|
||||
v-permission="'system:dict_type:create'"
|
||||
>
|
||||
<Plus class="size-5" />
|
||||
{{ $t('ui.actionTitle.create', [$t('system.dict_type.name')]) }}
|
||||
</Button>
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { SystemMenuApi } from '#/api/system/menu';
|
||||
|
||||
import { $t } from '#/locales';
|
||||
import {op} from "#/utils/permission";
|
||||
|
||||
export function getMenuTypeOptions() {
|
||||
return [
|
||||
@@ -95,12 +96,12 @@ export function useColumns(
|
||||
},
|
||||
name: 'CellOperation',
|
||||
options: [
|
||||
{
|
||||
op('system:menu:create', {
|
||||
code: 'append',
|
||||
text: '新增下级',
|
||||
},
|
||||
'edit', // 默认的编辑按钮
|
||||
'delete', // 默认的删除按钮
|
||||
}),
|
||||
op('system:menu:edit', 'edit'),
|
||||
op('system:menu:delete', 'delete'),
|
||||
],
|
||||
},
|
||||
field: 'operation',
|
||||
|
||||
@@ -115,7 +115,11 @@ function onDelete(row: SystemMenuApi.SystemMenu) {
|
||||
<FormDrawer @success="onRefresh" />
|
||||
<Grid>
|
||||
<template #toolbar-tools>
|
||||
<Button type="primary" @click="onCreate">
|
||||
<Button
|
||||
type="primary"
|
||||
@click="onCreate"
|
||||
v-permission="'system:menu:create'"
|
||||
>
|
||||
<Plus class="size-5" />
|
||||
{{ $t('ui.actionTitle.create', [$t('system.menu.name')]) }}
|
||||
</Button>
|
||||
|
||||
@@ -7,6 +7,7 @@ import type { SystemPostApi } from '#/models/system/post';
|
||||
import { z } from '#/adapter/form';
|
||||
import { $t } from '#/locales';
|
||||
import { format_datetime } from '#/utils/date';
|
||||
import {op} from "#/utils/permission";
|
||||
|
||||
/**
|
||||
* 获取编辑表单的字段配置
|
||||
@@ -107,10 +108,8 @@ export function useColumns(
|
||||
},
|
||||
name: 'CellOperation',
|
||||
options: [
|
||||
'edit', // 默认的编辑按钮
|
||||
{
|
||||
code: 'delete', // 默认的删除按钮
|
||||
},
|
||||
op('system:post:edit', 'edit'),
|
||||
op('system:post:delete', 'delete'),
|
||||
],
|
||||
},
|
||||
field: 'operation',
|
||||
|
||||
@@ -128,7 +128,11 @@ function refreshGrid() {
|
||||
<FormModal @success="refreshGrid" />
|
||||
<Grid table-title="岗位信息表">
|
||||
<template #toolbar-tools>
|
||||
<Button type="primary" @click="onCreate">
|
||||
<Button
|
||||
type="primary"
|
||||
@click="onCreate"
|
||||
v-permission="'system:post:create'"
|
||||
>
|
||||
<Plus class="size-5" />
|
||||
{{ $t('ui.actionTitle.create', [$t('system.post.name')]) }}
|
||||
</Button>
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { SystemRoleApi } from '#/api/system/role';
|
||||
|
||||
import { $t } from '#/locales';
|
||||
import { format_datetime } from '#/utils/date';
|
||||
import {op} from "#/utils/permission";
|
||||
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
@@ -127,6 +128,10 @@ export function useColumns<T = SystemRoleApi.SystemRole>(
|
||||
onClick: onActionClick,
|
||||
},
|
||||
name: 'CellOperation',
|
||||
options: [
|
||||
op('system:role:edit', 'edit'),
|
||||
op('system:role:delete', 'delete'),
|
||||
],
|
||||
},
|
||||
field: 'operation',
|
||||
fixed: 'right',
|
||||
|
||||
@@ -153,10 +153,14 @@ function onCreate() {
|
||||
</script>
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<FormDrawer @success="onRefresh"/>
|
||||
<FormDrawer @success="onRefresh" />
|
||||
<Grid :table-title="$t('system.role.list')">
|
||||
<template #toolbar-tools>
|
||||
<Button type="primary" @click="onCreate">
|
||||
<Button
|
||||
type="primary"
|
||||
@click="onCreate"
|
||||
v-permission="'system:role:create'"
|
||||
>
|
||||
<Plus class="size-5" />
|
||||
{{ $t('ui.actionTitle.create', [$t('system.role.name')]) }}
|
||||
</Button>
|
||||
|
||||
@@ -128,7 +128,11 @@ function refreshGrid() {
|
||||
<FormModal @success="refreshGrid" />
|
||||
<Grid table-title="用户数据">
|
||||
<template #toolbar-tools>
|
||||
<Button type="primary" @click="onCreate">
|
||||
<Button
|
||||
type="primary"
|
||||
@click="onCreate"
|
||||
v-permission="'system:user:create'"
|
||||
>
|
||||
<Plus class="size-5" />
|
||||
{{ $t('ui.actionTitle.create', [$t('system.user.name')]) }}
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user