fix(common): 统一异常处理并迁移打印功能到hiprint
- 替换所有System.out.println和printStackTrace为slf4j日志记录 - 在BeanUtils、AuditFieldUtil、DateUtils、ServletUtils等工具类中添加Logger实例 - 在Flowable相关控制器和服务中统一错误日志记录格式 - 在代码生成器中添加日志记录功能 - 将前端打印组件从Lodop迁移到hiprint打印方案 - 更新体温单打印功能使用hiprint预览打印 - 移除调试用的console.log语句 - 修复打印模板中线条元素类型定义
This commit is contained in:
@@ -27,7 +27,8 @@
|
||||
</template>
|
||||
<script>
|
||||
import QRCode from 'qrcodejs2'
|
||||
import {getLodop} from '../../../plugins/print/LodopFuncs'
|
||||
// 迁移到 hiprint
|
||||
import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js'
|
||||
|
||||
export default {
|
||||
name: 'WristPrint',
|
||||
@@ -67,33 +68,31 @@ export default {
|
||||
clear() {
|
||||
document.getElementById('qrcode').innerHTML = ''
|
||||
},
|
||||
execPrint(preview, printerName) {
|
||||
const LODOP = getLodop()
|
||||
const printer = this.getPrinter(LODOP, printerName)
|
||||
if (printer === null) {
|
||||
this.openMesBox('6', '没有找到打印机【' + printerName + '】')
|
||||
return
|
||||
}
|
||||
LODOP.PRINT_INIT('')
|
||||
LODOP.ADD_PRINT_HTM(30, 100, '100%', 100, document.getElementById('div1').innerHTML)
|
||||
LODOP.ADD_PRINT_HTM(30, 20, '100%', 40, document.getElementById('qrcode').innerHTML)
|
||||
LODOP.SET_PRINT_PAGESIZE(2, '25mm', '270mm', '') // 设置横向打印
|
||||
if (preview) {
|
||||
LODOP.PREVIEW() // 打印预览
|
||||
return
|
||||
}
|
||||
// LODOP.PREVIEW(); // 打印预览
|
||||
LODOP.PRINT() // 直接打印
|
||||
},
|
||||
// 获取打印机
|
||||
getPrinter(LODOP, name) {
|
||||
const listCount = LODOP.GET_PRINTER_COUNT() // 当前打印设备数量
|
||||
for (let i = 0; i < listCount; i++) {
|
||||
if (LODOP.GET_PRINTER_NAME(i) === name) {
|
||||
return name
|
||||
/**
|
||||
* 使用 hiprint 执行打印
|
||||
* @param {boolean} preview 是否预览(hiprint暂不支持预览参数,保留兼容性)
|
||||
* @param {string} printerName 打印机名称
|
||||
*/
|
||||
async execPrint(preview, printerName) {
|
||||
try {
|
||||
// 构建打印数据
|
||||
const printData = {
|
||||
patientName: this.printData.patientName,
|
||||
hisId: this.printData.hisId,
|
||||
gender: this.printData.gender ? this.printData.gender.display : '',
|
||||
dept: this.printData.dept,
|
||||
bedName: this.printData.bedName,
|
||||
triageLevel: this.printData.triageLevel,
|
||||
checkInWardTime: this.printData.checkInWardTime
|
||||
}
|
||||
// 使用 hiprint 打印
|
||||
await simplePrint(PRINT_TEMPLATE.WRIST_BAND, printData, printerName)
|
||||
} catch (error) {
|
||||
console.error('腕带打印失败:', error)
|
||||
if (this.openMesBox) {
|
||||
this.openMesBox('6', '打印失败: ' + (error.message || '未知错误'))
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user