emis-app/pages/print/printData.js

29 lines
876 B
JavaScript
Raw Normal View History

2024-08-08 16:35:12 +00:00
import * as apiService from "@/common/api"
// 打印模板是否支持了打印命令
const isSupportCommandType = (type = '')=> {
let allType = type.split(",")
let supportTypes = [
'TAN-GC-130' // 子单模板
]
// 判断是否全支持
let isSupportAll = allType.filter(v=> supportTypes.indexOf(v) > -1).length == allType.length
2024-08-23 10:28:25 +00:00
// return isSupportAll
return true
2024-08-08 16:35:12 +00:00
}
export const getBillPrintData = async (params)=> {
let imageUrl = [], prtCmdData = ''
if(isSupportCommandType(params.printType)) {
let cmdPrtRes = await apiService.getRealGetPrintCommandByApp({ ...params, _loading: true })
prtCmdData = cmdPrtRes.data
} else {
let imgPrtRes = await apiService.getRealGetWaybillPrintData({ ...params, _loading: true })
imageUrl = imgPrtRes?.data?.map(t=> t.imageUrl) || []
imageUrl = imageUrl.filter(v=> !!v)
}
return {
imageUrl,
prtCmdData
}
}