From 97cb62d6a7824773c8296873f605d99250359703 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Thu, 9 Apr 2026 13:01:46 +0800 Subject: [PATCH 1/5] =?UTF-8?q?refactor(vite):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=87=B3=20Vite=208=20=E9=85=8D=E7=BD=AE=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.ts | 187 +++++++++++++++++++++++-------------------------- 1 file changed, 89 insertions(+), 98 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 71bcd5e2..4dc1b846 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -9,20 +9,20 @@ import { mockDevServerPlugin } from "vite-plugin-mock-dev-server"; import UnoCSS from "unocss/vite"; import { resolve } from "path"; -import { name, version, engines, dependencies, devDependencies } from "./package.json"; +import { name, version } from "./package.json"; -// 平台的名称、版本、运行所需的 node 版本、依赖、构建时间的类型提示 +// 平台名称、版本信息 const __APP_INFO__ = { - pkg: { name, version, engines, dependencies, devDependencies }, + pkg: { name, version }, buildTimestamp: Date.now(), }; -const pathSrc = resolve(__dirname, "src"); +// ESM 模式下使用 import.meta.dirname(Node 20.11+) +const pathSrc = resolve(import.meta.dirname, "src"); // Vite配置 https://cn.vitejs.dev/config export default defineConfig(({ mode }: ConfigEnv): UserConfig => { const env = loadEnv(mode, process.cwd()); - const isProduction = mode === "production"; return { resolve: { @@ -85,7 +85,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { //dts: "src/types/components.d.ts", }), ] as PluginOption[], - // 预加载项目必需的组件 + // 预加载项目必需的依赖 optimizeDeps: { include: [ "vue", @@ -111,112 +111,103 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { "element-plus/es", "element-plus/es/locale/lang/en", "element-plus/es/locale/lang/zh-cn", - "element-plus/es/components/alert/style/index", - "element-plus/es/components/avatar/style/index", - "element-plus/es/components/backtop/style/index", - "element-plus/es/components/badge/style/index", - "element-plus/es/components/base/style/index", - "element-plus/es/components/breadcrumb-item/style/index", - "element-plus/es/components/breadcrumb/style/index", - "element-plus/es/components/button/style/index", - "element-plus/es/components/card/style/index", - "element-plus/es/components/cascader/style/index", - "element-plus/es/components/checkbox-group/style/index", - "element-plus/es/components/checkbox/style/index", - "element-plus/es/components/col/style/index", - "element-plus/es/components/color-picker/style/index", - "element-plus/es/components/config-provider/style/index", - "element-plus/es/components/date-picker/style/index", - "element-plus/es/components/descriptions-item/style/index", - "element-plus/es/components/descriptions/style/index", - "element-plus/es/components/dialog/style/index", - "element-plus/es/components/divider/style/index", - "element-plus/es/components/drawer/style/index", - "element-plus/es/components/dropdown-item/style/index", - "element-plus/es/components/dropdown-menu/style/index", - "element-plus/es/components/dropdown/style/index", - "element-plus/es/components/empty/style/index", - "element-plus/es/components/form-item/style/index", - "element-plus/es/components/form/style/index", - "element-plus/es/components/icon/style/index", - "element-plus/es/components/image-viewer/style/index", - "element-plus/es/components/image/style/index", - "element-plus/es/components/input-number/style/index", - "element-plus/es/components/input-tag/style/index", - "element-plus/es/components/input/style/index", - "element-plus/es/components/link/style/index", - "element-plus/es/components/loading/style/index", - "element-plus/es/components/menu-item/style/index", - "element-plus/es/components/menu/style/index", - "element-plus/es/components/message-box/style/index", - "element-plus/es/components/message/style/index", - "element-plus/es/components/notification/style/index", - "element-plus/es/components/option/style/index", - "element-plus/es/components/pagination/style/index", - "element-plus/es/components/popover/style/index", - "element-plus/es/components/progress/style/index", - "element-plus/es/components/radio-button/style/index", - "element-plus/es/components/radio-group/style/index", - "element-plus/es/components/radio/style/index", - "element-plus/es/components/row/style/index", - "element-plus/es/components/scrollbar/style/index", - "element-plus/es/components/select/style/index", - "element-plus/es/components/skeleton-item/style/index", - "element-plus/es/components/skeleton/style/index", - "element-plus/es/components/step/style/index", - "element-plus/es/components/steps/style/index", - "element-plus/es/components/sub-menu/style/index", - "element-plus/es/components/switch/style/index", - "element-plus/es/components/tab-pane/style/index", - "element-plus/es/components/table-column/style/index", - "element-plus/es/components/table/style/index", - "element-plus/es/components/tabs/style/index", - "element-plus/es/components/tag/style/index", - "element-plus/es/components/text/style/index", - "element-plus/es/components/time-picker/style/index", - "element-plus/es/components/time-select/style/index", - "element-plus/es/components/timeline-item/style/index", - "element-plus/es/components/timeline/style/index", - "element-plus/es/components/tooltip/style/index", - "element-plus/es/components/tree-select/style/index", - "element-plus/es/components/tree/style/index", - "element-plus/es/components/upload/style/index", - "element-plus/es/components/watermark/style/index", - "element-plus/es/components/checkbox-button/style/index", - "element-plus/es/components/space/style/index", + // Element Plus 组件样式预构建(避免按需发现时触发页面重载) + ...[ + "alert", + "avatar", + "backtop", + "badge", + "base", + "breadcrumb", + "breadcrumb-item", + "button", + "card", + "cascader", + "checkbox", + "checkbox-group", + "checkbox-button", + "col", + "color-picker", + "config-provider", + "date-picker", + "descriptions", + "descriptions-item", + "dialog", + "divider", + "drawer", + "dropdown", + "dropdown-item", + "dropdown-menu", + "empty", + "form", + "form-item", + "icon", + "image", + "image-viewer", + "input", + "input-number", + "input-tag", + "link", + "loading", + "menu", + "menu-item", + "message", + "message-box", + "notification", + "option", + "pagination", + "popover", + "progress", + "radio", + "radio-button", + "radio-group", + "row", + "scrollbar", + "select", + "skeleton", + "skeleton-item", + "space", + "step", + "steps", + "sub-menu", + "switch", + "tab-pane", + "table", + "table-column", + "tabs", + "tag", + "text", + "time-picker", + "time-select", + "timeline", + "timeline-item", + "tooltip", + "tree", + "tree-select", + "upload", + "watermark", + ].map((c) => `element-plus/es/components/${c}/style/index`), ], }, - // 构建配置 + // 构建配置(Vite 8 使用 Rolldown + Oxc) build: { - chunkSizeWarningLimit: 2000, // 消除打包大小超过500kb警告 + chunkSizeWarningLimit: 1200, // chunk 大小警告阈值 reportCompressedSize: false, - minify: isProduction ? "terser" : false, // Vite 8 推荐使用 terser 进行生产压缩 - terserOptions: isProduction - ? { - compress: { - drop_console: true, // 生产环境移除 console - drop_debugger: true, // 生产环境移除 debugger - }, - } - : undefined, - rollupOptions: { + cssMinify: "lightningcss", // Vite 8 默认使用 Lightning CSS 压缩 + // minify 默认使用 'oxc',压缩速度比 terser 快 30-90 倍 + rolldownOptions: { output: { - // manualChunks: { - // "vue-i18n": ["vue-i18n"], - // }, - // 用于从入口点创建的块的打包输出格式[name]表示文件名,[hash]表示该文件内容hash值 + // 用于从入口点创建的块的打包输出格式 entryFileNames: "js/[name].[hash].js", // 用于命名代码拆分时创建的共享块的输出命名 chunkFileNames: "js/[name].[hash].js", - // 用于输出静态资源的命名,[ext]表示文件扩展名 + // 用于输出静态资源的命名 assetFileNames: (assetInfo: any) => { - // Vite 8 / Rolldown: 添加空值保护 if (!assetInfo.name) { return "assets/[name].[hash][extname]"; } const info = assetInfo.name.split("."); let extType = info[info.length - 1]; - // console.log('文件信息', assetInfo.name) if (/\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/i.test(assetInfo.name)) { extType = "media"; } else if (/\.(png|jpe?g|gif|svg)(\?.*)?$/.test(assetInfo.name)) { From 3d64ceb761dabf22d5a573f7c6027a0b17712bf7 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Thu, 9 Apr 2026 19:01:42 +0800 Subject: [PATCH 2/5] fix(mock): menu form returns fallback data to avoid edit form crash --- mock/menu.mock.ts | 180 +++++++++++++++++++++++++--------------------- 1 file changed, 100 insertions(+), 80 deletions(-) diff --git a/mock/menu.mock.ts b/mock/menu.mock.ts index 71d6cfdd..73c3242b 100644 --- a/mock/menu.mock.ts +++ b/mock/menu.mock.ts @@ -542,7 +542,7 @@ export default defineMock([ id: 1, parentId: 0, name: "系统管理", - type: "CATALOG", + type: "C", routeName: "", routePath: "/system", component: "Layout", @@ -556,7 +556,7 @@ export default defineMock([ id: 2, parentId: 1, name: "用户管理", - type: "MENU", + type: "M", routeName: "User", routePath: "user", component: "system/user/index", @@ -570,7 +570,7 @@ export default defineMock([ id: 105, parentId: 2, name: "用户查询", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -585,7 +585,7 @@ export default defineMock([ id: 31, parentId: 2, name: "用户新增", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -600,7 +600,7 @@ export default defineMock([ id: 32, parentId: 2, name: "用户编辑", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -615,7 +615,7 @@ export default defineMock([ id: 33, parentId: 2, name: "用户删除", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -630,7 +630,7 @@ export default defineMock([ id: 88, parentId: 2, name: "重置密码", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -645,7 +645,7 @@ export default defineMock([ id: 106, parentId: 2, name: "用户导入", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -660,7 +660,7 @@ export default defineMock([ id: 107, parentId: 2, name: "用户导出", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -677,7 +677,7 @@ export default defineMock([ id: 3, parentId: 1, name: "角色管理", - type: "MENU", + type: "M", routeName: "Role", routePath: "role", component: "system/role/index", @@ -691,7 +691,7 @@ export default defineMock([ id: 70, parentId: 3, name: "角色新增", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -706,7 +706,7 @@ export default defineMock([ id: 71, parentId: 3, name: "角色编辑", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -721,7 +721,7 @@ export default defineMock([ id: 72, parentId: 3, name: "角色删除", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -738,7 +738,7 @@ export default defineMock([ id: 4, parentId: 1, name: "菜单管理", - type: "MENU", + type: "M", routeName: "Menu", routePath: "menu", component: "system/menu/index", @@ -752,7 +752,7 @@ export default defineMock([ id: 73, parentId: 4, name: "菜单新增", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -767,7 +767,7 @@ export default defineMock([ id: 74, parentId: 4, name: "菜单编辑", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -782,7 +782,7 @@ export default defineMock([ id: 75, parentId: 4, name: "菜单删除", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -799,7 +799,7 @@ export default defineMock([ id: 5, parentId: 1, name: "部门管理", - type: "MENU", + type: "M", routeName: "Dept", routePath: "dept", component: "system/dept/index", @@ -813,7 +813,7 @@ export default defineMock([ id: 76, parentId: 5, name: "部门新增", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -828,7 +828,7 @@ export default defineMock([ id: 77, parentId: 5, name: "部门编辑", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -843,7 +843,7 @@ export default defineMock([ id: 78, parentId: 5, name: "部门删除", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -860,7 +860,7 @@ export default defineMock([ id: 6, parentId: 1, name: "字典管理", - type: "MENU", + type: "M", routeName: "Dict", routePath: "dict", component: "system/dict/index", @@ -874,7 +874,7 @@ export default defineMock([ id: 79, parentId: 6, name: "字典新增", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -889,7 +889,7 @@ export default defineMock([ id: 81, parentId: 6, name: "字典编辑", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -904,7 +904,7 @@ export default defineMock([ id: 84, parentId: 6, name: "字典删除", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -921,7 +921,7 @@ export default defineMock([ id: 135, parentId: 1, name: "字典项", - type: "MENU", + type: "M", routeName: "DictData", routePath: "dict-item", component: "system/dict/dict-item", @@ -935,7 +935,7 @@ export default defineMock([ id: 136, parentId: 135, name: "字典项新增", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -950,7 +950,7 @@ export default defineMock([ id: 137, parentId: 135, name: "字典项编辑", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -965,7 +965,7 @@ export default defineMock([ id: 138, parentId: 135, name: "字典项删除", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -982,7 +982,7 @@ export default defineMock([ id: 117, parentId: 1, name: "系统日志", - type: "MENU", + type: "M", routeName: "Log", routePath: "log", component: "system/log/index", @@ -997,7 +997,7 @@ export default defineMock([ id: 120, parentId: 1, name: "系统配置", - type: "MENU", + type: "M", routeName: "Config", routePath: "config", component: "system/config/index", @@ -1011,7 +1011,7 @@ export default defineMock([ id: 121, parentId: 120, name: "查询系统配置", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1026,7 +1026,7 @@ export default defineMock([ id: 122, parentId: 120, name: "新增系统配置", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1041,7 +1041,7 @@ export default defineMock([ id: 123, parentId: 120, name: "修改系统配置", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1056,7 +1056,7 @@ export default defineMock([ id: 124, parentId: 120, name: "删除系统配置", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1071,7 +1071,7 @@ export default defineMock([ id: 125, parentId: 120, name: "刷新系统配置", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1088,7 +1088,7 @@ export default defineMock([ id: 126, parentId: 1, name: "通知公告", - type: "MENU", + type: "M", routeName: "Notice", routePath: "notice", component: "system/notice/index", @@ -1102,7 +1102,7 @@ export default defineMock([ id: 127, parentId: 126, name: "查询", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1117,7 +1117,7 @@ export default defineMock([ id: 128, parentId: 126, name: "新增", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1132,7 +1132,7 @@ export default defineMock([ id: 129, parentId: 126, name: "编辑", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1147,7 +1147,7 @@ export default defineMock([ id: 130, parentId: 126, name: "删除", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1162,7 +1162,7 @@ export default defineMock([ id: 133, parentId: 126, name: "发布", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1177,7 +1177,7 @@ export default defineMock([ id: 134, parentId: 126, name: "撤回", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1196,7 +1196,7 @@ export default defineMock([ id: 118, parentId: 0, name: "系统工具", - type: "CATALOG", + type: "C", routeName: null, routePath: "/codegen", component: "Layout", @@ -1210,7 +1210,7 @@ export default defineMock([ id: 119, parentId: 118, name: "代码生成", - type: "MENU", + type: "M", routeName: "Codegen", routePath: "codegen", component: "codegen/index", @@ -1227,7 +1227,7 @@ export default defineMock([ id: 40, parentId: 0, name: "接口文档", - type: "CATALOG", + type: "C", routeName: null, routePath: "/api", component: "Layout", @@ -1241,7 +1241,7 @@ export default defineMock([ id: 41, parentId: 40, name: "Apifox", - type: "MENU", + type: "M", routeName: null, routePath: "apifox", component: "demo/api/apifox", @@ -1258,7 +1258,7 @@ export default defineMock([ id: 26, parentId: 0, name: "平台文档", - type: "CATALOG", + type: "C", routeName: null, routePath: "/doc", component: "Layout", @@ -1304,7 +1304,7 @@ export default defineMock([ id: 20, parentId: 0, name: "多级菜单", - type: "CATALOG", + type: "C", routeName: null, routePath: "/multi-level", component: "Layout", @@ -1318,7 +1318,7 @@ export default defineMock([ id: 21, parentId: 20, name: "菜单一级", - type: "CATALOG", + type: "C", routeName: null, routePath: "multi-level1", component: "Layout", @@ -1332,7 +1332,7 @@ export default defineMock([ id: 22, parentId: 21, name: "菜单二级", - type: "CATALOG", + type: "C", routeName: null, routePath: "multi-level2", component: "Layout", @@ -1346,7 +1346,7 @@ export default defineMock([ id: 23, parentId: 22, name: "菜单三级-1", - type: "MENU", + type: "M", routeName: null, routePath: "multi-level3-1", component: "demo/multi-level/children/children/level3-1", @@ -1361,7 +1361,7 @@ export default defineMock([ id: 24, parentId: 22, name: "菜单三级-2", - type: "MENU", + type: "M", routeName: null, routePath: "multi-level3-2", component: "demo/multi-level/children/children/level3-2", @@ -1382,7 +1382,7 @@ export default defineMock([ id: 36, parentId: 0, name: "组件封装", - type: "CATALOG", + type: "C", routeName: null, routePath: "/component", component: "Layout", @@ -1396,7 +1396,7 @@ export default defineMock([ id: 108, parentId: 36, name: "增删改查", - type: "MENU", + type: "M", routeName: null, routePath: "curd", component: "demo/curd/index", @@ -1411,7 +1411,7 @@ export default defineMock([ id: 109, parentId: 36, name: "列表选择器", - type: "MENU", + type: "M", routeName: null, routePath: "table-select", component: "demo/table-select/index", @@ -1426,7 +1426,7 @@ export default defineMock([ id: 37, parentId: 36, name: "富文本编辑器", - type: "MENU", + type: "M", routeName: null, routePath: "wang-editor", component: "demo/wang-editor", @@ -1441,7 +1441,7 @@ export default defineMock([ id: 38, parentId: 36, name: "图片上传", - type: "MENU", + type: "M", routeName: null, routePath: "upload", component: "demo/upload", @@ -1456,7 +1456,7 @@ export default defineMock([ id: 95, parentId: 36, name: "字典组件", - type: "MENU", + type: "M", routeName: null, routePath: "dict-demo", component: "demo/dict", @@ -1471,7 +1471,7 @@ export default defineMock([ id: 39, parentId: 36, name: "图标选择器", - type: "MENU", + type: "M", routeName: null, routePath: "icon-selector", component: "demo/icon-selector", @@ -1488,7 +1488,7 @@ export default defineMock([ id: 110, parentId: 0, name: "路由参数", - type: "CATALOG", + type: "C", routeName: null, routePath: "/route-param", component: "Layout", @@ -1502,7 +1502,7 @@ export default defineMock([ id: 111, parentId: 110, name: "参数(type=1)", - type: "MENU", + type: "M", routeName: null, routePath: "route-param-type1", component: "demo/route-param", @@ -1517,7 +1517,7 @@ export default defineMock([ id: 112, parentId: 110, name: "参数(type=2)", - type: "MENU", + type: "M", routeName: null, routePath: "route-param-type2", component: "demo/route-param", @@ -1534,7 +1534,7 @@ export default defineMock([ id: 7, parentId: 0, name: "功能演示", - type: "CATALOG", + type: "C", routeName: null, routePath: "/function", component: "Layout", @@ -1548,7 +1548,7 @@ export default defineMock([ id: 801, parentId: 7, name: "Icons", - type: "MENU", + type: "M", routeName: null, routePath: "icon-demo", component: "demo/icons", @@ -1563,7 +1563,7 @@ export default defineMock([ id: 802, parentId: 7, name: "字典实时同步", - type: "MENU", + type: "M", routeName: null, routePath: "dict-sync", component: "demo/dict-sync", @@ -1578,7 +1578,7 @@ export default defineMock([ id: 803, parentId: 7, name: "VxeTable", - type: "MENU", + type: "M", routeName: null, routePath: "vxe-table", component: "demo/vxe-table/index", @@ -1593,7 +1593,7 @@ export default defineMock([ id: 804, parentId: 7, name: "CURD单文件", - type: "MENU", + type: "M", routeName: null, routePath: "curd-single", component: "demo/curd-single", @@ -1978,9 +1978,29 @@ export default defineMock([ url: "menus/:id/form", method: ["GET"], body: ({ params }) => { + const menu = menuMap[params.id]; return { code: "00000", - data: menuMap[params.id], + data: + menu ?? + ({ + id: params.id, + parentId: "0", + name: "", + type: "M", + routeName: "", + routePath: "", + component: "", + icon: "", + redirect: "", + perm: null, + visible: 1, + scope: 2, + sort: 1, + alwaysShow: 0, + keepAlive: 1, + params: [], + } as any), msg: "一切ok", }; }, @@ -2019,7 +2039,7 @@ const menuMap: Record = { id: 1, parentId: 0, name: "系统管理", - type: "CATALOG", + type: "C", routeName: "", routePath: "/system", component: "Layout", @@ -2036,7 +2056,7 @@ const menuMap: Record = { id: 2, parentId: 1, name: "用户管理", - type: "MENU", + type: "M", routeName: "User", routePath: "user", component: "system/user/index", @@ -2052,7 +2072,7 @@ const menuMap: Record = { id: 3, parentId: 1, name: "角色管理", - type: "MENU", + type: "M", routeName: "Role", routePath: "role", component: "system/role/index", @@ -2068,7 +2088,7 @@ const menuMap: Record = { id: 4, parentId: 1, name: "菜单管理", - type: "MENU", + type: "M", routeName: "Menu", routePath: "menu", component: "system/menu/index", @@ -2084,7 +2104,7 @@ const menuMap: Record = { id: 5, parentId: 1, name: "部门管理", - type: "MENU", + type: "M", routeName: "Dept", routePath: "dept", component: "system/dept/index", @@ -2100,7 +2120,7 @@ const menuMap: Record = { id: 6, parentId: 1, name: "字典管理", - type: "MENU", + type: "M", routeName: "Dict", routePath: "dict", component: "system/dict/index", @@ -2116,7 +2136,7 @@ const menuMap: Record = { id: 7, parentId: 0, name: "功能演示", - type: "CATALOG", + type: "C", routeName: "", routePath: "/function", component: "Layout", @@ -2133,7 +2153,7 @@ const menuMap: Record = { id: 801, parentId: 7, name: "Icons", - type: "MENU", + type: "M", routeName: "IconDemo", routePath: "icon-demo", component: "demo/icons", @@ -2150,7 +2170,7 @@ const menuMap: Record = { id: 802, parentId: 7, name: "字典实时同步", - type: "MENU", + type: "M", routeName: "DictSync", routePath: "dict-sync", component: "demo/dict-sync", @@ -2167,7 +2187,7 @@ const menuMap: Record = { id: 803, parentId: 7, name: "VxeTable", - type: "MENU", + type: "M", routeName: "VxeTable", routePath: "vxe-table", component: "demo/vxe-table/index", @@ -2184,7 +2204,7 @@ const menuMap: Record = { id: 804, parentId: 7, name: "CURD单文件", - type: "MENU", + type: "M", routeName: "CurdSingle", routePath: "curd-single", component: "demo/curd-single", From 1b5838e4bbfdd671797455fc2d7df26b910024bd Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Thu, 9 Apr 2026 19:10:53 +0800 Subject: [PATCH 3/5] fix(mock): stringify all id/parentId fields to match backend API --- mock/dept.mock.ts | 30 ++-- mock/dict.mock.ts | 16 +- mock/log.mock.ts | 20 +-- mock/menu.mock.ts | 324 +++++++++++++++++++-------------------- mock/notice.mock.ts | 50 +++--- mock/role.mock.ts | 36 ++--- mock/tenant-plan.mock.ts | 12 +- mock/tenant.mock.ts | 38 ++--- mock/user.mock.ts | 20 +-- 9 files changed, 273 insertions(+), 273 deletions(-) diff --git a/mock/dept.mock.ts b/mock/dept.mock.ts index 542a6c1d..b8c1a12f 100644 --- a/mock/dept.mock.ts +++ b/mock/dept.mock.ts @@ -8,15 +8,15 @@ export default defineMock([ code: "00000", data: [ { - value: 1, + value: "1", label: "有来技术", children: [ { - value: 2, + value: "2", label: "研发部门", }, { - value: 3, + value: "3", label: "测试部门", }, ], @@ -33,16 +33,16 @@ export default defineMock([ code: "00000", data: [ { - id: 1, - parentId: 0, + id: "1", + parentId: "0", name: "有来技术", code: "YOULAI", sort: 1, status: 1, children: [ { - id: 2, - parentId: 1, + id: "2", + parentId: "1", name: "研发部门", code: "RD001", sort: 1, @@ -52,8 +52,8 @@ export default defineMock([ updateTime: "2022-04-19 12:46", }, { - id: 3, - parentId: 1, + id: "3", + parentId: "1", name: "测试部门", code: "QA001", sort: 1, @@ -127,26 +127,26 @@ export default defineMock([ // 部门映射表数据 const deptMap: Record = { 1: { - id: 1, + id: "1", name: "有来技术", code: "YOULAI", - parentId: 0, + parentId: "0", status: 1, sort: 1, }, 2: { - id: 2, + id: "2", name: "研发部门", code: "RD001", - parentId: 1, + parentId: "1", status: 1, sort: 1, }, 3: { - id: 3, + id: "3", name: "测试部门", code: "QA001", - parentId: 1, + parentId: "1", status: 1, sort: 1, }, diff --git a/mock/dict.mock.ts b/mock/dict.mock.ts index 41b8f909..131709b4 100644 --- a/mock/dict.mock.ts +++ b/mock/dict.mock.ts @@ -9,7 +9,7 @@ export default defineMock([ data: { list: [ { - id: 1, + id: "1", name: "性别", dictCode: "gender", status: 1, @@ -104,7 +104,7 @@ export default defineMock([ data: { list: [ { - id: 1, + id: "1", dictCode: "gender", label: "男", value: "1", @@ -113,7 +113,7 @@ export default defineMock([ tagType: "P", }, { - id: 2, + id: "2", dictCode: "gender", label: "女", value: "2", @@ -122,7 +122,7 @@ export default defineMock([ tagType: "D", }, { - id: 3, + id: "3", dictCode: "gender", label: "保密", value: "0", @@ -276,7 +276,7 @@ export default defineMock([ // 字典映射表数据 const dictMap: Record = { 1: { - id: 1, + id: "1", name: "性别", dictCode: "gender", status: 1, @@ -286,7 +286,7 @@ const dictMap: Record = { // 字典项映射表数据 const dictItemMap: Record = { 1: { - id: 1, + id: "1", value: "1", label: "男", sort: 1, @@ -294,7 +294,7 @@ const dictItemMap: Record = { tagType: "P", }, 2: { - id: 2, + id: "2", value: "2", label: "女", sort: 2, @@ -302,7 +302,7 @@ const dictItemMap: Record = { tagType: "D", }, 3: { - id: 3, + id: "3", value: "0", label: "保密", sort: 3, diff --git a/mock/log.mock.ts b/mock/log.mock.ts index b800e52c..9d2e4b28 100644 --- a/mock/log.mock.ts +++ b/mock/log.mock.ts @@ -9,7 +9,7 @@ export default defineMock([ data: { list: [ { - id: 36192, + id: "36192", module: "菜单", content: "菜单列表", requestUri: "/api/v1/menus", @@ -24,7 +24,7 @@ export default defineMock([ operator: "系统管理员", }, { - id: 36190, + id: "36190", module: "字典", content: "字典分页列表", requestUri: "/api/v1/dicts", @@ -39,7 +39,7 @@ export default defineMock([ operator: "系统管理员", }, { - id: 36193, + id: "36193", module: "部门", content: "部门列表", requestUri: "/api/v1/depts", @@ -54,7 +54,7 @@ export default defineMock([ operator: "系统管理员", }, { - id: 36191, + id: "36191", module: "菜单", content: "菜单列表", requestUri: "/api/v1/menus", @@ -69,7 +69,7 @@ export default defineMock([ operator: "系统管理员", }, { - id: 36189, + id: "36189", module: "角色", content: "角色分页列表", requestUri: "/api/v1/roles", @@ -84,7 +84,7 @@ export default defineMock([ operator: "系统管理员", }, { - id: 36188, + id: "36188", module: "用户", content: "用户分页列表", requestUri: "/api/v1/users", @@ -99,7 +99,7 @@ export default defineMock([ operator: "系统管理员", }, { - id: 36187, + id: "36187", module: "登录", content: "登录", requestUri: "/api/v1/auth/login", @@ -114,7 +114,7 @@ export default defineMock([ operator: "系统管理员", }, { - id: 36186, + id: "36186", module: "登录", content: "登录", requestUri: "/api/v1/auth/login", @@ -129,7 +129,7 @@ export default defineMock([ operator: "系统管理员", }, { - id: 36185, + id: "36185", module: "登录", content: "登录", requestUri: "/api/v1/auth/login", @@ -144,7 +144,7 @@ export default defineMock([ operator: "系统管理员", }, { - id: 36184, + id: "36184", module: "登录", content: "登录", requestUri: "/api/v1/auth/login", diff --git a/mock/menu.mock.ts b/mock/menu.mock.ts index 73c3242b..48a6b7b7 100644 --- a/mock/menu.mock.ts +++ b/mock/menu.mock.ts @@ -539,8 +539,8 @@ export default defineMock([ code: "00000", data: [ { - id: 1, - parentId: 0, + id: "1", + parentId: "0", name: "系统管理", type: "C", routeName: "", @@ -553,8 +553,8 @@ export default defineMock([ perm: null, children: [ { - id: 2, - parentId: 1, + id: "2", + parentId: "1", name: "用户管理", type: "M", routeName: "User", @@ -567,8 +567,8 @@ export default defineMock([ perm: null, children: [ { - id: 105, - parentId: 2, + id: "105", + parentId: "2", name: "用户查询", type: "F", routeName: null, @@ -582,8 +582,8 @@ export default defineMock([ children: [], }, { - id: 31, - parentId: 2, + id: "31", + parentId: "2", name: "用户新增", type: "F", routeName: null, @@ -597,8 +597,8 @@ export default defineMock([ children: [], }, { - id: 32, - parentId: 2, + id: "32", + parentId: "2", name: "用户编辑", type: "F", routeName: null, @@ -612,8 +612,8 @@ export default defineMock([ children: [], }, { - id: 33, - parentId: 2, + id: "33", + parentId: "2", name: "用户删除", type: "F", routeName: null, @@ -627,8 +627,8 @@ export default defineMock([ children: [], }, { - id: 88, - parentId: 2, + id: "88", + parentId: "2", name: "重置密码", type: "F", routeName: null, @@ -642,8 +642,8 @@ export default defineMock([ children: [], }, { - id: 106, - parentId: 2, + id: "106", + parentId: "2", name: "用户导入", type: "F", routeName: null, @@ -657,8 +657,8 @@ export default defineMock([ children: [], }, { - id: 107, - parentId: 2, + id: "107", + parentId: "2", name: "用户导出", type: "F", routeName: null, @@ -674,8 +674,8 @@ export default defineMock([ ], }, { - id: 3, - parentId: 1, + id: "3", + parentId: "1", name: "角色管理", type: "M", routeName: "Role", @@ -688,8 +688,8 @@ export default defineMock([ perm: null, children: [ { - id: 70, - parentId: 3, + id: "70", + parentId: "3", name: "角色新增", type: "F", routeName: null, @@ -703,8 +703,8 @@ export default defineMock([ children: [], }, { - id: 71, - parentId: 3, + id: "71", + parentId: "3", name: "角色编辑", type: "F", routeName: null, @@ -718,8 +718,8 @@ export default defineMock([ children: [], }, { - id: 72, - parentId: 3, + id: "72", + parentId: "3", name: "角色删除", type: "F", routeName: null, @@ -735,8 +735,8 @@ export default defineMock([ ], }, { - id: 4, - parentId: 1, + id: "4", + parentId: "1", name: "菜单管理", type: "M", routeName: "Menu", @@ -749,8 +749,8 @@ export default defineMock([ perm: null, children: [ { - id: 73, - parentId: 4, + id: "73", + parentId: "4", name: "菜单新增", type: "F", routeName: null, @@ -764,8 +764,8 @@ export default defineMock([ children: [], }, { - id: 74, - parentId: 4, + id: "74", + parentId: "4", name: "菜单编辑", type: "F", routeName: null, @@ -779,8 +779,8 @@ export default defineMock([ children: [], }, { - id: 75, - parentId: 4, + id: "75", + parentId: "4", name: "菜单删除", type: "F", routeName: null, @@ -796,8 +796,8 @@ export default defineMock([ ], }, { - id: 5, - parentId: 1, + id: "5", + parentId: "1", name: "部门管理", type: "M", routeName: "Dept", @@ -810,8 +810,8 @@ export default defineMock([ perm: null, children: [ { - id: 76, - parentId: 5, + id: "76", + parentId: "5", name: "部门新增", type: "F", routeName: null, @@ -825,8 +825,8 @@ export default defineMock([ children: [], }, { - id: 77, - parentId: 5, + id: "77", + parentId: "5", name: "部门编辑", type: "F", routeName: null, @@ -840,8 +840,8 @@ export default defineMock([ children: [], }, { - id: 78, - parentId: 5, + id: "78", + parentId: "5", name: "部门删除", type: "F", routeName: null, @@ -857,8 +857,8 @@ export default defineMock([ ], }, { - id: 6, - parentId: 1, + id: "6", + parentId: "1", name: "字典管理", type: "M", routeName: "Dict", @@ -871,8 +871,8 @@ export default defineMock([ perm: null, children: [ { - id: 79, - parentId: 6, + id: "79", + parentId: "6", name: "字典新增", type: "F", routeName: null, @@ -886,8 +886,8 @@ export default defineMock([ children: [], }, { - id: 81, - parentId: 6, + id: "81", + parentId: "6", name: "字典编辑", type: "F", routeName: null, @@ -901,8 +901,8 @@ export default defineMock([ children: [], }, { - id: 84, - parentId: 6, + id: "84", + parentId: "6", name: "字典删除", type: "F", routeName: null, @@ -918,8 +918,8 @@ export default defineMock([ ], }, { - id: 135, - parentId: 1, + id: "135", + parentId: "1", name: "字典项", type: "M", routeName: "DictData", @@ -932,8 +932,8 @@ export default defineMock([ perm: null, children: [ { - id: 136, - parentId: 135, + id: "136", + parentId: "135", name: "字典项新增", type: "F", routeName: null, @@ -947,8 +947,8 @@ export default defineMock([ children: [], }, { - id: 137, - parentId: 135, + id: "137", + parentId: "135", name: "字典项编辑", type: "F", routeName: null, @@ -962,8 +962,8 @@ export default defineMock([ children: [], }, { - id: 138, - parentId: 135, + id: "138", + parentId: "135", name: "字典项删除", type: "F", routeName: null, @@ -979,8 +979,8 @@ export default defineMock([ ], }, { - id: 117, - parentId: 1, + id: "117", + parentId: "1", name: "系统日志", type: "M", routeName: "Log", @@ -994,8 +994,8 @@ export default defineMock([ children: [], }, { - id: 120, - parentId: 1, + id: "120", + parentId: "1", name: "系统配置", type: "M", routeName: "Config", @@ -1008,8 +1008,8 @@ export default defineMock([ perm: null, children: [ { - id: 121, - parentId: 120, + id: "121", + parentId: "120", name: "查询系统配置", type: "F", routeName: null, @@ -1023,8 +1023,8 @@ export default defineMock([ children: [], }, { - id: 122, - parentId: 120, + id: "122", + parentId: "120", name: "新增系统配置", type: "F", routeName: null, @@ -1038,8 +1038,8 @@ export default defineMock([ children: [], }, { - id: 123, - parentId: 120, + id: "123", + parentId: "120", name: "修改系统配置", type: "F", routeName: null, @@ -1053,8 +1053,8 @@ export default defineMock([ children: [], }, { - id: 124, - parentId: 120, + id: "124", + parentId: "120", name: "删除系统配置", type: "F", routeName: null, @@ -1068,8 +1068,8 @@ export default defineMock([ children: [], }, { - id: 125, - parentId: 120, + id: "125", + parentId: "120", name: "刷新系统配置", type: "F", routeName: null, @@ -1085,8 +1085,8 @@ export default defineMock([ ], }, { - id: 126, - parentId: 1, + id: "126", + parentId: "1", name: "通知公告", type: "M", routeName: "Notice", @@ -1099,8 +1099,8 @@ export default defineMock([ perm: null, children: [ { - id: 127, - parentId: 126, + id: "127", + parentId: "126", name: "查询", type: "F", routeName: null, @@ -1114,8 +1114,8 @@ export default defineMock([ children: [], }, { - id: 128, - parentId: 126, + id: "128", + parentId: "126", name: "新增", type: "F", routeName: null, @@ -1129,8 +1129,8 @@ export default defineMock([ children: [], }, { - id: 129, - parentId: 126, + id: "129", + parentId: "126", name: "编辑", type: "F", routeName: null, @@ -1144,8 +1144,8 @@ export default defineMock([ children: [], }, { - id: 130, - parentId: 126, + id: "130", + parentId: "126", name: "删除", type: "F", routeName: null, @@ -1159,8 +1159,8 @@ export default defineMock([ children: [], }, { - id: 133, - parentId: 126, + id: "133", + parentId: "126", name: "发布", type: "F", routeName: null, @@ -1174,8 +1174,8 @@ export default defineMock([ children: [], }, { - id: 134, - parentId: 126, + id: "134", + parentId: "126", name: "撤回", type: "F", routeName: null, @@ -1193,8 +1193,8 @@ export default defineMock([ ], }, { - id: 118, - parentId: 0, + id: "118", + parentId: "0", name: "系统工具", type: "C", routeName: null, @@ -1207,8 +1207,8 @@ export default defineMock([ perm: null, children: [ { - id: 119, - parentId: 118, + id: "119", + parentId: "118", name: "代码生成", type: "M", routeName: "Codegen", @@ -1224,8 +1224,8 @@ export default defineMock([ ], }, { - id: 40, - parentId: 0, + id: "40", + parentId: "0", name: "接口文档", type: "C", routeName: null, @@ -1238,8 +1238,8 @@ export default defineMock([ perm: null, children: [ { - id: 41, - parentId: 40, + id: "41", + parentId: "40", name: "Apifox", type: "M", routeName: null, @@ -1255,8 +1255,8 @@ export default defineMock([ ], }, { - id: 26, - parentId: 0, + id: "26", + parentId: "0", name: "平台文档", type: "C", routeName: null, @@ -1269,8 +1269,8 @@ export default defineMock([ perm: null, children: [ { - id: 102, - parentId: 26, + id: "102", + parentId: "26", name: "平台文档(内嵌)", type: "EXTLINK", routeName: null, @@ -1284,8 +1284,8 @@ export default defineMock([ children: [], }, { - id: 30, - parentId: 26, + id: "30", + parentId: "26", name: "平台文档(外链)", type: "EXTLINK", routeName: null, @@ -1301,8 +1301,8 @@ export default defineMock([ ], }, { - id: 20, - parentId: 0, + id: "20", + parentId: "0", name: "多级菜单", type: "C", routeName: null, @@ -1315,8 +1315,8 @@ export default defineMock([ perm: null, children: [ { - id: 21, - parentId: 20, + id: "21", + parentId: "20", name: "菜单一级", type: "C", routeName: null, @@ -1329,8 +1329,8 @@ export default defineMock([ perm: null, children: [ { - id: 22, - parentId: 21, + id: "22", + parentId: "21", name: "菜单二级", type: "C", routeName: null, @@ -1343,8 +1343,8 @@ export default defineMock([ perm: null, children: [ { - id: 23, - parentId: 22, + id: "23", + parentId: "22", name: "菜单三级-1", type: "M", routeName: null, @@ -1358,8 +1358,8 @@ export default defineMock([ children: [], }, { - id: 24, - parentId: 22, + id: "24", + parentId: "22", name: "菜单三级-2", type: "M", routeName: null, @@ -1379,8 +1379,8 @@ export default defineMock([ ], }, { - id: 36, - parentId: 0, + id: "36", + parentId: "0", name: "组件封装", type: "C", routeName: null, @@ -1393,8 +1393,8 @@ export default defineMock([ perm: null, children: [ { - id: 108, - parentId: 36, + id: "108", + parentId: "36", name: "增删改查", type: "M", routeName: null, @@ -1408,8 +1408,8 @@ export default defineMock([ children: [], }, { - id: 109, - parentId: 36, + id: "109", + parentId: "36", name: "列表选择器", type: "M", routeName: null, @@ -1423,8 +1423,8 @@ export default defineMock([ children: [], }, { - id: 37, - parentId: 36, + id: "37", + parentId: "36", name: "富文本编辑器", type: "M", routeName: null, @@ -1438,8 +1438,8 @@ export default defineMock([ children: [], }, { - id: 38, - parentId: 36, + id: "38", + parentId: "36", name: "图片上传", type: "M", routeName: null, @@ -1453,8 +1453,8 @@ export default defineMock([ children: [], }, { - id: 95, - parentId: 36, + id: "95", + parentId: "36", name: "字典组件", type: "M", routeName: null, @@ -1468,8 +1468,8 @@ export default defineMock([ children: [], }, { - id: 39, - parentId: 36, + id: "39", + parentId: "36", name: "图标选择器", type: "M", routeName: null, @@ -1485,8 +1485,8 @@ export default defineMock([ ], }, { - id: 110, - parentId: 0, + id: "110", + parentId: "0", name: "路由参数", type: "C", routeName: null, @@ -1499,8 +1499,8 @@ export default defineMock([ perm: null, children: [ { - id: 111, - parentId: 110, + id: "111", + parentId: "110", name: "参数(type=1)", type: "M", routeName: null, @@ -1514,8 +1514,8 @@ export default defineMock([ children: [], }, { - id: 112, - parentId: 110, + id: "112", + parentId: "110", name: "参数(type=2)", type: "M", routeName: null, @@ -1531,8 +1531,8 @@ export default defineMock([ ], }, { - id: 7, - parentId: 0, + id: "7", + parentId: "0", name: "功能演示", type: "C", routeName: null, @@ -1545,8 +1545,8 @@ export default defineMock([ perm: null, children: [ { - id: 801, - parentId: 7, + id: "801", + parentId: "7", name: "Icons", type: "M", routeName: null, @@ -1560,8 +1560,8 @@ export default defineMock([ children: [], }, { - id: 802, - parentId: 7, + id: "802", + parentId: "7", name: "字典实时同步", type: "M", routeName: null, @@ -1575,8 +1575,8 @@ export default defineMock([ children: [], }, { - id: 803, - parentId: 7, + id: "803", + parentId: "7", name: "VxeTable", type: "M", routeName: null, @@ -1590,8 +1590,8 @@ export default defineMock([ children: [], }, { - id: 804, - parentId: 7, + id: "804", + parentId: "7", name: "CURD单文件", type: "M", routeName: null, @@ -2036,8 +2036,8 @@ export default defineMock([ // 菜单映射表数据 const menuMap: Record = { 1: { - id: 1, - parentId: 0, + id: "1", + parentId: "0", name: "系统管理", type: "C", routeName: "", @@ -2053,8 +2053,8 @@ const menuMap: Record = { params: null, }, 2: { - id: 2, - parentId: 1, + id: "2", + parentId: "1", name: "用户管理", type: "M", routeName: "User", @@ -2069,8 +2069,8 @@ const menuMap: Record = { alwaysShow: null, }, 3: { - id: 3, - parentId: 1, + id: "3", + parentId: "1", name: "角色管理", type: "M", routeName: "Role", @@ -2085,8 +2085,8 @@ const menuMap: Record = { alwaysShow: null, }, 4: { - id: 4, - parentId: 1, + id: "4", + parentId: "1", name: "菜单管理", type: "M", routeName: "Menu", @@ -2101,8 +2101,8 @@ const menuMap: Record = { alwaysShow: null, }, 5: { - id: 5, - parentId: 1, + id: "5", + parentId: "1", name: "部门管理", type: "M", routeName: "Dept", @@ -2117,8 +2117,8 @@ const menuMap: Record = { alwaysShow: null, }, 6: { - id: 6, - parentId: 1, + id: "6", + parentId: "1", name: "字典管理", type: "M", routeName: "Dict", @@ -2133,8 +2133,8 @@ const menuMap: Record = { alwaysShow: null, }, 7: { - id: 7, - parentId: 0, + id: "7", + parentId: "0", name: "功能演示", type: "C", routeName: "", @@ -2150,8 +2150,8 @@ const menuMap: Record = { params: null, }, 801: { - id: 801, - parentId: 7, + id: "801", + parentId: "7", name: "Icons", type: "M", routeName: "IconDemo", @@ -2167,8 +2167,8 @@ const menuMap: Record = { params: null, }, 802: { - id: 802, - parentId: 7, + id: "802", + parentId: "7", name: "字典实时同步", type: "M", routeName: "DictSync", @@ -2184,8 +2184,8 @@ const menuMap: Record = { params: null, }, 803: { - id: 803, - parentId: 7, + id: "803", + parentId: "7", name: "VxeTable", type: "M", routeName: "VxeTable", @@ -2201,8 +2201,8 @@ const menuMap: Record = { params: null, }, 804: { - id: 804, - parentId: 7, + id: "804", + parentId: "7", name: "CURD单文件", type: "M", routeName: "CurdSingle", diff --git a/mock/notice.mock.ts b/mock/notice.mock.ts index 43be43dd..701dbc33 100644 --- a/mock/notice.mock.ts +++ b/mock/notice.mock.ts @@ -9,7 +9,7 @@ export default defineMock([ data: { list: [ { - id: 1, + id: "1", title: "v2.12.0 新增系统日志,访问趋势统计功能。", publishStatus: 1, type: 1, @@ -22,7 +22,7 @@ export default defineMock([ revokeTime: "2024-09-30 17:21", }, { - id: 2, + id: "2", title: "v2.13.0 新增菜单搜索。", publishStatus: 1, type: 1, @@ -35,7 +35,7 @@ export default defineMock([ revokeTime: "2024-09-30 17:21", }, { - id: 3, + id: "3", title: "\r\nv2.14.0 新增个人中心。", publishStatus: 1, type: 1, @@ -48,7 +48,7 @@ export default defineMock([ revokeTime: "2024-09-30 17:21", }, { - id: 4, + id: "4", title: "v2.15.0 登录页面改造。", publishStatus: 1, type: 1, @@ -61,7 +61,7 @@ export default defineMock([ revokeTime: "2024-09-30 17:21", }, { - id: 5, + id: "5", title: "v2.16.0 通知公告、字典翻译组件。", publishStatus: 1, type: 1, @@ -74,7 +74,7 @@ export default defineMock([ revokeTime: "2024-09-30 17:21", }, { - id: 6, + id: "6", title: "系统将于本周六凌晨 2 点进行维护,预计维护时间为 2 小时。", publishStatus: 1, type: 2, @@ -87,7 +87,7 @@ export default defineMock([ revokeTime: "2024-09-30 17:21", }, { - id: 7, + id: "7", title: "最近发现一些钓鱼邮件,请大家提高警惕,不要点击陌生链接。", publishStatus: 1, type: 3, @@ -100,7 +100,7 @@ export default defineMock([ revokeTime: "2024-09-30 17:21", }, { - id: 8, + id: "8", title: "国庆假期从 10 月 1 日至 10 月 7 日放假,共 7 天。", publishStatus: 1, type: 4, @@ -113,7 +113,7 @@ export default defineMock([ revokeTime: "2024-09-30 17:21", }, { - id: 9, + id: "9", title: "公司将在 10 月 15 日举办新产品发布会,敬请期待。", publishStatus: 1, type: 5, @@ -126,7 +126,7 @@ export default defineMock([ revokeTime: "2024-09-30 17:21", }, { - id: 10, + id: "10", title: "v2.16.1 版本修复了 WebSocket 重复连接导致的后台线程阻塞问题,优化了通知公告。", publishStatus: 1, type: 1, @@ -218,7 +218,7 @@ export default defineMock([ data: { list: [ { - id: 10, + id: "10", title: "v2.16.1 版本修复了 WebSocket 重复连接导致的后台线程阻塞问题,优化了通知公告。", type: 1, level: "L", @@ -227,7 +227,7 @@ export default defineMock([ isRead: 0, }, { - id: 9, + id: "9", title: "公司将在 10 月 15 日举办新产品发布会,敬请期待。", type: 5, level: "L", @@ -236,7 +236,7 @@ export default defineMock([ isRead: 0, }, { - id: 8, + id: "8", title: "国庆假期从 10 月 1 日至 10 月 7 日放假,共 7 天。", type: 4, level: "L", @@ -245,7 +245,7 @@ export default defineMock([ isRead: 0, }, { - id: 7, + id: "7", title: "最近发现一些钓鱼邮件,请大家提高警惕,不要点击陌生链接。", type: 3, level: "L", @@ -254,7 +254,7 @@ export default defineMock([ isRead: 0, }, { - id: 6, + id: "6", title: "系统将于本周六凌晨 2 点进行维护,预计维护时间为 2 小时。", type: 2, level: "L", @@ -273,7 +273,7 @@ export default defineMock([ // 通知映射表数据 const noticeMap: Record = { 1: { - id: 1, + id: "1", title: "v2.12.0 新增系统日志,访问趋势统计功能。", publishStatus: 1, type: 1, @@ -287,7 +287,7 @@ const noticeMap: Record = { revokeTime: "2024-09-30 17:21", }, 2: { - id: 2, + id: "2", title: "v2.13.0 新增菜单搜索。", publishStatus: 1, type: 1, @@ -301,7 +301,7 @@ const noticeMap: Record = { revokeTime: "2024-09-30 17:21", }, 3: { - id: 3, + id: "3", title: "\r\nv2.14.0 新增个人中心。", publishStatus: 1, type: 1, @@ -315,7 +315,7 @@ const noticeMap: Record = { revokeTime: "2024-09-30 17:21", }, 4: { - id: 4, + id: "4", title: "v2.15.0 登录页面改造。", publishStatus: 1, type: 1, @@ -330,7 +330,7 @@ const noticeMap: Record = { }, 5: { - id: 5, + id: "5", title: "v2.16.0 通知公告、字典翻译组件。", publishStatus: 1, type: 1, @@ -344,7 +344,7 @@ const noticeMap: Record = { revokeTime: "2024-09-30 17:21", }, 6: { - id: 6, + id: "6", title: "系统将于本周六凌晨 2 点进行维护,预计维护时间为 2 小时。", publishStatus: 1, type: 2, @@ -358,7 +358,7 @@ const noticeMap: Record = { revokeTime: "2024-09-30 17:21", }, 7: { - id: 7, + id: "7", title: "最近发现一些钓鱼邮件,请大家提高警惕,不要点击陌生链接。", publishStatus: 1, type: 3, @@ -372,7 +372,7 @@ const noticeMap: Record = { revokeTime: "2024-09-30 17:21", }, 8: { - id: 8, + id: "8", title: "国庆假期从 10 月 1 日至 10 月 7 日放假,共 7 天。", publishStatus: 1, type: 4, @@ -386,7 +386,7 @@ const noticeMap: Record = { revokeTime: "2024-09-30 17:21", }, 9: { - id: 9, + id: "9", title: "公司将在 10 月 15 日举办新产品发布会,敬请期待。", publishStatus: 1, type: 5, @@ -400,7 +400,7 @@ const noticeMap: Record = { revokeTime: "2024-09-30 17:21", }, 10: { - id: 10, + id: "10", title: "v2.16.1 版本修复了 WebSocket 重复连接导致的后台线程阻塞问题,优化了通知公告。", publishStatus: 1, type: 1, diff --git a/mock/role.mock.ts b/mock/role.mock.ts index 50999270..56bbc86a 100644 --- a/mock/role.mock.ts +++ b/mock/role.mock.ts @@ -7,12 +7,12 @@ export default defineMock([ body: { code: "00000", data: [ - { value: 2, label: "系统管理员" }, - { value: 4, label: "部门主管" }, - { value: 5, label: "部门成员" }, - { value: 6, label: "普通员工" }, - { value: 7, label: "自定义权限用户" }, - { value: 3, label: "访问游客" }, + { value: "2", label: "系统管理员" }, + { value: "4", label: "部门主管" }, + { value: "5", label: "部门成员" }, + { value: "6", label: "普通员工" }, + { value: "7", label: "自定义权限用户" }, + { value: "3", label: "访问游客" }, ], msg: "一切ok", }, @@ -26,7 +26,7 @@ export default defineMock([ data: { list: [ { - id: 2, + id: "2", name: "系统管理员", code: "ADMIN", status: 1, @@ -36,7 +36,7 @@ export default defineMock([ updateTime: null, }, { - id: 3, + id: "3", name: "访问游客", code: "GUEST", status: 1, @@ -46,7 +46,7 @@ export default defineMock([ updateTime: "2019-05-05 16:00:00", }, { - id: 4, + id: "4", name: "部门主管", code: "DEPT_MANAGER", status: 1, @@ -56,7 +56,7 @@ export default defineMock([ updateTime: null, }, { - id: 5, + id: "5", name: "部门成员", code: "DEPT_MEMBER", status: 1, @@ -66,7 +66,7 @@ export default defineMock([ updateTime: null, }, { - id: 6, + id: "6", name: "普通员工", code: "EMPLOYEE", status: 1, @@ -76,7 +76,7 @@ export default defineMock([ updateTime: null, }, { - id: 7, + id: "7", name: "自定义权限用户", code: "CUSTOM_USER", status: 1, @@ -187,7 +187,7 @@ export default defineMock([ // 角色映射表数据 const roleMap: Record = { 2: { - id: 2, + id: "2", name: "系统管理员", code: "ADMIN", status: 1, @@ -197,7 +197,7 @@ const roleMap: Record = { updateTime: null, }, 3: { - id: 3, + id: "3", name: "访问游客", code: "GUEST", status: 1, @@ -207,7 +207,7 @@ const roleMap: Record = { updateTime: "2019-05-05 16:00:00", }, 4: { - id: 4, + id: "4", name: "部门主管", code: "DEPT_MANAGER", status: 1, @@ -217,7 +217,7 @@ const roleMap: Record = { updateTime: null, }, 5: { - id: 5, + id: "5", name: "部门成员", code: "DEPT_MEMBER", status: 1, @@ -227,7 +227,7 @@ const roleMap: Record = { updateTime: null, }, 6: { - id: 6, + id: "6", name: "普通员工", code: "EMPLOYEE", status: 1, @@ -237,7 +237,7 @@ const roleMap: Record = { updateTime: null, }, 7: { - id: 7, + id: "7", name: "自定义权限用户", code: "CUSTOM_USER", status: 1, diff --git a/mock/tenant-plan.mock.ts b/mock/tenant-plan.mock.ts index 395a06ca..0eb6b81e 100644 --- a/mock/tenant-plan.mock.ts +++ b/mock/tenant-plan.mock.ts @@ -9,7 +9,7 @@ export default defineMock([ data: { list: [ { - id: 1, + id: "1", name: "基础版", code: "BASIC", status: 1, @@ -19,7 +19,7 @@ export default defineMock([ updateTime: "2026-03-01 10:00:00", }, { - id: 2, + id: "2", name: "专业版", code: "PRO", status: 1, @@ -40,8 +40,8 @@ export default defineMock([ body: { code: "00000", data: [ - { value: 1, label: "基础版" }, - { value: 2, label: "专业版" }, + { value: "1", label: "基础版" }, + { value: "2", label: "专业版" }, ], msg: "一切ok", }, @@ -54,7 +54,7 @@ export default defineMock([ const form = planId === 2 ? { - id: 2, + id: "2", name: "专业版", code: "PRO", status: 1, @@ -62,7 +62,7 @@ export default defineMock([ remark: "", } : { - id: 1, + id: "1", name: "基础版", code: "BASIC", status: 1, diff --git a/mock/tenant.mock.ts b/mock/tenant.mock.ts index 63c189e5..2aed47e4 100644 --- a/mock/tenant.mock.ts +++ b/mock/tenant.mock.ts @@ -8,7 +8,7 @@ export default defineMock([ code: "00000", data: [ { - id: 1, + id: "1", name: "默认租户", code: "default", contactName: "管理员", @@ -16,14 +16,14 @@ export default defineMock([ contactEmail: "", domain: "default", logo: "", - planId: 1, + planId: "1", status: 1, remark: "", expireTime: null, isDefault: true, }, { - id: 2, + id: "2", name: "演示租户", code: "demo", contactName: "演示用户", @@ -31,7 +31,7 @@ export default defineMock([ contactEmail: "", domain: "demo", logo: "", - planId: 2, + planId: "2", status: 1, remark: "", expireTime: null, @@ -47,7 +47,7 @@ export default defineMock([ body: { code: "00000", data: { - id: 1, + id: "1", name: "默认租户", code: "default", contactName: "管理员", @@ -55,7 +55,7 @@ export default defineMock([ contactEmail: "", domain: "default", logo: "", - planId: 1, + planId: "1", status: 1, remark: "", expireTime: null, @@ -72,7 +72,7 @@ export default defineMock([ data: { list: [ { - id: 1, + id: "1", name: "默认租户", code: "default", contactName: "管理员", @@ -80,7 +80,7 @@ export default defineMock([ contactEmail: "", domain: "default", logo: "", - planId: 1, + planId: "1", status: 1, remark: "", expireTime: null, @@ -88,7 +88,7 @@ export default defineMock([ updateTime: "2026-03-01 10:00:00", }, { - id: 2, + id: "2", name: "演示租户", code: "demo", contactName: "演示用户", @@ -96,7 +96,7 @@ export default defineMock([ contactEmail: "", domain: "demo", logo: "", - planId: 2, + planId: "2", status: 1, remark: "", expireTime: null, @@ -117,7 +117,7 @@ export default defineMock([ const form = tenantId === 2 ? { - id: 2, + id: "2", name: "演示租户", code: "demo", domain: "demo", @@ -125,13 +125,13 @@ export default defineMock([ contactPhone: "17621210366", contactEmail: "", logo: "", - planId: 2, + planId: "2", status: 1, remark: "", expireTime: null, } : { - id: 1, + id: "1", name: "默认租户", code: "default", domain: "default", @@ -139,7 +139,7 @@ export default defineMock([ contactPhone: "17621210366", contactEmail: "", logo: "", - planId: 1, + planId: "1", status: 1, remark: "", expireTime: null, @@ -158,7 +158,7 @@ export default defineMock([ body: { code: "00000", data: { - tenantId: 3, + tenantId: "3", tenantCode: "test", tenantName: "测试租户", adminUsername: "admin", @@ -221,7 +221,7 @@ export default defineMock([ const allTenants = [ { - id: 1, + id: "1", name: "默认租户", code: "default", contactName: "管理员", @@ -229,14 +229,14 @@ export default defineMock([ contactEmail: "", domain: "default", logo: "", - planId: 1, + planId: "1", status: 1, remark: "", expireTime: null, isDefault: true, }, { - id: 2, + id: "2", name: "演示租户", code: "demo", contactName: "演示用户", @@ -244,7 +244,7 @@ export default defineMock([ contactEmail: "", domain: "demo", logo: "", - planId: 2, + planId: "2", status: 1, remark: "", expireTime: null, diff --git a/mock/user.mock.ts b/mock/user.mock.ts index f3c8d15c..4912b7da 100644 --- a/mock/user.mock.ts +++ b/mock/user.mock.ts @@ -7,7 +7,7 @@ export default defineMock([ body: { code: "00000", data: { - userId: 2, + userId: "2", username: "admin", nickname: "系统管理员", avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif", @@ -72,7 +72,7 @@ export default defineMock([ data: { list: [ { - id: 2, + id: "2", username: "admin", nickname: "系统管理员", mobile: "17621210366", @@ -80,11 +80,11 @@ export default defineMock([ avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif", email: "", status: 1, - deptId: 1, + deptId: "1", roleIds: [2], }, { - id: 3, + id: "3", username: "test", nickname: "测试小用户", mobile: "17621210366", @@ -92,7 +92,7 @@ export default defineMock([ avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif", email: "youlaitech@163.com", status: 1, - deptId: 3, + deptId: "3", roleIds: [3], }, ], @@ -182,7 +182,7 @@ export default defineMock([ body: { code: "00000", data: { - id: 2, + id: "2", username: "admin", nickname: "系统管理员", avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif", @@ -224,7 +224,7 @@ export default defineMock([ // 用户映射表数据 const userMap: Record = { 2: { - id: 2, + id: "2", username: "admin", nickname: "系统管理员", mobile: "17621210366", @@ -232,11 +232,11 @@ const userMap: Record = { avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif", email: "", status: 1, - deptId: 1, + deptId: "1", roleIds: [2], }, 3: { - id: 3, + id: "3", username: "test", nickname: "测试小用户", mobile: "17621210366", @@ -244,7 +244,7 @@ const userMap: Record = { avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif", email: "youlaitech@163.com", status: 1, - deptId: 3, + deptId: "3", roleIds: [3], }, }; From 53a8f17f16558b3ff3ba0ca66f395a7bfaea17f6 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Thu, 9 Apr 2026 19:11:49 +0800 Subject: [PATCH 4/5] chore: bump version to 4.4.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 363493c7..d72a5aa1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vue3-element-admin", "description": "Vue3 + Vite + TypeScript + Element-Plus 的后台管理模板,vue-element-admin 的 Vue3 版本", - "version": "4.4.0", + "version": "4.4.1", "private": true, "type": "module", "scripts": { From 4d8e8909b9dde19829a77d0df4875ba4c245f558 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Thu, 9 Apr 2026 23:56:21 +0800 Subject: [PATCH 5/5] fix(dashboard): correct legend name mismatch and initialize chart options --- src/views/dashboard/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 95da2120..d241cf73 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -515,7 +515,7 @@ const displayTransitionTotalPvCount = computed(() => // 访问趋势日期范围(单位:天) const visitTrendDateRange = ref(7); // 访问趋势图表配置 -const visitTrendChartOptions = ref(); +const visitTrendChartOptions = ref({}); /** * 获取访客统计数据 @@ -558,7 +558,7 @@ const updateVisitTrendChartOptions = (data: VisitTrendDetail) => { trigger: "axis", }, legend: { - data: ["浏览量(PV)", "访客数(UV)"], + data: ["浏览量(PV)", "访客量(UV)"], bottom: 0, }, grid: {