This commit is contained in:
wangshiming
2022-04-11 14:13:34 +08:00
parent 8c477a6b94
commit 044f79cabc
4 changed files with 27 additions and 6 deletions

View File

@ -4,7 +4,7 @@
* @Author : Shiming
* @Date : 2021-12-03 15:31:52
* @LastEditors : Shiming
* @LastEditTime : 2022-02-28 17:11:54
* @LastEditTime : 2022-04-11 14:12:35
* @FilePath : \\tms-obc-web\\src\\app\\routes\\insurance-management\\services\\insurance-management.service.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
@ -32,6 +32,28 @@ export class InsuranceManagementService extends ShipperBaseService {
// 保险费列表数据导出接口
$api_get_asyncExport = `/api/sdc/premiumInfo/asyncExport`;
public reviewPDF(url: string) {
if (!url) {
return;
}
const uA = window.navigator.userAgent; // 判断浏览器内核
const isIE =
/msie\s|trident\/|edge\//i.test(uA) &&
!!('uniqueID' in document || 'documentMode' in document || 'ActiveXObject' in window || 'MSInputMethodContext' in window);
const objectUrl = url;
const a = document.createElement('a');
document.body.appendChild(a);
a.href = objectUrl;
a.download = '保单.pdf';
if (isIE) {
// 兼容IE11无法触发下载的问题
(navigator as any).msSaveBlob(url, a.download);
} else {
a.click();
}
a.remove();
}
constructor(public injector: Injector) {
super(injector);
}