feat(clgl)条码打印修改

This commit is contained in:
2026-06-24 09:59:56 +08:00
parent 75d7c48ff2
commit efa5c91aa1
15 changed files with 410 additions and 12 deletions
+48
View File
@@ -254,6 +254,54 @@
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
function printByHiddenFrame(url) {
var frameId = 'fastreport-print-frame-' + new Date().getTime();
var frame = document.createElement('iframe');
frame.id = frameId;
frame.name = frameId;
frame.style.position = 'fixed';
frame.style.left = '-10000px';
frame.style.top = '-10000px';
frame.style.width = '1px';
frame.style.height = '1px';
frame.style.border = '0';
frame.style.opacity = '0';
frame.onload = function () {
setTimeout(function () {
try {
frame.contentWindow.onafterprint = cleanupPrintFrame;
frame.contentWindow.focus();
frame.contentWindow.print();
} catch (e) {
window.print();
}
}, 500);
};
frame.src = url;
document.body.appendChild(frame);
var cleaned = false;
function cleanupPrintFrame() {
if (cleaned) {
return;
}
cleaned = true;
if (frame && frame.parentNode) {
frame.parentNode.removeChild(frame);
}
window.removeEventListener('afterprint', cleanupPrintFrame);
}
window.addEventListener('afterprint', cleanupPrintFrame);
setTimeout(cleanupPrintFrame, 300000);
}
window.addEventListener('message', function (event) {
if (!event.data || event.data.type !== 'fastreport-print-finished') {
return;
}
var frame = document.getElementById(event.data.frameId);
if (frame && frame.parentNode) {
frame.parentNode.removeChild(frame);
}
});
</script>
</body>
</html>