diff --git a/dist.7z b/dist.7z new file mode 100644 index 0000000..114d42d Binary files /dev/null and b/dist.7z differ diff --git a/src/utils/file.js b/src/utils/file.js new file mode 100644 index 0000000..42a93e5 --- /dev/null +++ b/src/utils/file.js @@ -0,0 +1,24 @@ + +function handleExport(data) { + // 动态创建iframe下载文件 + let fileName = this.selectedTabelRow[0].dirName; + if (!data) { + return; + } + let blob = new Blob([data], { type: "application/octet-stream" }); + if ("download" in document.createElement("a")) { + // 不是IE浏览器 + let url = window.URL.createObjectURL(blob); + let link = document.createElement("a"); + link.style.display = "none"; + link.href = url; + link.setAttribute("download", fileName); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); // 下载完成移除元素 + window.URL.revokeObjectURL(url); // 释放掉blob对象 + } else { + // IE 10+ + window.navigator.msSaveBlob(blob, fileName); + } +} diff --git a/src/utils/httpRequest.js b/src/utils/httpRequest.js index f58e065..f1557cd 100644 --- a/src/utils/httpRequest.js +++ b/src/utils/httpRequest.js @@ -6,7 +6,7 @@ import merge from 'lodash/merge' import { clearLoginInfo } from '@/utils' const http = axios.create({ - timeout: 1000 * 30, + timeout: 1000 * 300, withCredentials: true, headers: { 'Content-Type': 'application/json; charset=utf-8' diff --git a/src/utils/index.js b/src/utils/index.js index 024c562..a0836ce 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -56,3 +56,28 @@ export function clearLoginInfo () { store.commit('resetStore') router.options.isAddDynamicMenuRoutes = false } + + +export function handleExport(data) { + // 动态创建iframe下载文件 + let fileName = this.selectedTabelRow[0].dirName; + if (!data) { + return; + } + let blob = new Blob([data], { type: "application/octet-stream" }); + if ("download" in document.createElement("a")) { + // 不是IE浏览器 + let url = window.URL.createObjectURL(blob); + let link = document.createElement("a"); + link.style.display = "none"; + link.href = url; + link.setAttribute("download", fileName); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); // 下载完成移除元素 + window.URL.revokeObjectURL(url); // 释放掉blob对象 + } else { + // IE 10+ + window.navigator.msSaveBlob(blob, fileName); + } +} diff --git a/src/views/modules/sys/language/common.vue b/src/views/modules/sys/language/common.vue index 8e8378d..acbaf91 100644 --- a/src/views/modules/sys/language/common.vue +++ b/src/views/modules/sys/language/common.vue @@ -429,6 +429,7 @@ import column from "../../common/column"; // { // functionId: "9001", // languageValue: '设置默认配置', + // objectId: 'defaultTable', // objectType: "button", // tableId: "common1001"