curd外协付款

This commit is contained in:
Vergil
2020-02-08 18:30:18 +08:00
parent 4e1ce7eb2e
commit bd56a45125
3 changed files with 68 additions and 54 deletions

View File

@@ -5,6 +5,10 @@ Created by hedekun
import { type } from './tool' // type判断传入值的类型比typeof更详细
export default {
install(Vue) {
Vue.prototype.exportExcel_NPOI = function(url, type, name, data) {
console.log(url, type, name, data, 1111111111)
// this.download(`${url}?param=${data}`)
}
Vue.prototype.CreateData = function(type, name, data, pageSize, pageList) {
var paramStr = ''
var paramarray = []
@@ -268,3 +272,40 @@ export default {
}
}
}
// function download(url) {
// getBlob(url, function(blob, filename) {
// var filename1 = decodeURIComponent(filename)
// saveAs(blob, filename1)
// })
// }
//
// function decodeUtf8(bytes) { var encoded = ""; for (var i = 0; i < bytes.length; i++) { encoded += '%' + bytes[i].toString(16); } return decodeURIComponent(encoded); }
//
// function getBlob(url, cb) {
// var xhr = new XMLHttpRequest()
// xhr.open('GET', url, true)
// xhr.responseType = 'blob'
// xhr.onload = function() {
// if (xhr.status === 200) {
// var name = decodeUtf8(xhr.getResponseHeader('content-disposition').split('=')[1])
// }
// }
// xhr.send()
// }
//
// function saveAs(blob, filename = '下载文件.xls') {
// if (window.navigator.msSaveOrOpenBlob) {
// navigator.msSaveBlob(blob, filename)
// } else {
// var link = document.createElement('a')
// var body = document.querySelector('body')
// link.href = window.URL.createObjectURL(blob)
// link.download = filename
// link.style.display = 'none'
// body.appendChild(link)
// link.click()
// body.removeChild(link)
// window.URL.revokeObjectURL(link.href)
// }
// }