feat: 流程分类按钮权限

pull/71/head
jason 2025-04-11 13:38:55 +08:00
parent ce431e28be
commit e82ddeb915
2 changed files with 20 additions and 5 deletions

View File

@ -2,10 +2,13 @@ import type { VbenFormSchema } from '#/adapter/form';
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { CategoryApi } from '#/api/bpm/category/index'; import type { CategoryApi } from '#/api/bpm/category/index';
import { useAccess } from '@vben/access';
import { z } from '#/adapter/form'; import { z } from '#/adapter/form';
import { CommonStatusEnum } from '#/utils/constants'; import { CommonStatusEnum } from '#/utils/constants';
import { DICT_TYPE, getDictOptions } from '#/utils/dict'; import { DICT_TYPE, getDictOptions } from '#/utils/dict';
const { hasAccessByCodes } = useAccess();
/** 新增/修改的表单 */ /** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] { export function useFormSchema(): VbenFormSchema[] {
return [ return [
@ -80,7 +83,15 @@ export function useGridFormSchema(): VbenFormSchema[] {
allowClear: true, allowClear: true,
}, },
}, },
// TODO 分类标志 {
fieldName: 'code',
label: '分类标志',
component: 'Input',
componentProps: {
placeholder: '请输入分类标志',
allowClear: true,
},
},
{ {
fieldName: 'status', fieldName: 'status',
label: '分类状态', label: '分类状态',
@ -91,6 +102,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
allowClear: true, allowClear: true,
}, },
}, },
// TODO 创建时间 等通用方法完善后加
]; ];
} }
@ -150,11 +162,11 @@ export function useGridColumns<T = CategoryApi.CategoryVO>(
options: [ options: [
{ {
code: 'edit', code: 'edit',
// show: hasAccessByCodes(['bpm:category:update']), TODO 权限 show: hasAccessByCodes(['bpm:category:update']),
}, },
{ {
code: 'delete', code: 'delete',
// show: hasAccessByCodes(['bpm:category:delete']), show: hasAccessByCodes(['bpm:category:delete']),
}, },
], ],
}, },

View File

@ -6,7 +6,6 @@ import type {
import type { CategoryApi } from '#/api/bpm/category/index'; import type { CategoryApi } from '#/api/bpm/category/index';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { Plus } from '@vben/icons';
import { Button, message } from 'ant-design-vue'; import { Button, message } from 'ant-design-vue';
@ -107,7 +106,11 @@ async function onDelete(row: CategoryApi.CategoryVO) {
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<Button type="primary" @click="onCreate"> <Button
type="primary"
@click="onCreate"
v-access:code="['bpm:category:create']"
>
<Plus class="size-5" /> <Plus class="size-5" />
{{ $t('ui.actionTitle.create', ['流程分类']) }} {{ $t('ui.actionTitle.create', ['流程分类']) }}
</Button> </Button>