Files
lgp-admin-plus/apps/web-antd/src/views/code-generation/config/table.ts

179 lines
4.2 KiB
TypeScript
Raw Normal View History

2025-05-12 17:04:27 +08:00
import type { VxeGridProps } from '#/adapter/vxe-table';
import filedType from '#/util/json/filedType.json';
import formType from '#/util/json/formType.json';
import { getAdminList } from '#/views/system/admin/api';
2025-05-13 16:34:31 +08:00
export const gridOptions: VxeGridProps = {
2025-05-12 17:04:27 +08:00
title: '时间字段由系统生成',
titleHelpMessage:
'创建时间:created_at 编辑时间:updated_at 删除时间:deleted_at',
checkboxConfig: {
highlight: true,
labelField: '',
},
columnConfig: {
useKey: true,
},
rowConfig: {
useKey: true,
},
columns: [
{
title: '字段名称',
tableTitleHelp: '表中字段名称,为英文开头,纯小写 多个单词下划线隔开',
dataIndex: 'name',
editRow: true,
},
{
title: '字段类型',
tableTitleHelp: '表中字段储存类型',
dataIndex: 'type',
editRow: true,
editComponent: 'Select',
editComponentProps: {
options: filedType,
showSearch: true,
},
},
{
title: '字段长度',
tableTitleHelp: '表中字段储存类型长度',
dataIndex: 'type_number',
editRow: true,
width: 100,
},
{
title: '默认值',
tableTitleHelp: '表中字段的默认值',
dataIndex: 'default',
editRow: true,
width: 100,
},
{
title: '备注',
tableTitleHelp: '表中字段备注',
dataIndex: 'comment',
editRow: true,
},
{
title: '非空',
tableTitleHelp: '表中字段是否为必填',
dataIndex: 'null',
width: 80,
editRow: true,
editComponent: 'Switch',
editComponentProps: {
checkedChildren: '是',
unCheckedChildren: '否',
size: 'default',
},
},
{
title: '表单',
tableTitleHelp: '是否在表单中展示该字段',
dataIndex: 'formShow',
width: 80,
editRow: true,
editComponent: 'Switch',
editComponentProps: {
checkedChildren: '是',
unCheckedChildren: '否',
size: 'default',
},
},
{
title: '表格',
tableTitleHelp: '是否在表格中展示该字段',
dataIndex: 'tableShow',
width: 80,
editRow: true,
editComponent: 'Switch',
editComponentProps: {
checkedChildren: '是',
unCheckedChildren: '否',
size: 'default',
},
},
{
title: '搜索',
tableTitleHelp: '是否在表格中搜索该字段',
dataIndex: 'search',
width: 80,
editRow: true,
editComponent: 'Switch',
editComponentProps: {
checkedChildren: '是',
unCheckedChildren: '否',
size: 'default',
},
},
{
title: '搜索方式',
tableTitleHelp: '是否在表格中搜索该字段',
dataIndex: 'searchValue',
editRow: true,
editComponent: 'Select',
editComponentProps: {
options: [
{
label: '绝对查询',
value: '=',
},
{
label: '模糊查询',
value: 'like',
},
],
size: 'default',
},
},
{
title: '表单类型',
tableTitleHelp: '在表单中展示该字段的组件类型 如不在表单中展示则不填',
dataIndex: 'formType',
width: 250,
editRow: true,
editComponent: 'Select',
editComponentProps: {
options: formType,
showSearch: true,
},
},
],
keepSource: true,
pagerConfig: {},
proxyConfig: {
ajax: {
// 请求后端接口方法
query: async ({ page }, formValues) => {
return await getAdminList({
page: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
height: 'auto',
border: false,
toolbarConfig: {
// 是否显示搜索表单控制按钮
// @ts-ignore 正式环境时有完整的类型声明
2025-05-13 10:42:57 +08:00
search: false,
refresh: false, // 刷新
2025-05-12 17:04:27 +08:00
print: false, // 打印
export: false, // 导出
// custom: true, // 自定义列
2025-05-13 10:42:57 +08:00
zoom: false, // 最大化最小化
// slots: {
// buttons: 'toolbar-buttons',
// },
2025-05-12 17:04:27 +08:00
custom: {
// 自定义列-图标
icon: 'vxe-icon-menu',
},
},
showOverflow: false,
};