修改权限膜拜
This commit is contained in:
@@ -17,6 +17,16 @@ ${form_fields}
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取编辑表单的字段配置
|
||||
*/
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
${form_fields}
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取表格列配置
|
||||
* @description 使用函数的形式返回列数据而不是直接export一个Array常量,是为了响应语言切换时重新翻译表头
|
||||
@@ -36,7 +46,10 @@ ${columns}
|
||||
onClick: onActionClick,
|
||||
},
|
||||
name: 'CellOperation',
|
||||
options: ['edit', 'delete'],
|
||||
options: [
|
||||
op('${app_name}:${model_name_snake}:edit', 'edit'),
|
||||
op('${app_name}:${model_name_snake}:delete', 'delete'),
|
||||
],
|
||||
},
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
|
||||
@@ -14,7 +14,7 @@ import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { $$t } from '#/locales';
|
||||
import { ${app_name_camel}${model_name}Model } from '#/models/${app_name}/${model_name_snake}';
|
||||
|
||||
import { useColumns } from './data';
|
||||
import { useColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const formModel = new ${app_name_camel}${model_name}Model();
|
||||
@@ -81,6 +81,10 @@ function onActionClick({
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
submitOnChange: true,
|
||||
},
|
||||
gridEvents: {},
|
||||
gridOptions: {
|
||||
columns: useColumns(onActionClick),
|
||||
@@ -105,6 +109,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
export: false,
|
||||
refresh: { code: 'query' },
|
||||
zoom: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions,
|
||||
});
|
||||
@@ -122,7 +127,11 @@ function refreshGrid() {
|
||||
<FormModal @success="refreshGrid" />
|
||||
<Grid table-title="${verbose_name}">
|
||||
<template #toolbar-tools>
|
||||
<Button type="primary" @click="onCreate">
|
||||
<Button
|
||||
type="primary"
|
||||
@click="onCreate"
|
||||
v-permission="'${app_name}:${model_name_snake}:create'"
|
||||
>
|
||||
<Plus class="size-5" />
|
||||
{{ $$t('ui.actionTitle.create', [$$t('${app_name}.${model_name_snake}.name')]) }}
|
||||
</Button>
|
||||
|
||||
@@ -15,9 +15,8 @@ import { Button, message } from 'ant-design-vue';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { deleteDictType, getDictTypeList } from '#/api/system/dict_type';
|
||||
import { $t } from '#/locales';
|
||||
import { useGridFormSchema } from '#/views/system/dict_type/data';
|
||||
|
||||
import { useColumns } from './data';
|
||||
import { useColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
@@ -13,9 +13,8 @@ import { Button, message } from 'ant-design-vue';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { $t } from '#/locales';
|
||||
import { SystemPostModel } from '#/models/system/post';
|
||||
import { useGridFormSchema } from '#/views/system/post/data';
|
||||
|
||||
import { useColumns } from './data';
|
||||
import { useColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const formModel = new SystemPostModel();
|
||||
|
||||
Reference in New Issue
Block a user