fix bug
This commit is contained in:
@ -4,7 +4,7 @@
|
|||||||
* @Author : Shiming
|
* @Author : Shiming
|
||||||
* @Date : 2021-12-03 11:10:14
|
* @Date : 2021-12-03 11:10:14
|
||||||
* @LastEditors : Shiming
|
* @LastEditors : Shiming
|
||||||
* @LastEditTime : 2022-03-01 16:16:29
|
* @LastEditTime : 2022-03-02 09:46:36
|
||||||
* @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\model\\import-supply\\import-supply.component.html
|
* @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\model\\import-supply\\import-supply.component.html
|
||||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||||
-->
|
-->
|
||||||
@ -28,7 +28,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</nz-upload>
|
</nz-upload>
|
||||||
<span style="color: #ff4d4f; font-size: 12px;margin-left: 10px;" (click)="downFile()">下载导入模板</span>
|
<span style="color: #ff4d4f; font-size: 12px;margin-left: 10px; cursor: pointer;" (click)="downFile()">下载导入模板</span>
|
||||||
<div style="color: #ff4d4f; font-size: 12px; margin-top: 5px; width: 400px">仅支持XLX / XLSX文件格式,最多不能超过100行数据</div>
|
<div style="color: #ff4d4f; font-size: 12px; margin-top: 5px; width: 400px">仅支持XLX / XLSX文件格式,最多不能超过100行数据</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</sf>
|
</sf>
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
* @Author : Shiming
|
* @Author : Shiming
|
||||||
* @Date : 2022-03-01 15:13:03
|
* @Date : 2022-03-01 15:13:03
|
||||||
* @LastEditors : Shiming
|
* @LastEditors : Shiming
|
||||||
* @LastEditTime : 2022-03-01 16:18:58
|
* @LastEditTime : 2022-03-02 09:52:53
|
||||||
* @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\model\\import-supply\\import-supply.component.ts
|
* @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\model\\import-supply\\import-supply.component.ts
|
||||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||||
*/
|
*/
|
||||||
@ -184,12 +184,36 @@ export class SupplyManagementImportSupplyComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
downFile() {
|
downFile() {
|
||||||
this.service.request(this.service.$api_exportGoodsResourceOperateTemplate).subscribe((res: any)=> {
|
console.log('78')
|
||||||
console.log(res)
|
// this.service.request(this.service.$api_exportGoodsResourceOperateTemplate).subscribe((res: any)=> {
|
||||||
if(res) {
|
// console.log('66')
|
||||||
this.status = false
|
// console.log(res)
|
||||||
}
|
// let aLink = document.createElement('a');
|
||||||
})
|
// const content = res;
|
||||||
|
// let blob = this.base64ToBlob(content); //new Blob([content]);
|
||||||
|
// let evt = document.createEvent("HTMLEvents");
|
||||||
|
// evt.initEvent("click", true, true);//initEvent 不加后两个参数在IE下会报错 事件类型,是否冒泡,是否阻止浏览器的默认行为
|
||||||
|
// aLink.download = '模板';
|
||||||
|
// aLink.href = URL.createObjectURL(blob);
|
||||||
|
// // aLink.dispatchEvent(evt);
|
||||||
|
// aLink.click();
|
||||||
|
// this.status = false
|
||||||
|
// })
|
||||||
|
this.service.downloadFile(this.service.$api_exportGoodsResourceOperateTemplate);
|
||||||
|
|
||||||
|
|
||||||
// window.location.href('')
|
// window.location.href('')
|
||||||
}
|
}
|
||||||
|
//base64转blob
|
||||||
|
base64ToBlob(code: any) {
|
||||||
|
let parts = code.split(';base64,');
|
||||||
|
let contentType = parts[0].split(':')[1];
|
||||||
|
let raw = window.atob(parts[1]);
|
||||||
|
let rawLength = raw.length;
|
||||||
|
let uInt8Array = new Uint8Array(rawLength);
|
||||||
|
for (let i = 0; i < rawLength; ++i) {
|
||||||
|
uInt8Array[i] = raw.charCodeAt(i);
|
||||||
|
}
|
||||||
|
return new Blob([uInt8Array], { type: contentType });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user