From b6d0a6417093799cb2a72a8e573dff8246858ec8 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Sat, 15 Jun 2024 11:45:32 +0800 Subject: [PATCH 01/35] =?UTF-8?q?docs:=20:memo:=20=E6=B7=BB=E5=8A=A0=20nod?= =?UTF-8?q?e=20=E4=B8=8D=E5=8F=AF=E7=94=A8=E7=89=88=E6=9C=AC=E5=A3=B0?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 986bea32..81ec1720 100644 --- a/README.md +++ b/README.md @@ -53,8 +53,8 @@ | 环境 | 名称版本 | 下载地址 | | -------------------- | :----------------------------------------------------------- | ------------------------------------------------------------ | -| **开发工具** | VSCode | [下载](https://code.visualstudio.com/Download) | -| **运行环境** | Node ≥18 | [下载](http://nodejs.cn/download) | +| **开发工具** | VSCode | [下载](https://code.visualstudio.com/Download) | +| **运行环境** | Node ≥18 (其中 20.6.0 版本不可用) | [下载](http://nodejs.cn/download) | ## 项目启动 From 2d9193c47fd224f01f82b9c0b2bbeb5e7cb33584 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Sun, 16 Jun 2024 10:12:16 +0800 Subject: [PATCH 02/35] =?UTF-8?q?feat:=20:sparkles:=20=E6=9B=B4=E6=8D=A2?= =?UTF-8?q?=E6=9D=83=E9=99=90=E5=88=86=E9=85=8D=E5=BC=B9=E7=AA=97=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=B8=BA=20drawer=20=E5=B9=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=88=B6=E5=AD=90=E8=81=94=E5=8A=A8=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将权限分配弹窗从 dialog 更换为 drawer,提升用户体验。 添加父子联动开关以解决选择父节点时无需选择子节点的问题。 https://gitee.com/youlaiorg/vue3-element-admin/issues/I9T2BA #I9T2BA --- src/views/system/role/index.vue | 200 +++++++++++++++++++++----------- 1 file changed, 135 insertions(+), 65 deletions(-) diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index 388f4b43..e62b10ea 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -22,7 +22,7 @@ - - + - - + - diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index 65cfd16d..2b0a91e4 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -1,5 +1,4 @@ - - + - + @@ -418,8 +447,7 @@ defineOptions({ inheritAttrs: false, }); -import MenuAPI from "@/api/menu"; -import { MenuQuery, MenuForm, MenuVO } from "@/api/menu/model"; +import MenuAPI, { MenuQuery, MenuForm, MenuVO } from "@/api/menu"; import { MenuTypeEnum } from "@/enums/MenuTypeEnum"; const queryFormRef = ref(ElForm); @@ -458,7 +486,7 @@ const rules = reactive({ parentId: [{ required: true, message: "请选择顶级菜单", trigger: "blur" }], name: [{ required: true, message: "请输入菜单名称", trigger: "blur" }], type: [{ required: true, message: "请选择菜单类型", trigger: "blur" }], - path: [{ required: true, message: "请输入路由路径", trigger: "blur" }], + routePath: [{ required: true, message: "请输入路由路径", trigger: "blur" }], component: [{ required: true, message: "请输入组件路径", trigger: "blur" }], visible: [{ required: true, message: "请输入路由路径", trigger: "blur" }], }); @@ -496,7 +524,7 @@ function handleRowClick(row: MenuVO) { * @param parentId 父菜单ID * @param menuId 菜单ID */ -function handleDialogOpen(parentId?: number, menuId?: number) { +function handleOpenDialog(parentId?: number, menuId?: number) { MenuAPI.getOptions() .then((data) => { menuOptions.value = [{ value: 0, label: "顶级菜单", children: data }]; @@ -541,13 +569,13 @@ function submitForm() { if (menuId) { MenuAPI.update(menuId, formData.value).then(() => { ElMessage.success("修改成功"); - closeDialog(); + handleCloseDialog(); handleQuery(); }); } else { MenuAPI.add(formData.value).then(() => { ElMessage.success("新增成功"); - closeDialog(); + handleCloseDialog(); handleQuery(); }); } @@ -577,7 +605,7 @@ function handleDelete(menuId: number) { } // 关闭弹窗 -function closeDialog() { +function handleCloseDialog() { dialog.visible = false; menuFormRef.value.resetFields(); menuFormRef.value.clearValidate(); diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index e62b10ea..d332e135 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -195,7 +195,6 @@ :data="menuPermOptions" :filter-node-method="handlePermFilter" :default-expand-all="true" - :check-on-click-node="true" :check-strictly="!parentChildLinked" class="mt-5" > @@ -222,11 +221,9 @@ defineOptions({ inheritAttrs: false, }); -import RoleAPI from "@/api/role"; +import RoleAPI, { RolePageVO, RoleForm, RolePageQuery } from "@/api/role"; import MenuAPI from "@/api/menu"; -import { RolePageVO, RoleForm, RoleQuery } from "@/api/role/model"; - const queryFormRef = ref(ElForm); const roleFormRef = ref(ElForm); const permTreeRef = ref>(); @@ -235,7 +232,7 @@ const loading = ref(false); const ids = ref([]); const total = ref(0); -const queryParams = reactive({ +const queryParams = reactive({ pageNum: 1, pageSize: 10, }); @@ -315,7 +312,7 @@ function handleOpenDialog(roleId?: number) { } } -// 角色保存提交 +/** 提交角色表单 */ function handleSubmit() { roleFormRef.value.validate((valid: any) => { if (valid) { @@ -342,7 +339,7 @@ function handleSubmit() { }); } -// 关闭表单弹窗 +/** 关闭表单弹窗 */ function handleCloseDialog() { dialog.visible = false; @@ -354,7 +351,7 @@ function handleCloseDialog() { formData.status = 1; } -// 删除角色 +/** 删除角色 */ function handleDelete(roleId?: number) { const roleIds = [roleId || ids.value].join(","); if (!roleIds) { @@ -377,7 +374,7 @@ function handleDelete(roleId?: number) { }); } -// 打开分配权限 +/** 打开分配菜单权限弹窗 */ async function handleOpenAssignPermDialog(row: RolePageVO) { const roleId = row.id; if (roleId) { @@ -404,7 +401,7 @@ async function handleOpenAssignPermDialog(row: RolePageVO) { } } -// 分配权限提交 +/** 分配菜单权限提交 */ function handleAssignPermSubmit() { const roleId = checkedRole.value.id; if (roleId) { @@ -425,7 +422,7 @@ function handleAssignPermSubmit() { } } -// 切换菜单树展开状态 +/** 展开/收缩 菜单权限树 */ function togglePermTree() { isExpanded.value = !isExpanded.value; if (permTreeRef.value) { @@ -438,11 +435,12 @@ function togglePermTree() { }); } } +// 菜单权限筛选 watch(permKeywords, (val) => { permTreeRef.value!.filter(val); }); -// 权限筛选 +/** 权限筛选 */ function handlePermFilter( value: string, data: { @@ -453,6 +451,7 @@ function handlePermFilter( return data.label.includes(value); } +/** 父子菜单节点是否联动 change*/ function handleparentChildLinkedChange(val: any) { parentChildLinked.value = val; } diff --git a/src/views/system/user/components/user-import.vue b/src/views/system/user/components/user-import.vue new file mode 100644 index 00000000..016dac52 --- /dev/null +++ b/src/views/system/user/components/user-import.vue @@ -0,0 +1,145 @@ + + + diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index f337f7a1..6124a205 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -59,12 +59,12 @@ @@ -332,30 +285,28 @@ defineOptions({ inheritAttrs: false, }); -import UserAPI from "@/api/user"; +import UserAPI, { UserForm, UserPageQuery, UserPageVO } from "@/api/user"; import DeptAPI from "@/api/dept"; import RoleAPI from "@/api/role"; -import { UserForm, UserQuery, UserPageVO } from "@/api/user/model"; -import type { UploadInstance } from "element-plus"; -import { genFileId } from "element-plus"; +const queryFormRef = ref(ElForm); +const userFormRef = ref(ElForm); -const queryFormRef = ref(ElForm); // 查询表单 -const userFormRef = ref(ElForm); // 用户表单 -const uploadRef = ref(); // 上传组件 - -const loading = ref(false); // 加载状态 -const removeIds = ref([]); // 删除用户ID集合 用于批量删除 -const queryParams = reactive({ +const loading = ref(false); +const removeIds = ref([]); +const total = ref(0); +const pageData = ref(); +/** 部门下拉选项 */ +const deptOptions = ref(); +/** 角色下拉选项 */ +const roleOptions = ref(); +/** 用户查询参数 */ +const queryParams = reactive({ pageNum: 1, pageSize: 10, }); -const dateTimeRange = ref(""); -const total = ref(0); // 数据总数 -const pageData = ref(); // 用户分页数据 -const deptList = ref(); // 部门下拉数据源 -const roleList = ref(); // 角色下拉数据源 +const dateTimeRange = ref(""); watch(dateTimeRange, (newVal) => { if (newVal) { queryParams.startTime = newVal[0]; @@ -363,27 +314,21 @@ watch(dateTimeRange, (newVal) => { } }); -// 弹窗对象 +/** 用户弹窗对象 */ const dialog = reactive({ visible: false, - type: "user-form", - width: 800, title: "", }); +/** 导入弹窗显示状态 */ +const importDialogVisible = ref(false); + // 用户表单数据 const formData = reactive({ status: 1, }); -// 用户导入数据 -const importData = reactive({ - deptId: undefined, - file: undefined, - fileList: [], -}); - -// 校验规则 +/** 用户表单校验规则 */ const rules = reactive({ username: [{ required: true, message: "用户名不能为空", trigger: "blur" }], nickname: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }], @@ -436,7 +381,7 @@ function handleSelectionChange(selection: any) { } /** 重置密码 */ -function resetPassword(row: { [key: string]: any }) { +function hancleResetPassword(row: { [key: string]: any }) { ElMessageBox.prompt( "请输入用户「" + row.username + "」的新密码", "重置密码", @@ -456,110 +401,63 @@ function resetPassword(row: { [key: string]: any }) { }); } -/** 加载角色下拉数据源 */ -async function loadRoleOptions() { - RoleAPI.getOptions().then((data) => { - roleList.value = data; - }); -} - -/** 加载部门下拉数据源 */ -async function loadDeptOptions() { - DeptAPI.getOptions().then((data) => { - deptList.value = data; - }); -} - /** * 打开弹窗 * - * @param type 弹窗类型 用户表单:user-form | 用户导入:user-import * @param id 用户ID */ -async function openDialog(type: string, id?: number) { +async function handleOpenDialog(id?: number) { dialog.visible = true; - dialog.type = type; + // 加载角色下拉数据源 + roleOptions.value = await RoleAPI.getOptions(); + // 加载部门下拉数据源 + deptOptions.value = await DeptAPI.getOptions(); - if (dialog.type === "user-form") { - // 用户表单弹窗 - await loadDeptOptions(); - await loadRoleOptions(); - if (id) { - dialog.title = "修改用户"; - UserAPI.getFormData(id).then((data) => { - Object.assign(formData, { ...data }); - }); - } else { - dialog.title = "新增用户"; - } - } else if (dialog.type === "user-import") { - // 用户导入弹窗 - dialog.title = "导入用户"; - dialog.width = 600; - loadDeptOptions(); + if (id) { + dialog.title = "修改用户"; + UserAPI.getFormData(id).then((data) => { + Object.assign(formData, { ...data }); + }); + } else { + dialog.title = "新增用户"; } } -/** - * 关闭弹窗 - * - * @param type 弹窗类型 用户表单:user-form | 用户导入:user-import - */ -function closeDialog() { +/** 关闭弹窗 */ +function handleCloseDialog() { dialog.visible = false; - if (dialog.type === "user-form") { - userFormRef.value.resetFields(); - userFormRef.value.clearValidate(); + userFormRef.value.resetFields(); + userFormRef.value.clearValidate(); - formData.id = undefined; - formData.status = 1; - } else if (dialog.type === "user-import") { - importData.file = undefined; - importData.fileList = []; - } + formData.id = undefined; + formData.status = 1; } /** 表单提交 */ const handleSubmit = useThrottleFn(() => { - if (dialog.type === "user-form") { - userFormRef.value.validate((valid: any) => { - if (valid) { - const userId = formData.id; - loading.value = true; - if (userId) { - UserAPI.update(userId, formData) - .then(() => { - ElMessage.success("修改用户成功"); - closeDialog(); - handleResetQuery(); - }) - .finally(() => (loading.value = false)); - } else { - UserAPI.add(formData) - .then(() => { - ElMessage.success("新增用户成功"); - closeDialog(); - handleResetQuery(); - }) - .finally(() => (loading.value = false)); - } + userFormRef.value.validate((valid: any) => { + if (valid) { + const userId = formData.id; + loading.value = true; + if (userId) { + UserAPI.update(userId, formData) + .then(() => { + ElMessage.success("修改用户成功"); + handleCloseDialog(); + handleResetQuery(); + }) + .finally(() => (loading.value = false)); + } else { + UserAPI.add(formData) + .then(() => { + ElMessage.success("新增用户成功"); + handleCloseDialog(); + handleResetQuery(); + }) + .finally(() => (loading.value = false)); } - }); - } else if (dialog.type === "user-import") { - if (!importData?.deptId) { - ElMessage.warning("请选择部门"); - return false; } - if (!importData?.file) { - ElMessage.warning("上传Excel文件不能为空"); - return false; - } - UserAPI.import(importData?.deptId, importData?.file).then((data) => { - ElMessage.success("导入用户成功"); - closeDialog(); - handleResetQuery(); - }); - } + }); }, 3000); /** 删除用户 */ @@ -581,44 +479,14 @@ function handleDelete(id?: number) { }); }); } - -/** 下载导入模板 */ -function downloadTemplate() { - UserAPI.downloadTemplate().then((response: any) => { - const fileData = response.data; - const fileName = decodeURI( - response.headers["content-disposition"].split(";")[1].split("=")[1] - ); - const fileType = - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"; - - const blob = new Blob([fileData], { type: fileType }); - const downloadUrl = window.URL.createObjectURL(blob); - - const downloadLink = document.createElement("a"); - downloadLink.href = downloadUrl; - downloadLink.download = fileName; - - document.body.appendChild(downloadLink); - downloadLink.click(); - - document.body.removeChild(downloadLink); - window.URL.revokeObjectURL(downloadUrl); - }); +/** 打开导入弹窗 */ +function handleOpenImportDialog() { + importDialogVisible.value = true; } -/** Excel文件 Change */ -function handleFileChange(file: any) { - importData.file = file.raw; -} - -/** Excel文件 Exceed */ -function handleFileExceed(files: any) { - uploadRef.value!.clearFiles(); - const file = files[0]; - file.uid = genFileId(); - uploadRef.value!.handleStart(file); - importData.file = file; +/** 导入用户成功 */ +function handleOpenImportDialogSuccess() { + handleQuery(); } /** 导出用户 */ diff --git a/tsconfig.json b/tsconfig.json index 6d1e993c..9acc1fad 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,9 +25,8 @@ "jsxFragmentFactory": "Fragment" }, "include": [ - "src/**/*.ts", "src/**/*.vue", - "src/typings/**/*.d.ts", + "src/types/**/*.d.ts", "mock/**/*.ts", "vite.config.ts" ], From 87305aaf8f5e4db1c142d03e3a306d32e4aa19fb Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Tue, 25 Jun 2024 00:18:51 +0800 Subject: [PATCH 17/35] =?UTF-8?q?chore:=20:hammer:=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=AF=BC=E5=85=A5=E7=B1=BB=E5=9E=8B=E5=A3=B0?= =?UTF-8?q?=E6=98=8E=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index ecd70d33..4a6b65c0 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -100,7 +100,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { vueTemplate: true, // 指定自动导入函数TS类型声明文件路径 (false:关闭自动生成) dts: false, - // dts: "src/typings/auto-imports.d.ts", + // dts: "src/types/auto-imports.d.ts", }), Components({ resolvers: [ @@ -116,7 +116,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { dirs: ["src/components", "src/**/components"], // 指定自动导入组件TS类型声明文件路径 (false:关闭自动生成) dts: false, - // dts: "src/typings/components.d.ts", + // dts: "src/types/components.d.ts", }), Icons({ // 自动安装图标库 From 339db4be8ed5600dd073d18b9044baae970b6db9 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Tue, 25 Jun 2024 00:20:03 +0800 Subject: [PATCH 18/35] =?UTF-8?q?refactor:=20:recycle:=20=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E6=8E=A5=E5=8F=A3=E9=87=8D=E6=9E=84mock=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=90=8C=E6=AD=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mock/dept.mock.ts | 6 + mock/dict.mock.ts | 197 +++++++-------------- mock/menu.mock.ts | 434 ++++++++++++++++++++++++++++++---------------- 3 files changed, 349 insertions(+), 288 deletions(-) diff --git a/mock/dept.mock.ts b/mock/dept.mock.ts index eac3aa83..e9b6d1bb 100644 --- a/mock/dept.mock.ts +++ b/mock/dept.mock.ts @@ -36,6 +36,7 @@ export default defineMock([ id: 1, parentId: 0, name: "有来技术", + code: "YOULAI", sort: 1, status: 1, children: [ @@ -43,6 +44,7 @@ export default defineMock([ id: 2, parentId: 1, name: "研发部门", + code: "RD001", sort: 1, status: 1, children: [], @@ -53,6 +55,7 @@ export default defineMock([ id: 3, parentId: 1, name: "测试部门", + code: "QA001", sort: 1, status: 1, children: [], @@ -126,6 +129,7 @@ const deptMap: Record = { 1: { id: 1, name: "有来技术", + code: "YOULAI", parentId: 0, status: 1, sort: 1, @@ -133,6 +137,7 @@ const deptMap: Record = { 2: { id: 2, name: "研发部门", + code: "RD001", parentId: 1, status: 1, sort: 1, @@ -140,6 +145,7 @@ const deptMap: Record = { 3: { id: 3, name: "测试部门", + code: "QA001", parentId: 1, status: 1, sort: 1, diff --git a/mock/dict.mock.ts b/mock/dict.mock.ts index ebaef2ec..63b4b2c1 100644 --- a/mock/dict.mock.ts +++ b/mock/dict.mock.ts @@ -5,11 +5,11 @@ export default defineMock([ url: "dict/:code/options", method: ["GET"], body: ({ params }) => { - const typeCode = params.code; + const code = params.code; let list = null; - if (typeCode == "gender") { + if (code == "gender") { list = [ { value: "1", @@ -21,7 +21,7 @@ export default defineMock([ }, { value: "0", - label: "未知", + label: "保密", }, ]; } @@ -35,7 +35,7 @@ export default defineMock([ }, { - url: "dict/types/page", + url: "dict/page", method: ["GET"], body: { code: "00000", @@ -46,104 +46,37 @@ export default defineMock([ name: "性别", code: "gender", status: 1, - }, - { - id: 2, - name: "状态", - code: "status", - status: 1, + dictItems: [ + { + id: 1, + name: "男", + value: "1", + sort: 1, + status: 1, + }, + { + id: 2, + name: "女", + value: "2", + sort: 2, + status: 1, + }, + { + id: 3, + name: "保密", + value: "0", + sort: 3, + status: 1, + }, + ], }, ], - total: 2, + total: 1, }, msg: "一切ok", }, }, - { - url: "dict/page", - method: ["GET"], - body: { - code: "00000", - data: { - list: [ - { - id: 1, - name: "男", - value: "1", - status: 1, - }, - { - id: 2, - name: "女", - value: "2", - status: 1, - }, - { - id: 3, - name: "未知", - value: "0", - status: 1, - }, - ], - total: 3, - }, - msg: "一切ok", - }, - }, - - // 新增字典 - { - url: "dict/types", - method: ["POST"], - body({ body }) { - return { - code: "00000", - data: null, - msg: "新增字典" + body.name + "成功", - }; - }, - }, - - // 获取字典表单数据 - { - url: "dict/types/:id/form", - method: ["GET"], - body: ({ params }) => { - return { - code: "00000", - data: dictTypeMap[params.id], - msg: "一切ok", - }; - }, - }, - - // 修改字典 - { - url: "dict/types/:id", - method: ["PUT"], - body({ body }) { - return { - code: "00000", - data: null, - msg: "修改字典" + body.name + "成功", - }; - }, - }, - - // 删除字典 - { - url: "dict/types/:id", - method: ["DELETE"], - body({ params }) { - return { - code: "00000", - data: null, - msg: "删除字典" + params.id + "成功", - }; - }, - }, - // 新增字典 { url: "dict", @@ -197,51 +130,39 @@ export default defineMock([ }, ]); -// 字典映射表数据 -const dictTypeMap: Record = { - 1: { - id: 1, - name: "性别", - code: "gender", - status: 1, - remark: null, - }, - 2: { - id: 2, - name: "状态", - code: "status", - status: 1, - remark: null, - }, -}; - // 字典映射表数据 const dictMap: Record = { 1: { - id: 1, - typeCode: "gender", - name: "男", - value: "1", - status: 1, - sort: 1, - remark: null, - }, - 2: { - id: 2, - typeCode: "gender", - name: "女", - value: "2", - status: 1, - sort: 2, - remark: null, - }, - 3: { - id: 3, - typeCode: "gender", - name: "未知", - value: "0", - status: 1, - sort: 1, - remark: null, + code: "00000", + data: { + id: 1, + name: "性别", + code: "gender", + status: 1, + dictItems: [ + { + id: 1, + name: "男", + value: "1", + sort: 1, + status: 1, + }, + { + id: 2, + name: "女", + value: "2", + sort: 2, + status: 1, + }, + { + id: 3, + name: "未知", + value: "0", + sort: 3, + status: 1, + }, + ], + }, + msg: "一切ok", }, }; diff --git a/mock/menu.mock.ts b/mock/menu.mock.ts index 59c3b918..993bc63d 100644 --- a/mock/menu.mock.ts +++ b/mock/menu.mock.ts @@ -454,7 +454,8 @@ export default defineMock([ parentId: 0, name: "系统管理", type: "CATALOG", - path: "/system", + routeName: "", + routePath: "/system", component: "Layout", sort: 1, visible: 1, @@ -467,7 +468,8 @@ export default defineMock([ parentId: 1, name: "用户管理", type: "MENU", - path: "user", + routeName: "User", + routePath: "user", component: "system/user/index", sort: 1, visible: 1, @@ -475,12 +477,28 @@ export default defineMock([ redirect: null, perm: null, children: [ + { + id: 105, + parentId: 2, + name: "用户查询", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 0, + visible: 1, + icon: "", + redirect: null, + perm: "sys:user:query", + children: [], + }, { id: 31, parentId: 2, name: "用户新增", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 1, visible: 1, @@ -494,7 +512,8 @@ export default defineMock([ parentId: 2, name: "用户编辑", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 2, visible: 1, @@ -508,7 +527,8 @@ export default defineMock([ parentId: 2, name: "用户删除", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 3, visible: 1, @@ -522,7 +542,8 @@ export default defineMock([ parentId: 2, name: "重置密码", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 4, visible: 1, @@ -531,6 +552,36 @@ export default defineMock([ perm: "sys:user:password:reset", children: [], }, + { + id: 106, + parentId: 2, + name: "用户导入", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 5, + visible: 1, + icon: "", + redirect: null, + perm: "sys:user:import", + children: [], + }, + { + id: 107, + parentId: 2, + name: "用户导出", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 6, + visible: 1, + icon: "", + redirect: null, + perm: "sys:user:export", + children: [], + }, ], }, { @@ -538,7 +589,8 @@ export default defineMock([ parentId: 1, name: "角色管理", type: "MENU", - path: "role", + routeName: "Role", + routePath: "role", component: "system/role/index", sort: 2, visible: 1, @@ -551,7 +603,8 @@ export default defineMock([ parentId: 3, name: "角色新增", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 1, visible: 1, @@ -565,7 +618,8 @@ export default defineMock([ parentId: 3, name: "角色编辑", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 2, visible: 1, @@ -579,7 +633,8 @@ export default defineMock([ parentId: 3, name: "角色删除", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 3, visible: 1, @@ -595,7 +650,8 @@ export default defineMock([ parentId: 1, name: "菜单管理", type: "MENU", - path: "menu", + routeName: "Menu", + routePath: "menu", component: "system/menu/index", sort: 3, visible: 1, @@ -608,7 +664,8 @@ export default defineMock([ parentId: 4, name: "菜单新增", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 1, visible: 1, @@ -617,26 +674,13 @@ export default defineMock([ perm: "sys:menu:add", children: [], }, - { - id: 74, - parentId: 4, - name: "菜单编辑", - type: "BUTTON", - path: "", - component: null, - sort: 3, - visible: 1, - icon: "", - redirect: null, - perm: "sys:menu:edit", - children: [], - }, { id: 75, parentId: 4, name: "菜单删除", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 3, visible: 1, @@ -645,6 +689,21 @@ export default defineMock([ perm: "sys:menu:delete", children: [], }, + { + id: 74, + parentId: 4, + name: "菜单编辑", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 3, + visible: 1, + icon: "", + redirect: null, + perm: "sys:menu:edit", + children: [], + }, ], }, { @@ -652,7 +711,8 @@ export default defineMock([ parentId: 1, name: "部门管理", type: "MENU", - path: "dept", + routeName: "Dept", + routePath: "dept", component: "system/dept/index", sort: 4, visible: 1, @@ -665,7 +725,8 @@ export default defineMock([ parentId: 5, name: "部门新增", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 1, visible: 1, @@ -679,7 +740,8 @@ export default defineMock([ parentId: 5, name: "部门编辑", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 2, visible: 1, @@ -693,7 +755,8 @@ export default defineMock([ parentId: 5, name: "部门删除", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 3, visible: 1, @@ -709,7 +772,8 @@ export default defineMock([ parentId: 1, name: "字典管理", type: "MENU", - path: "dict", + routeName: "Dict", + routePath: "dict", component: "system/dict/index", sort: 5, visible: 1, @@ -720,9 +784,10 @@ export default defineMock([ { id: 79, parentId: 6, - name: "字典新增", + name: "字典类型新增", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 1, visible: 1, @@ -734,9 +799,10 @@ export default defineMock([ { id: 81, parentId: 6, - name: "字典编辑", + name: "字典类型编辑", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 2, visible: 1, @@ -748,9 +814,10 @@ export default defineMock([ { id: 84, parentId: 6, - name: "字典删除", + name: "字典类型删除", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 3, visible: 1, @@ -764,7 +831,8 @@ export default defineMock([ parentId: 6, name: "字典数据新增", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 4, visible: 1, @@ -778,7 +846,8 @@ export default defineMock([ parentId: 6, name: "字典数据编辑", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 5, visible: 1, @@ -792,7 +861,8 @@ export default defineMock([ parentId: 6, name: "字典数据删除", type: "BUTTON", - path: "", + routeName: null, + routePath: "", component: null, sort: 6, visible: 1, @@ -810,7 +880,8 @@ export default defineMock([ parentId: 0, name: "接口文档", type: "CATALOG", - path: "/api", + routeName: null, + routePath: "/api", component: "Layout", sort: 7, visible: 1, @@ -823,7 +894,8 @@ export default defineMock([ parentId: 40, name: "Apifox", type: "MENU", - path: "apifox", + routeName: null, + routePath: "apifox", component: "demo/api/apifox", sort: 1, visible: 1, @@ -832,34 +904,6 @@ export default defineMock([ perm: null, children: [], }, - { - id: 103, - parentId: 40, - name: "Swagger", - type: "MENU", - path: "swagger", - component: "demo/api/swagger", - sort: 2, - visible: 0, - icon: "api", - redirect: "", - perm: null, - children: [], - }, - { - id: 104, - parentId: 40, - name: "Knife4j", - type: "MENU", - path: "knife4j", - component: "demo/api/knife4j", - sort: 3, - visible: 0, - icon: "api", - redirect: "", - perm: null, - children: [], - }, ], }, { @@ -867,12 +911,13 @@ export default defineMock([ parentId: 0, name: "平台文档", type: "CATALOG", - path: "/doc", + routeName: null, + routePath: "/doc", component: "Layout", sort: 8, visible: 1, icon: "document", - redirect: null, + redirect: "https://juejin.cn/post/7228990409909108793", perm: null, children: [ { @@ -880,7 +925,8 @@ export default defineMock([ parentId: 26, name: "平台文档(内嵌)", type: "EXTLINK", - path: "internal-doc", + routeName: null, + routePath: "internal-doc", component: "demo/internal-doc", sort: 1, visible: 1, @@ -894,7 +940,8 @@ export default defineMock([ parentId: 26, name: "平台文档(外链)", type: "EXTLINK", - path: "https://juejin.cn/post/7228990409909108793", + routeName: null, + routePath: "https://juejin.cn/post/7228990409909108793", component: "", sort: 2, visible: 1, @@ -910,12 +957,13 @@ export default defineMock([ parentId: 0, name: "多级菜单", type: "CATALOG", - path: "/multi-level", + routeName: null, + routePath: "/multi-level", component: "Layout", sort: 9, visible: 1, icon: "cascader", - redirect: "/multi-level/multi-level1", + redirect: "", perm: null, children: [ { @@ -923,12 +971,13 @@ export default defineMock([ parentId: 20, name: "菜单一级", type: "MENU", - path: "multi-level1", + routeName: null, + routePath: "multi-level1", component: "demo/multi-level/level1", sort: 1, visible: 1, icon: "", - redirect: "/multi-level/multi-level2", + redirect: "", perm: null, children: [ { @@ -936,12 +985,13 @@ export default defineMock([ parentId: 21, name: "菜单二级", type: "MENU", - path: "multi-level2", + routeName: null, + routePath: "multi-level2", component: "demo/multi-level/children/level2", sort: 1, visible: 1, icon: "", - redirect: "/multi-level/multi-level2/multi-level3-1", + redirect: null, perm: null, children: [ { @@ -949,7 +999,8 @@ export default defineMock([ parentId: 22, name: "菜单三级-1", type: "MENU", - path: "multi-level3-1", + routeName: null, + routePath: "multi-level3-1", component: "demo/multi-level/children/children/level3-1", sort: 1, visible: 1, @@ -963,7 +1014,8 @@ export default defineMock([ parentId: 22, name: "菜单三级-2", type: "MENU", - path: "multi-level3-2", + routeName: null, + routePath: "multi-level3-2", component: "demo/multi-level/children/children/level3-2", sort: 2, visible: 1, @@ -983,7 +1035,8 @@ export default defineMock([ parentId: 0, name: "组件封装", type: "CATALOG", - path: "/component", + routeName: null, + routePath: "/component", component: "Layout", sort: 10, visible: 1, @@ -991,14 +1044,45 @@ export default defineMock([ redirect: "", perm: null, children: [ + { + id: 108, + parentId: 36, + name: "增删改查", + type: "MENU", + routeName: null, + routePath: "curd", + component: "demo/curd/index", + sort: 0, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + { + id: 109, + parentId: 36, + name: "列表选择器", + type: "MENU", + routeName: null, + routePath: "table-select", + component: "demo/table-select/index", + sort: 1, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, { id: 37, parentId: 36, name: "富文本编辑器", type: "MENU", - path: "wang-editor", + routeName: null, + routePath: "wang-editor", component: "demo/wang-editor", - sort: 1, + sort: 2, visible: 1, icon: "", redirect: "", @@ -1010,22 +1094,9 @@ export default defineMock([ parentId: 36, name: "图片上传", type: "MENU", - path: "upload", + routeName: null, + routePath: "upload", component: "demo/upload", - sort: 2, - visible: 1, - icon: "", - redirect: "", - perm: null, - children: [], - }, - { - id: 39, - parentId: 36, - name: "图标选择器", - type: "MENU", - path: "icon-selector", - component: "demo/icon-selector", sort: 3, visible: 1, icon: "", @@ -1038,7 +1109,8 @@ export default defineMock([ parentId: 36, name: "字典组件", type: "MENU", - path: "dict-demo", + routeName: null, + routePath: "dict-demo", component: "demo/dict", sort: 4, visible: 1, @@ -1048,30 +1120,63 @@ export default defineMock([ children: [], }, { - id: 93, + id: 39, parentId: 36, - name: "签名", + name: "图标选择器", type: "MENU", - path: "signature", - component: "demo/signature", - sort: 6, + routeName: null, + routePath: "icon-selector", + component: "demo/icon-selector", + sort: 4, visible: 1, icon: "", redirect: "", perm: null, children: [], }, + ], + }, + { + id: 110, + parentId: 0, + name: "路由参数", + type: "CATALOG", + routeName: null, + routePath: "/route-param", + component: "Layout", + sort: 11, + visible: 1, + icon: "el-icon-ElementPlus", + redirect: null, + perm: null, + children: [ { - id: 94, - parentId: 36, - name: "表格", + id: 111, + parentId: 110, + name: "参数(type=1)", type: "MENU", - path: "table", - component: "demo/table", - sort: 7, + routeName: null, + routePath: "route-param-type1", + component: "demo/route-param", + sort: 1, visible: 1, - icon: "", - redirect: "", + icon: "el-icon-Star", + redirect: null, + perm: null, + children: [], + }, + { + id: 112, + parentId: 110, + name: "参数(type=2)", + type: "MENU", + routeName: null, + routePath: "route-param-type2", + component: "demo/route-param", + sort: 2, + visible: 1, + icon: "el-icon-StarFilled", + redirect: null, perm: null, children: [], }, @@ -1082,9 +1187,10 @@ export default defineMock([ parentId: 0, name: "功能演示", type: "CATALOG", - path: "/function", + routeName: null, + routePath: "/function", component: "Layout", - sort: 11, + sort: 12, visible: 1, icon: "menu", redirect: "", @@ -1095,11 +1201,12 @@ export default defineMock([ parentId: 89, name: "Icons", type: "MENU", - path: "icon-demo", + routeName: null, + routePath: "icon-demo", component: "demo/icons", sort: 2, visible: 1, - icon: "el-icon-edit", + icon: "el-icon-Notification", redirect: "", perm: null, children: [], @@ -1109,7 +1216,8 @@ export default defineMock([ parentId: 89, name: "Websocket", type: "MENU", - path: "/function/websocket", + routeName: null, + routePath: "/function/websocket", component: "demo/websocket", sort: 3, visible: 1, @@ -1123,7 +1231,8 @@ export default defineMock([ parentId: 89, name: "敬请期待...", type: "CATALOG", - path: "other", + routeName: null, + routePath: "other/:id", component: "demo/other", sort: 4, visible: 1, @@ -1153,6 +1262,10 @@ export default defineMock([ value: 2, label: "用户管理", children: [ + { + value: 105, + label: "用户查询", + }, { value: 31, label: "用户新增", @@ -1169,6 +1282,14 @@ export default defineMock([ value: 88, label: "重置密码", }, + { + value: 106, + label: "用户导入", + }, + { + value: 107, + label: "用户导出", + }, ], }, { @@ -1197,14 +1318,14 @@ export default defineMock([ value: 73, label: "菜单新增", }, - { - value: 74, - label: "菜单编辑", - }, { value: 75, label: "菜单删除", }, + { + value: 74, + label: "菜单编辑", + }, ], }, { @@ -1231,15 +1352,15 @@ export default defineMock([ children: [ { value: 79, - label: "字典新增", + label: "字典类型新增", }, { value: 81, - label: "字典编辑", + label: "字典类型编辑", }, { value: 84, - label: "字典删除", + label: "字典类型删除", }, { value: 85, @@ -1265,14 +1386,6 @@ export default defineMock([ value: 41, label: "Apifox", }, - { - value: 103, - label: "Swagger", - }, - { - value: 104, - label: "Knife4j", - }, ], }, { @@ -1319,6 +1432,14 @@ export default defineMock([ value: 36, label: "组件封装", children: [ + { + value: 108, + label: "增删改查", + }, + { + value: 109, + label: "列表选择器", + }, { value: 37, label: "富文本编辑器", @@ -1327,21 +1448,27 @@ export default defineMock([ value: 38, label: "图片上传", }, - { - value: 39, - label: "图标选择器", - }, { value: 95, label: "字典组件", }, { - value: 93, - label: "签名", + value: 39, + label: "图标选择器", + }, + ], + }, + { + value: 110, + label: "路由参数", + children: [ + { + value: 111, + label: "参数(type=1)", }, { - value: 94, - label: "表格", + value: 112, + label: "参数(type=2)", }, ], }, @@ -1428,7 +1555,8 @@ const menuMap: Record = { parentId: 0, name: "系统管理", type: "CATALOG", - path: "/system", + routeName: "", + routePath: "/system", component: "Layout", perm: null, visible: 1, @@ -1437,13 +1565,15 @@ const menuMap: Record = { redirect: "/system/user", keepAlive: null, alwaysShow: null, + params: null, }, 2: { id: 2, parentId: 1, name: "用户管理", type: "MENU", - path: "user", + routeName: "User", + routePath: "user", component: "system/user/index", perm: null, visible: 1, @@ -1458,7 +1588,8 @@ const menuMap: Record = { parentId: 1, name: "角色管理", type: "MENU", - path: "role", + routeName: "Role", + routePath: "role", component: "system/role/index", perm: null, visible: 1, @@ -1473,7 +1604,8 @@ const menuMap: Record = { parentId: 1, name: "菜单管理", type: "MENU", - path: "menu", + routeName: "Menu", + routePath: "menu", component: "system/menu/index", perm: null, visible: 1, @@ -1488,7 +1620,8 @@ const menuMap: Record = { parentId: 1, name: "部门管理", type: "MENU", - path: "dept", + routeName: "Dept", + routePath: "dept", component: "system/dept/index", perm: null, visible: 1, @@ -1503,7 +1636,8 @@ const menuMap: Record = { parentId: 1, name: "字典管理", type: "MENU", - path: "dict", + routeName: "Dict", + routePath: "dict", component: "system/dict/index", perm: null, visible: 1, From 5ec0b03a8e338c04920b374c1f1983fc207a5cd5 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Tue, 25 Jun 2024 00:21:18 +0800 Subject: [PATCH 19/35] =?UTF-8?q?refactor:=20:recycle:=20=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/dept/index.vue | 2 +- src/views/system/dict/index.vue | 4 ---- src/views/system/menu/index.vue | 6 ++---- src/views/system/role/index.vue | 12 ++++++------ 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index d956aca0..e9234e33 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -90,7 +90,7 @@ 禁用 - - - - diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index 9f0ef2f7..e67ad2ad 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -208,10 +208,7 @@