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'; interface RowType { id: string; nick_name: string; email: string; avatar: string; roles: { name: string }[]; open_id: string; code: string; platform_id: string; phone: string; desc: string; created_at: string; } export const gridOptions: VxeGridProps = { 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: 'isKey', // width: 80, // editRow: true, // editComponent: 'Switch', // editComponentProps: { // checkedChildren: '是', // unCheckedChildren: '否', // size: 'default', // }, // }, { 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 正式环境时有完整的类型声明 search: true, refresh: true, // 刷新 print: false, // 打印 export: false, // 导出 // custom: true, // 自定义列 zoom: true, // 最大化最小化 slots: { buttons: 'toolbar-buttons', }, custom: { // 自定义列-图标 icon: 'vxe-icon-menu', }, }, showOverflow: false, }; // const columns: BasicColumn[] = [ // { // 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: 'isKey', // // width: 80, // // editRow: true, // // editComponent: 'Switch', // // editComponentProps: { // // checkedChildren: '是', // // unCheckedChildren: '否', // // size: 'default', // // }, // // }, // { // 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, // }, // }, // ];