作者 RuoYi

优化导出数据操作

正在显示 37 个修改的文件 包含 192 行增加318 行删除
1 package com.ruoyi.web.controller.monitor; 1 package com.ruoyi.web.controller.monitor;
2 2
3 import java.util.List; 3 import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
4 import org.springframework.beans.factory.annotation.Autowired; 5 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.security.access.prepost.PreAuthorize; 6 import org.springframework.security.access.prepost.PreAuthorize;
6 import org.springframework.web.bind.annotation.DeleteMapping; 7 import org.springframework.web.bind.annotation.DeleteMapping;
7 import org.springframework.web.bind.annotation.GetMapping; 8 import org.springframework.web.bind.annotation.GetMapping;
8 import org.springframework.web.bind.annotation.PathVariable; 9 import org.springframework.web.bind.annotation.PathVariable;
  10 +import org.springframework.web.bind.annotation.PostMapping;
9 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
10 import org.springframework.web.bind.annotation.RestController; 12 import org.springframework.web.bind.annotation.RestController;
11 import com.ruoyi.common.annotation.Log; 13 import com.ruoyi.common.annotation.Log;
@@ -40,12 +42,12 @@ public class SysLogininforController extends BaseController @@ -40,12 +42,12 @@ public class SysLogininforController extends BaseController
40 42
41 @Log(title = "登录日志", businessType = BusinessType.EXPORT) 43 @Log(title = "登录日志", businessType = BusinessType.EXPORT)
42 @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") 44 @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
43 - @GetMapping("/export")  
44 - public AjaxResult export(SysLogininfor logininfor) 45 + @PostMapping("/export")
  46 + public void export(HttpServletResponse response, SysLogininfor logininfor)
45 { 47 {
46 List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); 48 List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
47 ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class); 49 ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
48 - return util.exportExcel(list, "登录日志"); 50 + util.exportExcel(response, list, "登录日志");
49 } 51 }
50 52
51 @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") 53 @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
1 package com.ruoyi.web.controller.monitor; 1 package com.ruoyi.web.controller.monitor;
2 2
3 import java.util.List; 3 import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
4 import org.springframework.beans.factory.annotation.Autowired; 5 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.security.access.prepost.PreAuthorize; 6 import org.springframework.security.access.prepost.PreAuthorize;
6 import org.springframework.web.bind.annotation.DeleteMapping; 7 import org.springframework.web.bind.annotation.DeleteMapping;
7 import org.springframework.web.bind.annotation.GetMapping; 8 import org.springframework.web.bind.annotation.GetMapping;
8 import org.springframework.web.bind.annotation.PathVariable; 9 import org.springframework.web.bind.annotation.PathVariable;
  10 +import org.springframework.web.bind.annotation.PostMapping;
9 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
10 import org.springframework.web.bind.annotation.RestController; 12 import org.springframework.web.bind.annotation.RestController;
11 import com.ruoyi.common.annotation.Log; 13 import com.ruoyi.common.annotation.Log;
@@ -40,12 +42,12 @@ public class SysOperlogController extends BaseController @@ -40,12 +42,12 @@ public class SysOperlogController extends BaseController
40 42
41 @Log(title = "操作日志", businessType = BusinessType.EXPORT) 43 @Log(title = "操作日志", businessType = BusinessType.EXPORT)
42 @PreAuthorize("@ss.hasPermi('monitor:operlog:export')") 44 @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
43 - @GetMapping("/export")  
44 - public AjaxResult export(SysOperLog operLog) 45 + @PostMapping("/export")
  46 + public void export(HttpServletResponse response, SysOperLog operLog)
45 { 47 {
46 List<SysOperLog> list = operLogService.selectOperLogList(operLog); 48 List<SysOperLog> list = operLogService.selectOperLogList(operLog);
47 ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class); 49 ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
48 - return util.exportExcel(list, "操作日志"); 50 + util.exportExcel(response, list, "操作日志");
49 } 51 }
50 52
51 @Log(title = "操作日志", businessType = BusinessType.DELETE) 53 @Log(title = "操作日志", businessType = BusinessType.DELETE)
1 package com.ruoyi.web.controller.system; 1 package com.ruoyi.web.controller.system;
2 2
3 import java.util.List; 3 import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
4 import org.springframework.beans.factory.annotation.Autowired; 5 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.security.access.prepost.PreAuthorize; 6 import org.springframework.security.access.prepost.PreAuthorize;
6 import org.springframework.validation.annotation.Validated; 7 import org.springframework.validation.annotation.Validated;
@@ -13,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody; @@ -13,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody;
13 import org.springframework.web.bind.annotation.RequestMapping; 14 import org.springframework.web.bind.annotation.RequestMapping;
14 import org.springframework.web.bind.annotation.RestController; 15 import org.springframework.web.bind.annotation.RestController;
15 import com.ruoyi.common.annotation.Log; 16 import com.ruoyi.common.annotation.Log;
16 -import com.ruoyi.common.annotation.RepeatSubmit;  
17 import com.ruoyi.common.constant.UserConstants; 17 import com.ruoyi.common.constant.UserConstants;
18 import com.ruoyi.common.core.controller.BaseController; 18 import com.ruoyi.common.core.controller.BaseController;
19 import com.ruoyi.common.core.domain.AjaxResult; 19 import com.ruoyi.common.core.domain.AjaxResult;
@@ -49,12 +49,12 @@ public class SysConfigController extends BaseController @@ -49,12 +49,12 @@ public class SysConfigController extends BaseController
49 49
50 @Log(title = "参数管理", businessType = BusinessType.EXPORT) 50 @Log(title = "参数管理", businessType = BusinessType.EXPORT)
51 @PreAuthorize("@ss.hasPermi('system:config:export')") 51 @PreAuthorize("@ss.hasPermi('system:config:export')")
52 - @GetMapping("/export")  
53 - public AjaxResult export(SysConfig config) 52 + @PostMapping("/export")
  53 + public void export(HttpServletResponse response, SysConfig config)
54 { 54 {
55 List<SysConfig> list = configService.selectConfigList(config); 55 List<SysConfig> list = configService.selectConfigList(config);
56 ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); 56 ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
57 - return util.exportExcel(list, "参数数据"); 57 + util.exportExcel(response, list, "参数数据");
58 } 58 }
59 59
60 /** 60 /**
@@ -82,7 +82,6 @@ public class SysConfigController extends BaseController @@ -82,7 +82,6 @@ public class SysConfigController extends BaseController
82 @PreAuthorize("@ss.hasPermi('system:config:add')") 82 @PreAuthorize("@ss.hasPermi('system:config:add')")
83 @Log(title = "参数管理", businessType = BusinessType.INSERT) 83 @Log(title = "参数管理", businessType = BusinessType.INSERT)
84 @PostMapping 84 @PostMapping
85 - @RepeatSubmit  
86 public AjaxResult add(@Validated @RequestBody SysConfig config) 85 public AjaxResult add(@Validated @RequestBody SysConfig config)
87 { 86 {
88 if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) 87 if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system; @@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
2 2
3 import java.util.ArrayList; 3 import java.util.ArrayList;
4 import java.util.List; 4 import java.util.List;
  5 +import javax.servlet.http.HttpServletResponse;
5 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.security.access.prepost.PreAuthorize; 7 import org.springframework.security.access.prepost.PreAuthorize;
7 import org.springframework.validation.annotation.Validated; 8 import org.springframework.validation.annotation.Validated;
@@ -50,12 +51,12 @@ public class SysDictDataController extends BaseController @@ -50,12 +51,12 @@ public class SysDictDataController extends BaseController
50 51
51 @Log(title = "字典数据", businessType = BusinessType.EXPORT) 52 @Log(title = "字典数据", businessType = BusinessType.EXPORT)
52 @PreAuthorize("@ss.hasPermi('system:dict:export')") 53 @PreAuthorize("@ss.hasPermi('system:dict:export')")
53 - @GetMapping("/export")  
54 - public AjaxResult export(SysDictData dictData) 54 + @PostMapping("/export")
  55 + public void export(HttpServletResponse response, SysDictData dictData)
55 { 56 {
56 List<SysDictData> list = dictDataService.selectDictDataList(dictData); 57 List<SysDictData> list = dictDataService.selectDictDataList(dictData);
57 ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); 58 ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
58 - return util.exportExcel(list, "字典数据"); 59 + util.exportExcel(response, list, "字典数据");
59 } 60 }
60 61
61 /** 62 /**
1 package com.ruoyi.web.controller.system; 1 package com.ruoyi.web.controller.system;
2 2
3 import java.util.List; 3 import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
4 import org.springframework.beans.factory.annotation.Autowired; 5 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.security.access.prepost.PreAuthorize; 6 import org.springframework.security.access.prepost.PreAuthorize;
6 import org.springframework.validation.annotation.Validated; 7 import org.springframework.validation.annotation.Validated;
@@ -45,12 +46,12 @@ public class SysDictTypeController extends BaseController @@ -45,12 +46,12 @@ public class SysDictTypeController extends BaseController
45 46
46 @Log(title = "字典类型", businessType = BusinessType.EXPORT) 47 @Log(title = "字典类型", businessType = BusinessType.EXPORT)
47 @PreAuthorize("@ss.hasPermi('system:dict:export')") 48 @PreAuthorize("@ss.hasPermi('system:dict:export')")
48 - @GetMapping("/export")  
49 - public AjaxResult export(SysDictType dictType) 49 + @PostMapping("/export")
  50 + public void export(HttpServletResponse response, SysDictType dictType)
50 { 51 {
51 List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); 52 List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
52 ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class); 53 ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
53 - return util.exportExcel(list, "字典类型"); 54 + util.exportExcel(response, list, "字典类型");
54 } 55 }
55 56
56 /** 57 /**
1 package com.ruoyi.web.controller.system; 1 package com.ruoyi.web.controller.system;
2 2
3 import java.util.List; 3 import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
4 import org.springframework.beans.factory.annotation.Autowired; 5 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.security.access.prepost.PreAuthorize; 6 import org.springframework.security.access.prepost.PreAuthorize;
6 import org.springframework.validation.annotation.Validated; 7 import org.springframework.validation.annotation.Validated;
@@ -48,12 +49,12 @@ public class SysPostController extends BaseController @@ -48,12 +49,12 @@ public class SysPostController extends BaseController
48 49
49 @Log(title = "岗位管理", businessType = BusinessType.EXPORT) 50 @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
50 @PreAuthorize("@ss.hasPermi('system:post:export')") 51 @PreAuthorize("@ss.hasPermi('system:post:export')")
51 - @GetMapping("/export")  
52 - public AjaxResult export(SysPost post) 52 + @PostMapping("/export")
  53 + public void export(HttpServletResponse response, SysPost post)
53 { 54 {
54 List<SysPost> list = postService.selectPostList(post); 55 List<SysPost> list = postService.selectPostList(post);
55 ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class); 56 ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
56 - return util.exportExcel(list, "岗位数据"); 57 + util.exportExcel(response, list, "岗位数据");
57 } 58 }
58 59
59 /** 60 /**
1 package com.ruoyi.web.controller.system; 1 package com.ruoyi.web.controller.system;
2 2
3 import java.util.List; 3 import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
4 import org.springframework.beans.factory.annotation.Autowired; 5 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.security.access.prepost.PreAuthorize; 6 import org.springframework.security.access.prepost.PreAuthorize;
6 import org.springframework.validation.annotation.Validated; 7 import org.springframework.validation.annotation.Validated;
@@ -61,12 +62,12 @@ public class SysRoleController extends BaseController @@ -61,12 +62,12 @@ public class SysRoleController extends BaseController
61 62
62 @Log(title = "角色管理", businessType = BusinessType.EXPORT) 63 @Log(title = "角色管理", businessType = BusinessType.EXPORT)
63 @PreAuthorize("@ss.hasPermi('system:role:export')") 64 @PreAuthorize("@ss.hasPermi('system:role:export')")
64 - @GetMapping("/export")  
65 - public AjaxResult export(SysRole role) 65 + @PostMapping("/export")
  66 + public void export(HttpServletResponse response, SysRole role)
66 { 67 {
67 List<SysRole> list = roleService.selectRoleList(role); 68 List<SysRole> list = roleService.selectRoleList(role);
68 ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); 69 ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
69 - return util.exportExcel(list, "角色数据"); 70 + util.exportExcel(response, list, "角色数据");
70 } 71 }
71 72
72 /** 73 /**
@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system; @@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
2 2
3 import java.util.List; 3 import java.util.List;
4 import java.util.stream.Collectors; 4 import java.util.stream.Collectors;
  5 +import javax.servlet.http.HttpServletResponse;
5 import org.apache.commons.lang3.ArrayUtils; 6 import org.apache.commons.lang3.ArrayUtils;
6 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.security.access.prepost.PreAuthorize; 8 import org.springframework.security.access.prepost.PreAuthorize;
@@ -62,12 +63,12 @@ public class SysUserController extends BaseController @@ -62,12 +63,12 @@ public class SysUserController extends BaseController
62 63
63 @Log(title = "用户管理", businessType = BusinessType.EXPORT) 64 @Log(title = "用户管理", businessType = BusinessType.EXPORT)
64 @PreAuthorize("@ss.hasPermi('system:user:export')") 65 @PreAuthorize("@ss.hasPermi('system:user:export')")
65 - @GetMapping("/export")  
66 - public AjaxResult export(SysUser user) 66 + @PostMapping("/export")
  67 + public void export(HttpServletResponse response, SysUser user)
67 { 68 {
68 List<SysUser> list = userService.selectUserList(user); 69 List<SysUser> list = userService.selectUserList(user);
69 ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); 70 ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
70 - return util.exportExcel(list, "用户数据"); 71 + util.exportExcel(response, list, "用户数据");
71 } 72 }
72 73
73 @Log(title = "用户管理", businessType = BusinessType.IMPORT) 74 @Log(title = "用户管理", businessType = BusinessType.IMPORT)
@@ -82,11 +83,11 @@ public class SysUserController extends BaseController @@ -82,11 +83,11 @@ public class SysUserController extends BaseController
82 return AjaxResult.success(message); 83 return AjaxResult.success(message);
83 } 84 }
84 85
85 - @GetMapping("/importTemplate")  
86 - public AjaxResult importTemplate() 86 + @PostMapping("/importTemplate")
  87 + public void importTemplate(HttpServletResponse response)
87 { 88 {
88 ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); 89 ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
89 - return util.importTemplateExcel("用户数据"); 90 + util.importTemplateExcel(response, "用户数据");
90 } 91 }
91 92
92 /** 93 /**
@@ -431,7 +431,7 @@ public class ExcelUtil<T> @@ -431,7 +431,7 @@ public class ExcelUtil<T>
431 * @return 结果 431 * @return 结果
432 * @throws IOException 432 * @throws IOException
433 */ 433 */
434 - public void exportExcel(HttpServletResponse response, List<T> list, String sheetName)throws IOException 434 + public void exportExcel(HttpServletResponse response, List<T> list, String sheetName)
435 { 435 {
436 exportExcel(response, list, sheetName, StringUtils.EMPTY); 436 exportExcel(response, list, sheetName, StringUtils.EMPTY);
437 } 437 }
@@ -446,12 +446,12 @@ public class ExcelUtil<T> @@ -446,12 +446,12 @@ public class ExcelUtil<T>
446 * @return 结果 446 * @return 结果
447 * @throws IOException 447 * @throws IOException
448 */ 448 */
449 - public void exportExcel(HttpServletResponse response, List<T> list, String sheetName, String title) throws IOException 449 + public void exportExcel(HttpServletResponse response, List<T> list, String sheetName, String title)
450 { 450 {
451 response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); 451 response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
452 response.setCharacterEncoding("utf-8"); 452 response.setCharacterEncoding("utf-8");
453 this.init(list, sheetName, title, Type.EXPORT); 453 this.init(list, sheetName, title, Type.EXPORT);
454 - exportExcel(response.getOutputStream()); 454 + exportExcel(response);
455 } 455 }
456 456
457 /** 457 /**
@@ -484,7 +484,7 @@ public class ExcelUtil<T> @@ -484,7 +484,7 @@ public class ExcelUtil<T>
484 * @param sheetName 工作表的名称 484 * @param sheetName 工作表的名称
485 * @return 结果 485 * @return 结果
486 */ 486 */
487 - public void importTemplateExcel(HttpServletResponse response, String sheetName) throws IOException 487 + public void importTemplateExcel(HttpServletResponse response, String sheetName)
488 { 488 {
489 importTemplateExcel(response, sheetName, StringUtils.EMPTY); 489 importTemplateExcel(response, sheetName, StringUtils.EMPTY);
490 } 490 }
@@ -496,12 +496,12 @@ public class ExcelUtil<T> @@ -496,12 +496,12 @@ public class ExcelUtil<T>
496 * @param title 标题 496 * @param title 标题
497 * @return 结果 497 * @return 结果
498 */ 498 */
499 - public void importTemplateExcel(HttpServletResponse response, String sheetName, String title) throws IOException 499 + public void importTemplateExcel(HttpServletResponse response, String sheetName, String title)
500 { 500 {
501 response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); 501 response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
502 response.setCharacterEncoding("utf-8"); 502 response.setCharacterEncoding("utf-8");
503 this.init(null, sheetName, title, Type.IMPORT); 503 this.init(null, sheetName, title, Type.IMPORT);
504 - exportExcel(response.getOutputStream()); 504 + exportExcel(response);
505 } 505 }
506 506
507 /** 507 /**
@@ -509,12 +509,12 @@ public class ExcelUtil<T> @@ -509,12 +509,12 @@ public class ExcelUtil<T>
509 * 509 *
510 * @return 结果 510 * @return 结果
511 */ 511 */
512 - public void exportExcel(OutputStream out) 512 + public void exportExcel(HttpServletResponse response)
513 { 513 {
514 try 514 try
515 { 515 {
516 writeSheet(); 516 writeSheet();
517 - wb.write(out); 517 + wb.write(response.getOutputStream());
518 } 518 }
519 catch (Exception e) 519 catch (Exception e)
520 { 520 {
@@ -523,7 +523,6 @@ public class ExcelUtil<T> @@ -523,7 +523,6 @@ public class ExcelUtil<T>
523 finally 523 finally
524 { 524 {
525 IOUtils.closeQuietly(wb); 525 IOUtils.closeQuietly(wb);
526 - IOUtils.closeQuietly(out);  
527 } 526 }
528 } 527 }
529 528
1 package ${packageName}.controller; 1 package ${packageName}.controller;
2 2
3 import java.util.List; 3 import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
4 import org.springframework.security.access.prepost.PreAuthorize; 5 import org.springframework.security.access.prepost.PreAuthorize;
5 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.web.bind.annotation.GetMapping; 7 import org.springframework.web.bind.annotation.GetMapping;
@@ -61,12 +62,12 @@ public class ${ClassName}Controller extends BaseController @@ -61,12 +62,12 @@ public class ${ClassName}Controller extends BaseController
61 */ 62 */
62 @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')") 63 @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
63 @Log(title = "${functionName}", businessType = BusinessType.EXPORT) 64 @Log(title = "${functionName}", businessType = BusinessType.EXPORT)
64 - @GetMapping("/export")  
65 - public AjaxResult export(${ClassName} ${className}) 65 + @PostMapping("/export")
  66 + public void export(HttpServletResponse response, ${ClassName} ${className})
66 { 67 {
67 List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); 68 List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
68 ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class); 69 ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
69 - return util.exportExcel(list, "${functionName}数据"); 70 + util.exportExcel(response, list, "${functionName}数据");
70 } 71 }
71 72
72 /** 73 /**
@@ -108,7 +108,6 @@ @@ -108,7 +108,6 @@
108 plain 108 plain
109 icon="el-icon-download" 109 icon="el-icon-download"
110 size="mini" 110 size="mini"
111 - :loading="exportLoading"  
112 @click="handleExport" 111 @click="handleExport"
113 v-hasPermi="['${moduleName}:${businessName}:export']" 112 v-hasPermi="['${moduleName}:${businessName}:export']"
114 >导出</el-button> 113 >导出</el-button>
@@ -313,7 +312,7 @@ @@ -313,7 +312,7 @@
313 </template> 312 </template>
314 313
315 <script> 314 <script>
316 -import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}"; 315 +import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
317 316
318 export default { 317 export default {
319 name: "${BusinessName}", 318 name: "${BusinessName}",
@@ -324,8 +323,6 @@ export default { @@ -324,8 +323,6 @@ export default {
324 return { 323 return {
325 // 遮罩层 324 // 遮罩层
326 loading: true, 325 loading: true,
327 - // 导出遮罩层  
328 - exportLoading: false,  
329 // 选中数组 326 // 选中数组
330 ids: [], 327 ids: [],
331 #if($table.sub) 328 #if($table.sub)
@@ -562,14 +559,9 @@ export default { @@ -562,14 +559,9 @@ export default {
562 #end 559 #end
563 /** 导出按钮操作 */ 560 /** 导出按钮操作 */
564 handleExport() { 561 handleExport() {
565 - const queryParams = this.queryParams;  
566 - this.#[[$modal]]#.confirm('是否确认导出所有${functionName}数据项?').then(() => {  
567 - this.exportLoading = true;  
568 - return export${BusinessName}(queryParams);  
569 - }).then(response => {  
570 - this.#[[$download]]#.name(response.msg);  
571 - this.exportLoading = false;  
572 - }).catch(() => {}); 562 + this.download('${moduleName}/${businessName}/export', {
  563 + ...this.queryParams
  564 + }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
573 } 565 }
574 } 566 }
575 }; 567 };
1 package com.ruoyi.quartz.controller; 1 package com.ruoyi.quartz.controller;
2 2
3 import java.util.List; 3 import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
4 import org.quartz.SchedulerException; 5 import org.quartz.SchedulerException;
5 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.security.access.prepost.PreAuthorize; 7 import org.springframework.security.access.prepost.PreAuthorize;
@@ -54,12 +55,12 @@ public class SysJobController extends BaseController @@ -54,12 +55,12 @@ public class SysJobController extends BaseController
54 */ 55 */
55 @PreAuthorize("@ss.hasPermi('monitor:job:export')") 56 @PreAuthorize("@ss.hasPermi('monitor:job:export')")
56 @Log(title = "定时任务", businessType = BusinessType.EXPORT) 57 @Log(title = "定时任务", businessType = BusinessType.EXPORT)
57 - @GetMapping("/export")  
58 - public AjaxResult export(SysJob sysJob) 58 + @PostMapping("/export")
  59 + public void export(HttpServletResponse response, SysJob sysJob)
59 { 60 {
60 List<SysJob> list = jobService.selectJobList(sysJob); 61 List<SysJob> list = jobService.selectJobList(sysJob);
61 ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class); 62 ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
62 - return util.exportExcel(list, "定时任务"); 63 + util.exportExcel(response, list, "定时任务");
63 } 64 }
64 65
65 /** 66 /**
1 package com.ruoyi.quartz.controller; 1 package com.ruoyi.quartz.controller;
2 2
3 import java.util.List; 3 import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
4 import org.springframework.beans.factory.annotation.Autowired; 5 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.security.access.prepost.PreAuthorize; 6 import org.springframework.security.access.prepost.PreAuthorize;
6 import org.springframework.web.bind.annotation.DeleteMapping; 7 import org.springframework.web.bind.annotation.DeleteMapping;
7 import org.springframework.web.bind.annotation.GetMapping; 8 import org.springframework.web.bind.annotation.GetMapping;
8 import org.springframework.web.bind.annotation.PathVariable; 9 import org.springframework.web.bind.annotation.PathVariable;
  10 +import org.springframework.web.bind.annotation.PostMapping;
9 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
10 import org.springframework.web.bind.annotation.RestController; 12 import org.springframework.web.bind.annotation.RestController;
11 import com.ruoyi.common.annotation.Log; 13 import com.ruoyi.common.annotation.Log;
@@ -46,12 +48,12 @@ public class SysJobLogController extends BaseController @@ -46,12 +48,12 @@ public class SysJobLogController extends BaseController
46 */ 48 */
47 @PreAuthorize("@ss.hasPermi('monitor:job:export')") 49 @PreAuthorize("@ss.hasPermi('monitor:job:export')")
48 @Log(title = "任务调度日志", businessType = BusinessType.EXPORT) 50 @Log(title = "任务调度日志", businessType = BusinessType.EXPORT)
49 - @GetMapping("/export")  
50 - public AjaxResult export(SysJobLog sysJobLog) 51 + @PostMapping("/export")
  52 + public void export(HttpServletResponse response, SysJobLog sysJobLog)
51 { 53 {
52 List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog); 54 List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
53 ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class); 55 ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
54 - return util.exportExcel(list, "调度日志"); 56 + util.exportExcel(response, list, "调度日志");
55 } 57 }
56 58
57 /** 59 /**
@@ -43,15 +43,6 @@ export function delJob(jobId) { @@ -43,15 +43,6 @@ export function delJob(jobId) {
43 }) 43 })
44 } 44 }
45 45
46 -// 导出定时任务调度  
47 -export function exportJob(query) {  
48 - return request({  
49 - url: '/monitor/job/export',  
50 - method: 'get',  
51 - params: query  
52 - })  
53 -}  
54 -  
55 // 任务状态修改 46 // 任务状态修改
56 export function changeJobStatus(jobId, status) { 47 export function changeJobStatus(jobId, status) {
57 const data = { 48 const data = {
@@ -24,12 +24,3 @@ export function cleanJobLog() { @@ -24,12 +24,3 @@ export function cleanJobLog() {
24 method: 'delete' 24 method: 'delete'
25 }) 25 })
26 } 26 }
27 -  
28 -// 导出调度日志  
29 -export function exportJobLog(query) {  
30 - return request({  
31 - url: '/monitor/jobLog/export',  
32 - method: 'get',  
33 - params: query  
34 - })  
35 -}  
@@ -24,12 +24,3 @@ export function cleanLogininfor() { @@ -24,12 +24,3 @@ export function cleanLogininfor() {
24 method: 'delete' 24 method: 'delete'
25 }) 25 })
26 } 26 }
27 -  
28 -// 导出登录日志  
29 -export function exportLogininfor(query) {  
30 - return request({  
31 - url: '/monitor/logininfor/export',  
32 - method: 'get',  
33 - params: query  
34 - })  
35 -}  
@@ -24,12 +24,3 @@ export function cleanOperlog() { @@ -24,12 +24,3 @@ export function cleanOperlog() {
24 method: 'delete' 24 method: 'delete'
25 }) 25 })
26 } 26 }
27 -  
28 -// 导出操作日志  
29 -export function exportOperlog(query) {  
30 - return request({  
31 - url: '/monitor/operlog/export',  
32 - method: 'get',  
33 - params: query  
34 - })  
35 -}  
@@ -58,12 +58,3 @@ export function refreshCache() { @@ -58,12 +58,3 @@ export function refreshCache() {
58 method: 'delete' 58 method: 'delete'
59 }) 59 })
60 } 60 }
61 -  
62 -// 导出参数  
63 -export function exportConfig(query) {  
64 - return request({  
65 - url: '/system/config/export',  
66 - method: 'get',  
67 - params: query  
68 - })  
69 -}  
@@ -50,12 +50,3 @@ export function delData(dictCode) { @@ -50,12 +50,3 @@ export function delData(dictCode) {
50 method: 'delete' 50 method: 'delete'
51 }) 51 })
52 } 52 }
53 -  
54 -// 导出字典数据  
55 -export function exportData(query) {  
56 - return request({  
57 - url: '/system/dict/data/export',  
58 - method: 'get',  
59 - params: query  
60 - })  
61 -}  
@@ -51,15 +51,6 @@ export function refreshCache() { @@ -51,15 +51,6 @@ export function refreshCache() {
51 }) 51 })
52 } 52 }
53 53
54 -// 导出字典类型  
55 -export function exportType(query) {  
56 - return request({  
57 - url: '/system/dict/type/export',  
58 - method: 'get',  
59 - params: query  
60 - })  
61 -}  
62 -  
63 // 获取字典选择框列表 54 // 获取字典选择框列表
64 export function optionselect() { 55 export function optionselect() {
65 return request({ 56 return request({
@@ -42,12 +42,3 @@ export function delPost(postId) { @@ -42,12 +42,3 @@ export function delPost(postId) {
42 method: 'delete' 42 method: 'delete'
43 }) 43 })
44 } 44 }
45 -  
46 -// 导出岗位  
47 -export function exportPost(query) {  
48 - return request({  
49 - url: '/system/post/export',  
50 - method: 'get',  
51 - params: query  
52 - })  
53 -}  
@@ -65,15 +65,6 @@ export function delRole(roleId) { @@ -65,15 +65,6 @@ export function delRole(roleId) {
65 }) 65 })
66 } 66 }
67 67
68 -// 导出角色  
69 -export function exportRole(query) {  
70 - return request({  
71 - url: '/system/role/export',  
72 - method: 'get',  
73 - params: query  
74 - })  
75 -}  
76 -  
77 // 查询角色已授权用户列表 68 // 查询角色已授权用户列表
78 export function allocatedUserList(query) { 69 export function allocatedUserList(query) {
79 return request({ 70 return request({
@@ -44,15 +44,6 @@ export function delUser(userId) { @@ -44,15 +44,6 @@ export function delUser(userId) {
44 }) 44 })
45 } 45 }
46 46
47 -// 导出用户  
48 -export function exportUser(query) {  
49 - return request({  
50 - url: '/system/user/export',  
51 - method: 'get',  
52 - params: query  
53 - })  
54 -}  
55 -  
56 // 用户密码重置 47 // 用户密码重置
57 export function resetUserPwd(userId, password) { 48 export function resetUserPwd(userId, password) {
58 const data = { 49 const data = {
@@ -118,14 +109,6 @@ export function uploadAvatar(data) { @@ -118,14 +109,6 @@ export function uploadAvatar(data) {
118 }) 109 })
119 } 110 }
120 111
121 -// 下载用户导入模板  
122 -export function importTemplate() {  
123 - return request({  
124 - url: '/system/user/importTemplate',  
125 - method: 'get'  
126 - })  
127 -}  
128 -  
129 // 查询授权角色 112 // 查询授权角色
130 export function getAuthRole(userId) { 113 export function getAuthRole(userId) {
131 return request({ 114 return request({
@@ -12,6 +12,7 @@ import store from './store' @@ -12,6 +12,7 @@ import store from './store'
12 import router from './router' 12 import router from './router'
13 import directive from './directive' //directive 13 import directive from './directive' //directive
14 import plugins from './plugins' // plugins 14 import plugins from './plugins' // plugins
  15 +import { download } from '@/utils/request'
15 16
16 import './assets/icons' // icon 17 import './assets/icons' // icon
17 import './permission' // permission control 18 import './permission' // permission control
@@ -43,6 +44,7 @@ Vue.prototype.resetForm = resetForm @@ -43,6 +44,7 @@ Vue.prototype.resetForm = resetForm
43 Vue.prototype.addDateRange = addDateRange 44 Vue.prototype.addDateRange = addDateRange
44 Vue.prototype.selectDictLabel = selectDictLabel 45 Vue.prototype.selectDictLabel = selectDictLabel
45 Vue.prototype.selectDictLabels = selectDictLabels 46 Vue.prototype.selectDictLabels = selectDictLabels
  47 +Vue.prototype.download = download
46 Vue.prototype.handleTree = handleTree 48 Vue.prototype.handleTree = handleTree
47 49
48 // 全局组件挂载 50 // 全局组件挂载
1 -import { saveAs } from 'file-saver'  
2 import axios from 'axios' 1 import axios from 'axios'
3 -import { getToken } from '@/utils/auth'  
4 import { Message } from 'element-ui' 2 import { Message } from 'element-ui'
  3 +import { saveAs } from 'file-saver'
  4 +import { getToken } from '@/utils/auth'
  5 +import { blobValidate } from "@/utils/ruoyi";
5 6
6 const baseURL = process.env.VUE_APP_BASE_API 7 const baseURL = process.env.VUE_APP_BASE_API
7 8
@@ -48,7 +49,7 @@ export default { @@ -48,7 +49,7 @@ export default {
48 responseType: 'blob', 49 responseType: 'blob',
49 headers: { 'Authorization': 'Bearer ' + getToken() } 50 headers: { 'Authorization': 'Bearer ' + getToken() }
50 }).then(async (res) => { 51 }).then(async (res) => {
51 - const isLogin = await this.blobValidate(res.data); 52 + const isLogin = await blobValidate(res.data);
52 if (isLogin) { 53 if (isLogin) {
53 const blob = new Blob([res.data], { type: 'application/zip' }) 54 const blob = new Blob([res.data], { type: 'application/zip' })
54 this.saveAs(blob, name) 55 this.saveAs(blob, name)
@@ -59,15 +60,6 @@ export default { @@ -59,15 +60,6 @@ export default {
59 }, 60 },
60 saveAs(text, name, opts) { 61 saveAs(text, name, opts) {
61 saveAs(text, name, opts); 62 saveAs(text, name, opts);
62 - },  
63 - async blobValidate(data) {  
64 - try {  
65 - const text = await data.text();  
66 - JSON.parse(text);  
67 - return false;  
68 - } catch (error) {  
69 - return true;  
70 - }  
71 - }, 63 + }
72 } 64 }
73 65
1 import axios from 'axios' 1 import axios from 'axios'
2 -import { Notification, MessageBox, Message } from 'element-ui' 2 +import { Notification, MessageBox, Message, Loading } from 'element-ui'
3 import store from '@/store' 3 import store from '@/store'
4 import { getToken } from '@/utils/auth' 4 import { getToken } from '@/utils/auth'
5 import errorCode from '@/utils/errorCode' 5 import errorCode from '@/utils/errorCode'
  6 +import { tansParams, blobValidate } from "@/utils/ruoyi";
  7 +import { saveAs } from 'file-saver'
  8 +
  9 +let downloadLoadingInstance;
6 10
7 axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' 11 axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
8 // 创建axios实例 12 // 创建axios实例
@@ -12,6 +16,7 @@ const service = axios.create({ @@ -12,6 +16,7 @@ const service = axios.create({
12 // 超时 16 // 超时
13 timeout: 10000 17 timeout: 10000
14 }) 18 })
  19 +
15 // request拦截器 20 // request拦截器
16 service.interceptors.request.use(config => { 21 service.interceptors.request.use(config => {
17 // 是否需要设置 token 22 // 是否需要设置 token
@@ -21,24 +26,7 @@ service.interceptors.request.use(config => { @@ -21,24 +26,7 @@ service.interceptors.request.use(config => {
21 } 26 }
22 // get请求映射params参数 27 // get请求映射params参数
23 if (config.method === 'get' && config.params) { 28 if (config.method === 'get' && config.params) {
24 - let url = config.url + '?';  
25 - for (const propName of Object.keys(config.params)) {  
26 - const value = config.params[propName];  
27 - var part = encodeURIComponent(propName) + "=";  
28 - if (value !== null && typeof(value) !== "undefined") {  
29 - if (typeof value === 'object') {  
30 - for (const key of Object.keys(value)) {  
31 - if (value[key] !== null && typeof (value[key]) !== 'undefined') {  
32 - let params = propName + '[' + key + ']';  
33 - let subPart = encodeURIComponent(params) + '=';  
34 - url += subPart + encodeURIComponent(value[key]) + '&';  
35 - }  
36 - }  
37 - } else {  
38 - url += part + encodeURIComponent(value) + "&";  
39 - }  
40 - }  
41 - } 29 + let url = config.url + '?' + tansParams(config.params);
42 url = url.slice(0, -1); 30 url = url.slice(0, -1);
43 config.params = {}; 31 config.params = {};
44 config.url = url; 32 config.url = url;
@@ -55,17 +43,24 @@ service.interceptors.response.use(res => { @@ -55,17 +43,24 @@ service.interceptors.response.use(res => {
55 const code = res.data.code || 200; 43 const code = res.data.code || 200;
56 // 获取错误信息 44 // 获取错误信息
57 const msg = errorCode[code] || res.data.msg || errorCode['default'] 45 const msg = errorCode[code] || res.data.msg || errorCode['default']
  46 + // 二进制数据则直接返回
  47 + if(res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer'){
  48 + return res.data
  49 + }
58 if (code === 401) { 50 if (code === 401) {
59 - MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { 51 + let doms = document.getElementsByClassName('el-message-box')[0]
  52 + if(doms === undefined){
  53 + MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
60 confirmButtonText: '重新登录', 54 confirmButtonText: '重新登录',
61 cancelButtonText: '取消', 55 cancelButtonText: '取消',
62 type: 'warning' 56 type: 'warning'
63 } 57 }
64 - ).then(() => {  
65 - store.dispatch('LogOut').then(() => {  
66 - location.href = '/index';  
67 - })  
68 - }).catch(() => {}); 58 + ).then(() => {
  59 + store.dispatch('LogOut').then(() => {
  60 + location.href = '/index';
  61 + })
  62 + }).catch(() => {});
  63 + }
69 return Promise.reject('无效的会话,或者会话已过期,请重新登录。') 64 return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
70 } else if (code === 500) { 65 } else if (code === 500) {
71 Message({ 66 Message({
@@ -103,4 +98,27 @@ service.interceptors.response.use(res => { @@ -103,4 +98,27 @@ service.interceptors.response.use(res => {
103 } 98 }
104 ) 99 )
105 100
  101 +// 通用下载方法
  102 +export function download(url, params, filename) {
  103 + downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
  104 + return service.post(url, params, {
  105 + transformRequest: [(params) => { return tansParams(params) }],
  106 + headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  107 + responseType: 'blob'
  108 + }).then(async (data) => {
  109 + const isLogin = await blobValidate(data);
  110 + if (isLogin) {
  111 + const blob = new Blob([data])
  112 + saveAs(blob, filename)
  113 + } else {
  114 + Message.error('无效的会话,或者会话已过期,请重新登录。');
  115 + }
  116 + downloadLoadingInstance.close();
  117 + }).catch((r) => {
  118 + console.error(r)
  119 + Message.error('下载文件出现错误,请联系管理员!')
  120 + downloadLoadingInstance.close();
  121 + })
  122 +}
  123 +
106 export default service 124 export default service
@@ -181,3 +181,40 @@ export function handleTree(data, id, parentId, children) { @@ -181,3 +181,40 @@ export function handleTree(data, id, parentId, children) {
181 } 181 }
182 return tree; 182 return tree;
183 } 183 }
  184 +
  185 +/**
  186 +* 参数处理
  187 +* @param {*} params 参数
  188 +*/
  189 +export function tansParams(params) {
  190 + let result = ''
  191 + for (const propName of Object.keys(params)) {
  192 + const value = params[propName];
  193 + var part = encodeURIComponent(propName) + "=";
  194 + if (value !== null && typeof (value) !== "undefined") {
  195 + if (typeof value === 'object') {
  196 + for (const key of Object.keys(value)) {
  197 + if (value[key] !== null && typeof (value[key]) !== 'undefined') {
  198 + let params = propName + '[' + key + ']';
  199 + var subPart = encodeURIComponent(params) + "=";
  200 + result += subPart + encodeURIComponent(value[key]) + "&";
  201 + }
  202 + }
  203 + } else {
  204 + result += part + encodeURIComponent(value) + "&";
  205 + }
  206 + }
  207 + }
  208 + return result
  209 +}
  210 +
  211 +// 验证是否为blob格式
  212 +export async function blobValidate(data) {
  213 + try {
  214 + const text = await data.text();
  215 + JSON.parse(text);
  216 + return false;
  217 + } catch (error) {
  218 + return true;
  219 + }
  220 +}
@@ -75,7 +75,6 @@ @@ -75,7 +75,6 @@
75 plain 75 plain
76 icon="el-icon-download" 76 icon="el-icon-download"
77 size="mini" 77 size="mini"
78 - :loading="exportLoading"  
79 @click="handleExport" 78 @click="handleExport"
80 v-hasPermi="['monitor:job:export']" 79 v-hasPermi="['monitor:job:export']"
81 >导出</el-button> 80 >导出</el-button>
@@ -295,7 +294,7 @@ @@ -295,7 +294,7 @@
295 </template> 294 </template>
296 295
297 <script> 296 <script>
298 -import { listJob, getJob, delJob, addJob, updateJob, exportJob, runJob, changeJobStatus } from "@/api/monitor/job"; 297 +import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job";
299 import Crontab from '@/components/Crontab' 298 import Crontab from '@/components/Crontab'
300 299
301 export default { 300 export default {
@@ -306,8 +305,6 @@ export default { @@ -306,8 +305,6 @@ export default {
306 return { 305 return {
307 // 遮罩层 306 // 遮罩层
308 loading: true, 307 loading: true,
309 - // 导出遮罩层  
310 - exportLoading: false,  
311 // 选中数组 308 // 选中数组
312 ids: [], 309 ids: [],
313 // 非单个禁用 310 // 非单个禁用
@@ -510,14 +507,9 @@ export default { @@ -510,14 +507,9 @@ export default {
510 }, 507 },
511 /** 导出按钮操作 */ 508 /** 导出按钮操作 */
512 handleExport() { 509 handleExport() {
513 - const queryParams = this.queryParams;  
514 - this.$modal.confirm('是否确认导出所有定时任务数据项?').then(() => {  
515 - this.exportLoading = true;  
516 - return exportJob(queryParams);  
517 - }).then(response => {  
518 - this.$download.name(response.msg);  
519 - this.exportLoading = false;  
520 - }).catch(() => {}); 510 + this.download('monitor/job/export', {
  511 + ...this.queryParams
  512 + }, `job_${new Date().getTime()}.xlsx`)
521 } 513 }
522 } 514 }
523 }; 515 };
@@ -89,7 +89,6 @@ @@ -89,7 +89,6 @@
89 plain 89 plain
90 icon="el-icon-download" 90 icon="el-icon-download"
91 size="mini" 91 size="mini"
92 - :loading="exportLoading"  
93 @click="handleExport" 92 @click="handleExport"
94 v-hasPermi="['monitor:job:export']" 93 v-hasPermi="['monitor:job:export']"
95 >导出</el-button> 94 >导出</el-button>
@@ -186,7 +185,7 @@ @@ -186,7 +185,7 @@
186 185
187 <script> 186 <script>
188 import { getJob} from "@/api/monitor/job"; 187 import { getJob} from "@/api/monitor/job";
189 -import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from "@/api/monitor/jobLog"; 188 +import { listJobLog, delJobLog, cleanJobLog } from "@/api/monitor/jobLog";
190 189
191 export default { 190 export default {
192 name: "JobLog", 191 name: "JobLog",
@@ -195,8 +194,6 @@ export default { @@ -195,8 +194,6 @@ export default {
195 return { 194 return {
196 // 遮罩层 195 // 遮罩层
197 loading: true, 196 loading: true,
198 - // 导出遮罩层  
199 - exportLoading: false,  
200 // 选中数组 197 // 选中数组
201 ids: [], 198 ids: [],
202 // 非多个禁用 199 // 非多个禁用
@@ -293,14 +290,9 @@ export default { @@ -293,14 +290,9 @@ export default {
293 }, 290 },
294 /** 导出按钮操作 */ 291 /** 导出按钮操作 */
295 handleExport() { 292 handleExport() {
296 - const queryParams = this.queryParams;  
297 - this.$modal.confirm('是否确认导出所有调度日志数据项?').then(() => {  
298 - this.exportLoading = true;  
299 - return exportJobLog(queryParams);  
300 - }).then(response => {  
301 - this.$download.name(response.msg);  
302 - this.exportLoading = false;  
303 - }).catch(() => {}); 293 + this.download('/monitor/jobLog/export', {
  294 + ...this.queryParams
  295 + }, `log_${new Date().getTime()}.xlsx`)
304 } 296 }
305 } 297 }
306 }; 298 };
@@ -83,7 +83,6 @@ @@ -83,7 +83,6 @@
83 plain 83 plain
84 icon="el-icon-download" 84 icon="el-icon-download"
85 size="mini" 85 size="mini"
86 - :loading="exportLoading"  
87 @click="handleExport" 86 @click="handleExport"
88 v-hasPermi="['monitor:logininfor:export']" 87 v-hasPermi="['monitor:logininfor:export']"
89 >导出</el-button> 88 >导出</el-button>
@@ -123,7 +122,7 @@ @@ -123,7 +122,7 @@
123 </template> 122 </template>
124 123
125 <script> 124 <script>
126 -import { list, delLogininfor, cleanLogininfor, exportLogininfor } from "@/api/monitor/logininfor"; 125 +import { list, delLogininfor, cleanLogininfor } from "@/api/monitor/logininfor";
127 126
128 export default { 127 export default {
129 name: "Logininfor", 128 name: "Logininfor",
@@ -132,8 +131,6 @@ export default { @@ -132,8 +131,6 @@ export default {
132 return { 131 return {
133 // 遮罩层 132 // 遮罩层
134 loading: true, 133 loading: true,
135 - // 导出遮罩层  
136 - exportLoading: false,  
137 // 选中数组 134 // 选中数组
138 ids: [], 135 ids: [],
139 // 非多个禁用 136 // 非多个禁用
@@ -216,14 +213,9 @@ export default { @@ -216,14 +213,9 @@ export default {
216 }, 213 },
217 /** 导出按钮操作 */ 214 /** 导出按钮操作 */
218 handleExport() { 215 handleExport() {
219 - const queryParams = this.queryParams;  
220 - this.$modal.confirm('是否确认导出所有操作日志数据项?').then(() => {  
221 - this.exportLoading = true;  
222 - return exportLogininfor(queryParams);  
223 - }).then(response => {  
224 - this.$download.name(response.msg);  
225 - this.exportLoading = false;  
226 - }).catch(() => {}); 216 + this.download('monitor/logininfor/export', {
  217 + ...this.queryParams
  218 + }, `logininfor_${new Date().getTime()}.xlsx`)
227 } 219 }
228 } 220 }
229 }; 221 };
@@ -99,7 +99,6 @@ @@ -99,7 +99,6 @@
99 plain 99 plain
100 icon="el-icon-download" 100 icon="el-icon-download"
101 size="mini" 101 size="mini"
102 - :loading="exportLoading"  
103 @click="handleExport" 102 @click="handleExport"
104 v-hasPermi="['monitor:operlog:export']" 103 v-hasPermi="['monitor:operlog:export']"
105 >导出</el-button> 104 >导出</el-button>
@@ -196,7 +195,7 @@ @@ -196,7 +195,7 @@
196 </template> 195 </template>
197 196
198 <script> 197 <script>
199 -import { list, delOperlog, cleanOperlog, exportOperlog } from "@/api/monitor/operlog"; 198 +import { list, delOperlog, cleanOperlog } from "@/api/monitor/operlog";
200 199
201 export default { 200 export default {
202 name: "Operlog", 201 name: "Operlog",
@@ -205,8 +204,6 @@ export default { @@ -205,8 +204,6 @@ export default {
205 return { 204 return {
206 // 遮罩层 205 // 遮罩层
207 loading: true, 206 loading: true,
208 - // 导出遮罩层  
209 - exportLoading: false,  
210 // 选中数组 207 // 选中数组
211 ids: [], 208 ids: [],
212 // 非多个禁用 209 // 非多个禁用
@@ -303,14 +300,9 @@ export default { @@ -303,14 +300,9 @@ export default {
303 }, 300 },
304 /** 导出按钮操作 */ 301 /** 导出按钮操作 */
305 handleExport() { 302 handleExport() {
306 - const queryParams = this.queryParams;  
307 - this.$modal.confirm('是否确认导出所有操作日志数据项?').then(() => {  
308 - this.exportLoading = true;  
309 - return exportOperlog(queryParams);  
310 - }).then(response => {  
311 - this.$download.name(response.msg);  
312 - this.exportLoading = false;  
313 - }).catch(() => {}); 303 + this.download('monitor/operlog/export', {
  304 + ...this.queryParams
  305 + }, `operlog_${new Date().getTime()}.xlsx`)
314 } 306 }
315 } 307 }
316 }; 308 };
@@ -88,7 +88,6 @@ @@ -88,7 +88,6 @@
88 plain 88 plain
89 icon="el-icon-download" 89 icon="el-icon-download"
90 size="mini" 90 size="mini"
91 - :loading="exportLoading"  
92 @click="handleExport" 91 @click="handleExport"
93 v-hasPermi="['system:config:export']" 92 v-hasPermi="['system:config:export']"
94 >导出</el-button> 93 >导出</el-button>
@@ -185,7 +184,7 @@ @@ -185,7 +184,7 @@
185 </template> 184 </template>
186 185
187 <script> 186 <script>
188 -import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig, refreshCache } from "@/api/system/config"; 187 +import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config";
189 188
190 export default { 189 export default {
191 name: "Config", 190 name: "Config",
@@ -194,8 +193,6 @@ export default { @@ -194,8 +193,6 @@ export default {
194 return { 193 return {
195 // 遮罩层 194 // 遮罩层
196 loading: true, 195 loading: true,
197 - // 导出遮罩层  
198 - exportLoading: false,  
199 // 选中数组 196 // 选中数组
200 ids: [], 197 ids: [],
201 // 非单个禁用 198 // 非单个禁用
@@ -334,14 +331,9 @@ export default { @@ -334,14 +331,9 @@ export default {
334 }, 331 },
335 /** 导出按钮操作 */ 332 /** 导出按钮操作 */
336 handleExport() { 333 handleExport() {
337 - const queryParams = this.queryParams;  
338 - this.$modal.confirm('是否确认导出所有参数数据项?').then(() => {  
339 - this.exportLoading = true;  
340 - return exportConfig(queryParams);  
341 - }).then(response => {  
342 - this.$download.name(response.msg);  
343 - this.exportLoading = false;  
344 - }).catch(() => {}); 334 + this.download('system/config/export', {
  335 + ...this.queryParams
  336 + }, `config_${new Date().getTime()}.xlsx`)
345 }, 337 },
346 /** 刷新缓存按钮操作 */ 338 /** 刷新缓存按钮操作 */
347 handleRefreshCache() { 339 handleRefreshCache() {
@@ -75,7 +75,6 @@ @@ -75,7 +75,6 @@
75 plain 75 plain
76 icon="el-icon-download" 76 icon="el-icon-download"
77 size="mini" 77 size="mini"
78 - :loading="exportLoading"  
79 @click="handleExport" 78 @click="handleExport"
80 v-hasPermi="['system:dict:export']" 79 v-hasPermi="['system:dict:export']"
81 >导出</el-button> 80 >导出</el-button>
@@ -183,7 +182,7 @@ @@ -183,7 +182,7 @@
183 </template> 182 </template>
184 183
185 <script> 184 <script>
186 -import { listData, getData, delData, addData, updateData, exportData } from "@/api/system/dict/data"; 185 +import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data";
187 import { listType, getType } from "@/api/system/dict/type"; 186 import { listType, getType } from "@/api/system/dict/type";
188 187
189 export default { 188 export default {
@@ -193,8 +192,6 @@ export default { @@ -193,8 +192,6 @@ export default {
193 return { 192 return {
194 // 遮罩层 193 // 遮罩层
195 loading: true, 194 loading: true,
196 - // 导出遮罩层  
197 - exportLoading: false,  
198 // 选中数组 195 // 选中数组
199 ids: [], 196 ids: [],
200 // 非单个禁用 197 // 非单个禁用
@@ -380,14 +377,9 @@ export default { @@ -380,14 +377,9 @@ export default {
380 }, 377 },
381 /** 导出按钮操作 */ 378 /** 导出按钮操作 */
382 handleExport() { 379 handleExport() {
383 - const queryParams = this.queryParams;  
384 - this.$modal.confirm('是否确认导出所有数据项?').then(() => {  
385 - this.exportLoading = true;  
386 - return exportData(queryParams);  
387 - }).then(response => {  
388 - this.$download.name(response.msg);  
389 - this.exportLoading = false;  
390 - }).catch(() => {}); 380 + this.download('system/dict/data/export', {
  381 + ...this.queryParams
  382 + }, `data_${new Date().getTime()}.xlsx`)
391 } 383 }
392 } 384 }
393 }; 385 };
@@ -94,7 +94,6 @@ @@ -94,7 +94,6 @@
94 plain 94 plain
95 icon="el-icon-download" 95 icon="el-icon-download"
96 size="mini" 96 size="mini"
97 - :loading="exportLoading"  
98 @click="handleExport" 97 @click="handleExport"
99 v-hasPermi="['system:dict:export']" 98 v-hasPermi="['system:dict:export']"
100 >导出</el-button> 99 >导出</el-button>
@@ -193,7 +192,7 @@ @@ -193,7 +192,7 @@
193 </template> 192 </template>
194 193
195 <script> 194 <script>
196 -import { listType, getType, delType, addType, updateType, exportType, refreshCache } from "@/api/system/dict/type"; 195 +import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
197 196
198 export default { 197 export default {
199 name: "Dict", 198 name: "Dict",
@@ -202,8 +201,6 @@ export default { @@ -202,8 +201,6 @@ export default {
202 return { 201 return {
203 // 遮罩层 202 // 遮罩层
204 loading: true, 203 loading: true,
205 - // 导出遮罩层  
206 - exportLoading: false,  
207 // 选中数组 204 // 选中数组
208 ids: [], 205 ids: [],
209 // 非单个禁用 206 // 非单个禁用
@@ -338,14 +335,9 @@ export default { @@ -338,14 +335,9 @@ export default {
338 }, 335 },
339 /** 导出按钮操作 */ 336 /** 导出按钮操作 */
340 handleExport() { 337 handleExport() {
341 - const queryParams = this.queryParams;  
342 - this.$modal.confirm('是否确认导出所有类型数据项?').then(() => {  
343 - this.exportLoading = true;  
344 - return exportType(queryParams);  
345 - }).then(response => {  
346 - this.$download.name(response.msg);  
347 - this.exportLoading = false;  
348 - }).catch(() => {}); 338 + this.download('system/dict/type/export', {
  339 + ...this.queryParams
  340 + }, `type_${new Date().getTime()}.xlsx`)
349 }, 341 },
350 /** 刷新缓存按钮操作 */ 342 /** 刷新缓存按钮操作 */
351 handleRefreshCache() { 343 handleRefreshCache() {
@@ -74,7 +74,6 @@ @@ -74,7 +74,6 @@
74 plain 74 plain
75 icon="el-icon-download" 75 icon="el-icon-download"
76 size="mini" 76 size="mini"
77 - :loading="exportLoading"  
78 @click="handleExport" 77 @click="handleExport"
79 v-hasPermi="['system:post:export']" 78 v-hasPermi="['system:post:export']"
80 >导出</el-button> 79 >导出</el-button>
@@ -160,7 +159,7 @@ @@ -160,7 +159,7 @@
160 </template> 159 </template>
161 160
162 <script> 161 <script>
163 -import { listPost, getPost, delPost, addPost, updatePost, exportPost } from "@/api/system/post"; 162 +import { listPost, getPost, delPost, addPost, updatePost } from "@/api/system/post";
164 163
165 export default { 164 export default {
166 name: "Post", 165 name: "Post",
@@ -169,8 +168,6 @@ export default { @@ -169,8 +168,6 @@ export default {
169 return { 168 return {
170 // 遮罩层 169 // 遮罩层
171 loading: true, 170 loading: true,
172 - // 导出遮罩层  
173 - exportLoading: false,  
174 // 选中数组 171 // 选中数组
175 ids: [], 172 ids: [],
176 // 非单个禁用 173 // 非单个禁用
@@ -305,14 +302,9 @@ export default { @@ -305,14 +302,9 @@ export default {
305 }, 302 },
306 /** 导出按钮操作 */ 303 /** 导出按钮操作 */
307 handleExport() { 304 handleExport() {
308 - const queryParams = this.queryParams;  
309 - this.$modal.confirm('是否确认导出所有岗位数据项?').then(() => {  
310 - this.exportLoading = true;  
311 - return exportPost(queryParams);  
312 - }).then(response => {  
313 - this.$download.name(response.msg);  
314 - this.exportLoading = false;  
315 - }).catch(() => {}); 305 + this.download('system/post/export', {
  306 + ...this.queryParams
  307 + }, `post_${new Date().getTime()}.xlsx`)
316 } 308 }
317 } 309 }
318 }; 310 };
@@ -94,7 +94,6 @@ @@ -94,7 +94,6 @@
94 plain 94 plain
95 icon="el-icon-download" 95 icon="el-icon-download"
96 size="mini" 96 size="mini"
97 - :loading="exportLoading"  
98 @click="handleExport" 97 @click="handleExport"
99 v-hasPermi="['system:role:export']" 98 v-hasPermi="['system:role:export']"
100 >导出</el-button> 99 >导出</el-button>
@@ -259,7 +258,7 @@ @@ -259,7 +258,7 @@
259 </template> 258 </template>
260 259
261 <script> 260 <script>
262 -import { listRole, getRole, delRole, addRole, updateRole, exportRole, dataScope, changeRoleStatus } from "@/api/system/role"; 261 +import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus } from "@/api/system/role";
263 import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu"; 262 import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu";
264 import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept"; 263 import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept";
265 264
@@ -270,8 +269,6 @@ export default { @@ -270,8 +269,6 @@ export default {
270 return { 269 return {
271 // 遮罩层 270 // 遮罩层
272 loading: true, 271 loading: true,
273 - // 导出遮罩层  
274 - exportLoading: false,  
275 // 选中数组 272 // 选中数组
276 ids: [], 273 ids: [],
277 // 非单个禁用 274 // 非单个禁用
@@ -613,14 +610,9 @@ export default { @@ -613,14 +610,9 @@ export default {
613 }, 610 },
614 /** 导出按钮操作 */ 611 /** 导出按钮操作 */
615 handleExport() { 612 handleExport() {
616 - const queryParams = this.queryParams;  
617 - this.$modal.confirm('是否确认导出所有用户数据项?').then(() => {  
618 - this.exportLoading = true;  
619 - return exportRole(queryParams);  
620 - }).then(response => {  
621 - this.$download.name(response.msg);  
622 - this.exportLoading = false;  
623 - }).catch(() => {}); 613 + this.download('system/role/export', {
  614 + ...this.queryParams
  615 + }, `role_${new Date().getTime()}.xlsx`)
624 } 616 }
625 } 617 }
626 }; 618 };
@@ -131,7 +131,6 @@ @@ -131,7 +131,6 @@
131 plain 131 plain
132 icon="el-icon-download" 132 icon="el-icon-download"
133 size="mini" 133 size="mini"
134 - :loading="exportLoading"  
135 @click="handleExport" 134 @click="handleExport"
136 v-hasPermi="['system:user:export']" 135 v-hasPermi="['system:user:export']"
137 >导出</el-button> 136 >导出</el-button>
@@ -346,7 +345,7 @@ @@ -346,7 +345,7 @@
346 </template> 345 </template>
347 346
348 <script> 347 <script>
349 -import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus, importTemplate } from "@/api/system/user"; 348 +import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/system/user";
350 import { getToken } from "@/utils/auth"; 349 import { getToken } from "@/utils/auth";
351 import { treeselect } from "@/api/system/dept"; 350 import { treeselect } from "@/api/system/dept";
352 import Treeselect from "@riophae/vue-treeselect"; 351 import Treeselect from "@riophae/vue-treeselect";
@@ -360,8 +359,6 @@ export default { @@ -360,8 +359,6 @@ export default {
360 return { 359 return {
361 // 遮罩层 360 // 遮罩层
362 loading: true, 361 loading: true,
363 - // 导出遮罩层  
364 - exportLoading: false,  
365 // 选中数组 362 // 选中数组
366 ids: [], 363 ids: [],
367 // 非单个禁用 364 // 非单个禁用
@@ -643,14 +640,9 @@ export default { @@ -643,14 +640,9 @@ export default {
643 }, 640 },
644 /** 导出按钮操作 */ 641 /** 导出按钮操作 */
645 handleExport() { 642 handleExport() {
646 - const queryParams = this.queryParams;  
647 - this.$modal.confirm('是否确认导出所有用户数据项?').then(() => {  
648 - this.exportLoading = true;  
649 - return exportUser(queryParams);  
650 - }).then(response => {  
651 - this.$download.name(response.msg);  
652 - this.exportLoading = false;  
653 - }).catch(() => {}); 643 + this.download('system/user/export', {
  644 + ...this.queryParams
  645 + }, `user_${new Date().getTime()}.xlsx`)
654 }, 646 },
655 /** 导入按钮操作 */ 647 /** 导入按钮操作 */
656 handleImport() { 648 handleImport() {
@@ -659,9 +651,9 @@ export default { @@ -659,9 +651,9 @@ export default {
659 }, 651 },
660 /** 下载模板操作 */ 652 /** 下载模板操作 */
661 importTemplate() { 653 importTemplate() {
662 - importTemplate().then(response => {  
663 - this.$download.name(response.msg);  
664 - }); 654 + this.download('system/user/importTemplate', {
  655 + ...this.queryParams
  656 + }, `user_template_${new Date().getTime()}.xlsx`)
665 }, 657 },
666 // 文件上传中处理 658 // 文件上传中处理
667 handleFileUploadProgress(event, file, fileList) { 659 handleFileUploadProgress(event, file, fileList) {