feat:样品标签打印
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { getConAssayTaskWithReportTemplateContent, queryTaskDetailListByAssayTaskId } from '@/nx/api/auncel'
|
||||
import { getConfigReportTemplateByKey, getBusinessSubSample } from '@/nx/api/report'
|
||||
export default {
|
||||
//打印机Map对象
|
||||
printMap: new Map(),
|
||||
@@ -178,36 +178,33 @@ export default {
|
||||
//不存在则打开
|
||||
this.open(printServerIp)
|
||||
}
|
||||
if (printer.socketTask) {
|
||||
if (printer?.socketTask) {
|
||||
printer.socketTask.send({
|
||||
data: data
|
||||
})
|
||||
}
|
||||
},
|
||||
//获取打印模板并执行打印
|
||||
getPrintTemplateAndPrint(currentTask) {
|
||||
const id = currentTask.taskTypeId
|
||||
getConAssayTaskWithReportTemplateContent(id)
|
||||
getPrintTemplateAndPrint(businessSubId) {
|
||||
getBusinessSubSample(businessSubId)
|
||||
.then(res => {
|
||||
this.print(currentTask, res)
|
||||
this.print(res)
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
//调用send方法执行打印
|
||||
print(currentTask, conAssayTask) {
|
||||
print(businessSubData) {
|
||||
const { printTemplate } = businessSubData
|
||||
const me = this
|
||||
let id = currentTask.id
|
||||
const reportTemplate = conAssayTask.reportTemplateDataContent
|
||||
me.getReportData(id, function (res) {
|
||||
const data = res.data || []
|
||||
me.getReportData(printTemplate, function (res) {
|
||||
const reportData = {
|
||||
data: data
|
||||
data: [businessSubData]
|
||||
}
|
||||
let printData = {
|
||||
type: 'print',
|
||||
reportTemplate: reportTemplate,
|
||||
type: 'preview',
|
||||
reportTemplate: res.content,
|
||||
reportData: JSON.stringify(reportData)
|
||||
}
|
||||
//连接打印服务
|
||||
@@ -220,12 +217,11 @@ export default {
|
||||
})
|
||||
},
|
||||
//获取打印模板
|
||||
getReportData(id, onComplete) {
|
||||
getReportData(templateKey, onComplete) {
|
||||
const param = {
|
||||
taskId: id,
|
||||
hideResultFlag: 'true'
|
||||
key: templateKey
|
||||
}
|
||||
queryTaskDetailListByAssayTaskId(param).then(res => {
|
||||
getConfigReportTemplateByKey(param).then(res => {
|
||||
onComplete(res)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user