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 71d6cfdd..48a6b7b7 100644 --- a/mock/menu.mock.ts +++ b/mock/menu.mock.ts @@ -539,10 +539,10 @@ export default defineMock([ code: "00000", data: [ { - id: 1, - parentId: 0, + id: "1", + parentId: "0", name: "系统管理", - type: "CATALOG", + type: "C", routeName: "", routePath: "/system", component: "Layout", @@ -553,10 +553,10 @@ export default defineMock([ perm: null, children: [ { - id: 2, - parentId: 1, + id: "2", + parentId: "1", name: "用户管理", - type: "MENU", + type: "M", routeName: "User", routePath: "user", component: "system/user/index", @@ -567,10 +567,10 @@ export default defineMock([ perm: null, children: [ { - id: 105, - parentId: 2, + id: "105", + parentId: "2", name: "用户查询", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -582,10 +582,10 @@ export default defineMock([ children: [], }, { - id: 31, - parentId: 2, + id: "31", + parentId: "2", name: "用户新增", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -597,10 +597,10 @@ export default defineMock([ children: [], }, { - id: 32, - parentId: 2, + id: "32", + parentId: "2", name: "用户编辑", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -612,10 +612,10 @@ export default defineMock([ children: [], }, { - id: 33, - parentId: 2, + id: "33", + parentId: "2", name: "用户删除", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -627,10 +627,10 @@ export default defineMock([ children: [], }, { - id: 88, - parentId: 2, + id: "88", + parentId: "2", name: "重置密码", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -642,10 +642,10 @@ export default defineMock([ children: [], }, { - id: 106, - parentId: 2, + id: "106", + parentId: "2", name: "用户导入", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -657,10 +657,10 @@ export default defineMock([ children: [], }, { - id: 107, - parentId: 2, + id: "107", + parentId: "2", name: "用户导出", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -674,10 +674,10 @@ export default defineMock([ ], }, { - id: 3, - parentId: 1, + id: "3", + parentId: "1", name: "角色管理", - type: "MENU", + type: "M", routeName: "Role", routePath: "role", component: "system/role/index", @@ -688,10 +688,10 @@ export default defineMock([ perm: null, children: [ { - id: 70, - parentId: 3, + id: "70", + parentId: "3", name: "角色新增", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -703,10 +703,10 @@ export default defineMock([ children: [], }, { - id: 71, - parentId: 3, + id: "71", + parentId: "3", name: "角色编辑", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -718,10 +718,10 @@ export default defineMock([ children: [], }, { - id: 72, - parentId: 3, + id: "72", + parentId: "3", name: "角色删除", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -735,10 +735,10 @@ export default defineMock([ ], }, { - id: 4, - parentId: 1, + id: "4", + parentId: "1", name: "菜单管理", - type: "MENU", + type: "M", routeName: "Menu", routePath: "menu", component: "system/menu/index", @@ -749,10 +749,10 @@ export default defineMock([ perm: null, children: [ { - id: 73, - parentId: 4, + id: "73", + parentId: "4", name: "菜单新增", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -764,10 +764,10 @@ export default defineMock([ children: [], }, { - id: 74, - parentId: 4, + id: "74", + parentId: "4", name: "菜单编辑", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -779,10 +779,10 @@ export default defineMock([ children: [], }, { - id: 75, - parentId: 4, + id: "75", + parentId: "4", name: "菜单删除", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -796,10 +796,10 @@ export default defineMock([ ], }, { - id: 5, - parentId: 1, + id: "5", + parentId: "1", name: "部门管理", - type: "MENU", + type: "M", routeName: "Dept", routePath: "dept", component: "system/dept/index", @@ -810,10 +810,10 @@ export default defineMock([ perm: null, children: [ { - id: 76, - parentId: 5, + id: "76", + parentId: "5", name: "部门新增", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -825,10 +825,10 @@ export default defineMock([ children: [], }, { - id: 77, - parentId: 5, + id: "77", + parentId: "5", name: "部门编辑", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -840,10 +840,10 @@ export default defineMock([ children: [], }, { - id: 78, - parentId: 5, + id: "78", + parentId: "5", name: "部门删除", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -857,10 +857,10 @@ export default defineMock([ ], }, { - id: 6, - parentId: 1, + id: "6", + parentId: "1", name: "字典管理", - type: "MENU", + type: "M", routeName: "Dict", routePath: "dict", component: "system/dict/index", @@ -871,10 +871,10 @@ export default defineMock([ perm: null, children: [ { - id: 79, - parentId: 6, + id: "79", + parentId: "6", name: "字典新增", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -886,10 +886,10 @@ export default defineMock([ children: [], }, { - id: 81, - parentId: 6, + id: "81", + parentId: "6", name: "字典编辑", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -901,10 +901,10 @@ export default defineMock([ children: [], }, { - id: 84, - parentId: 6, + id: "84", + parentId: "6", name: "字典删除", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -918,10 +918,10 @@ export default defineMock([ ], }, { - id: 135, - parentId: 1, + id: "135", + parentId: "1", name: "字典项", - type: "MENU", + type: "M", routeName: "DictData", routePath: "dict-item", component: "system/dict/dict-item", @@ -932,10 +932,10 @@ export default defineMock([ perm: null, children: [ { - id: 136, - parentId: 135, + id: "136", + parentId: "135", name: "字典项新增", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -947,10 +947,10 @@ export default defineMock([ children: [], }, { - id: 137, - parentId: 135, + id: "137", + parentId: "135", name: "字典项编辑", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -962,10 +962,10 @@ export default defineMock([ children: [], }, { - id: 138, - parentId: 135, + id: "138", + parentId: "135", name: "字典项删除", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -979,10 +979,10 @@ export default defineMock([ ], }, { - id: 117, - parentId: 1, + id: "117", + parentId: "1", name: "系统日志", - type: "MENU", + type: "M", routeName: "Log", routePath: "log", component: "system/log/index", @@ -994,10 +994,10 @@ export default defineMock([ children: [], }, { - id: 120, - parentId: 1, + id: "120", + parentId: "1", name: "系统配置", - type: "MENU", + type: "M", routeName: "Config", routePath: "config", component: "system/config/index", @@ -1008,10 +1008,10 @@ export default defineMock([ perm: null, children: [ { - id: 121, - parentId: 120, + id: "121", + parentId: "120", name: "查询系统配置", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1023,10 +1023,10 @@ export default defineMock([ children: [], }, { - id: 122, - parentId: 120, + id: "122", + parentId: "120", name: "新增系统配置", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1038,10 +1038,10 @@ export default defineMock([ children: [], }, { - id: 123, - parentId: 120, + id: "123", + parentId: "120", name: "修改系统配置", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1053,10 +1053,10 @@ export default defineMock([ children: [], }, { - id: 124, - parentId: 120, + id: "124", + parentId: "120", name: "删除系统配置", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1068,10 +1068,10 @@ export default defineMock([ children: [], }, { - id: 125, - parentId: 120, + id: "125", + parentId: "120", name: "刷新系统配置", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1085,10 +1085,10 @@ export default defineMock([ ], }, { - id: 126, - parentId: 1, + id: "126", + parentId: "1", name: "通知公告", - type: "MENU", + type: "M", routeName: "Notice", routePath: "notice", component: "system/notice/index", @@ -1099,10 +1099,10 @@ export default defineMock([ perm: null, children: [ { - id: 127, - parentId: 126, + id: "127", + parentId: "126", name: "查询", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1114,10 +1114,10 @@ export default defineMock([ children: [], }, { - id: 128, - parentId: 126, + id: "128", + parentId: "126", name: "新增", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1129,10 +1129,10 @@ export default defineMock([ children: [], }, { - id: 129, - parentId: 126, + id: "129", + parentId: "126", name: "编辑", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1144,10 +1144,10 @@ export default defineMock([ children: [], }, { - id: 130, - parentId: 126, + id: "130", + parentId: "126", name: "删除", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1159,10 +1159,10 @@ export default defineMock([ children: [], }, { - id: 133, - parentId: 126, + id: "133", + parentId: "126", name: "发布", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1174,10 +1174,10 @@ export default defineMock([ children: [], }, { - id: 134, - parentId: 126, + id: "134", + parentId: "126", name: "撤回", - type: "BUTTON", + type: "F", routeName: null, routePath: "", component: null, @@ -1193,10 +1193,10 @@ export default defineMock([ ], }, { - id: 118, - parentId: 0, + id: "118", + parentId: "0", name: "系统工具", - type: "CATALOG", + type: "C", routeName: null, routePath: "/codegen", component: "Layout", @@ -1207,10 +1207,10 @@ export default defineMock([ perm: null, children: [ { - id: 119, - parentId: 118, + id: "119", + parentId: "118", name: "代码生成", - type: "MENU", + type: "M", routeName: "Codegen", routePath: "codegen", component: "codegen/index", @@ -1224,10 +1224,10 @@ export default defineMock([ ], }, { - id: 40, - parentId: 0, + id: "40", + parentId: "0", name: "接口文档", - type: "CATALOG", + type: "C", routeName: null, routePath: "/api", component: "Layout", @@ -1238,10 +1238,10 @@ export default defineMock([ perm: null, children: [ { - id: 41, - parentId: 40, + id: "41", + parentId: "40", name: "Apifox", - type: "MENU", + type: "M", routeName: null, routePath: "apifox", component: "demo/api/apifox", @@ -1255,10 +1255,10 @@ export default defineMock([ ], }, { - id: 26, - parentId: 0, + id: "26", + parentId: "0", name: "平台文档", - type: "CATALOG", + type: "C", routeName: null, routePath: "/doc", component: "Layout", @@ -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,10 +1301,10 @@ export default defineMock([ ], }, { - id: 20, - parentId: 0, + id: "20", + parentId: "0", name: "多级菜单", - type: "CATALOG", + type: "C", routeName: null, routePath: "/multi-level", component: "Layout", @@ -1315,10 +1315,10 @@ export default defineMock([ perm: null, children: [ { - id: 21, - parentId: 20, + id: "21", + parentId: "20", name: "菜单一级", - type: "CATALOG", + type: "C", routeName: null, routePath: "multi-level1", component: "Layout", @@ -1329,10 +1329,10 @@ export default defineMock([ perm: null, children: [ { - id: 22, - parentId: 21, + id: "22", + parentId: "21", name: "菜单二级", - type: "CATALOG", + type: "C", routeName: null, routePath: "multi-level2", component: "Layout", @@ -1343,10 +1343,10 @@ export default defineMock([ perm: null, children: [ { - id: 23, - parentId: 22, + id: "23", + parentId: "22", name: "菜单三级-1", - type: "MENU", + type: "M", routeName: null, routePath: "multi-level3-1", component: "demo/multi-level/children/children/level3-1", @@ -1358,10 +1358,10 @@ export default defineMock([ children: [], }, { - id: 24, - parentId: 22, + id: "24", + parentId: "22", name: "菜单三级-2", - type: "MENU", + type: "M", routeName: null, routePath: "multi-level3-2", component: "demo/multi-level/children/children/level3-2", @@ -1379,10 +1379,10 @@ export default defineMock([ ], }, { - id: 36, - parentId: 0, + id: "36", + parentId: "0", name: "组件封装", - type: "CATALOG", + type: "C", routeName: null, routePath: "/component", component: "Layout", @@ -1393,10 +1393,10 @@ export default defineMock([ perm: null, children: [ { - id: 108, - parentId: 36, + id: "108", + parentId: "36", name: "增删改查", - type: "MENU", + type: "M", routeName: null, routePath: "curd", component: "demo/curd/index", @@ -1408,10 +1408,10 @@ export default defineMock([ children: [], }, { - id: 109, - parentId: 36, + id: "109", + parentId: "36", name: "列表选择器", - type: "MENU", + type: "M", routeName: null, routePath: "table-select", component: "demo/table-select/index", @@ -1423,10 +1423,10 @@ export default defineMock([ children: [], }, { - id: 37, - parentId: 36, + id: "37", + parentId: "36", name: "富文本编辑器", - type: "MENU", + type: "M", routeName: null, routePath: "wang-editor", component: "demo/wang-editor", @@ -1438,10 +1438,10 @@ export default defineMock([ children: [], }, { - id: 38, - parentId: 36, + id: "38", + parentId: "36", name: "图片上传", - type: "MENU", + type: "M", routeName: null, routePath: "upload", component: "demo/upload", @@ -1453,10 +1453,10 @@ export default defineMock([ children: [], }, { - id: 95, - parentId: 36, + id: "95", + parentId: "36", name: "字典组件", - type: "MENU", + type: "M", routeName: null, routePath: "dict-demo", component: "demo/dict", @@ -1468,10 +1468,10 @@ export default defineMock([ children: [], }, { - id: 39, - parentId: 36, + id: "39", + parentId: "36", name: "图标选择器", - type: "MENU", + type: "M", routeName: null, routePath: "icon-selector", component: "demo/icon-selector", @@ -1485,10 +1485,10 @@ export default defineMock([ ], }, { - id: 110, - parentId: 0, + id: "110", + parentId: "0", name: "路由参数", - type: "CATALOG", + type: "C", routeName: null, routePath: "/route-param", component: "Layout", @@ -1499,10 +1499,10 @@ export default defineMock([ perm: null, children: [ { - id: 111, - parentId: 110, + id: "111", + parentId: "110", name: "参数(type=1)", - type: "MENU", + type: "M", routeName: null, routePath: "route-param-type1", component: "demo/route-param", @@ -1514,10 +1514,10 @@ export default defineMock([ children: [], }, { - id: 112, - parentId: 110, + id: "112", + parentId: "110", name: "参数(type=2)", - type: "MENU", + type: "M", routeName: null, routePath: "route-param-type2", component: "demo/route-param", @@ -1531,10 +1531,10 @@ export default defineMock([ ], }, { - id: 7, - parentId: 0, + id: "7", + parentId: "0", name: "功能演示", - type: "CATALOG", + type: "C", routeName: null, routePath: "/function", component: "Layout", @@ -1545,10 +1545,10 @@ export default defineMock([ perm: null, children: [ { - id: 801, - parentId: 7, + id: "801", + parentId: "7", name: "Icons", - type: "MENU", + type: "M", routeName: null, routePath: "icon-demo", component: "demo/icons", @@ -1560,10 +1560,10 @@ export default defineMock([ children: [], }, { - id: 802, - parentId: 7, + id: "802", + parentId: "7", name: "字典实时同步", - type: "MENU", + type: "M", routeName: null, routePath: "dict-sync", component: "demo/dict-sync", @@ -1575,10 +1575,10 @@ export default defineMock([ children: [], }, { - id: 803, - parentId: 7, + id: "803", + parentId: "7", name: "VxeTable", - type: "MENU", + type: "M", routeName: null, routePath: "vxe-table", component: "demo/vxe-table/index", @@ -1590,10 +1590,10 @@ export default defineMock([ children: [], }, { - id: 804, - parentId: 7, + 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", }; }, @@ -2016,10 +2036,10 @@ export default defineMock([ // 菜单映射表数据 const menuMap: Record = { 1: { - id: 1, - parentId: 0, + id: "1", + parentId: "0", name: "系统管理", - type: "CATALOG", + type: "C", routeName: "", routePath: "/system", component: "Layout", @@ -2033,10 +2053,10 @@ const menuMap: Record = { params: null, }, 2: { - id: 2, - parentId: 1, + id: "2", + parentId: "1", name: "用户管理", - type: "MENU", + type: "M", routeName: "User", routePath: "user", component: "system/user/index", @@ -2049,10 +2069,10 @@ const menuMap: Record = { alwaysShow: null, }, 3: { - id: 3, - parentId: 1, + id: "3", + parentId: "1", name: "角色管理", - type: "MENU", + type: "M", routeName: "Role", routePath: "role", component: "system/role/index", @@ -2065,10 +2085,10 @@ const menuMap: Record = { alwaysShow: null, }, 4: { - id: 4, - parentId: 1, + id: "4", + parentId: "1", name: "菜单管理", - type: "MENU", + type: "M", routeName: "Menu", routePath: "menu", component: "system/menu/index", @@ -2081,10 +2101,10 @@ const menuMap: Record = { alwaysShow: null, }, 5: { - id: 5, - parentId: 1, + id: "5", + parentId: "1", name: "部门管理", - type: "MENU", + type: "M", routeName: "Dept", routePath: "dept", component: "system/dept/index", @@ -2097,10 +2117,10 @@ const menuMap: Record = { alwaysShow: null, }, 6: { - id: 6, - parentId: 1, + id: "6", + parentId: "1", name: "字典管理", - type: "MENU", + type: "M", routeName: "Dict", routePath: "dict", component: "system/dict/index", @@ -2113,10 +2133,10 @@ const menuMap: Record = { alwaysShow: null, }, 7: { - id: 7, - parentId: 0, + id: "7", + parentId: "0", name: "功能演示", - type: "CATALOG", + type: "C", routeName: "", routePath: "/function", component: "Layout", @@ -2130,10 +2150,10 @@ const menuMap: Record = { params: null, }, 801: { - id: 801, - parentId: 7, + id: "801", + parentId: "7", name: "Icons", - type: "MENU", + type: "M", routeName: "IconDemo", routePath: "icon-demo", component: "demo/icons", @@ -2147,10 +2167,10 @@ const menuMap: Record = { params: null, }, 802: { - id: 802, - parentId: 7, + id: "802", + parentId: "7", name: "字典实时同步", - type: "MENU", + type: "M", routeName: "DictSync", routePath: "dict-sync", component: "demo/dict-sync", @@ -2164,10 +2184,10 @@ const menuMap: Record = { params: null, }, 803: { - id: 803, - parentId: 7, + id: "803", + parentId: "7", name: "VxeTable", - type: "MENU", + type: "M", routeName: "VxeTable", routePath: "vxe-table", component: "demo/vxe-table/index", @@ -2181,10 +2201,10 @@ const menuMap: Record = { params: null, }, 804: { - id: 804, - parentId: 7, + id: "804", + parentId: "7", name: "CURD单文件", - type: "MENU", + type: "M", routeName: "CurdSingle", routePath: "curd-single", component: "demo/curd-single", 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], }, }; 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": { 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: { 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)) {