var timestamp = new Date ( ) . getTime ( ) ;
var xmlResquest = new XMLHttpRequest ( ) ;
xmlResquest. open ( 'POST' , _this. hnss + ` /sheshui/yjjc/exportCompanyList?pageNum= ${ _this. page} &pageSize= ${ _this. pageSize} ` ) ;
xmlResquest. setRequestHeader ( 'Content-type' , 'application/json' , 'Cookie' , 'mycookie=cookie' ) ;
xmlResquest. withCredentials = true ;
xmlResquest. responseType = 'blob' ;
xmlResquest. onload = function ( oEvent ) {
var content = xmlResquest. response;
var elink = document. createElement ( 'a' ) ;
elink. download = '企业详情导出模板' + timestamp + '.xlsx' ;
elink. style. display = 'none' ;
var blob = new Blob ( [ content] ) ;
elink. href = URL . createObjectURL ( blob) ;
document. body. appendChild ( elink) ;
elink. click ( ) ;
document. body. removeChild ( elink) ;
} ;
xmlResquest. send ( ) ;
$. ajax ( {
url: _this. hnss + ` /sheshui/yjjc/companyWithlabel?pageNum= ${ _this. pageqy} &pageSize= ${ _this. pageSizeqy} &import=1 ` ,
type: 'post' ,
dataType: 'json' ,
xhrFields: {
withCredentials: true
} ,
headers: {
'Content-Type' : 'application/json'
} ,
data: JSON . stringify ( {
nsrmc: _this. formqy. nsrmc
} ) ,
success : function ( res ) {
_this. totalCountqy = res. result. total
} ,
error : function ( error ) {
console. log ( error)
}
} ) ;
} ,
download ( ) {
let param = {
page: this . page,
}
axios ( {
method: 'post' ,
url: ` ${ API_HOST } /model/downLoadUpData ` ,
responseType: 'blob' ,
withCredentials: true ,
data: param
} ) . then ( ( res ) => {
const content = res. data
const blob = new Blob ( [ content] , {
type: 'application/vnd.ms-excel;charset=utf-8'
} )
if ( 'download' in document. createElement ( 'a' ) ) {
const elink = document. createElement ( 'a' )
elink. download = ` name.xls `
elink. style. display = 'none'
elink. href = URL . createObjectURL ( blob)
document. body. appendChild ( elink)
elink. click ( )
URL . revokeObjectURL ( elink. href)
document. body. removeChild ( elink)
} else {
navigator. msSaveBlob ( blob, name)
}
} )
}