From 2781655b0a965e1a5c39a24d06369c7dc87159ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Wed, 17 Nov 2021 19:42:14 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E9=80=82=E9=85=8D=20ruoyi=20=E5=85=B3?= =?UTF-8?q?=E4=BA=8E=E4=BC=98=E5=8C=96=E5=AF=BC=E5=87=BA=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitor/SysLogininforController.java | 2 +- .../monitor/SysOperlogController.java | 2 +- .../system/SysConfigController.java | 2 +- .../system/SysDictDataController.java | 2 +- .../system/SysDictTypeController.java | 2 +- .../controller/system/SysPostController.java | 2 +- .../controller/system/SysRoleController.java | 2 +- .../controller/system/SysUserController.java | 4 +- .../demo/controller/TestDemoController.java | 2 +- ruoyi-ui/src/plugins/download.js | 42 +------------------ ruoyi-ui/src/router/index.js | 13 ------ ruoyi-ui/src/views/demo/demo/index.vue | 7 ++-- 12 files changed, 14 insertions(+), 68 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java index d971ca7b..17df95ce 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java @@ -43,7 +43,7 @@ public class SysLogininforController extends BaseController { @ApiOperation("导出系统访问记录列表") @Log(title = "登录日志", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") - @GetMapping("/export") + @PostMapping("/export") public void export(SysLogininfor logininfor, HttpServletResponse response) { List list = logininforService.selectLogininforList(logininfor); ExcelUtil.exportExcel(list, "登录日志", SysLogininfor.class, response); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java index f0f090b8..0b6ee7f9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java @@ -43,7 +43,7 @@ public class SysOperlogController extends BaseController { @ApiOperation("导出操作日志记录列表") @Log(title = "操作日志", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('monitor:operlog:export')") - @GetMapping("/export") + @PostMapping("/export") public void export(SysOperLog operLog, HttpServletResponse response) { List list = operLogService.selectOperLogList(operLog); ExcelUtil.exportExcel(list, "操作日志", SysOperLog.class, response); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java index 2f384bf2..c8f9f459 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java @@ -47,7 +47,7 @@ public class SysConfigController extends BaseController { @ApiOperation("导出参数配置列表") @Log(title = "参数管理", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:config:export')") - @GetMapping("/export") + @PostMapping("/export") public void export(SysConfig config, HttpServletResponse response) { List list = configService.selectConfigList(config); ExcelUtil.exportExcel(list, "参数数据", SysConfig.class, response); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java index cd580776..82b05cf3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java @@ -47,7 +47,7 @@ public class SysDictDataController extends BaseController { @ApiOperation("导出字典数据列表") @Log(title = "字典数据", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:dict:export')") - @GetMapping("/export") + @PostMapping("/export") public void export(SysDictData dictData, HttpServletResponse response) { List list = dictDataService.selectDictDataList(dictData); ExcelUtil.exportExcel(list, "字典数据", SysDictData.class, response); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java index 94fb7ae3..eb3ae00b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java @@ -44,7 +44,7 @@ public class SysDictTypeController extends BaseController { @ApiOperation("导出字典类型列表") @Log(title = "字典类型", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:dict:export')") - @GetMapping("/export") + @PostMapping("/export") public void export(SysDictType dictType, HttpServletResponse response) { List list = dictTypeService.selectDictTypeList(dictType); ExcelUtil.exportExcel(list, "字典类型", SysDictType.class, response); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java index 40fa1ccc..0ccb313b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java @@ -47,7 +47,7 @@ public class SysPostController extends BaseController { @ApiOperation("导出岗位列表") @Log(title = "岗位管理", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:post:export')") - @GetMapping("/export") + @PostMapping("/export") public void export(SysPost post, HttpServletResponse response) { List list = postService.selectPostList(post); ExcelUtil.exportExcel(list, "岗位数据", SysPost.class, response); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index 4fc05f1b..c1b9baa3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -54,7 +54,7 @@ public class SysRoleController extends BaseController { @ApiOperation("导出角色信息列表") @Log(title = "角色管理", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:role:export')") - @GetMapping("/export") + @PostMapping("/export") public void export(SysRole role, HttpServletResponse response) { List list = roleService.selectRoleList(role); ExcelUtil.exportExcel(list, "角色数据", SysRole.class, response); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index 5aace8c8..b8692213 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -67,7 +67,7 @@ public class SysUserController extends BaseController { @ApiOperation("导出用户列表") @Log(title = "用户管理", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:user:export')") - @GetMapping("/export") + @PostMapping("/export") public void export(SysUser user, HttpServletResponse response) { List list = userService.selectUserList(user); List listVo = BeanUtil.copyToList(list, SysUserExportVo.class); @@ -98,7 +98,7 @@ public class SysUserController extends BaseController { } @ApiOperation("下载导入模板") - @GetMapping("/importTemplate") + @PostMapping("/importTemplate") public void importTemplate(HttpServletResponse response) { ExcelUtil.exportExcel(new ArrayList<>(), "用户数据", SysUserImportVo.class, response); } diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java index 66339de2..692b5679 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java @@ -70,7 +70,7 @@ public class TestDemoController extends BaseController { @ApiOperation("导出测试单表列表") @PreAuthorize("@ss.hasPermi('demo:demo:export')") @Log(title = "测试单表", businessType = BusinessType.EXPORT) - @GetMapping("/export") + @PostMapping("/export") public void export(@Validated TestDemoBo bo, HttpServletResponse response) { List list = iTestDemoService.queryList(bo); // 测试雪花id导出 diff --git a/ruoyi-ui/src/plugins/download.js b/ruoyi-ui/src/plugins/download.js index 94249eec..ac50dade 100644 --- a/ruoyi-ui/src/plugins/download.js +++ b/ruoyi-ui/src/plugins/download.js @@ -7,46 +7,6 @@ import { blobValidate } from "@/utils/ruoyi"; const baseURL = process.env.VUE_APP_BASE_API export default { - excel(url, params) { - // get请求映射params参数 - if (params) { - let urlparams = url + '?'; - for (const propName of Object.keys(params)) { - const value = params[propName]; - var part = encodeURIComponent(propName) + "="; - if (value !== null && typeof(value) !== "undefined") { - if (typeof value === 'object') { - for (const key of Object.keys(value)) { - if (value[key] !== null && typeof (value[key]) !== 'undefined') { - let params = propName + '[' + key + ']'; - let subPart = encodeURIComponent(params) + '='; - urlparams += subPart + encodeURIComponent(value[key]) + '&'; - } - } - } else { - urlparams += part + encodeURIComponent(value) + "&"; - } - } - } - urlparams = urlparams.slice(0, -1); - url = urlparams; - } - url = baseURL + url - axios({ - method: 'get', - url: url, - responseType: 'blob', - headers: { 'Authorization': 'Bearer ' + getToken() } - }).then(async (res) => { - const isLogin = await this.blobValidate(res.data); - if (isLogin) { - const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }) - this.saveAs(blob, decodeURI(res.headers['download-filename'])) - } else { - Message.error('无效的会话,或者会话已过期,请重新登录。'); - } - }) - }, oss(ossId) { var url = baseURL + '/system/oss/download/' + ossId axios({ @@ -55,7 +15,7 @@ export default { responseType: 'blob', headers: { 'Authorization': 'Bearer ' + getToken() } }).then(async (res) => { - const isLogin = await this.blobValidate(res.data); + const isLogin = await blobValidate(res.data); if (isLogin) { const blob = new Blob([res.data], { type: 'application/octet-stream' }) this.saveAs(blob, decodeURI(res.headers['download-filename'])) diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js index 96f557b3..b6b14fab 100644 --- a/ruoyi-ui/src/router/index.js +++ b/ruoyi-ui/src/router/index.js @@ -138,19 +138,6 @@ export const constantRoutes = [ } ] }, - { - path: '/monitor/job-log', - component: Layout, - hidden: true, - children: [ - { - path: 'index', - component: (resolve) => require(['@/views/monitor/job/log'], resolve), - name: 'JobLog', - meta: { title: '调度日志', activeMenu: '/monitor/job'} - } - ] - }, { path: '/tool/gen-edit', component: Layout, diff --git a/ruoyi-ui/src/views/demo/demo/index.vue b/ruoyi-ui/src/views/demo/demo/index.vue index 678ae218..9ff0e475 100644 --- a/ruoyi-ui/src/views/demo/demo/index.vue +++ b/ruoyi-ui/src/views/demo/demo/index.vue @@ -77,7 +77,6 @@ plain icon="el-icon-download" size="mini" - :loading="exportLoading" @click="handleExport" v-hasPermi="['demo:demo:export']" >导出 @@ -181,8 +180,6 @@ export default { buttonLoading: false, // 遮罩层 loading: true, - // 导出遮罩层 - exportLoading: false, // 选中数组 ids: [], // 非单个禁用 @@ -358,7 +355,9 @@ export default { }, /** 导出按钮操作 */ handleExport() { - this.$download.excel('/demo/demo/export', this.queryParams); + this.download('demo/demo/export', { + ...this.queryParams + }, `demo_${new Date().getTime()}.xlsx`) } } };