|
|
@ -7,7 +7,7 @@ import commonUtils from '../utils/Common'
|
|
|
|
|
|
|
|
|
|
|
|
// http://mf.kiisoo.com:58080/
|
|
|
|
// http://mf.kiisoo.com:58080/
|
|
|
|
// axios.defaults.baseURL = 'http://mf.kiisoo.com:58080/gds/api';
|
|
|
|
// axios.defaults.baseURL = 'http://mf.kiisoo.com:58080/gds/api';
|
|
|
|
axios.defaults.baseURL = '/ic';
|
|
|
|
axios.defaults.baseURL = 'https://wxtk.bsdits.com/kiisoo-ic/';
|
|
|
|
// axios.defaults.baseURL = '/kiisoo-ic';
|
|
|
|
// axios.defaults.baseURL = '/kiisoo-ic';
|
|
|
|
|
|
|
|
|
|
|
|
//响应时间
|
|
|
|
//响应时间
|
|
|
@ -271,6 +271,8 @@ export function downloadExcel(url,filename, options = {}) {
|
|
|
|
)
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function downloadImg(url,filename, options = {}) {
|
|
|
|
export function downloadImg(url,filename, options = {}) {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
axios.defaults.headers['content-type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
|
|
|
|
axios.defaults.headers['content-type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
|
|
|
@ -307,6 +309,38 @@ export function downloadImg(url,filename, options = {}) {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function downloadFileToExcel(url,filename, options) {
|
|
|
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
|
|
|
axios.defaults.headers['content-type'] = 'application/json'
|
|
|
|
|
|
|
|
axios.get(url, {params: options, responseType: 'blob'}).then(
|
|
|
|
|
|
|
|
response => {
|
|
|
|
|
|
|
|
resolve({success: true});
|
|
|
|
|
|
|
|
let blob = new Blob([response.data], {
|
|
|
|
|
|
|
|
type: 'application/vnd.ms-excel'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
console.log(blob)
|
|
|
|
|
|
|
|
let fileName = filename + '.xls';
|
|
|
|
|
|
|
|
if (window.navigator.msSaveOrOpenBlob) {
|
|
|
|
|
|
|
|
// console.log(2)
|
|
|
|
|
|
|
|
navigator.msSaveBlob(blob, fileName)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// console.log(3)
|
|
|
|
|
|
|
|
var link = document.createElement('a')
|
|
|
|
|
|
|
|
link.href = window.URL.createObjectURL(blob)
|
|
|
|
|
|
|
|
link.download = fileName
|
|
|
|
|
|
|
|
link.click()
|
|
|
|
|
|
|
|
//释放内存
|
|
|
|
|
|
|
|
window.URL.revokeObjectURL(link.href)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
err => {
|
|
|
|
|
|
|
|
reject(err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function getBaseUrl() {
|
|
|
|
export function getBaseUrl() {
|
|
|
|
return axios.defaults.baseURL;
|
|
|
|
return axios.defaults.baseURL;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -319,5 +353,6 @@ export default {
|
|
|
|
downloadImg,
|
|
|
|
downloadImg,
|
|
|
|
put,
|
|
|
|
put,
|
|
|
|
fetchDelete,
|
|
|
|
fetchDelete,
|
|
|
|
getBaseUrl
|
|
|
|
getBaseUrl,
|
|
|
|
|
|
|
|
downloadFileToExcel
|
|
|
|
}
|
|
|
|
}
|
|
|
|