fix bug
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
* @Author : Shiming
|
||||
* @Date : 2021-12-03 15:31:52
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-04-11 14:35:08
|
||||
* @LastEditTime : 2022-04-11 22:29:34
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\services\\order-management.service.ts
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
*/
|
||||
@ -244,4 +244,25 @@ export class OrderManagementService extends ShipperBaseService {
|
||||
constructor(public injector: Injector) {
|
||||
super(injector);
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user