diff --git a/.env b/.env index 5301bb84a..d50543672 100644 --- a/.env +++ b/.env @@ -2,7 +2,7 @@ VITE_PORT=3100 # spa-title -VITE_GLOB_APP_TITLE=Vben Admin +VITE_GLOB_APP_TITLE=Bootx-Platform # spa shortname -VITE_GLOB_APP_SHORT_NAME=vue_vben_admin +VITE_GLOB_APP_SHORT_NAME=bootx_platform diff --git a/src/design/components/antdv.less b/src/design/components/antdv.less index 94eedf499..c68831e9c 100644 --- a/src/design/components/antdv.less +++ b/src/design/components/antdv.less @@ -1,5 +1,5 @@ -/* 表单项间隔(小) */ +/* 表单项间隔(超级小) */ .mini-from-item { .ant-form-item { margin-bottom: 8px; diff --git a/src/enums/formTypeEnum.ts b/src/enums/formTypeEnum.ts new file mode 100644 index 000000000..5fe213332 --- /dev/null +++ b/src/enums/formTypeEnum.ts @@ -0,0 +1,8 @@ +/** + * 表单类型 + */ +export enum FormType { + Add, + Edit, + Show, +} diff --git a/src/hooks/bootx/useDict.ts b/src/hooks/bootx/useDict.ts new file mode 100644 index 000000000..e69de29bb diff --git a/src/hooks/bootx/useFormEdit.ts b/src/hooks/bootx/useFormEdit.ts new file mode 100644 index 000000000..c16bbf20b --- /dev/null +++ b/src/hooks/bootx/useFormEdit.ts @@ -0,0 +1,72 @@ +import { reactive, toRefs } from 'vue' +import { FormType } from "/@/enums/formTypeEnum"; + +export default function () { + const model = reactive({ + // 表单项标题文字 + labelCol: { + sm: { span: 7 }, + }, + // 表单项内容 + wrapperCol: { + sm: { span: 13 }, + }, + title: '新增', + modalWidth: '50%', + confirmLoading: false, + visible: false, + editable: false, + addable: false, + showable: false, + type: FormType.Add, + }) + // 状态 + const { labelCol, wrapperCol, title, modalWidth, confirmLoading, visible, editable, addable, showable, type } = toRefs(model) + + function initFormModel(record, fromType: FormType, ...vars) { + type.value = fromType + visible.value = true + if (type.value === FormType.Add) { + addable.value = true + title.value = '新增' + } + if (type.value === FormType.Edit) { + editable.value = true + title.value = '修改' + } + if (type.value === FormType.Show) { + showable.value = true + title.value = '查看' + } + } + + // 关闭 + function handleCancel() { + visible.value = false + addable.value = false + editable.value = false + showable.value = false + } + + // 搜索 + function search(input: string, option) { + return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 + } + + return { + model, + labelCol, + wrapperCol, + title, + modalWidth, + confirmLoading, + visible, + editable, + addable, + showable, + type, + initFormModel, + handleCancel, + search, + } +} diff --git a/src/hooks/bootx/useFrom.ts b/src/hooks/bootx/useFrom.ts deleted file mode 100644 index 8565c2576..000000000 --- a/src/hooks/bootx/useFrom.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { reactive, ref, toRefs } from 'vue' -import { FormType } from '/#/web' - -export default function () { - const model = reactive({ - // 表单项标题文字 - labelCol: { - sm: { span: 7 }, - }, - // 表单项内容 - wrapperCol: { - sm: { span: 13 }, - }, - title: '新增', - modalWidth: '50%', - confirmLoading: false, - visible: false, - editable: false, - addable: false, - showable: false, - type: FormType.Add, - }) - const { labelCol, wrapperCol, title, modalWidth, confirmLoading, visible, editable, addable, showable, type } = toRefs(model) - return { - model, - labelCol, - wrapperCol, - title, - modalWidth, - confirmLoading, - visible, - editable, - addable, - showable, - type, - } -} diff --git a/src/hooks/bootx/useTable.ts b/src/hooks/bootx/useTablePage.ts similarity index 97% rename from src/hooks/bootx/useTable.ts rename to src/hooks/bootx/useTablePage.ts index b5f308bcf..75e844fa4 100644 --- a/src/hooks/bootx/useTable.ts +++ b/src/hooks/bootx/useTablePage.ts @@ -1,5 +1,5 @@ import { TablePageModel } from '/#/web' -import { reactive, ref, toRefs } from 'vue' +import { reactive, ref } from 'vue' import { PageResult } from '/#/axios' /** diff --git a/src/layouts/default/footer/index.vue b/src/layouts/default/footer/index.vue index 75d60fa7a..c95a18c39 100644 --- a/src/layouts/default/footer/index.vue +++ b/src/layouts/default/footer/index.vue @@ -7,7 +7,7 @@ {{ t('layout.footer.onlineDocument') }} -
Copyright ©2020 Vben Admin
+
Copyright ©2021 Bootx
diff --git a/src/views/demo/page/account/center/data.tsx b/src/views/demo/page/account/center/data.tsx index 47a507476..b7c993cb7 100644 --- a/src/views/demo/page/account/center/data.tsx +++ b/src/views/demo/page/account/center/data.tsx @@ -88,7 +88,7 @@ export const articleList = (() => { const result: any[] = [] for (let i = 0; i < 4; i++) { result.push({ - title: 'Vben Admin', + title: 'Bootx Platform', description: ['Vben', '设计语言', 'Typescript'], content: '基于Vue Next, TypeScript, Ant Design实现的一套完整的企业级后台管理系统。', time: '2020-11-14 11:20', diff --git a/src/views/modules/system/client/Client.api.ts b/src/views/modules/system/client/Client.api.ts index 7c4024ec0..46c258a59 100644 --- a/src/views/modules/system/client/Client.api.ts +++ b/src/views/modules/system/client/Client.api.ts @@ -6,28 +6,56 @@ import { BaseEntity } from '/#/web' * 分页 */ export const page = (params) => { - return defHttp.get>({ + return defHttp.get>>({ url: '/client/page', params, }) } /** - * 实体类 + * 获取单条 */ -// export class Client extends BaseEntity { -// // 编码 -// public code: string -// // 名称 -// name: string -// // 是否系统内置 -// system: boolean -// // 是否可用 -// enable: boolean -// // 关联登录方式 -// loginTypeIds: string -// // 关联登录方式 -// loginTypeIdList: Array -// // 描述 -// description: string -// } +export const get = (id) => { + return defHttp.get>({ + url: '/client/findById', + params: { id }, + }) +} + +/** + * 添加 + */ +export const add = (obj) => { + return defHttp.post({ + url: '/client/add', + data: obj, + }) +} + +/** + * 更新 + */ +export const update = (obj) => { + return defHttp.post({ + url: '/client/update', + data: obj, + }) +} + +/** + * 实体类接口 + */ +export interface Client extends BaseEntity { + // 编码 + code: string + // 名称 + name: string + // 是否系统内置 + system: boolean + // 是否可用 + enable: boolean + // 关联登录方式 + loginTypeIdList: Array | undefined | null + // 描述 + description: string +} diff --git a/src/views/modules/system/client/ClientEdit.vue b/src/views/modules/system/client/ClientEdit.vue index ad6510d54..9d0fecfcf 100644 --- a/src/views/modules/system/client/ClientEdit.vue +++ b/src/views/modules/system/client/ClientEdit.vue @@ -8,17 +8,17 @@ :confirmLoading="confirmLoading" > - - + + - + - + - + @@ -34,7 +34,7 @@ :filter-option="search" :disabled="showable" style="width: 100%" - placeholder="选择关联的终端" + placeholder="选择关联的登录方式" > {{ o.name }} @@ -56,68 +56,81 @@ diff --git a/types/web.d.ts b/types/web.d.ts index 1ae59bc60..5617652be 100644 --- a/types/web.d.ts +++ b/types/web.d.ts @@ -31,25 +31,9 @@ export interface TablePageModel { pagination: PageResult } -/** - * 编辑界面参数对象 - */ -export interface EditModel { - -} - /** * 基础实体对象 */ -export class BaseEntity { - id: number -} - -/** - * 表单类型 - */ -export enum FormType { - Add, - Edit, - Show, +export interface BaseEntity { + id: number | null }