关于前端页面连接打印机打印

关于前端连接打印机打印

页面代码

<div class="print-Box" >
		<div id="test">
		<el-row :gutter="10">
			<el-col :span="6" class="text-left">此处条形码</el-col>
			<el-col :span="12">
				<h2 class="text-center">兰州五零四医院处方笺</h2>
			</el-col>
			<el-col :span="6">
				<h2 class="text-right">普通处方</h2>
			</el-col>
		</el-row>
		<el-row :gutter="10">
			<el-col :span="8" class="text-left">处方编号:</el-col>
			<el-col :span="8" class="text-left">开方日期:</el-col>
			<el-col :span="8" class="text-left">药房:</el-col>
		</el-row>
		<el-col :span="24" class="text-left">————————————————————————————————————————————————————————————————————————————————————————————</el-col>
		<el-row :gutter="10">
			<el-col :span="6" class="text-left">开方科室:</el-col>
			<el-col :span="6" class="text-left">门诊号:</el-col>
			<el-col :span="6" class="text-left">就诊科室:</el-col>
			<el-col :span="6" class="text-left">费别:</el-col>
			<el-col :span="6" class="text-left">姓名:</el-col>
			<el-col :span="6" class="text-left">性别:</el-col>
			<el-col :span="6" class="text-left">年龄:</el-col>
		</el-row>
		<el-col :span="24" class="text-left">————————————————————————————————————————————————————————————————————————————————————————————</el-col>
		<el-row :gutter="10">
			<el-col :span="24" class="text-left">临床诊断:</el-col>
		</el-row>
		<el-col :span="24" class="text-left">————————————————————————————————————————————————————————————————————————————————————————————</el-col>
		<el-row :gutter="10">
			<el-col :span="6" class="text-left">付数:</el-col>
			<el-col :span="6" class="text-left">待煎类型:</el-col>
			<el-col :span="6" class="text-left">用法:</el-col>
			<el-col :span="6" class="text-left">频次:</el-col>
			<el-col :span="24" class="text-left">备注:</el-col>
		</el-row>
		<el-col :span="24" class="text-left">————————————————————————————————————————————————————————————————————————————————————————————</el-col>
		<el-row :gutter="10">
			<el-col :span="4" class="text-left">处方金额:</el-col>
			<el-col :span="4" class="text-left">医师签名(签章):</el-col>
			<el-col :span="4" class="text-left">药师审核:</el-col>
			<el-col :span="4" class="text-left">调配:</el-col>
			<el-col :span="4" class="text-left">核对:</el-col>
			<el-col :span="4" class="text-left">发药:</el-col>
			<el-col :span="24" class="text-left">1、请遵医嘱服药;2、请在窗口点清药品;3、处方当日有效;4、发出药品不予退换。</el-col>
		</el-row>
		</div>
		<!--endprint-->
		<div>
			<button @click="doPrint('#test')">打印</button>
		</div>
	</div>

逻辑代码需要引入JQ

function doPrint(obj) {
				var bodyHTML = window.document.body.innerHTML;
				window.document.body.innerHTML = $(obj).html();
				window.print();
				window.document.body.innerHTML = bodyHTML;
					 window.location.reload() // 刷新解决页面无法点击

			}

转载请注明原处,https://blog.csdn.net/w167837978/article/details/103715500 ,谢谢。

    原文作者:JAVA八年实习生
    原文地址: https://blog.csdn.net/w167837978/article/details/103715500
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞