From a0fca434823606c8c1bbf90a21f8c07323bb3630 Mon Sep 17 00:00:00 2001 From: XiaLangQing <413901125@qq.com> Date: Thu, 29 Aug 2024 08:55:12 +0800 Subject: [PATCH 01/19] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=87=AA=E8=A1=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/hr/dept/index.vue | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 apps/web-antd/src/views/hr/dept/index.vue diff --git a/apps/web-antd/src/views/hr/dept/index.vue b/apps/web-antd/src/views/hr/dept/index.vue new file mode 100644 index 00000000..06372a15 --- /dev/null +++ b/apps/web-antd/src/views/hr/dept/index.vue @@ -0,0 +1,9 @@ + + + -- Gitee From aca7f2be2cb562332618b72522ea5ee2e0be57c3 Mon Sep 17 00:00:00 2001 From: XiaLangQing <413901125@qq.com> Date: Thu, 29 Aug 2024 08:56:10 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=9C=BA=E6=9E=84=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/hr/organize/index.vue | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 apps/web-antd/src/views/hr/organize/index.vue diff --git a/apps/web-antd/src/views/hr/organize/index.vue b/apps/web-antd/src/views/hr/organize/index.vue new file mode 100644 index 00000000..06372a15 --- /dev/null +++ b/apps/web-antd/src/views/hr/organize/index.vue @@ -0,0 +1,9 @@ + + + -- Gitee From 02aabfde8fe39fa01f5c407502276218aa378dca Mon Sep 17 00:00:00 2001 From: XiaLangQing <413901125@qq.com> Date: Tue, 10 Sep 2024 09:01:25 +0800 Subject: [PATCH 03/19] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/components/dict/index.ts | 5 - .../web-antd/src/components/dict/src/data.tsx | 44 ------- apps/web-antd/src/components/tinymce/index.ts | 5 - .../src/components/tinymce/src/helper.ts | 85 ------------- .../src/components/tinymce/src/img-upload.vue | 115 ------------------ .../src/components/tinymce/src/tinymce.ts | 11 -- .../lint-configs/prettier-config/package.json | 1 + 7 files changed, 1 insertion(+), 265 deletions(-) delete mode 100644 apps/web-antd/src/components/dict/index.ts delete mode 100644 apps/web-antd/src/components/dict/src/data.tsx delete mode 100644 apps/web-antd/src/components/tinymce/index.ts delete mode 100644 apps/web-antd/src/components/tinymce/src/helper.ts delete mode 100644 apps/web-antd/src/components/tinymce/src/img-upload.vue delete mode 100644 apps/web-antd/src/components/tinymce/src/tinymce.ts diff --git a/apps/web-antd/src/components/dict/index.ts b/apps/web-antd/src/components/dict/index.ts deleted file mode 100644 index 9dd84d24..00000000 --- a/apps/web-antd/src/components/dict/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { withInstall } from '#/utils'; - -import dictTag from './src/index.vue'; - -export const DictTag = withInstall(dictTag); diff --git a/apps/web-antd/src/components/dict/src/data.tsx b/apps/web-antd/src/components/dict/src/data.tsx deleted file mode 100644 index 68395f8a..00000000 --- a/apps/web-antd/src/components/dict/src/data.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { type VNode } from 'vue'; - -import { Tag } from 'ant-design-vue'; - -interface TagType { - [key: string]: { color: string; label: string }; -} - -export const tagTypes: TagType = { - cyan: { color: 'cyan', label: 'cyan' }, - danger: { color: 'error', label: '危险(danger)' }, - /** 由于和elementUI不同 用于替换颜色 */ - default: { color: 'default', label: '默认(default)' }, - green: { color: 'green', label: 'green' }, - info: { color: 'default', label: '信息(info)' }, - orange: { color: 'orange', label: 'orange' }, - /** 自定义预设 color可以为16进制颜色 */ - pink: { color: 'pink', label: 'pink' }, - primary: { color: 'processing', label: '主要(primary)' }, - purple: { color: 'purple', label: 'purple' }, - red: { color: 'red', label: 'red' }, - success: { color: 'success', label: '成功(success)' }, - warning: { color: 'warning', label: '警告(warning)' }, -}; - -// 字典选择使用 { label: string; value: string }[] -interface Options { - label: string | VNode; - value: string; -} - -export function tagSelectOptions() { - const selectArray: Options[] = []; - Object.keys(tagTypes).forEach((key) => { - if (!tagTypes[key]) return; - const label = tagTypes[key].label; - const color = tagTypes[key].color; - selectArray.push({ - label: {label}, - value: key, - }); - }); - return selectArray; -} diff --git a/apps/web-antd/src/components/tinymce/index.ts b/apps/web-antd/src/components/tinymce/index.ts deleted file mode 100644 index bc00d6b2..00000000 --- a/apps/web-antd/src/components/tinymce/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { withInstall } from '#/utils'; - -import tinymce from './src/editor.vue'; - -export const Tinymce = withInstall(tinymce); diff --git a/apps/web-antd/src/components/tinymce/src/helper.ts b/apps/web-antd/src/components/tinymce/src/helper.ts deleted file mode 100644 index e169f501..00000000 --- a/apps/web-antd/src/components/tinymce/src/helper.ts +++ /dev/null @@ -1,85 +0,0 @@ -const validEvents = new Set([ - 'onActivate', - 'onAddUndo', - 'onBeforeAddUndo', - 'onBeforeExecCommand', - 'onBeforeGetContent', - 'onBeforeRenderUI', - 'onBeforeSetContent', - 'onBeforePaste', - 'onBlur', - 'onChange', - 'onClearUndos', - 'onClick', - 'onContextMenu', - 'onCopy', - 'onCut', - 'onDblclick', - 'onDeactivate', - 'onDirty', - 'onDrag', - 'onDragDrop', - 'onDragEnd', - 'onDragGesture', - 'onDragOver', - 'onDrop', - 'onExecCommand', - 'onFocus', - 'onFocusIn', - 'onFocusOut', - 'onGetContent', - 'onHide', - 'onInit', - 'onKeyDown', - 'onKeyPress', - 'onKeyUp', - 'onLoadContent', - 'onMouseDown', - 'onMouseEnter', - 'onMouseLeave', - 'onMouseMove', - 'onMouseOut', - 'onMouseOver', - 'onMouseUp', - 'onNodeChange', - 'onObjectResizeStart', - 'onObjectResized', - 'onObjectSelected', - 'onPaste', - 'onPostProcess', - 'onPostRender', - 'onPreProcess', - 'onProgressState', - 'onRedo', - 'onRemove', - 'onReset', - 'onSaveContent', - 'onSelectionChange', - 'onSetAttrib', - 'onSetContent', - 'onShow', - 'onSubmit', - 'onUndo', - 'onVisualAid', -]); - -const isValidKey = (key: string) => validEvents.has(key); - -export const bindHandlers = ( - initEvent: Event, - listeners: any, - editor: any, -): void => { - Object.keys(listeners) - .filter((element) => isValidKey(element)) - .forEach((key: string) => { - const handler = listeners[key]; - if (typeof handler === 'function') { - if (key === 'onInit') { - handler(initEvent, editor); - } else { - editor.on(key.slice(2), (e: any) => handler(e, editor)); - } - } - }); -}; diff --git a/apps/web-antd/src/components/tinymce/src/img-upload.vue b/apps/web-antd/src/components/tinymce/src/img-upload.vue deleted file mode 100644 index 441b9fee..00000000 --- a/apps/web-antd/src/components/tinymce/src/img-upload.vue +++ /dev/null @@ -1,115 +0,0 @@ - - - - diff --git a/apps/web-antd/src/components/tinymce/src/tinymce.ts b/apps/web-antd/src/components/tinymce/src/tinymce.ts deleted file mode 100644 index eb3964a6..00000000 --- a/apps/web-antd/src/components/tinymce/src/tinymce.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Any plugins you want to setting has to be imported -// Detail plugins list see https://www.tinymce.com/docs/plugins/ -// Custom builds see https://www.tinymce.com/download/custom-builds/ -// colorpicker/contextmenu/textcolor plugin is now built in to the core editor, please remove it from your editor configuration - -// quickbars 快捷栏 -export const plugins = - 'preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap emoticons accordion'; - -export const toolbar = - 'undo redo | accordion accordionremove | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl'; diff --git a/internal/lint-configs/prettier-config/package.json b/internal/lint-configs/prettier-config/package.json index 50693636..9efb3e95 100644 --- a/internal/lint-configs/prettier-config/package.json +++ b/internal/lint-configs/prettier-config/package.json @@ -22,6 +22,7 @@ } }, "dependencies": { + "@vben/prettier-config": "file:", "prettier": "^3.3.3", "prettier-plugin-tailwindcss": "^0.6.6" } -- Gitee From 59af57644be6114fadc3a28e030ce44c6f656c8f Mon Sep 17 00:00:00 2001 From: XiaLangQing <413901125@qq.com> Date: Fri, 13 Sep 2024 16:17:54 +0800 Subject: [PATCH 04/19] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E5=9C=86=E8=A7=92=E6=A0=B7=E5=BC=8F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/styles/src/antd/index.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/styles/src/antd/index.css b/packages/styles/src/antd/index.css index 77df64fd..9564a0f8 100644 --- a/packages/styles/src/antd/index.css +++ b/packages/styles/src/antd/index.css @@ -11,3 +11,7 @@ .ant-notification-notice { @apply dark:border-border/60 dark:border; } + +:root { + --ad-border-radius: 5px; +} -- Gitee From 990c7c903838d0edd7679bf791bd630c7b693ed7 Mon Sep 17 00:00:00 2001 From: XiaLangQing <413901125@qq.com> Date: Wed, 18 Sep 2024 17:05:38 +0800 Subject: [PATCH 05/19] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E5=9C=86=E8=A7=92=E6=A0=B7=E5=BC=8F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/styles/src/antd/index.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/styles/src/antd/index.css b/packages/styles/src/antd/index.css index b6246ea4..82f2d848 100644 --- a/packages/styles/src/antd/index.css +++ b/packages/styles/src/antd/index.css @@ -15,3 +15,7 @@ .ant-app .form-valid-error .ant-select-selector { border-color: hsl(var(--destructive)); } + +:root { + --ad-border-radius: 5px; +} -- Gitee From 3b97cf48d6c226192da4e3bd35e8776cbd6e1c2b Mon Sep 17 00:00:00 2001 From: liangqing xia <413901125@qq.com> Date: Sun, 6 Oct 2024 10:38:28 +0800 Subject: [PATCH 06/19] =?UTF-8?q?=E5=90=88=E5=B9=B6bell=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/backend-mock/api/menu/all.ts | 2 +- apps/backend-mock/api/table/list.ts | 48 + apps/backend-mock/api/user/info.ts | 1 - apps/backend-mock/package.json | 1 + apps/backend-mock/utils/response.ts | 36 + apps/web-antd/package.json | 2 +- apps/web-antd/src/adapter/index.ts | 1 + apps/web-antd/src/adapter/vxe-table.ts | 89 + .../src/api/monitor/logininfo/index.ts | 2 +- apps/web-antd/src/api/monitor/online/index.ts | 10 +- apps/web-antd/src/api/system/dept/index.ts | 4 +- .../web-antd/src/api/system/dict/dict-type.ts | 8 +- apps/web-antd/src/api/system/menu/index.ts | 4 +- apps/web-antd/src/api/system/notice/index.ts | 4 +- apps/web-antd/src/api/system/oss/index.ts | 53 + apps/web-antd/src/api/system/oss/model.d.ts | 28 + .../src/api/system/tenant-package/index.ts | 6 +- apps/web-antd/src/components/table/index.ts | 1 + .../src/components/table/src/table-switch.vue | 82 + apps/web-antd/src/router/routes/local.ts | 2 +- .../profile/components/online-device.vue | 51 +- .../src/views/_core/profile/index.vue | 7 +- .../src/views/monitor/logininfor/data.tsx | 90 +- .../src/views/monitor/logininfor/index.vue | 203 +- .../web-antd/src/views/monitor/online/data.ts | 71 +- .../src/views/monitor/online/index.vue | 79 +- .../src/views/monitor/operlog/data.tsx | 76 +- .../src/views/monitor/operlog/index.vue | 180 +- .../web-antd/src/views/system/client/data.tsx | 74 +- .../src/views/system/client/index.vue | 201 +- apps/web-antd/src/views/system/config/data.ts | 44 +- .../src/views/system/config/index.vue | 257 +- apps/web-antd/src/views/system/dept/data.ts | 53 +- apps/web-antd/src/views/system/dept/index.vue | 163 +- .../src/views/system/dict/data/data.ts | 42 +- .../src/views/system/dict/data/index.vue | 219 +- apps/web-antd/src/views/system/dict/index.vue | 15 +- .../src/views/system/dict/type/data.ts | 29 +- .../system/dict/type/dict-type-modal.vue | 79 + .../src/views/system/dict/type/index.vue | 223 +- apps/web-antd/src/views/system/menu/data.tsx | 97 +- apps/web-antd/src/views/system/menu/index.vue | 154 +- apps/web-antd/src/views/system/notice/data.ts | 47 +- .../src/views/system/notice/index.vue | 188 +- .../src/views/system/oss-config/data.tsx | 54 +- .../src/views/system/oss-config/index.vue | 200 +- apps/web-antd/src/views/system/oss/data.tsx | 46 +- apps/web-antd/src/views/system/oss/index.vue | 224 +- apps/web-antd/src/views/system/post/data.ts | 47 +- apps/web-antd/src/views/system/post/index.vue | 215 +- .../src/views/system/post/post-drawer.vue | 1 + apps/web-antd/src/views/system/role/data.tsx | 56 +- apps/web-antd/src/views/system/role/index.vue | 290 +- .../web-antd/src/views/system/tenant/data.tsx | 44 +- .../src/views/system/tenant/index.vue | 215 +- .../src/views/system/tenantPackage/data.ts | 26 +- .../src/views/system/tenantPackage/index.vue | 192 +- apps/web-antd/src/views/system/user/data.tsx | 63 +- .../src/views/system/user/dept-tree.vue | 3 + apps/web-antd/src/views/system/user/index.vue | 330 +- apps/web-antd/src/views/system/user/info.tsx | 4 +- .../src/views/system/user/user-info-modal.vue | 2 +- .../system/user/user-reset-pwd-modal.vue | 20 +- apps/web-antd/src/views/tool/gen/data.tsx | 33 +- .../views/tool/gen/edit-steps/gen-config.vue | 37 +- .../views/tool/gen/edit-steps/gen-data.tsx | 327 +- apps/web-antd/src/views/tool/gen/index.vue | 297 +- .../src/views/tool/gen/table-import-modal.vue | 126 + apps/web-antd/types/global-components.d.ts | 8 + apps/web-ele/package.json | 2 +- apps/web-ele/src/adapter/index.ts | 1 + apps/web-ele/src/adapter/vxe-table.ts | 60 + apps/web-ele/src/api/core/auth.ts | 4 +- apps/web-naive/package.json | 2 +- apps/web-naive/src/adapter/form.ts | 3 + apps/web-naive/src/adapter/index.ts | 1 + apps/web-naive/src/adapter/vxe-table.ts | 59 + apps/web-naive/src/api/core/auth.ts | 4 +- cspell.json | 3 +- docs/package.json | 4 +- docs/src/components/common-ui/vben-form.md | 1 + docs/src/en/guide/essentials/development.md | 2 +- docs/src/guide/essentials/development.md | 2 +- .../commitlint-config/package.json | 2 +- .../eslint-config/src/configs/unicorn.ts | 1 + .../stylelint-config/package.json | 2 +- internal/node-utils/package.json | 2 +- internal/tailwind-config/package.json | 2 +- internal/tailwind-config/src/index.ts | 5 +- internal/tsconfig/package.json | 2 +- internal/vite-config/package.json | 5 +- .../vite-config/src/config/application.ts | 1 + internal/vite-config/src/plugins/index.ts | 8 + internal/vite-config/src/plugins/vxe-table.ts | 20 + internal/vite-config/src/typing.ts | 2 + package.json | 12 +- packages/@core/base/design/package.json | 2 +- .../design/src/design-tokens/dark/index.css | 6 + .../src/design-tokens/default/index.css | 7 +- packages/@core/base/icons/build.config.ts | 16 +- packages/@core/base/icons/package.json | 2 +- .../@core/base/icons/src/components/empty.vue | 27 + packages/@core/base/icons/src/index.ts | 3 +- packages/@core/base/shared/package.json | 2 +- .../base/shared/src/constants/globals.ts | 10 +- packages/@core/base/shared/src/utils/dom.ts | 8 + packages/@core/base/typings/package.json | 2 +- packages/@core/composables/package.json | 2 +- packages/@core/composables/src/index.ts | 2 +- .../@core/composables/src/use-layout-style.ts | 87 + .../__snapshots__/config.test.ts.snap | 2 +- packages/@core/preferences/package.json | 2 +- packages/@core/preferences/src/config.ts | 2 +- .../@core/preferences/src/use-preferences.ts | 5 + .../ui-kit/form-ui/__tests__/form-api.test.ts | 2 +- .../form-ui/src/components/form-actions.vue | 22 +- packages/@core/ui-kit/form-ui/src/config.ts | 9 +- packages/@core/ui-kit/form-ui/src/form-api.ts | 4 +- .../form-ui/src/form-render/form-field.vue | 7 +- .../ui-kit/form-ui/src/form-render/form.vue | 2 + packages/@core/ui-kit/form-ui/src/types.ts | 14 + .../@core/ui-kit/form-ui/src/use-vben-form.ts | 2 +- .../ui-kit/form-ui/src/vben-use-form.vue | 15 + packages/@core/ui-kit/layout-ui/package.json | 2 +- .../src/components/layout-content.vue | 4 +- .../ui-kit/layout-ui/src/vben-layout.vue | 29 +- packages/@core/ui-kit/menu-ui/build.config.ts | 7 - packages/@core/ui-kit/menu-ui/package.json | 2 +- .../@core/ui-kit/shadcn-ui/build.config.ts | 7 - packages/@core/ui-kit/shadcn-ui/package.json | 2 +- .../src/components/pagination/pagination.vue | 14 +- .../src/components/spinner/loading.vue | 2 +- .../src/components/spinner/spinner.vue | 2 +- packages/@core/ui-kit/tabs-ui/package.json | 2 +- packages/constants/package.json | 2 +- packages/effects/access/package.json | 2 +- packages/effects/common-ui/package.json | 2 +- .../components/page/__tests__/page.test.ts | 2 +- .../common-ui/src/components/page/page.vue | 81 +- packages/effects/hooks/package.json | 2 +- .../effects/hooks/src/use-design-tokens.ts | 8 +- packages/effects/layouts/package.json | 2 +- .../layouts/src/basic/content/content.vue | 11 +- .../widgets/global-search/search-panel.vue | 2 +- .../widgets/user-dropdown/user-dropdown.vue | 11 +- packages/effects/plugins/package.json | 18 +- packages/effects/plugins/postcss.config.mjs | 1 + packages/effects/plugins/src/vxe-table/api.ts | 111 + .../effects/plugins/src/vxe-table/index.ts | 4 + .../effects/plugins/src/vxe-table/init.ts | 122 + .../effects/plugins/src/vxe-table/theme.css | 82 + .../effects/plugins/src/vxe-table/types.ts | 53 + .../plugins/src/vxe-table/use-vxe-grid.ts | 42 + .../plugins/src/vxe-table/use-vxe-grid.vue | 279 + packages/effects/plugins/tailwind.config.mjs | 1 + packages/effects/request/package.json | 2 +- packages/icons/package.json | 2 +- packages/locales/package.json | 2 +- packages/locales/src/langs/en-US.json | 3 +- packages/locales/src/langs/zh-CN.json | 3 +- packages/preferences/package.json | 2 +- packages/stores/package.json | 2 +- packages/stores/src/modules/tabbar.ts | 2 +- packages/stores/src/modules/user.ts | 1 + packages/styles/package.json | 2 +- packages/styles/src/antd/index.css | 14 + packages/types/package.json | 2 +- packages/utils/package.json | 2 +- packages/utils/src/index.ts | 1 + playground/src/adapter/index.ts | 1 + playground/src/adapter/vxe-table.ts | 59 + playground/src/api/core/auth.ts | 4 +- playground/src/api/examples/index.ts | 2 + playground/src/api/examples/status.ts | 10 + playground/src/api/examples/table.ts | 18 + playground/src/api/index.ts | 2 +- playground/src/locales/langs/en-US.json | 12 + playground/src/locales/langs/zh-CN.json | 12 + .../src/router/routes/modules/examples.ts | 84 +- playground/src/views/examples/doc-button.vue | 2 +- playground/src/views/examples/form/basic.vue | 5 + .../src/views/examples/vxe-table/basic.vue | 93 + .../views/examples/vxe-table/custom-cell.vue | 110 + .../views/examples/vxe-table/edit-cell.vue | 57 + .../src/views/examples/vxe-table/edit-row.vue | 94 + .../src/views/examples/vxe-table/fixed.vue | 64 + .../src/views/examples/vxe-table/form.vue | 102 + .../src/views/examples/vxe-table/remote.vue | 65 + .../views/examples/vxe-table/table-data.ts | 172 + .../src/views/examples/vxe-table/tree.vue | 59 + .../src/views/examples/vxe-table/virtual.vue | 63 + pnpm-lock.yaml | 5082 ++++++++--------- pnpm-workspace.yaml | 32 +- scripts/turbo-run/package.json | 2 +- scripts/turbo-run/src/run.ts | 1 + scripts/vsh/package.json | 2 +- turbo.json | 3 - 197 files changed, 9783 insertions(+), 3742 deletions(-) create mode 100644 apps/backend-mock/api/table/list.ts create mode 100644 apps/web-antd/src/adapter/vxe-table.ts create mode 100644 apps/web-antd/src/api/system/oss/index.ts create mode 100644 apps/web-antd/src/api/system/oss/model.d.ts create mode 100644 apps/web-antd/src/components/table/index.ts create mode 100644 apps/web-antd/src/components/table/src/table-switch.vue create mode 100644 apps/web-antd/src/views/system/dict/type/dict-type-modal.vue create mode 100644 apps/web-antd/src/views/tool/gen/table-import-modal.vue create mode 100644 apps/web-antd/types/global-components.d.ts create mode 100644 apps/web-ele/src/adapter/vxe-table.ts create mode 100644 apps/web-naive/src/adapter/vxe-table.ts create mode 100644 internal/vite-config/src/plugins/vxe-table.ts create mode 100644 packages/@core/base/icons/src/components/empty.vue create mode 100644 packages/@core/composables/src/use-layout-style.ts create mode 100644 packages/effects/plugins/postcss.config.mjs create mode 100644 packages/effects/plugins/src/vxe-table/api.ts create mode 100644 packages/effects/plugins/src/vxe-table/index.ts create mode 100644 packages/effects/plugins/src/vxe-table/init.ts create mode 100644 packages/effects/plugins/src/vxe-table/theme.css create mode 100644 packages/effects/plugins/src/vxe-table/types.ts create mode 100644 packages/effects/plugins/src/vxe-table/use-vxe-grid.ts create mode 100644 packages/effects/plugins/src/vxe-table/use-vxe-grid.vue create mode 100644 packages/effects/plugins/tailwind.config.mjs create mode 100644 playground/src/adapter/vxe-table.ts create mode 100644 playground/src/api/examples/index.ts create mode 100644 playground/src/api/examples/status.ts create mode 100644 playground/src/api/examples/table.ts create mode 100644 playground/src/views/examples/vxe-table/basic.vue create mode 100644 playground/src/views/examples/vxe-table/custom-cell.vue create mode 100644 playground/src/views/examples/vxe-table/edit-cell.vue create mode 100644 playground/src/views/examples/vxe-table/edit-row.vue create mode 100644 playground/src/views/examples/vxe-table/fixed.vue create mode 100644 playground/src/views/examples/vxe-table/form.vue create mode 100644 playground/src/views/examples/vxe-table/remote.vue create mode 100644 playground/src/views/examples/vxe-table/table-data.ts create mode 100644 playground/src/views/examples/vxe-table/tree.vue create mode 100644 playground/src/views/examples/vxe-table/virtual.vue diff --git a/apps/backend-mock/api/menu/all.ts b/apps/backend-mock/api/menu/all.ts index b27b7ea4..580cee4f 100644 --- a/apps/backend-mock/api/menu/all.ts +++ b/apps/backend-mock/api/menu/all.ts @@ -1,7 +1,7 @@ import { verifyAccessToken } from '~/utils/jwt-utils'; import { unAuthorizedResponse } from '~/utils/response'; -export default eventHandler((event) => { +export default eventHandler(async (event) => { const userinfo = verifyAccessToken(event); if (!userinfo) { return unAuthorizedResponse(event); diff --git a/apps/backend-mock/api/table/list.ts b/apps/backend-mock/api/table/list.ts new file mode 100644 index 00000000..4a0db94e --- /dev/null +++ b/apps/backend-mock/api/table/list.ts @@ -0,0 +1,48 @@ +import { faker } from '@faker-js/faker'; +import { verifyAccessToken } from '~/utils/jwt-utils'; +import { unAuthorizedResponse } from '~/utils/response'; + +function generateMockDataList(count: number) { + const dataList = []; + + for (let i = 0; i < count; i++) { + const dataItem = { + id: faker.string.uuid(), + imageUrl: faker.image.avatar(), + imageUrl2: faker.image.avatar(), + open: faker.datatype.boolean(), + status: faker.helpers.arrayElement(['success', 'error', 'warning']), + productName: faker.commerce.productName(), + price: faker.commerce.price(), + currency: faker.finance.currencyCode(), + quantity: faker.number.int({ min: 1, max: 100 }), + available: faker.datatype.boolean(), + category: faker.commerce.department(), + releaseDate: faker.date.past(), + rating: faker.number.float({ min: 1, max: 5 }), + description: faker.commerce.productDescription(), + weight: faker.number.float({ min: 0.1, max: 10 }), + color: faker.color.human(), + inProduction: faker.datatype.boolean(), + tags: Array.from({ length: 3 }, () => faker.commerce.productAdjective()), + }; + + dataList.push(dataItem); + } + + return dataList; +} + +const mockData = generateMockDataList(100); + +export default eventHandler(async (event) => { + const userinfo = verifyAccessToken(event); + if (!userinfo) { + return unAuthorizedResponse(event); + } + + await sleep(600); + + const { page, pageSize } = getQuery(event); + return usePageResponseSuccess(page as string, pageSize as string, mockData); +}); diff --git a/apps/backend-mock/api/user/info.ts b/apps/backend-mock/api/user/info.ts index e3526ae5..cfa2346c 100644 --- a/apps/backend-mock/api/user/info.ts +++ b/apps/backend-mock/api/user/info.ts @@ -6,6 +6,5 @@ export default eventHandler((event) => { if (!userinfo) { return unAuthorizedResponse(event); } - return useResponseSuccess(userinfo); }); diff --git a/apps/backend-mock/package.json b/apps/backend-mock/package.json index 2700d89c..cc0b8d53 100644 --- a/apps/backend-mock/package.json +++ b/apps/backend-mock/package.json @@ -10,6 +10,7 @@ "start": "nitro dev" }, "dependencies": { + "@faker-js/faker": "catalog:", "jsonwebtoken": "catalog:", "nitropack": "catalog:" }, diff --git a/apps/backend-mock/utils/response.ts b/apps/backend-mock/utils/response.ts index dea14724..aa6d18cc 100644 --- a/apps/backend-mock/utils/response.ts +++ b/apps/backend-mock/utils/response.ts @@ -9,6 +9,27 @@ export function useResponseSuccess(data: T) { }; } +export function usePageResponseSuccess( + page: number | string, + pageSize: number | string, + list: T[], + { message = 'ok' } = {}, +) { + const pageData = pagination( + Number.parseInt(`${page}`), + Number.parseInt(`${pageSize}`), + list, + ); + + return { + ...useResponseSuccess({ + items: pageData, + total: list.length, + }), + message, + }; +} + export function useResponseError(message: string, error: any = null) { return { code: -1, @@ -27,3 +48,18 @@ export function unAuthorizedResponse(event: H3Event) { setResponseStatus(event, 401); return useResponseError('UnauthorizedException', 'Unauthorized Exception'); } + +export function sleep(ms: number) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +export function pagination( + pageNo: number, + pageSize: number, + array: T[], +): T[] { + const offset = (pageNo - 1) * Number(pageSize); + return offset + Number(pageSize) >= array.length + ? array.slice(offset) + : array.slice(offset, offset + Number(pageSize)); +} diff --git a/apps/web-antd/package.json b/apps/web-antd/package.json index b73d6644..48a8d727 100644 --- a/apps/web-antd/package.json +++ b/apps/web-antd/package.json @@ -1,6 +1,6 @@ { "name": "@vben/web-antd", - "version": "5.3.1", + "version": "5.3.2", "homepage": "https://vben.pro", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/apps/web-antd/src/adapter/index.ts b/apps/web-antd/src/adapter/index.ts index 698d687b..6a9391be 100644 --- a/apps/web-antd/src/adapter/index.ts +++ b/apps/web-antd/src/adapter/index.ts @@ -1 +1,2 @@ export * from './form'; +export * from './vxe-table'; diff --git a/apps/web-antd/src/adapter/vxe-table.ts b/apps/web-antd/src/adapter/vxe-table.ts new file mode 100644 index 00000000..2a2d56b8 --- /dev/null +++ b/apps/web-antd/src/adapter/vxe-table.ts @@ -0,0 +1,89 @@ +import { h } from 'vue'; + +import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table'; + +import { Button, Image } from 'ant-design-vue'; + +import { renderDict } from '#/utils/render'; + +import { useVbenForm } from './form'; + +setupVbenVxeTable({ + configVxeTable: (vxeUI) => { + vxeUI.setConfig({ + grid: { + align: 'center', + border: true, + minHeight: 180, + proxyConfig: { + autoLoad: true, + response: { + result: 'rows', + total: 'total', + list: 'rows', + }, + showActiveMsg: true, + showResponseMsg: false, + }, + columnConfig: { + resizable: true, + }, + toolbarConfig: { + // 自定义列 + custom: true, + // 最大化 + zoom: true, + // 刷新 + refresh: true, + }, + round: true, + size: 'medium', + }, + }); + + // 表格配置项可以用 cellRender: { name: 'CellImage' }, + vxeUI.renderer.add('CellImage', { + renderDefault(_renderOpts, params) { + const { column, row } = params; + return h(Image, { src: row[column.field] }); + }, + }); + + // 表格配置项可以用 cellRender: { name: 'CellLink' }, + vxeUI.renderer.add('CellLink', { + renderDefault(renderOpts) { + const { props } = renderOpts; + return h( + Button, + { size: 'small', type: 'link' }, + { default: () => props?.text }, + ); + }, + }); + + /** + * 表格dict渲染 必传 props: { field: 参数名, dictName: 字典名 } + */ + vxeUI.renderer.add('DictTag', { + renderDefault(renderOpts, params) { + const { props } = renderOpts; + const field = props?.field; + const dictName = props?.dictName; + if (!field || !dictName) { + console.warn('DictTag: field or dictName is not provided'); + return 'error'; + } + const { row } = params; + return renderDict(row[field], dictName); + }, + }); + + // 这里可以自行扩展 vxe-table 的全局配置,比如自定义格式化 + // vxeUI.formats.add + }, + useVbenForm, +}); + +export { useVbenVxeGrid }; + +export type * from '@vben/plugins/vxe-table'; diff --git a/apps/web-antd/src/api/monitor/logininfo/index.ts b/apps/web-antd/src/api/monitor/logininfo/index.ts index 59aa0c90..4ca071b2 100644 --- a/apps/web-antd/src/api/monitor/logininfo/index.ts +++ b/apps/web-antd/src/api/monitor/logininfo/index.ts @@ -37,7 +37,7 @@ export function loginInfoExport(data: any) { * @returns void */ export function loginInfoRemove(infoIds: IDS) { - return requestClient.deleteWithMsg(`${Api.root}/${infoIds.join(',')}`); + return requestClient.deleteWithMsg(`${Api.root}/${infoIds}`); } /** diff --git a/apps/web-antd/src/api/monitor/online/index.ts b/apps/web-antd/src/api/monitor/online/index.ts index 88289775..4d8224a2 100644 --- a/apps/web-antd/src/api/monitor/online/index.ts +++ b/apps/web-antd/src/api/monitor/online/index.ts @@ -1,6 +1,6 @@ import type { OnlineUser } from './model'; -import type { PageQuery } from '#/api/common'; +import type { PageQuery, PageResult } from '#/api/common'; import { requestClient } from '#/api/request'; @@ -14,11 +14,11 @@ enum Api { * @returns OnlineUser[] */ export function onlineDeviceList() { - return requestClient.get(Api.root); + return requestClient.get>(Api.root); } export function onlineList(params?: PageQuery) { - return requestClient.get(Api.onlineList, { params }); + return requestClient.get>(Api.onlineList, { params }); } /** @@ -27,7 +27,7 @@ export function onlineList(params?: PageQuery) { * @returns void */ export function forceLogout(tokenId: string) { - return requestClient.delete(`${Api.root}/${tokenId}`); + return requestClient.deleteWithMsg(`${Api.root}/${tokenId}`); } /** @@ -36,5 +36,5 @@ export function forceLogout(tokenId: string) { * @returns void */ export function forceLogout2(tokenId: string) { - return requestClient.post(`${Api.root}/${tokenId}`); + return requestClient.postWithMsg(`${Api.root}/${tokenId}`); } diff --git a/apps/web-antd/src/api/system/dept/index.ts b/apps/web-antd/src/api/system/dept/index.ts index 3b5e44a4..7557537d 100644 --- a/apps/web-antd/src/api/system/dept/index.ts +++ b/apps/web-antd/src/api/system/dept/index.ts @@ -1,6 +1,6 @@ import type { Dept } from './model'; -import type { ID, PageQuery } from '#/api/common'; +import type { ID } from '#/api/common'; import { requestClient } from '#/api/request'; @@ -10,7 +10,7 @@ enum Api { root = '/system/dept', } -export function deptList(params?: PageQuery) { +export function deptList(params?: any) { return requestClient.get(Api.deptList, { params }); } diff --git a/apps/web-antd/src/api/system/dict/dict-type.ts b/apps/web-antd/src/api/system/dict/dict-type.ts index 2f5576de..cbb5e92a 100644 --- a/apps/web-antd/src/api/system/dict/dict-type.ts +++ b/apps/web-antd/src/api/system/dict/dict-type.ts @@ -1,6 +1,6 @@ import type { DictType } from './dict-type-model'; -import type { ID, IDS, PageQuery } from '#/api/common'; +import type { ID, IDS, PageQuery, PageResult } from '#/api/common'; import { commonExport } from '#/api/helper'; import { requestClient } from '#/api/request'; @@ -18,8 +18,8 @@ enum Api { * @param params 请求参数 * @returns list */ -export function dictList(params?: PageQuery) { - return requestClient.get(Api.dictTypeList, { params }); +export function dictTypeList(params?: PageQuery) { + return requestClient.get>(Api.dictTypeList, { params }); } /** @@ -27,7 +27,7 @@ export function dictList(params?: PageQuery) { * @param data 表单参数 * @returns blob */ -export function dictExport(data: any) { +export function dictTypeExport(data: any) { return commonExport(Api.dictTypeExport, data); } diff --git a/apps/web-antd/src/api/system/menu/index.ts b/apps/web-antd/src/api/system/menu/index.ts index 7754e730..65c3b4f9 100644 --- a/apps/web-antd/src/api/system/menu/index.ts +++ b/apps/web-antd/src/api/system/menu/index.ts @@ -1,6 +1,6 @@ import type { Menu, MenuOption, MenuResp } from './model'; -import type { ID, IDS, PageQuery } from '#/api/common'; +import type { ID, IDS } from '#/api/common'; import { requestClient } from '#/api/request'; @@ -12,7 +12,7 @@ enum Api { tenantPackageMenuTreeselect = '/system/menu/tenantPackageMenuTreeselect', } -export function menuList(params?: PageQuery) { +export function menuList(params?: any) { return requestClient.get(Api.menuList, { params }); } diff --git a/apps/web-antd/src/api/system/notice/index.ts b/apps/web-antd/src/api/system/notice/index.ts index 6a8e2d15..82877943 100644 --- a/apps/web-antd/src/api/system/notice/index.ts +++ b/apps/web-antd/src/api/system/notice/index.ts @@ -26,7 +26,5 @@ export function noticeUpdate(data: any) { } export function noticeRemove(noticeIds: IDS) { - return requestClient.deleteWithMsg( - `${Api.root}/${noticeIds.join(',')}`, - ); + return requestClient.deleteWithMsg(`${Api.root}/${noticeIds}`); } diff --git a/apps/web-antd/src/api/system/oss/index.ts b/apps/web-antd/src/api/system/oss/index.ts new file mode 100644 index 00000000..139b9260 --- /dev/null +++ b/apps/web-antd/src/api/system/oss/index.ts @@ -0,0 +1,53 @@ +import type { OssFile } from './model'; + +import type { ID, IDS, PageQuery, PageResult } from '#/api/common'; + +import { ContentTypeEnum } from '#/api/helper'; +import { requestClient } from '#/api/request'; + +enum Api { + ossDownload = '/resource/oss/download', + ossInfo = '/resource/oss/listByIds', + ossList = '/resource/oss/list', + ossUpload = '/resource/oss/upload', + root = '/resource/oss', +} + +export function ossList(params?: PageQuery) { + return requestClient.get>(Api.ossList, { params }); +} + +export function ossInfo(ossIds: IDS) { + return requestClient.get(`${Api.ossInfo}/${ossIds}`); +} + +/** + * @deprecated + * @param file 文件 + * @returns void + */ +export function ossUpload(file: any) { + const formData = new FormData(); + formData.append('file', file); + return requestClient.postWithMsg(Api.ossUpload, formData, { + headers: { 'Content-Type': ContentTypeEnum.FORM_DATA }, + timeout: 30 * 1000, + }); +} + +/** + * 下载文件 返回为二进制 + * @param ossId ossId + * @returns blob + */ +export function ossDownload(ossId: ID) { + return requestClient.get(`${Api.ossDownload}/${ossId}`, { + responseType: 'blob', + timeout: 30 * 1000, + isTransformResponse: false, + }); +} + +export function ossRemove(ossIds: IDS) { + return requestClient.deleteWithMsg(`${Api.root}/${ossIds}`); +} diff --git a/apps/web-antd/src/api/system/oss/model.d.ts b/apps/web-antd/src/api/system/oss/model.d.ts new file mode 100644 index 00000000..6eb4f371 --- /dev/null +++ b/apps/web-antd/src/api/system/oss/model.d.ts @@ -0,0 +1,28 @@ +export interface OssFile { + ossId: string; + fileName: string; + originalName: string; + fileSuffix: string; + url: string; + createTime: string; + createBy: number; + createByName: string; + service: string; +} + +export interface OssConfig { + ossConfigId: number; + configKey: string; + accessKey: string; + secretKey: string; + bucketName: string; + prefix: string; + endpoint: string; + domain: string; + isHttps: string; + region: string; + status: string; + ext1: string; + remark: string; + accessPolicy: string; +} diff --git a/apps/web-antd/src/api/system/tenant-package/index.ts b/apps/web-antd/src/api/system/tenant-package/index.ts index 4b74faee..1851a7bc 100644 --- a/apps/web-antd/src/api/system/tenant-package/index.ts +++ b/apps/web-antd/src/api/system/tenant-package/index.ts @@ -1,6 +1,6 @@ import type { TenantPackage } from './model'; -import type { ID, IDS, PageQuery } from '#/api/common'; +import type { ID, IDS, PageQuery, PageResult } from '#/api/common'; import { commonExport } from '#/api/helper'; import { requestClient } from '#/api/request'; @@ -14,7 +14,9 @@ enum Api { } export function packageList(params?: PageQuery) { - return requestClient.get(Api.packageList, { params }); + return requestClient.get>(Api.packageList, { + params, + }); } // 下拉框 diff --git a/apps/web-antd/src/components/table/index.ts b/apps/web-antd/src/components/table/index.ts new file mode 100644 index 00000000..28bd800a --- /dev/null +++ b/apps/web-antd/src/components/table/index.ts @@ -0,0 +1 @@ +export { default as TableSwitch } from './src/table-switch.vue'; diff --git a/apps/web-antd/src/components/table/src/table-switch.vue b/apps/web-antd/src/components/table/src/table-switch.vue new file mode 100644 index 00000000..4d945195 --- /dev/null +++ b/apps/web-antd/src/components/table/src/table-switch.vue @@ -0,0 +1,82 @@ + + + diff --git a/apps/web-antd/src/router/routes/local.ts b/apps/web-antd/src/router/routes/local.ts index 3e99e69c..cb2abc80 100644 --- a/apps/web-antd/src/router/routes/local.ts +++ b/apps/web-antd/src/router/routes/local.ts @@ -96,7 +96,7 @@ const profileRoute: RouteRecordStringComponent[] = [ { component: '/system/role-assign/index', meta: { - activePath: '/tool/gen', + activePath: '/system/role', icon: 'mingcute:profile-line', keepAlive: true, title: '分配角色', diff --git a/apps/web-antd/src/views/_core/profile/components/online-device.vue b/apps/web-antd/src/views/_core/profile/components/online-device.vue index 452097f2..a0309d46 100644 --- a/apps/web-antd/src/views/_core/profile/components/online-device.vue +++ b/apps/web-antd/src/views/_core/profile/components/online-device.vue @@ -1,8 +1,53 @@ - + diff --git a/apps/web-antd/src/views/_core/profile/index.vue b/apps/web-antd/src/views/_core/profile/index.vue index 4e595b03..b27d62df 100644 --- a/apps/web-antd/src/views/_core/profile/index.vue +++ b/apps/web-antd/src/views/_core/profile/index.vue @@ -40,7 +40,12 @@ async function handleUploadFinish() { - + diff --git a/apps/web-antd/src/views/monitor/logininfor/data.tsx b/apps/web-antd/src/views/monitor/logininfor/data.tsx index f99a3857..7e2873c7 100644 --- a/apps/web-antd/src/views/monitor/logininfor/data.tsx +++ b/apps/web-antd/src/views/monitor/logininfor/data.tsx @@ -1,11 +1,9 @@ -import type { ColumnsType } from 'ant-design-vue/es/table'; - -import type { FormSchemaGetter } from '#/adapter'; +import type { FormSchemaGetter, VxeGridProps } from '#/adapter'; import type { DescItem } from '#/components/description'; -import { DictEnum } from '@vben/constants'; +import type { VNode } from 'vue'; -import { Tooltip } from 'ant-design-vue'; +import { DictEnum } from '@vben/constants'; import { getDictOptions } from '#/utils/dict'; import { renderBrowserIcon, renderDict, renderOsIcon } from '#/utils/render'; @@ -36,82 +34,74 @@ export const querySchema: FormSchemaGetter = () => [ }, ]; -export const columns: ColumnsType = [ +export const columns: VxeGridProps['columns'] = [ + { type: 'checkbox', width: 60 }, { - align: 'center', - dataIndex: 'userName', title: '用户账号', + field: 'userName', }, { - align: 'center', - dataIndex: 'clientKey', title: '登录平台', + field: 'clientKey', }, { - align: 'center', - dataIndex: 'ipaddr', title: 'IP地址', + field: 'ipaddr', }, { - align: 'center', - dataIndex: 'loginLocation', title: 'IP地点', + field: 'loginLocation', width: 200, }, { - align: 'center', - customRender({ value }) { - return renderBrowserIcon(value, true); - }, - dataIndex: 'browser', title: '浏览器', + field: 'browser', + slots: { + default: ({ row }) => { + return renderBrowserIcon(row.browser, true) as VNode; + }, + }, }, { - align: 'center', - customRender({ value }) { - // Windows 10 or Windows Server 2016 太长了 分割一下 详情依旧能看到详细的 - // 为什么不直接保存userAgent让前端解析 很奇怪 - if (value) { - const split = value.split(' or '); - if (split.length === 2) { - value = split[0]; + title: '系统', + field: 'os', + slots: { + default: ({ row }) => { + // Windows 10 or Windows Server 2016 太长了 分割一下 详情依旧能看到详细的 + let value = row.os; + if (value) { + const split = value.split(' or '); + if (split.length === 2) { + value = split[0]; + } } - } - return renderOsIcon(value, true); + return renderOsIcon(value, true) as VNode; + }, }, - dataIndex: 'os', - title: '系统', }, { - align: 'center', - customRender({ value }) { - return renderDict(value, DictEnum.SYS_COMMON_STATUS); - }, - dataIndex: 'status', title: '登录结果', + field: 'status', + slots: { + default: ({ row }) => { + return renderDict(row.status, DictEnum.SYS_COMMON_STATUS); + }, + }, }, { - align: 'center', - customRender({ value }) { - return ( - - {value} - - ); - }, - dataIndex: 'msg', - ellipsis: true, title: '信息', + field: 'msg', }, { - align: 'center', - dataIndex: 'loginTime', title: '日期', + field: 'loginTime', }, { - align: 'center', - dataIndex: 'action', + field: 'action', + fixed: 'right', + slots: { default: 'action' }, title: '操作', + width: 120, }, ]; diff --git a/apps/web-antd/src/views/monitor/logininfor/index.vue b/apps/web-antd/src/views/monitor/logininfor/index.vue index c954d8f7..090287c5 100644 --- a/apps/web-antd/src/views/monitor/logininfor/index.vue +++ b/apps/web-antd/src/views/monitor/logininfor/index.vue @@ -1,33 +1,87 @@