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') }} -