数据模板导入、数据导出

This commit is contained in:
陈淳
2022-09-27 19:27:17 +08:00
parent 6ce05984d5
commit 4997e25cdc
13 changed files with 115 additions and 26 deletions

View File

@@ -15,7 +15,7 @@ import directive from './directive' // directive
// 注册指令
import plugins from './plugins' // plugins
import { download } from '@/utils/request'
import { download } from '@/utils/ruoyi.js'
// svg图标
import 'virtual:svg-icons-register'

View File

@@ -249,4 +249,11 @@ export async function blobValidate(data) {
} catch (error) {
return true;
}
}
// 通用下载方法
export function download(url) {
// window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true;
// window.open(baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true)
window.open(import.meta.env.VITE_APP_BASE_API + url)
}

View File

@@ -370,9 +370,7 @@ function handleDelete(row) {
};
/** 导出按钮操作 */
function handleExport() {
proxy.download("system/user/export", {
...queryParams.value,
}, `user_${new Date().getTime()}.xlsx`);
proxy.download("user/export");
};
/** 用户状态修改 */
function handleStatusChange(row) {
@@ -430,8 +428,7 @@ function handleImport() {
};
/** 下载模板操作 */
function importTemplate() {
proxy.download("system/user/importTemplate", {
}, `user_template_${new Date().getTime()}.xlsx`);
proxy.download("user/template");
};
/**文件上传中处理 */
const handleFileUploadProgress = (event, file, fileList) => {