diff --git a/README.md b/README.md
index a7957e5e0..c103879eb 100644
--- a/README.md
+++ b/README.md
@@ -6,8 +6,9 @@
[](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus)
[]()
-[]()
+[]()
[]()
+[]()
RuoYi-Vue-Plus 是基于 RuoYi-Vue 针对 `分布式集群` 场景升级(不兼容原框架)
diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml
index a3e525cc8..f75ef2915 100644
--- a/ruoyi-admin/src/main/resources/application.yml
+++ b/ruoyi-admin/src/main/resources/application.yml
@@ -289,7 +289,7 @@ thread-pool:
# 线程池维护线程所允许的空闲时间
keepAliveSeconds: 300
# 线程池对拒绝任务(无线程可用)的处理策略
- # CALLER_RUNS_POLICY 等待
+ # CALLER_RUNS_POLICY 调用方执行
# DISCARD_OLDEST_POLICY 放弃最旧的
# DISCARD_POLICY 丢弃
# ABORT_POLICY 中止
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/ThreadPoolRejectedPolicy.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/ThreadPoolRejectedPolicy.java
index 0c40f341c..5529bb336 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/ThreadPoolRejectedPolicy.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/ThreadPoolRejectedPolicy.java
@@ -15,7 +15,7 @@ import java.util.concurrent.ThreadPoolExecutor;
@AllArgsConstructor
public enum ThreadPoolRejectedPolicy {
- CALLER_RUNS_POLICY("等待", ThreadPoolExecutor.CallerRunsPolicy.class),
+ CALLER_RUNS_POLICY("调用方执行", ThreadPoolExecutor.CallerRunsPolicy.class),
DISCARD_OLDEST_POLICY("放弃最旧的", ThreadPoolExecutor.DiscardOldestPolicy.class),
DISCARD_POLICY("丢弃", ThreadPoolExecutor.DiscardPolicy.class),
ABORT_POLICY("中止", ThreadPoolExecutor.AbortPolicy.class);
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
index dc3aea2c0..3ab304c0c 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
@@ -35,6 +35,7 @@ public class FileUtils extends FileUtil
.append(percentEncodedFileName);
response.setHeader("Content-disposition", contentDispositionValue.toString());
+ response.setHeader("download-filename", percentEncodedFileName);
}
/**
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 99e05c1d6..05a8baf2c 100644
--- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
+++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
@@ -573,7 +573,7 @@ export default {
#end
/** 导出按钮操作 */
handleExport() {
- this.downLoadExcel('/${moduleName}/${businessName}/export', this.queryParams);
+ this.#[[$download]]#.excel('/${moduleName}/${businessName}/export', this.queryParams);
}
}
};
diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json
index 58a8c790e..d43aee1d1 100644
--- a/ruoyi-ui/package.json
+++ b/ruoyi-ui/package.json
@@ -42,7 +42,7 @@
"core-js": "3.8.1",
"echarts": "4.9.0",
"element-ui": "2.15.5",
- "file-saver": "2.0.4",
+ "file-saver": "2.0.5",
"fuse.js": "6.4.3",
"highlight.js": "9.18.5",
"js-beautify": "1.13.0",
@@ -71,7 +71,7 @@
"eslint-plugin-vue": "7.2.0",
"lint-staged": "10.5.3",
"runjs": "4.4.2",
- "sass": "1.32.0",
+ "sass": "1.42.1",
"sass-loader": "10.1.0",
"script-ext-html-webpack-plugin": "2.1.5",
"svg-sprite-loader": "5.1.1",
diff --git a/ruoyi-ui/src/main.js b/ruoyi-ui/src/main.js
index 6024266ab..c6306a65c 100644
--- a/ruoyi-ui/src/main.js
+++ b/ruoyi-ui/src/main.js
@@ -17,7 +17,6 @@ import './assets/icons' // icon
import './permission' // permission control
import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config";
-import { downLoadExcel } from "@/utils/download";
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
// 分页组件
import Pagination from "@/components/Pagination";
@@ -44,7 +43,6 @@ Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
-Vue.prototype.downLoadExcel = downLoadExcel
Vue.prototype.handleTree = handleTree
// 全局组件挂载
diff --git a/ruoyi-ui/src/plugins/download.js b/ruoyi-ui/src/plugins/download.js
new file mode 100644
index 000000000..248ed01c8
--- /dev/null
+++ b/ruoyi-ui/src/plugins/download.js
@@ -0,0 +1,71 @@
+import { saveAs } from 'file-saver'
+import axios from 'axios'
+import { getToken } from '@/utils/auth'
+
+const baseURL = process.env.VUE_APP_BASE_API
+
+export default {
+ excel(url, params) {
+ // get请求映射params参数
+ if (params) {
+ let urlparams = url + '?';
+ for (const propName of Object.keys(params)) {
+ const value = params[propName];
+ var part = encodeURIComponent(propName) + "=";
+ if (value !== null && typeof(value) !== "undefined") {
+ if (typeof value === 'object') {
+ for (const key of Object.keys(value)) {
+ if (value[key] !== null && typeof (value[key]) !== 'undefined') {
+ let params = propName + '[' + key + ']';
+ let subPart = encodeURIComponent(params) + '=';
+ urlparams += subPart + encodeURIComponent(value[key]) + '&';
+ }
+ }
+ } else {
+ urlparams += part + encodeURIComponent(value) + "&";
+ }
+ }
+ }
+ urlparams = urlparams.slice(0, -1);
+ url = urlparams;
+ }
+ url = baseURL + url
+ axios({
+ method: 'get',
+ url: url,
+ responseType: 'blob',
+ headers: { 'Authorization': 'Bearer ' + getToken() }
+ }).then(res => {
+ const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
+ this.saveAs(blob, decodeURI(res.headers['download-filename']))
+ })
+ },
+ oss(ossId, name) {
+ var url = baseURL + '/system/oss/download/' + ossId
+ axios({
+ method: 'get',
+ url: url,
+ responseType: 'blob',
+ headers: { 'Authorization': 'Bearer ' + getToken() }
+ }).then(res => {
+ const blob = new Blob([res.data], { type: 'application/octet-stream' })
+ this.saveAs(blob, name)
+ })
+ },
+ zip(url, name) {
+ var url = baseURL + url
+ axios({
+ method: 'get',
+ url: url,
+ responseType: 'blob',
+ headers: { 'Authorization': 'Bearer ' + getToken() }
+ }).then(res => {
+ const blob = new Blob([res.data], { type: 'application/zip' })
+ this.saveAs(blob, name)
+ })
+ },
+ saveAs(text, name, opts) {
+ saveAs(text, name, opts);
+ }
+}
+
diff --git a/ruoyi-ui/src/plugins/index.js b/ruoyi-ui/src/plugins/index.js
index 15d829b18..a138e6d6f 100644
--- a/ruoyi-ui/src/plugins/index.js
+++ b/ruoyi-ui/src/plugins/index.js
@@ -1,5 +1,6 @@
import cache from './cache'
import modal from './modal'
+import download from './download'
export default {
install(Vue) {
@@ -7,5 +8,7 @@ export default {
Vue.prototype.$cache = cache
// 模态框对象
Vue.prototype.$modal = modal
+ // 下载文件
+ Vue.prototype.$download = download
}
}
diff --git a/ruoyi-ui/src/utils/download.js b/ruoyi-ui/src/utils/download.js
deleted file mode 100644
index 52b07f713..000000000
--- a/ruoyi-ui/src/utils/download.js
+++ /dev/null
@@ -1,91 +0,0 @@
-import axios from 'axios'
-import { getToken } from '@/utils/auth'
-
-const mimeMap = {
- xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
- zip: 'application/zip',
- oss: 'application/octet-stream'
-}
-
-const baseUrl = process.env.VUE_APP_BASE_API
-export function downLoadZip(str, filename) {
- var url = baseUrl + str
- axios({
- method: 'get',
- url: url,
- responseType: 'blob',
- headers: { 'Authorization': 'Bearer ' + getToken() }
- }).then(res => {
- resolveBlob(res, mimeMap.zip)
- })
-}
-
-export function downLoadOss(ossId) {
- var url = baseUrl + '/system/oss/download/' + ossId
- axios({
- method: 'get',
- url: url,
- responseType: 'blob',
- headers: { 'Authorization': 'Bearer ' + getToken() }
- }).then(res => {
- resolveBlob(res, mimeMap.oss)
- })
-}
-
-export function downLoadExcel(url, params) {
- // get请求映射params参数
- if (params) {
- let urlparams = url + '?';
- for (const propName of Object.keys(params)) {
- const value = params[propName];
- var part = encodeURIComponent(propName) + "=";
- if (value !== null && typeof(value) !== "undefined") {
- if (typeof value === 'object') {
- for (const key of Object.keys(value)) {
- if (value[key] !== null && typeof (value[key]) !== 'undefined') {
- let params = propName + '[' + key + ']';
- let subPart = encodeURIComponent(params) + '=';
- urlparams += subPart + encodeURIComponent(value[key]) + '&';
- }
- }
- } else {
- urlparams += part + encodeURIComponent(value) + "&";
- }
- }
- }
- urlparams = urlparams.slice(0, -1);
- url = urlparams;
- }
- url = baseUrl + url
- axios({
- method: 'get',
- url: url,
- responseType: 'blob',
- headers: { 'Authorization': 'Bearer ' + getToken() }
- }).then(res => {
- resolveBlob(res, mimeMap.xlsx)
- })
-}
-
-/**
- * 解析blob响应内容并下载
- * @param {*} res blob响应内容
- * @param {String} mimeType MIME类型
- */
-export function resolveBlob(res, mimeType) {
- const aLink = document.createElement('a')
- var blob = new Blob([res.data], { type: mimeType })
- // //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名;
- var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
- var contentDisposition = decodeURI(res.headers['content-disposition'])
- var result = patt.exec(contentDisposition)
- var fileName = result[1]
- fileName = fileName.replace(/\"/g, '')
- aLink.style.display = 'none'
- aLink.href = URL.createObjectURL(blob)
- aLink.setAttribute('download', decodeURI(fileName)) // 设置下载文件名称
- document.body.appendChild(aLink)
- aLink.click()
- URL.revokeObjectURL(aLink.href);//清除引用
- document.body.removeChild(aLink);
-}
diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js
index 10533e787..63bd379b7 100644
--- a/ruoyi-ui/src/utils/ruoyi.js
+++ b/ruoyi-ui/src/utils/ruoyi.js
@@ -3,8 +3,6 @@
* Copyright (c) 2019 ruoyi
*/
-const baseURL = process.env.VUE_APP_BASE_API
-
// 日期格式化
export function parseTime(time, pattern) {
if (arguments.length === 0 || !time) {
diff --git a/ruoyi-ui/src/views/demo/demo/index.vue b/ruoyi-ui/src/views/demo/demo/index.vue
index 6f952ec4b..678ae218a 100644
--- a/ruoyi-ui/src/views/demo/demo/index.vue
+++ b/ruoyi-ui/src/views/demo/demo/index.vue
@@ -358,7 +358,7 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.downLoadExcel('/demo/demo/export', this.queryParams);
+ this.$download.excel('/demo/demo/export', this.queryParams);
}
}
};
diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue
index 33d416ea2..a97477b0c 100644
--- a/ruoyi-ui/src/views/monitor/job/index.vue
+++ b/ruoyi-ui/src/views/monitor/job/index.vue
@@ -510,7 +510,7 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.downLoadExcel('/monitor/job/export', this.queryParams);
+ this.$download.excel('/monitor/job/export', this.queryParams);
}
}
};
diff --git a/ruoyi-ui/src/views/monitor/job/log.vue b/ruoyi-ui/src/views/monitor/job/log.vue
index 7f2e72e06..fca1af40e 100644
--- a/ruoyi-ui/src/views/monitor/job/log.vue
+++ b/ruoyi-ui/src/views/monitor/job/log.vue
@@ -293,7 +293,7 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.downLoadExcel('/monitor/jobLog/export', this.queryParams);
+ this.$download.excel('/monitor/jobLog/export', this.queryParams);
}
}
};
diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue
index 2b83181a4..5b113016d 100644
--- a/ruoyi-ui/src/views/monitor/logininfor/index.vue
+++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue
@@ -216,7 +216,7 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.downLoadExcel('/monitor/logininfor/export', this.queryParams);
+ this.$download.excel('/monitor/logininfor/export', this.queryParams);
}
}
};
diff --git a/ruoyi-ui/src/views/monitor/operlog/index.vue b/ruoyi-ui/src/views/monitor/operlog/index.vue
index fafaf6005..35fd2b812 100644
--- a/ruoyi-ui/src/views/monitor/operlog/index.vue
+++ b/ruoyi-ui/src/views/monitor/operlog/index.vue
@@ -303,7 +303,7 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.downLoadExcel('/monitor/operlog/export', this.queryParams);
+ this.$download.excel('/monitor/operlog/export', this.queryParams);
}
}
};
diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue
index c4029c328..b03791755 100644
--- a/ruoyi-ui/src/views/system/config/index.vue
+++ b/ruoyi-ui/src/views/system/config/index.vue
@@ -334,7 +334,7 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.downLoadExcel('/system/config/export', this.queryParams);
+ this.$download.excel('/system/config/export', this.queryParams);
},
/** 刷新缓存按钮操作 */
handleRefreshCache() {
diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue
index 3f0b5e077..c7a90067e 100644
--- a/ruoyi-ui/src/views/system/dict/data.vue
+++ b/ruoyi-ui/src/views/system/dict/data.vue
@@ -380,7 +380,7 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.downLoadExcel('/system/dict/data/export', this.queryParams);
+ this.$download.excel('/system/dict/data/export', this.queryParams);
}
}
};
diff --git a/ruoyi-ui/src/views/system/dict/index.vue b/ruoyi-ui/src/views/system/dict/index.vue
index c1c664936..6daa8679c 100644
--- a/ruoyi-ui/src/views/system/dict/index.vue
+++ b/ruoyi-ui/src/views/system/dict/index.vue
@@ -338,7 +338,7 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.downLoadExcel('/system/dict/type/export', this.queryParams);
+ this.$download.excel('/system/dict/type/export', this.queryParams);
},
/** 刷新缓存按钮操作 */
handleRefreshCache() {
diff --git a/ruoyi-ui/src/views/system/oss/index.vue b/ruoyi-ui/src/views/system/oss/index.vue
index 5b6719197..fdfed1650 100644
--- a/ruoyi-ui/src/views/system/oss/index.vue
+++ b/ruoyi-ui/src/views/system/oss/index.vue
@@ -188,7 +188,6 @@