Commit 07ab2a1f by Chao Sun

pdf移动端下载

parent 9320374b
......@@ -318,10 +318,13 @@ export class MyService {
//薪资pdf
payScalePdf(param) {
this.http.post(`${this.ydapi}/practitioner/payScalePdf`, param, { responseType: 'blob', observe: 'response' }).subscribe(data => {
console.log(data)
const link = document.createElement('a');
const blob = new Blob([data.body], { type: 'application/pdf;charset=UTF-8' });
console.log(blob)
link.setAttribute('href', window.URL.createObjectURL(blob));
link.setAttribute('download', data.headers.get('Content-Disposition').split('filename=')[1]);
alert(data.headers.get('Content-Disposition').split('filename=')[1])
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
......
......@@ -28,6 +28,7 @@ export class SalaryComponent implements OnInit {
//下载pdf
getPdf(monShId) {
this.myService.payScalePdf({ monShId: monShId })
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment