PlusCount() {
this.Standard.push({
agreement: "",
agreement_date: "",
is_actual: true,
agreement_addictions: "",
note: "",
standard_loading: "",
standard_unloading: "",
penalty_loading: "",
penalty_unloading: "",
note_calc: "",
client: "",
wagon_type: "",
});
{
"data": {
"Восточно-Сибирская ж. д.": {
"data": {
"ЧЭМК, АО": {
"data": {
"Южно-Уральская ж. д.": {
"loads": 1,
"revenue": 3876000.0
}
},
"total": {
"amount": 1,
"revenue": 3876000.0
}
}
},
"total": {
"amount": 1,
"revenue": 3876000.0
}
},
"Дальневосточная ж. д.": {
"data": {
"ППО": {
"data": {
"Красноярская ж. д.": {
"loads": 152,
"revenue": 615042080.0
}
},
"total": {
"amount": 152,
"revenue": 615042080.0
}
},
"ФЛК, ООО": {
"data": {
"Куйбышевская ж. д.": {
"loads": 1,
"revenue": 4017155.0000000005
}
},
"total": {
"amount": 1,
"revenue": 4017155.0000000005
}
}
},
"total": {
"amount": 153,
"revenue": 619059235.0
}
},
},
"total": {
"amount": 2313,
"revenue": 12780698437.256998
}
}
<div я родитель>
<div я дочерний> </div>
</div>
fetch('http://10.1.5.20/api/wagon-park/shipment-list/make-file/', {
headers: {
Authorization: `Basic ${token}`,
'responseType ': 'blob'
},
body: formData,
method: "POST",
})
.then(blob => {
let link = document.createElement('a');
link.download = 'hello.xlsx';
link.href = URL.createObjectURL(blob.data);
link.click();
URL.revokeObjectURL(link.href);
})
ответ получаю следующего вида
config
:
{transitional: {…}, transformRequest: Array(1), transformResponse: Array(1), timeout: 0, adapter: ƒ, …}
data
:
"PK\u0003\u0004\u0014\u0000\u0000\u0000\b\u0000�iT
headers
:
AxiosHeaders {content-length: '9526', content-type: 'text/html; charset=utf-8', Symbol(defaults): null}
request
:
XMLHttpRequest {onreadystatechange: null, readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, …}
status
:
200
statusText
:
"OK"
api
.postShipmentList(formData)
.then(resp => resp.blob())
.then(blob => {
let buffer = Buffer.from(blob.data)
let link = document.createElement('a');
link.download = 'hello.xlsx';
let blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;' });
link.href = URL.createObjectURL(blob);
link.click();
URL.revokeObjectURL(link.href);
})