|
|
@@ -42,7 +42,7 @@
|
|
|
</el-table>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
- <div style="display: flex; flex-wrap: wrap">
|
|
|
+ <div id="printDiv" style="display: flex; flex-wrap: wrap">
|
|
|
<div v-for="(item,index) in mzCfDetail" :id="item[0].patientId+'-'+index" style="margin: 8px 12px">
|
|
|
<div style="width: 260px;padding: 4px;border: 1px solid black;border-radius: 4px">
|
|
|
<table style="width: 100%;border-spacing: 0; border-collapse: collapse;table-layout: fixed">
|
|
|
@@ -94,7 +94,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
- <el-button type="primary" @click="printInfusionLabel(mzCfDetail)">
|
|
|
+ <el-button type="primary" @click="printInfusionLabelNew(mzCfDetail)">
|
|
|
打印
|
|
|
</el-button>
|
|
|
</el-row>
|
|
|
@@ -192,20 +192,17 @@ const cfMxCx = (row) => {
|
|
|
|
|
|
// 打印处方大输液瓶贴
|
|
|
const printInfusionLabel = (data) => {
|
|
|
- let infusionData = Object.values(data)
|
|
|
+ // 重写打印
|
|
|
let LODOP = getLodop();
|
|
|
const printStyle = `<style>td{border: 1px solid black;font-size: 12px;padding: 2px;}</style>`
|
|
|
- for (let i = 0; i < infusionData.length; i++) {
|
|
|
- let info = infusionData[i]
|
|
|
- let id = info[0].patientId + '-' + (i+1)
|
|
|
- const printContent = document.getElementById(id).innerHTML
|
|
|
- let pagePrint = printStyle + '<body>' + printContent + '</body>'
|
|
|
- LODOP.PRINT_INIT('门诊输液瓶贴')
|
|
|
- LODOP.SET_PRINT_PAGESIZE(1, '210mm', '297mm', '')
|
|
|
- LODOP.ADD_PRINT_TABLE('0mm', '0mm', '210mm', '230mm', pagePrint)
|
|
|
- LODOP.SET_PRINT_STYLE('ItemType', 3)
|
|
|
- LODOP.PRINT()
|
|
|
- }
|
|
|
+ LODOP.PRINT_INITA(6, 0, "80mm", "60mm", "门诊输液瓶贴");
|
|
|
+ LODOP.SET_PRINT_PAGESIZE(1, "80mm", "60mm", "");
|
|
|
+ LODOP.SET_PRINT_STYLE("FontSize", 10); //字体大小
|
|
|
+ LODOP.SET_PRINT_STYLEA(0, "ItemType", 2);
|
|
|
+ LODOP.ADD_PRINT_HTM("1mm", "3mm", "RightMargin:1mm", "BottomMargin:3mm", printStyle + document.getElementById("printDiv").innerHTML);
|
|
|
+ // LODOP.PRINT();
|
|
|
+ LODOP.NEWPAGE();
|
|
|
+ LODOP.PREVIEW();
|
|
|
}
|
|
|
|
|
|
const querySearchDept = async (str, cb) => {
|
|
|
@@ -223,6 +220,73 @@ const handleSelect = (item) => {
|
|
|
const closeBottleCard = (data) => {
|
|
|
printInfusionLabel(data)
|
|
|
}
|
|
|
+
|
|
|
+// 打印处方大输液瓶贴(新)
|
|
|
+const printInfusionLabelNew = (data) => {
|
|
|
+ let LODOP = getLodop();
|
|
|
+ if (!LODOP) {
|
|
|
+ alert("打印控件未安装!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const printData = Object.values(data)
|
|
|
+ try {
|
|
|
+ LODOP.PRINT_INIT("门诊输液瓶贴");
|
|
|
+ LODOP.SET_PRINT_PAGESIZE(1, "60mm", "60mm", ""); // 小票纸尺寸
|
|
|
+ LODOP.SET_PRINT_MODE("PRINT_MARGIN", "1mm,1mm,1mm,1mm");
|
|
|
+
|
|
|
+ const printStyle = `<style>
|
|
|
+ table { width: 100%; border-collapse: collapse; font-size: 9px; }
|
|
|
+ td { border: 1px solid #000; padding: 1px 2px; vertical-align: top;}
|
|
|
+ </style>`;
|
|
|
+
|
|
|
+ // 循环生成每页内容
|
|
|
+ printData.forEach((page, pageIndex) => {
|
|
|
+ if (pageIndex > 0) {
|
|
|
+ LODOP.NEWPAGE(); // 重要:每页都要NEWPAGE
|
|
|
+ }
|
|
|
+ let html = printStyle;
|
|
|
+ html += `<table style="width: 76%;border-spacing: 0; border-collapse: collapse;table-layout: fixed">`;
|
|
|
+ html += `<thead><tr><td colspan="24" style="text-align: left">${page[0].deptName} ${page[0].patName} ${page[0].patientId}</td></tr>`;
|
|
|
+ html += `<tr><td colspan="24" style="text-align: left">${page[0].gender} ${page[0].age === 0 ? '不满1岁' : page[0].age + '岁'} ${page[0].days}</td></tr>`;
|
|
|
+ html += `</thead><tbody>`;
|
|
|
+ html += `<tr><td colspan="17"><strong>药品名称/规格/一次剂量</strong></td><td colspan="4"><strong>频率</strong></td><td colspan="3"><strong>数量</strong></td></tr>`;
|
|
|
+ if (page.length > 0) {
|
|
|
+ page.forEach(item => {
|
|
|
+ html += `<tr><td colSpan="17" style="width: 100%;height: 100%;position: relative">`;
|
|
|
+ html += `<div style="position: absolute;left: 2px;top: 2px;">`;
|
|
|
+ if(page.length !== 1 && item.infusionFlag === '1') {
|
|
|
+ html += `<span style="font-size: 10px">▲</span>${item.drugName}</div>`;
|
|
|
+ } else {
|
|
|
+ html += `${item.drugName}</div>`;
|
|
|
+ }
|
|
|
+ if(item.infusionFlag === '0' || page.length === 1) {
|
|
|
+ html += `<div style="position: absolute;left: 2px;bottom: 0; font-weight: bolder">${item.specification}</div>`;
|
|
|
+ }
|
|
|
+ html += `<div style="position: absolute;right: 2px;bottom: 0; font-weight: bolder">${item.drugQuan + item.unitName}</div></td>`;
|
|
|
+ html += `<td colSpan="4" style="text-align: right"><div>${item.frequency}</div><div>${item.hours}</div></td>`;
|
|
|
+ html += `<td colSpan="3" style="text-align: center; vertical-align: middle">${item.quantity}</td></tr>`;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ html += `<tr><td colspan="24" style="height: 15mm; text-align: center;">无药品信息</td></tr>`;
|
|
|
+ }
|
|
|
+
|
|
|
+ html += `</tbody></table>`;
|
|
|
+
|
|
|
+ // 添加到打印任务
|
|
|
+ LODOP.ADD_PRINT_HTM("1mm", "1mm", "78mm", "58mm", html);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 预览打印
|
|
|
+ // LODOP.PREVIEW();
|
|
|
+ // 打印
|
|
|
+ LODOP.PRINT();
|
|
|
+
|
|
|
+ } catch (error) {
|
|
|
+ console.error("打印错误:", error);
|
|
|
+ alert("打印设置错误: " + error.message);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
</script>
|
|
|
<style scoped>
|
|
|
td {
|