From cedd2d1daf444c0f74ca2a7844e769d524877279 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期三, 17 十一月 2021 11:57:17 +0800
Subject: [PATCH] 优化导出数据操作
---
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java | 8
ruoyi-ui/src/api/system/dict/data.js | 9 -
ruoyi-ui/src/api/monitor/logininfor.js | 9 -
ruoyi-ui/src/views/monitor/job/log.vue | 16 -
ruoyi-ui/src/views/system/role/index.vue | 16 -
ruoyi-ui/src/views/system/user/index.vue | 22 -
ruoyi-ui/src/api/system/user.js | 17 -
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java | 7
ruoyi-ui/src/views/system/dict/index.vue | 16 -
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 17 -
ruoyi-ui/src/main.js | 2
ruoyi-generator/src/main/resources/vm/java/controller.java.vm | 7
ruoyi-ui/src/api/system/dict/type.js | 9 -
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java | 13
ruoyi-ui/src/views/monitor/logininfor/index.vue | 16 -
ruoyi-ui/src/views/system/post/index.vue | 16 -
ruoyi-ui/src/views/system/dict/data.vue | 16 -
ruoyi-ui/src/api/monitor/operlog.js | 9 -
ruoyi-ui/src/api/system/role.js | 9 -
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java | 7
ruoyi-ui/src/utils/ruoyi.js | 37 ++++
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm | 16 -
ruoyi-ui/src/api/system/post.js | 9 -
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java | 9
ruoyi-ui/src/views/monitor/job/index.vue | 16 -
ruoyi-ui/src/views/monitor/operlog/index.vue | 16 -
ruoyi-ui/src/api/monitor/job.js | 9 -
ruoyi-ui/src/views/system/config/index.vue | 16 -
ruoyi-ui/src/utils/request.js | 68 ++++--
ruoyi-ui/src/api/system/config.js | 9 -
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java | 7
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java | 7
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java | 7
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java | 8
ruoyi-ui/src/plugins/download.js | 18 -
ruoyi-ui/src/api/monitor/jobLog.js | 9 -
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java | 8
37 files changed, 192 insertions(+), 318 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 14f57fd..5bd40ba 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
@@ -1,11 +1,13 @@
package com.ruoyi.web.controller.monitor;
import java.util.List;
+import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
@@ -40,12 +42,12 @@
@Log(title = "鐧诲綍鏃ュ織", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
- @GetMapping("/export")
- public AjaxResult export(SysLogininfor logininfor)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysLogininfor logininfor)
{
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
- return util.exportExcel(list, "鐧诲綍鏃ュ織");
+ util.exportExcel(response, list, "鐧诲綍鏃ュ織");
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
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 75bf126..4ce126a 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
@@ -1,11 +1,13 @@
package com.ruoyi.web.controller.monitor;
import java.util.List;
+import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
@@ -40,12 +42,12 @@
@Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
- @GetMapping("/export")
- public AjaxResult export(SysOperLog operLog)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysOperLog operLog)
{
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
- return util.exportExcel(list, "鎿嶄綔鏃ュ織");
+ util.exportExcel(response, list, "鎿嶄綔鏃ュ織");
}
@Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.DELETE)
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 dc2532f..04f7162 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
@@ -1,6 +1,7 @@
package com.ruoyi.web.controller.system;
import java.util.List;
+import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@@ -13,7 +14,6 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
-import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@@ -49,12 +49,12 @@
@Log(title = "鍙傛暟绠$悊", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')")
- @GetMapping("/export")
- public AjaxResult export(SysConfig config)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysConfig config)
{
List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
- return util.exportExcel(list, "鍙傛暟鏁版嵁");
+ util.exportExcel(response, list, "鍙傛暟鏁版嵁");
}
/**
@@ -82,7 +82,6 @@
@PreAuthorize("@ss.hasPermi('system:config:add')")
@Log(title = "鍙傛暟绠$悊", businessType = BusinessType.INSERT)
@PostMapping
- @RepeatSubmit
public AjaxResult add(@Validated @RequestBody SysConfig config)
{
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
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 b9e3dc3..eea89fd 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
@@ -2,6 +2,7 @@
import java.util.ArrayList;
import java.util.List;
+import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@@ -50,12 +51,12 @@
@Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
- @GetMapping("/export")
- public AjaxResult export(SysDictData dictData)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysDictData dictData)
{
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
- return util.exportExcel(list, "瀛楀吀鏁版嵁");
+ util.exportExcel(response, list, "瀛楀吀鏁版嵁");
}
/**
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 acad00e..0dd3474 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
@@ -1,6 +1,7 @@
package com.ruoyi.web.controller.system;
import java.util.List;
+import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@@ -45,12 +46,12 @@
@Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
- @GetMapping("/export")
- public AjaxResult export(SysDictType dictType)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysDictType dictType)
{
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
- return util.exportExcel(list, "瀛楀吀绫诲瀷");
+ util.exportExcel(response, list, "瀛楀吀绫诲瀷");
}
/**
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 30a8761..1a2b408 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
@@ -1,6 +1,7 @@
package com.ruoyi.web.controller.system;
import java.util.List;
+import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@@ -48,12 +49,12 @@
@Log(title = "宀椾綅绠$悊", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:post:export')")
- @GetMapping("/export")
- public AjaxResult export(SysPost post)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysPost post)
{
List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
- return util.exportExcel(list, "宀椾綅鏁版嵁");
+ util.exportExcel(response, list, "宀椾綅鏁版嵁");
}
/**
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 d737490..d70fa81 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
@@ -1,6 +1,7 @@
package com.ruoyi.web.controller.system;
import java.util.List;
+import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@@ -61,12 +62,12 @@
@Log(title = "瑙掕壊绠$悊", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:role:export')")
- @GetMapping("/export")
- public AjaxResult export(SysRole role)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysRole role)
{
List<SysRole> list = roleService.selectRoleList(role);
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
- return util.exportExcel(list, "瑙掕壊鏁版嵁");
+ util.exportExcel(response, list, "瑙掕壊鏁版嵁");
}
/**
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 6cfbfb8..9aacc3b 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
@@ -2,6 +2,7 @@
import java.util.List;
import java.util.stream.Collectors;
+import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -62,12 +63,12 @@
@Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:user:export')")
- @GetMapping("/export")
- public AjaxResult export(SysUser user)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysUser user)
{
List<SysUser> list = userService.selectUserList(user);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
- return util.exportExcel(list, "鐢ㄦ埛鏁版嵁");
+ util.exportExcel(response, list, "鐢ㄦ埛鏁版嵁");
}
@Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.IMPORT)
@@ -82,11 +83,11 @@
return AjaxResult.success(message);
}
- @GetMapping("/importTemplate")
- public AjaxResult importTemplate()
+ @PostMapping("/importTemplate")
+ public void importTemplate(HttpServletResponse response)
{
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
- return util.importTemplateExcel("鐢ㄦ埛鏁版嵁");
+ util.importTemplateExcel(response, "鐢ㄦ埛鏁版嵁");
}
/**
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
index 4169360..93a19e8 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
@@ -431,7 +431,7 @@
* @return 缁撴灉
* @throws IOException
*/
- public void exportExcel(HttpServletResponse response, List<T> list, String sheetName)throws IOException
+ public void exportExcel(HttpServletResponse response, List<T> list, String sheetName)
{
exportExcel(response, list, sheetName, StringUtils.EMPTY);
}
@@ -446,12 +446,12 @@
* @return 缁撴灉
* @throws IOException
*/
- public void exportExcel(HttpServletResponse response, List<T> list, String sheetName, String title) throws IOException
+ public void exportExcel(HttpServletResponse response, List<T> list, String sheetName, String title)
{
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
this.init(list, sheetName, title, Type.EXPORT);
- exportExcel(response.getOutputStream());
+ exportExcel(response);
}
/**
@@ -484,7 +484,7 @@
* @param sheetName 宸ヤ綔琛ㄧ殑鍚嶇О
* @return 缁撴灉
*/
- public void importTemplateExcel(HttpServletResponse response, String sheetName) throws IOException
+ public void importTemplateExcel(HttpServletResponse response, String sheetName)
{
importTemplateExcel(response, sheetName, StringUtils.EMPTY);
}
@@ -496,12 +496,12 @@
* @param title 鏍囬
* @return 缁撴灉
*/
- public void importTemplateExcel(HttpServletResponse response, String sheetName, String title) throws IOException
+ public void importTemplateExcel(HttpServletResponse response, String sheetName, String title)
{
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
this.init(null, sheetName, title, Type.IMPORT);
- exportExcel(response.getOutputStream());
+ exportExcel(response);
}
/**
@@ -509,12 +509,12 @@
*
* @return 缁撴灉
*/
- public void exportExcel(OutputStream out)
+ public void exportExcel(HttpServletResponse response)
{
try
{
writeSheet();
- wb.write(out);
+ wb.write(response.getOutputStream());
}
catch (Exception e)
{
@@ -523,7 +523,6 @@
finally
{
IOUtils.closeQuietly(wb);
- IOUtils.closeQuietly(out);
}
}
diff --git a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm
index 56ff5e6..ab19cf5 100644
--- a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm
+++ b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm
@@ -1,6 +1,7 @@
package ${packageName}.controller;
import java.util.List;
+import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -61,12 +62,12 @@
*/
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult export(${ClassName} ${className})
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ${ClassName} ${className})
{
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
- return util.exportExcel(list, "${functionName}鏁版嵁");
+ util.exportExcel(response, list, "${functionName}鏁版嵁");
}
/**
diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
index 867225a..729a9da 100644
--- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
+++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
@@ -108,7 +108,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['${moduleName}:${businessName}:export']"
>瀵煎嚭</el-button>
@@ -313,7 +312,7 @@
</template>
<script>
-import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}";
+import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
export default {
name: "${BusinessName}",
@@ -324,8 +323,6 @@
return {
// 閬僵灞�
loading: true,
- // 瀵煎嚭閬僵灞�
- exportLoading: false,
// 閫変腑鏁扮粍
ids: [],
#if($table.sub)
@@ -562,14 +559,9 @@
#end
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
handleExport() {
- const queryParams = this.queryParams;
- this.#[[$modal]]#.confirm('鏄惁纭瀵煎嚭鎵�鏈�${functionName}鏁版嵁椤癸紵').then(() => {
- this.exportLoading = true;
- return export${BusinessName}(queryParams);
- }).then(response => {
- this.#[[$download]]#.name(response.msg);
- this.exportLoading = false;
- }).catch(() => {});
+ this.download('${moduleName}/${businessName}/export', {
+ ...this.queryParams
+ }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
}
}
};
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
index 2f3ddab..2512bf1 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
@@ -1,6 +1,7 @@
package com.ruoyi.quartz.controller;
import java.util.List;
+import javax.servlet.http.HttpServletResponse;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -54,12 +55,12 @@
*/
@PreAuthorize("@ss.hasPermi('monitor:job:export')")
@Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult export(SysJob sysJob)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysJob sysJob)
{
List<SysJob> list = jobService.selectJobList(sysJob);
ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
- return util.exportExcel(list, "瀹氭椂浠诲姟");
+ util.exportExcel(response, list, "瀹氭椂浠诲姟");
}
/**
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java
index 10a842b..fff959a 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java
@@ -1,11 +1,13 @@
package com.ruoyi.quartz.controller;
import java.util.List;
+import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
@@ -46,12 +48,12 @@
*/
@PreAuthorize("@ss.hasPermi('monitor:job:export')")
@Log(title = "浠诲姟璋冨害鏃ュ織", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult export(SysJobLog sysJobLog)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysJobLog sysJobLog)
{
List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
- return util.exportExcel(list, "璋冨害鏃ュ織");
+ util.exportExcel(response, list, "璋冨害鏃ュ織");
}
/**
diff --git a/ruoyi-ui/src/api/monitor/job.js b/ruoyi-ui/src/api/monitor/job.js
index 58c4343..3815569 100644
--- a/ruoyi-ui/src/api/monitor/job.js
+++ b/ruoyi-ui/src/api/monitor/job.js
@@ -43,15 +43,6 @@
})
}
-// 瀵煎嚭瀹氭椂浠诲姟璋冨害
-export function exportJob(query) {
- return request({
- url: '/monitor/job/export',
- method: 'get',
- params: query
- })
-}
-
// 浠诲姟鐘舵�佷慨鏀�
export function changeJobStatus(jobId, status) {
const data = {
diff --git a/ruoyi-ui/src/api/monitor/jobLog.js b/ruoyi-ui/src/api/monitor/jobLog.js
index be1fffd..6e0be61 100644
--- a/ruoyi-ui/src/api/monitor/jobLog.js
+++ b/ruoyi-ui/src/api/monitor/jobLog.js
@@ -24,12 +24,3 @@
method: 'delete'
})
}
-
-// 瀵煎嚭璋冨害鏃ュ織
-export function exportJobLog(query) {
- return request({
- url: '/monitor/jobLog/export',
- method: 'get',
- params: query
- })
-}
\ No newline at end of file
diff --git a/ruoyi-ui/src/api/monitor/logininfor.js b/ruoyi-ui/src/api/monitor/logininfor.js
index 0b89cdc..cd78151 100644
--- a/ruoyi-ui/src/api/monitor/logininfor.js
+++ b/ruoyi-ui/src/api/monitor/logininfor.js
@@ -24,12 +24,3 @@
method: 'delete'
})
}
-
-// 瀵煎嚭鐧诲綍鏃ュ織
-export function exportLogininfor(query) {
- return request({
- url: '/monitor/logininfor/export',
- method: 'get',
- params: query
- })
-}
\ No newline at end of file
diff --git a/ruoyi-ui/src/api/monitor/operlog.js b/ruoyi-ui/src/api/monitor/operlog.js
index c519355..6e881df 100644
--- a/ruoyi-ui/src/api/monitor/operlog.js
+++ b/ruoyi-ui/src/api/monitor/operlog.js
@@ -24,12 +24,3 @@
method: 'delete'
})
}
-
-// 瀵煎嚭鎿嶄綔鏃ュ織
-export function exportOperlog(query) {
- return request({
- url: '/monitor/operlog/export',
- method: 'get',
- params: query
- })
-}
\ No newline at end of file
diff --git a/ruoyi-ui/src/api/system/config.js b/ruoyi-ui/src/api/system/config.js
index f1f8727..7858c69 100644
--- a/ruoyi-ui/src/api/system/config.js
+++ b/ruoyi-ui/src/api/system/config.js
@@ -58,12 +58,3 @@
method: 'delete'
})
}
-
-// 瀵煎嚭鍙傛暟
-export function exportConfig(query) {
- return request({
- url: '/system/config/export',
- method: 'get',
- params: query
- })
-}
\ No newline at end of file
diff --git a/ruoyi-ui/src/api/system/dict/data.js b/ruoyi-ui/src/api/system/dict/data.js
index d3f8c2f..2a6e481 100644
--- a/ruoyi-ui/src/api/system/dict/data.js
+++ b/ruoyi-ui/src/api/system/dict/data.js
@@ -50,12 +50,3 @@
method: 'delete'
})
}
-
-// 瀵煎嚭瀛楀吀鏁版嵁
-export function exportData(query) {
- return request({
- url: '/system/dict/data/export',
- method: 'get',
- params: query
- })
-}
\ No newline at end of file
diff --git a/ruoyi-ui/src/api/system/dict/type.js b/ruoyi-ui/src/api/system/dict/type.js
index 2c66bd5..526977d 100644
--- a/ruoyi-ui/src/api/system/dict/type.js
+++ b/ruoyi-ui/src/api/system/dict/type.js
@@ -51,15 +51,6 @@
})
}
-// 瀵煎嚭瀛楀吀绫诲瀷
-export function exportType(query) {
- return request({
- url: '/system/dict/type/export',
- method: 'get',
- params: query
- })
-}
-
// 鑾峰彇瀛楀吀閫夋嫨妗嗗垪琛�
export function optionselect() {
return request({
diff --git a/ruoyi-ui/src/api/system/post.js b/ruoyi-ui/src/api/system/post.js
index fb124d9..8faa266 100644
--- a/ruoyi-ui/src/api/system/post.js
+++ b/ruoyi-ui/src/api/system/post.js
@@ -42,12 +42,3 @@
method: 'delete'
})
}
-
-// 瀵煎嚭宀椾綅
-export function exportPost(query) {
- return request({
- url: '/system/post/export',
- method: 'get',
- params: query
- })
-}
\ No newline at end of file
diff --git a/ruoyi-ui/src/api/system/role.js b/ruoyi-ui/src/api/system/role.js
index aa426df..b5ebdf6 100644
--- a/ruoyi-ui/src/api/system/role.js
+++ b/ruoyi-ui/src/api/system/role.js
@@ -65,15 +65,6 @@
})
}
-// 瀵煎嚭瑙掕壊
-export function exportRole(query) {
- return request({
- url: '/system/role/export',
- method: 'get',
- params: query
- })
-}
-
// 鏌ヨ瑙掕壊宸叉巿鏉冪敤鎴峰垪琛�
export function allocatedUserList(query) {
return request({
diff --git a/ruoyi-ui/src/api/system/user.js b/ruoyi-ui/src/api/system/user.js
index 85bdc19..577bea2 100644
--- a/ruoyi-ui/src/api/system/user.js
+++ b/ruoyi-ui/src/api/system/user.js
@@ -44,15 +44,6 @@
})
}
-// 瀵煎嚭鐢ㄦ埛
-export function exportUser(query) {
- return request({
- url: '/system/user/export',
- method: 'get',
- params: query
- })
-}
-
// 鐢ㄦ埛瀵嗙爜閲嶇疆
export function resetUserPwd(userId, password) {
const data = {
@@ -115,14 +106,6 @@
url: '/system/user/profile/avatar',
method: 'post',
data: data
- })
-}
-
-// 涓嬭浇鐢ㄦ埛瀵煎叆妯℃澘
-export function importTemplate() {
- return request({
- url: '/system/user/importTemplate',
- method: 'get'
})
}
diff --git a/ruoyi-ui/src/main.js b/ruoyi-ui/src/main.js
index 489600a..83b0791 100644
--- a/ruoyi-ui/src/main.js
+++ b/ruoyi-ui/src/main.js
@@ -12,6 +12,7 @@
import router from './router'
import directive from './directive' //directive
import plugins from './plugins' // plugins
+import { download } from '@/utils/request'
import './assets/icons' // icon
import './permission' // permission control
@@ -43,6 +44,7 @@
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
+Vue.prototype.download = download
Vue.prototype.handleTree = handleTree
// 鍏ㄥ眬缁勪欢鎸傝浇
diff --git a/ruoyi-ui/src/plugins/download.js b/ruoyi-ui/src/plugins/download.js
index 2aa8122..e1c6640 100644
--- a/ruoyi-ui/src/plugins/download.js
+++ b/ruoyi-ui/src/plugins/download.js
@@ -1,7 +1,8 @@
-import { saveAs } from 'file-saver'
import axios from 'axios'
-import { getToken } from '@/utils/auth'
import { Message } from 'element-ui'
+import { saveAs } from 'file-saver'
+import { getToken } from '@/utils/auth'
+import { blobValidate } from "@/utils/ruoyi";
const baseURL = process.env.VUE_APP_BASE_API
@@ -48,7 +49,7 @@
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/zip' })
this.saveAs(blob, name)
@@ -59,15 +60,6 @@
},
saveAs(text, name, opts) {
saveAs(text, name, opts);
- },
- async blobValidate(data) {
- try {
- const text = await data.text();
- JSON.parse(text);
- return false;
- } catch (error) {
- return true;
- }
- },
+ }
}
diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js
index 9b40b4a..78a20a2 100644
--- a/ruoyi-ui/src/utils/request.js
+++ b/ruoyi-ui/src/utils/request.js
@@ -1,8 +1,12 @@
import axios from 'axios'
-import { Notification, MessageBox, Message } from 'element-ui'
+import { Notification, MessageBox, Message, Loading } from 'element-ui'
import store from '@/store'
import { getToken } from '@/utils/auth'
import errorCode from '@/utils/errorCode'
+import { tansParams, blobValidate } from "@/utils/ruoyi";
+import { saveAs } from 'file-saver'
+
+let downloadLoadingInstance;
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 鍒涘缓axios瀹炰緥
@@ -12,6 +16,7 @@
// 瓒呮椂
timeout: 10000
})
+
// request鎷︽埅鍣�
service.interceptors.request.use(config => {
// 鏄惁闇�瑕佽缃� token
@@ -21,24 +26,7 @@
}
// get璇锋眰鏄犲皠params鍙傛暟
if (config.method === 'get' && config.params) {
- let url = config.url + '?';
- for (const propName of Object.keys(config.params)) {
- const value = config.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) + '=';
- url += subPart + encodeURIComponent(value[key]) + '&';
- }
- }
- } else {
- url += part + encodeURIComponent(value) + "&";
- }
- }
- }
+ let url = config.url + '?' + tansParams(config.params);
url = url.slice(0, -1);
config.params = {};
config.url = url;
@@ -55,17 +43,24 @@
const code = res.data.code || 200;
// 鑾峰彇閿欒淇℃伅
const msg = errorCode[code] || res.data.msg || errorCode['default']
+ // 浜岃繘鍒舵暟鎹垯鐩存帴杩斿洖
+ if(res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer'){
+ return res.data
+ }
if (code === 401) {
- MessageBox.confirm('鐧诲綍鐘舵�佸凡杩囨湡锛屾偍鍙互缁х画鐣欏湪璇ラ〉闈紝鎴栬�呴噸鏂扮櫥褰�', '绯荤粺鎻愮ず', {
+ let doms = document.getElementsByClassName('el-message-box')[0]
+ if(doms === undefined){
+ MessageBox.confirm('鐧诲綍鐘舵�佸凡杩囨湡锛屾偍鍙互缁х画鐣欏湪璇ラ〉闈紝鎴栬�呴噸鏂扮櫥褰�', '绯荤粺鎻愮ず', {
confirmButtonText: '閲嶆柊鐧诲綍',
cancelButtonText: '鍙栨秷',
type: 'warning'
}
- ).then(() => {
- store.dispatch('LogOut').then(() => {
- location.href = '/index';
- })
- }).catch(() => {});
+ ).then(() => {
+ store.dispatch('LogOut').then(() => {
+ location.href = '/index';
+ })
+ }).catch(() => {});
+ }
return Promise.reject('鏃犳晥鐨勪細璇濓紝鎴栬�呬細璇濆凡杩囨湡锛岃閲嶆柊鐧诲綍銆�')
} else if (code === 500) {
Message({
@@ -103,4 +98,27 @@
}
)
+// 閫氱敤涓嬭浇鏂规硶
+export function download(url, params, filename) {
+ downloadLoadingInstance = Loading.service({ text: "姝e湪涓嬭浇鏁版嵁锛岃绋嶅��", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
+ return service.post(url, params, {
+ transformRequest: [(params) => { return tansParams(params) }],
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ responseType: 'blob'
+ }).then(async (data) => {
+ const isLogin = await blobValidate(data);
+ if (isLogin) {
+ const blob = new Blob([data])
+ saveAs(blob, filename)
+ } else {
+ Message.error('鏃犳晥鐨勪細璇濓紝鎴栬�呬細璇濆凡杩囨湡锛岃閲嶆柊鐧诲綍銆�');
+ }
+ downloadLoadingInstance.close();
+ }).catch((r) => {
+ console.error(r)
+ Message.error('涓嬭浇鏂囦欢鍑虹幇閿欒锛岃鑱旂郴绠$悊鍛橈紒')
+ downloadLoadingInstance.close();
+ })
+}
+
export default service
diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js
index 440bf4c..4cc5e24 100644
--- a/ruoyi-ui/src/utils/ruoyi.js
+++ b/ruoyi-ui/src/utils/ruoyi.js
@@ -181,3 +181,40 @@
}
return tree;
}
+
+/**
+* 鍙傛暟澶勭悊
+* @param {*} params 鍙傛暟
+*/
+export function tansParams(params) {
+ let result = ''
+ 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 + ']';
+ var subPart = encodeURIComponent(params) + "=";
+ result += subPart + encodeURIComponent(value[key]) + "&";
+ }
+ }
+ } else {
+ result += part + encodeURIComponent(value) + "&";
+ }
+ }
+ }
+ return result
+}
+
+// 楠岃瘉鏄惁涓篵lob鏍煎紡
+export async function blobValidate(data) {
+ try {
+ const text = await data.text();
+ JSON.parse(text);
+ return false;
+ } catch (error) {
+ return true;
+ }
+}
diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue
index 06b939d..b8284ab 100644
--- a/ruoyi-ui/src/views/monitor/job/index.vue
+++ b/ruoyi-ui/src/views/monitor/job/index.vue
@@ -75,7 +75,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['monitor:job:export']"
>瀵煎嚭</el-button>
@@ -295,7 +294,7 @@
</template>
<script>
-import { listJob, getJob, delJob, addJob, updateJob, exportJob, runJob, changeJobStatus } from "@/api/monitor/job";
+import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job";
import Crontab from '@/components/Crontab'
export default {
@@ -306,8 +305,6 @@
return {
// 閬僵灞�
loading: true,
- // 瀵煎嚭閬僵灞�
- exportLoading: false,
// 閫変腑鏁扮粍
ids: [],
// 闈炲崟涓鐢�
@@ -510,14 +507,9 @@
},
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
handleExport() {
- const queryParams = this.queryParams;
- this.$modal.confirm('鏄惁纭瀵煎嚭鎵�鏈夊畾鏃朵换鍔℃暟鎹」锛�').then(() => {
- this.exportLoading = true;
- return exportJob(queryParams);
- }).then(response => {
- this.$download.name(response.msg);
- this.exportLoading = false;
- }).catch(() => {});
+ this.download('monitor/job/export', {
+ ...this.queryParams
+ }, `job_${new Date().getTime()}.xlsx`)
}
}
};
diff --git a/ruoyi-ui/src/views/monitor/job/log.vue b/ruoyi-ui/src/views/monitor/job/log.vue
index 44efe5f..35b7788 100644
--- a/ruoyi-ui/src/views/monitor/job/log.vue
+++ b/ruoyi-ui/src/views/monitor/job/log.vue
@@ -89,7 +89,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['monitor:job:export']"
>瀵煎嚭</el-button>
@@ -186,7 +185,7 @@
<script>
import { getJob} from "@/api/monitor/job";
-import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from "@/api/monitor/jobLog";
+import { listJobLog, delJobLog, cleanJobLog } from "@/api/monitor/jobLog";
export default {
name: "JobLog",
@@ -195,8 +194,6 @@
return {
// 閬僵灞�
loading: true,
- // 瀵煎嚭閬僵灞�
- exportLoading: false,
// 閫変腑鏁扮粍
ids: [],
// 闈炲涓鐢�
@@ -293,14 +290,9 @@
},
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
handleExport() {
- const queryParams = this.queryParams;
- this.$modal.confirm('鏄惁纭瀵煎嚭鎵�鏈夎皟搴︽棩蹇楁暟鎹」锛�').then(() => {
- this.exportLoading = true;
- return exportJobLog(queryParams);
- }).then(response => {
- this.$download.name(response.msg);
- this.exportLoading = false;
- }).catch(() => {});
+ this.download('/monitor/jobLog/export', {
+ ...this.queryParams
+ }, `log_${new Date().getTime()}.xlsx`)
}
}
};
diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue
index 6341419..0f4ecbb 100644
--- a/ruoyi-ui/src/views/monitor/logininfor/index.vue
+++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue
@@ -83,7 +83,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['monitor:logininfor:export']"
>瀵煎嚭</el-button>
@@ -123,7 +122,7 @@
</template>
<script>
-import { list, delLogininfor, cleanLogininfor, exportLogininfor } from "@/api/monitor/logininfor";
+import { list, delLogininfor, cleanLogininfor } from "@/api/monitor/logininfor";
export default {
name: "Logininfor",
@@ -132,8 +131,6 @@
return {
// 閬僵灞�
loading: true,
- // 瀵煎嚭閬僵灞�
- exportLoading: false,
// 閫変腑鏁扮粍
ids: [],
// 闈炲涓鐢�
@@ -216,14 +213,9 @@
},
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
handleExport() {
- const queryParams = this.queryParams;
- this.$modal.confirm('鏄惁纭瀵煎嚭鎵�鏈夋搷浣滄棩蹇楁暟鎹」锛�').then(() => {
- this.exportLoading = true;
- return exportLogininfor(queryParams);
- }).then(response => {
- this.$download.name(response.msg);
- this.exportLoading = false;
- }).catch(() => {});
+ this.download('monitor/logininfor/export', {
+ ...this.queryParams
+ }, `logininfor_${new Date().getTime()}.xlsx`)
}
}
};
diff --git a/ruoyi-ui/src/views/monitor/operlog/index.vue b/ruoyi-ui/src/views/monitor/operlog/index.vue
index 0aee4a6..28f705b 100644
--- a/ruoyi-ui/src/views/monitor/operlog/index.vue
+++ b/ruoyi-ui/src/views/monitor/operlog/index.vue
@@ -99,7 +99,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['monitor:operlog:export']"
>瀵煎嚭</el-button>
@@ -196,7 +195,7 @@
</template>
<script>
-import { list, delOperlog, cleanOperlog, exportOperlog } from "@/api/monitor/operlog";
+import { list, delOperlog, cleanOperlog } from "@/api/monitor/operlog";
export default {
name: "Operlog",
@@ -205,8 +204,6 @@
return {
// 閬僵灞�
loading: true,
- // 瀵煎嚭閬僵灞�
- exportLoading: false,
// 閫変腑鏁扮粍
ids: [],
// 闈炲涓鐢�
@@ -303,14 +300,9 @@
},
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
handleExport() {
- const queryParams = this.queryParams;
- this.$modal.confirm('鏄惁纭瀵煎嚭鎵�鏈夋搷浣滄棩蹇楁暟鎹」锛�').then(() => {
- this.exportLoading = true;
- return exportOperlog(queryParams);
- }).then(response => {
- this.$download.name(response.msg);
- this.exportLoading = false;
- }).catch(() => {});
+ this.download('monitor/operlog/export', {
+ ...this.queryParams
+ }, `operlog_${new Date().getTime()}.xlsx`)
}
}
};
diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue
index efb6961..9fde370 100644
--- a/ruoyi-ui/src/views/system/config/index.vue
+++ b/ruoyi-ui/src/views/system/config/index.vue
@@ -88,7 +88,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:config:export']"
>瀵煎嚭</el-button>
@@ -185,7 +184,7 @@
</template>
<script>
-import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig, refreshCache } from "@/api/system/config";
+import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config";
export default {
name: "Config",
@@ -194,8 +193,6 @@
return {
// 閬僵灞�
loading: true,
- // 瀵煎嚭閬僵灞�
- exportLoading: false,
// 閫変腑鏁扮粍
ids: [],
// 闈炲崟涓鐢�
@@ -334,14 +331,9 @@
},
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
handleExport() {
- const queryParams = this.queryParams;
- this.$modal.confirm('鏄惁纭瀵煎嚭鎵�鏈夊弬鏁版暟鎹」锛�').then(() => {
- this.exportLoading = true;
- return exportConfig(queryParams);
- }).then(response => {
- this.$download.name(response.msg);
- this.exportLoading = false;
- }).catch(() => {});
+ this.download('system/config/export', {
+ ...this.queryParams
+ }, `config_${new Date().getTime()}.xlsx`)
},
/** 鍒锋柊缂撳瓨鎸夐挳鎿嶄綔 */
handleRefreshCache() {
diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue
index 36eb6af..45327c0 100644
--- a/ruoyi-ui/src/views/system/dict/data.vue
+++ b/ruoyi-ui/src/views/system/dict/data.vue
@@ -75,7 +75,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:dict:export']"
>瀵煎嚭</el-button>
@@ -183,7 +182,7 @@
</template>
<script>
-import { listData, getData, delData, addData, updateData, exportData } from "@/api/system/dict/data";
+import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data";
import { listType, getType } from "@/api/system/dict/type";
export default {
@@ -193,8 +192,6 @@
return {
// 閬僵灞�
loading: true,
- // 瀵煎嚭閬僵灞�
- exportLoading: false,
// 閫変腑鏁扮粍
ids: [],
// 闈炲崟涓鐢�
@@ -380,14 +377,9 @@
},
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
handleExport() {
- const queryParams = this.queryParams;
- this.$modal.confirm('鏄惁纭瀵煎嚭鎵�鏈夋暟鎹」锛�').then(() => {
- this.exportLoading = true;
- return exportData(queryParams);
- }).then(response => {
- this.$download.name(response.msg);
- this.exportLoading = false;
- }).catch(() => {});
+ this.download('system/dict/data/export', {
+ ...this.queryParams
+ }, `data_${new Date().getTime()}.xlsx`)
}
}
};
diff --git a/ruoyi-ui/src/views/system/dict/index.vue b/ruoyi-ui/src/views/system/dict/index.vue
index 37de40f..17cb551 100644
--- a/ruoyi-ui/src/views/system/dict/index.vue
+++ b/ruoyi-ui/src/views/system/dict/index.vue
@@ -94,7 +94,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:dict:export']"
>瀵煎嚭</el-button>
@@ -193,7 +192,7 @@
</template>
<script>
-import { listType, getType, delType, addType, updateType, exportType, refreshCache } from "@/api/system/dict/type";
+import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
export default {
name: "Dict",
@@ -202,8 +201,6 @@
return {
// 閬僵灞�
loading: true,
- // 瀵煎嚭閬僵灞�
- exportLoading: false,
// 閫変腑鏁扮粍
ids: [],
// 闈炲崟涓鐢�
@@ -338,14 +335,9 @@
},
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
handleExport() {
- const queryParams = this.queryParams;
- this.$modal.confirm('鏄惁纭瀵煎嚭鎵�鏈夌被鍨嬫暟鎹」锛�').then(() => {
- this.exportLoading = true;
- return exportType(queryParams);
- }).then(response => {
- this.$download.name(response.msg);
- this.exportLoading = false;
- }).catch(() => {});
+ this.download('system/dict/type/export', {
+ ...this.queryParams
+ }, `type_${new Date().getTime()}.xlsx`)
},
/** 鍒锋柊缂撳瓨鎸夐挳鎿嶄綔 */
handleRefreshCache() {
diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue
index e206968..02698da 100644
--- a/ruoyi-ui/src/views/system/post/index.vue
+++ b/ruoyi-ui/src/views/system/post/index.vue
@@ -74,7 +74,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:post:export']"
>瀵煎嚭</el-button>
@@ -160,7 +159,7 @@
</template>
<script>
-import { listPost, getPost, delPost, addPost, updatePost, exportPost } from "@/api/system/post";
+import { listPost, getPost, delPost, addPost, updatePost } from "@/api/system/post";
export default {
name: "Post",
@@ -169,8 +168,6 @@
return {
// 閬僵灞�
loading: true,
- // 瀵煎嚭閬僵灞�
- exportLoading: false,
// 閫変腑鏁扮粍
ids: [],
// 闈炲崟涓鐢�
@@ -305,14 +302,9 @@
},
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
handleExport() {
- const queryParams = this.queryParams;
- this.$modal.confirm('鏄惁纭瀵煎嚭鎵�鏈夊矖浣嶆暟鎹」锛�').then(() => {
- this.exportLoading = true;
- return exportPost(queryParams);
- }).then(response => {
- this.$download.name(response.msg);
- this.exportLoading = false;
- }).catch(() => {});
+ this.download('system/post/export', {
+ ...this.queryParams
+ }, `post_${new Date().getTime()}.xlsx`)
}
}
};
diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue
index 5110834..b2cfd6b 100644
--- a/ruoyi-ui/src/views/system/role/index.vue
+++ b/ruoyi-ui/src/views/system/role/index.vue
@@ -94,7 +94,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:role:export']"
>瀵煎嚭</el-button>
@@ -259,7 +258,7 @@
</template>
<script>
-import { listRole, getRole, delRole, addRole, updateRole, exportRole, dataScope, changeRoleStatus } from "@/api/system/role";
+import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus } from "@/api/system/role";
import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu";
import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept";
@@ -270,8 +269,6 @@
return {
// 閬僵灞�
loading: true,
- // 瀵煎嚭閬僵灞�
- exportLoading: false,
// 閫変腑鏁扮粍
ids: [],
// 闈炲崟涓鐢�
@@ -613,14 +610,9 @@
},
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
handleExport() {
- const queryParams = this.queryParams;
- this.$modal.confirm('鏄惁纭瀵煎嚭鎵�鏈夌敤鎴锋暟鎹」锛�').then(() => {
- this.exportLoading = true;
- return exportRole(queryParams);
- }).then(response => {
- this.$download.name(response.msg);
- this.exportLoading = false;
- }).catch(() => {});
+ this.download('system/role/export', {
+ ...this.queryParams
+ }, `role_${new Date().getTime()}.xlsx`)
}
}
};
diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue
index 4f20b08..2b7283f 100644
--- a/ruoyi-ui/src/views/system/user/index.vue
+++ b/ruoyi-ui/src/views/system/user/index.vue
@@ -131,7 +131,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:user:export']"
>瀵煎嚭</el-button>
@@ -346,7 +345,7 @@
</template>
<script>
-import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus, importTemplate } from "@/api/system/user";
+import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/system/user";
import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
@@ -360,8 +359,6 @@
return {
// 閬僵灞�
loading: true,
- // 瀵煎嚭閬僵灞�
- exportLoading: false,
// 閫変腑鏁扮粍
ids: [],
// 闈炲崟涓鐢�
@@ -643,14 +640,9 @@
},
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
handleExport() {
- const queryParams = this.queryParams;
- this.$modal.confirm('鏄惁纭瀵煎嚭鎵�鏈夌敤鎴锋暟鎹」锛�').then(() => {
- this.exportLoading = true;
- return exportUser(queryParams);
- }).then(response => {
- this.$download.name(response.msg);
- this.exportLoading = false;
- }).catch(() => {});
+ this.download('system/user/export', {
+ ...this.queryParams
+ }, `user_${new Date().getTime()}.xlsx`)
},
/** 瀵煎叆鎸夐挳鎿嶄綔 */
handleImport() {
@@ -659,9 +651,9 @@
},
/** 涓嬭浇妯℃澘鎿嶄綔 */
importTemplate() {
- importTemplate().then(response => {
- this.$download.name(response.msg);
- });
+ this.download('system/user/importTemplate', {
+ ...this.queryParams
+ }, `user_template_${new Date().getTime()}.xlsx`)
},
// 鏂囦欢涓婁紶涓鐞�
handleFileUploadProgress(event, file, fileList) {
--
Gitblit v1.9.3