diff --git a/apps/web-antd/src/components/form/components/editor.vue b/apps/web-antd/src/components/form/components/editor.vue new file mode 100644 index 00000000..21dddf20 --- /dev/null +++ b/apps/web-antd/src/components/form/components/editor.vue @@ -0,0 +1,224 @@ + + + + diff --git a/apps/web-antd/src/views/system/base-config/api/index.ts b/apps/web-antd/src/views/system/base-config/api/index.ts new file mode 100644 index 00000000..36853d58 --- /dev/null +++ b/apps/web-antd/src/views/system/base-config/api/index.ts @@ -0,0 +1,49 @@ +import { requestClient } from '#/api/request'; + +const prefix = 'base-config/'; +/** + * 分页查询用户列表 + * @param data + */ +export async function getBaseConfigList(data: any) { + return requestClient.get(`${prefix}list`, { params: data }); +} +/** + * 分页查询用户列表 + * @param data + */ +export async function getBaseConfigOption(data: any) { + return requestClient.get(`${prefix}option`, { params: data }); +} + +/** + * 获取协议详情 + * @param id + */ +export async function getBaseConfigInfo(id: number) { + return requestClient.get(`${prefix}detail`, { params: { id } }); +} + +/** + * 新增协议 + * @param data + */ +export async function createBaseConfig(data: Record) { + return requestClient.post(`${prefix}create`, data); +} + +/** + * 编辑协议 + * @param data + */ +export async function updateBaseConfig(data: Record) { + return requestClient.post(`${prefix}update`, data); +} + +/** + * 删除协议 + * @param data + */ +export async function deleteBaseConfig(data: Record) { + return requestClient.post(`${prefix}delete`, data); +} diff --git a/apps/web-antd/src/views/system/base-config/components/detail.vue b/apps/web-antd/src/views/system/base-config/components/detail.vue new file mode 100644 index 00000000..77267dab --- /dev/null +++ b/apps/web-antd/src/views/system/base-config/components/detail.vue @@ -0,0 +1,43 @@ + + diff --git a/apps/web-antd/src/views/system/base-config/components/modal.vue b/apps/web-antd/src/views/system/base-config/components/modal.vue new file mode 100644 index 00000000..cccc583e --- /dev/null +++ b/apps/web-antd/src/views/system/base-config/components/modal.vue @@ -0,0 +1,62 @@ + + diff --git a/apps/web-antd/src/views/system/base-config/config/form.ts b/apps/web-antd/src/views/system/base-config/config/form.ts new file mode 100644 index 00000000..0c252031 --- /dev/null +++ b/apps/web-antd/src/views/system/base-config/config/form.ts @@ -0,0 +1,60 @@ +import type { VbenFormProps } from '#/adapter/form'; + +export const modalFormProps: VbenFormProps = { + wrapperClass: 'grid-cols-12', // 24栅格, + commonConfig: { + formItemClass: 'col-span-12', + // 所有表单项 + componentProps: { + class: 'w-full', + }, + }, + // handleSubmit: onSubmit, + layout: 'horizontal', + schema: [ + // { + // fieldName: 'baseinfo', + // component: 'Divider', + // label: '基础信息', + // formItemClass: 'col-span-12', + // componentProps: {}, + // hideLabel: true, + // renderComponentContent: () => { + // return { + // default: () => { + // return '基础信息'; + // }, + // }; + // }, + // }, + { + component: 'VbenInput', + fieldName: 'id', + label: 'ID', + formItemClass: 'col-span-6', + dependencies: { + show: false, + triggerFields: ['id'], + }, + }, + { + component: 'VbenInput', + componentProps: { + placeholder: '请输入协议昵称', + }, + fieldName: 'desc', + label: '协议名称', + rules: 'required', + }, + { + component: 'Editor', + componentProps: { + placeholder: '请输入协议介绍', + }, + fieldName: 'content', + label: '协议内容', + rules: 'required', + }, + ], + showDefaultActions: false, +}; diff --git a/apps/web-antd/src/views/system/base-config/config/search.ts b/apps/web-antd/src/views/system/base-config/config/search.ts new file mode 100644 index 00000000..b161675f --- /dev/null +++ b/apps/web-antd/src/views/system/base-config/config/search.ts @@ -0,0 +1,37 @@ +import type { VbenFormProps } from '#/adapter/form'; + +// import dayjs from 'dayjs'; + +export const formOptions: VbenFormProps = { + // 默认展开 + collapsed: false, + schema: [ + { + component: 'VbenInput', + componentProps: { + placeholder: '输入名称', + }, + defaultValue: '', + fieldName: 'name', + label: '协议名称', + }, + // { + // component: 'RangePicker', + // componentProps: { + // format: 'YYYY-MM-DD', // 确保格式与你需要的一致 + // }, + // // defaultValue: [dayjs().startOf('month'), dayjs()], + // fieldName: 'search_time', + // label: '时间范围', + // }, + ], + // 控制表单是否显示折叠按钮 + showCollapseButton: true, + submitButtonOptions: { + content: '查询', + }, + // 是否在字段值改变时提交表单 + submitOnChange: true, + // 按下回车时是否提交表单 + submitOnEnter: false, +}; diff --git a/apps/web-antd/src/views/system/base-config/config/table.ts b/apps/web-antd/src/views/system/base-config/config/table.ts new file mode 100644 index 00000000..51234dc9 --- /dev/null +++ b/apps/web-antd/src/views/system/base-config/config/table.ts @@ -0,0 +1,66 @@ +import type { VxeGridProps } from '#/adapter/vxe-table'; + +import { getBaseConfigList } from '#/views/system/base-config/api'; + +interface RowType { + id: string; + name: string; + logo: string; + introduce: string; + created_at: string; +} + +export const gridOptions: VxeGridProps = { + checkboxConfig: { + highlight: true, + labelField: '', + }, + columnConfig: { + useKey: true, + }, + rowConfig: { + useKey: true, + }, + columns: [ + { field: 'id', align: 'left', title: 'ID', width: 100 }, + { field: 'desc', align: 'left', title: '协议名称' }, + { field: 'content', title: '协议介绍', slots: { default: 'content' } }, + { field: 'end_txt', title: '协议端口' }, + { field: 'created_at', title: '创建时间' }, + { type: 'html', title: '操作', slots: { default: 'action' } }, + ], + keepSource: true, + pagerConfig: {}, + proxyConfig: { + ajax: { + // 请求后端接口方法 + query: async ({ page }, formValues) => { + return await getBaseConfigList({ + 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, +}; diff --git a/apps/web-antd/src/views/system/base-config/index.vue b/apps/web-antd/src/views/system/base-config/index.vue new file mode 100644 index 00000000..7e3f39f4 --- /dev/null +++ b/apps/web-antd/src/views/system/base-config/index.vue @@ -0,0 +1,155 @@ + + +