Browse Source

[完善]打印文档

非煤矿山灾害智能感知和预警系统
邵佳豪 2 years ago
parent
commit
8a4f454858
  1. 2524
      src/app/home/basic-info/unit-details/unit-details.component.html
  2. 4
      src/app/home/basic-info/unit-details/unit-details.component.scss
  3. 22
      src/app/home/basic-info/unit-details/unit-details.component.ts

2524
src/app/home/basic-info/unit-details/unit-details.component.html

File diff suppressed because it is too large Load Diff

4
src/app/home/basic-info/unit-details/unit-details.component.scss

@ -238,8 +238,8 @@
position: relative;
button{
position: absolute;
right: 80px;
top: 80px;
right: 15%;
top: 50px;
}
}
}

22
src/app/home/basic-info/unit-details/unit-details.component.ts

@ -1509,5 +1509,27 @@ export class UnitDetailsComponent implements OnInit {
print() {
// console.log(1111111,$('#xxx'))
// $('#xxx').printArea()
const iframe: any = document.getElementById("iframe1");//获取iframe的window对象
const iwindow: any = iframe.contentWindow;
// iwindow.document.body.innerText = "";//先清空iframe原先的内容
const printhtml: any = window.document.getElementById('tablebox3');
if (iwindow.document.readyState == "complete") {
const stylArr: Array<any> = [];
Object.assign(stylArr, window.document.getElementsByTagName('style'));
// 内容加上去
iwindow.document.write(printhtml.innerHTML);
// 样式加上去
for (let i = 0; i < stylArr.length; i++) {
const style = document.createElement('style');
style.innerHTML = stylArr[i].innerHTML;
iwindow.document.getElementsByTagName("head")[0].appendChild(style);
}
}
iwindow.print();
iwindow.close();
}
download(type) {
type == 2 ? $("#tablebox").wordExport('演练卡') : $("#tablebox2").wordExport('数字化预案');
}
}

Loading…
Cancel
Save