mirror of
https://github.com/yangzongzhuan/RuoYi-Cloud.git
synced 2025-09-09 00:08:19 +00:00
优化导出数据操作
This commit is contained in:
@@ -8,7 +8,7 @@ import { saveAs } from 'file-saver'
|
||||
|
||||
let downloadLoadingInstance;
|
||||
|
||||
axios.defaults.headers['Conntent-Type'] = 'application/json;charset=utf-8'
|
||||
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
||||
// 创建axios实例
|
||||
const service = axios.create({
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
@@ -48,16 +48,19 @@ service.interceptors.response.use(res => {
|
||||
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({
|
||||
|
@@ -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) {
|
||||
@@ -95,11 +93,6 @@ export function selectDictLabels(datas, value, separator) {
|
||||
return actions.join('').substring(0, actions.join('').length - 1);
|
||||
}
|
||||
|
||||
// 通用下载方法
|
||||
export function download(fileName) {
|
||||
window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true;
|
||||
}
|
||||
|
||||
// 字符串格式化(%s )
|
||||
export function sprintf(str) {
|
||||
var args = arguments, flag = true, i = 1;
|
||||
|
@@ -653,7 +653,7 @@ export default {
|
||||
importTemplate() {
|
||||
this.download('system/user/importTemplate', {
|
||||
...this.queryParams
|
||||
}, `user_${new Date().getTime()}.xlsx`)
|
||||
}, `user_template_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
// 文件上传中处理
|
||||
handleFileUploadProgress(event, file, fileList) {
|
||||
|
Reference in New Issue
Block a user