From cc75f098546fbbdea3a9d80f15fe71fde13da97e Mon Sep 17 00:00:00 2001 From: xbzhu <5430389+xbzhu@user.noreply.gitee.com> Date: Sat, 21 Jan 2023 07:03:49 +0000 Subject: [PATCH 1/3] =?UTF-8?q?update=20ZR.Vue/src/views/system/menu/index?= =?UTF-8?q?.vue.=20=E6=96=B0=E5=A2=9E/=E4=BF=AE=E6=94=B9/=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=AD=90=E8=8A=82=E7=82=B9=E6=97=B6=EF=BC=8C=E5=AD=90?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E6=9C=AA=E6=9B=B4=E6=96=B0=E3=80=82=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0table?= =?UTF-8?q?=E9=87=8C=E5=AD=90=E8=8A=82=E7=82=B9=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xbzhu <5430389+xbzhu@user.noreply.gitee.com> --- ZR.Vue/src/views/system/menu/index.vue | 33 ++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/ZR.Vue/src/views/system/menu/index.vue b/ZR.Vue/src/views/system/menu/index.vue index 92f97895..f4a18c74 100644 --- a/ZR.Vue/src/views/system/menu/index.vue +++ b/ZR.Vue/src/views/system/menu/index.vue @@ -27,6 +27,7 @@ { this.msgSuccess("修改成功"); this.open = false; - this.getList(); + if (this.form.parentId === 0) { + this.getList(); + } else { + this.refreshTableTree(this.form.parentId); + } }); } else { addMenu(this.form).then((response) => { this.msgSuccess("新增成功"); this.open = false; - this.getList(); + if (this.form.parentId === 0) { + this.getList(); + } else { + this.refreshTableTree(this.form.parentId); + } }); } } @@ -424,7 +435,11 @@ export default { return delMenu(row.menuId); }) .then(() => { - this.getList(); + if (row.parentId === 0) { + this.getList(); + } else { + this.refreshTableTree(row.parentId); + } this.msgSuccess("删除成功"); }); }, @@ -462,10 +477,20 @@ export default { }); }, loadMenu (row, treeNode, resolve) { + this.tableTreeNodeMap.set(row.menuId, { row, treeNode, resolve }); listMenuById(row.menuId).then((res) => { resolve(res.data) }) - } + }, + //新增/修改/删除子节点时刷新子节点 + refreshTableTree(key) { + const node = this.tableTreeNodeMap.get(key); + if (!node) { + return; + } + const { row, treeNode, resolve } = node; + this.loadMenu(row, treeNode, resolve); + }, }, }; -- Gitee From e67cf766dcb789332583ee5bbec8c9e64afaef8f Mon Sep 17 00:00:00 2001 From: xbzhu <5430389+xbzhu@user.noreply.gitee.com> Date: Sat, 21 Jan 2023 07:04:59 +0000 Subject: [PATCH 2/3] =?UTF-8?q?update=20ZR.Service/System/SysMenuService.c?= =?UTF-8?q?s.=20=E8=8F=9C=E5=8D=95=E7=AE=A1=E7=90=86=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=97=B6=E6=8A=A5=E9=94=99=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E6=9F=A5=E8=AF=A2=E4=B8=BA=E7=A9=BA=E6=97=B6?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=B8=80=E4=B8=AA=E9=BB=98=E8=AE=A4=E5=80=BC?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xbzhu <5430389+xbzhu@user.noreply.gitee.com> --- ZR.Service/System/SysMenuService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ZR.Service/System/SysMenuService.cs b/ZR.Service/System/SysMenuService.cs index ca28efc0..caaeb11f 100644 --- a/ZR.Service/System/SysMenuService.cs +++ b/ZR.Service/System/SysMenuService.cs @@ -1,4 +1,4 @@ -using Infrastructure.Attribute; +using Infrastructure.Attribute; using Infrastructure.Extensions; using SqlSugar; using System; @@ -41,7 +41,7 @@ namespace ZR.Service var userRoles = SysRoleService.SelectUserRoles(userId); menuList = SelectTreeMenuListByRoles(menu, userRoles); } - return menuList; + return menuList ?? new List(); } /// -- Gitee From f336ddadf1f5e9a1ddc5b4b14a35e40abb65aa6c Mon Sep 17 00:00:00 2001 From: zhuxb Date: Sat, 21 Jan 2023 15:31:35 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=97=A0=E6=B3=95=E5=AF=BC=E5=87=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=BA=86CodeGenTemplate?= =?UTF-8?q?=E9=87=8Ctplvue=E5=92=8Ctplvueapi=E4=B8=AD=E5=85=B3=E4=BA=8E?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AF=BC=E5=87=BA=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + ZR.Admin.WebApi/Controllers/BaseController.cs | 10 +++----- .../Properties/launchSettings.json | 25 +++++++++---------- .../wwwroot/CodeGenTemplate/TplVue.txt | 24 +++++++++++++----- .../wwwroot/CodeGenTemplate/TplVueApi.txt | 11 ++++---- 5 files changed, 40 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 91c5d327..e8d8005c 100644 --- a/.gitignore +++ b/.gitignore @@ -271,3 +271,4 @@ __pycache__/ /ZR.Admin.WebApi/DataProtection /Quartz.NET.WindowsService /ZRAdmin-vue +/ZR.Admin.WebApi/appsettings.Development.json diff --git a/ZR.Admin.WebApi/Controllers/BaseController.cs b/ZR.Admin.WebApi/Controllers/BaseController.cs index fe5f6131..b85b3048 100644 --- a/ZR.Admin.WebApi/Controllers/BaseController.cs +++ b/ZR.Admin.WebApi/Controllers/BaseController.cs @@ -63,11 +63,7 @@ namespace ZR.Admin.WebApi.Controllers /// protected IActionResult ExportExcel(string path, string fileName) { - //IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment)); - //string fileDir = Path.Combine(webHostEnvironment.WebRootPath, path, fileName); - - var stream = ff.File.OpenRead(path); //创建文件流 - return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", HttpUtility.UrlEncode(fileName)); + return SUCCESS(new { path = path, fileName = fileName }); } #region 方法 @@ -142,7 +138,7 @@ namespace ZR.Admin.WebApi.Controllers Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); MiniExcel.SaveAs(fullPath, list, sheetName: sheetName); - return (sFileName, fullPath); + return (sFileName, "/export/" + sFileName); } /// @@ -160,7 +156,7 @@ namespace ZR.Admin.WebApi.Controllers Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); MiniExcel.SaveAs(fullPath, sheets); - return (sFileName, fullPath); + return (sFileName, "/export/" + sFileName); } /// diff --git a/ZR.Admin.WebApi/Properties/launchSettings.json b/ZR.Admin.WebApi/Properties/launchSettings.json index a3bb2fda..16b84cad 100644 --- a/ZR.Admin.WebApi/Properties/launchSettings.json +++ b/ZR.Admin.WebApi/Properties/launchSettings.json @@ -1,4 +1,14 @@ -{ +{ + "profiles": { + "ZR.Admin.WebApi": { + "commandName": "Project", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:8888" + } + }, "$schema": "https://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, @@ -7,16 +17,5 @@ "applicationUrl": "http://localhost:63521", "sslPort": 44395 } - }, - "profiles": { - "ZR.Admin.WebApi": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchUrl": "", - "applicationUrl": "http://localhost:8888", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "" - } - } } -} +} \ No newline at end of file diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt index f4f5d5ac..9dddbd57 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt @@ -77,6 +77,7 @@ $end