diff --git a/src/components/BatchReceivingPrintDialog.vue b/src/components/BatchReceivingPrintDialog.vue
index d044bc2b..c0168f07 100644
--- a/src/components/BatchReceivingPrintDialog.vue
+++ b/src/components/BatchReceivingPrintDialog.vue
@@ -120,6 +120,7 @@
进度: {{ completedPrintCount }} / {{ selectionRows.length }}
关闭
+ 浏览器打印
{{ currentPrintIndex < selectionRows.length - 1 ? '打印并切换下一个' : '打印当前单据' }}
@@ -579,6 +580,36 @@ async function doPrint() {
printing.value = false
}
}
+
+function browserPrint() {
+ const previewEl = document.querySelector('.preview-page') as HTMLElement | null
+ if (!previewEl) {
+ ElMessage.warning('暂无预览内容可打印')
+ return
+ }
+ const printWindow = window.open('', '_blank', 'width=800,height=600')
+ if (!printWindow) {
+ ElMessage.warning('请允许浏览器弹出窗口')
+ return
+ }
+ const styles = document.querySelectorAll('style, link[rel="stylesheet"]')
+ let styleHtml = ''
+ styles.forEach(s => { styleHtml += s.outerHTML })
+
+ printWindow.document.write(`
+
+
+
打印预览${styleHtml}
+
+ ${previewEl.outerHTML}
+
+
+ `)
+ printWindow.document.close()
+ printWindow.focus()
+ printWindow.print()
+ printWindow.close()
+}