This commit is contained in:
Vergil
2020-02-10 17:59:59 +08:00
parent ac32df04d7
commit ad88ce3441
3 changed files with 18 additions and 5 deletions

View File

@@ -4,7 +4,7 @@ import { type } from './tool' // type判断传入值的类型比typeof更详
export default {
install(Vue) {
Vue.prototype.exportExcel_NPOI = function(param) {
console.log(ExcelDownLoad, param, 1111111111)
console.log(param, 1)
download(`${ExcelDownLoad}?param=${param}`)
}
Vue.prototype.CreateData = function(type, name, data, pageSize, pageList) {
@@ -272,6 +272,7 @@ export default {
}
function download(url) {
getBlob(url, function(blob, filename) {
console.log(blob, filename, 2)
saveAs(blob, filename)
})
}
@@ -283,14 +284,14 @@ function getBlob(url, cb) {
xhr.onload = function() {
if (xhr.status === 200) {
const name = xhr.getResponseHeader('content-disposition').split('=')[1]
var filename1 = decodeURIComponent(name)
cb(xhr.response, filename1)
var filename = decodeURIComponent(name)
cb(xhr.response, filename)
}
}
xhr.send()
}
function saveAs(blob, filename = '下载文件.xls') {
function saveAs(blob, filename) {
if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, filename)
} else {

View File

@@ -17,7 +17,7 @@ export const download = `http://123.56.95.229:8010/submit/downloadFile.ashx` //
export const uploadPerson = `http://123.56.95.229:8010/submit/uploadPerson.ashx`
export const uploadOP = `http://123.56.95.229:8010/submit/uploadOP.ashx`
export const url = `http://123.56.95.229:8010/submit/MESCommonBase.ashx` // 采购件入库、离线件入库
export const ExcelDownLoad = 'http://123.56.95.229:8010/submit/downloadFile.ashx' // 导出excel
export const ExcelDownLoad = 'http://123.56.95.229:8010/submit/MESDownloadExcel.ashx' // 导出excel
export const ExcelWaiGou = 'http://192.168.0.106:8045/submit/excel.ashx' // 导出excel
// 技术中心程序发布时要更改下面所有的IP到0段
export const ServerIP = `http://123.56.95.229:8010/webpage/file/`