|
@@ -84,12 +84,6 @@ export const hdPrint = function (printerType, type, url, params, fileName, callb
|
|
|
if (type !== 'export') {
|
|
|
params.type = printerType
|
|
|
}
|
|
|
- // 针式预览和喷墨预览一样
|
|
|
- if (type == 'preview') {
|
|
|
- // params.type = 'INK'
|
|
|
- // params.printType = 'INK'
|
|
|
- // printerType = 'INK'
|
|
|
- }
|
|
|
url(params).then(res => {
|
|
|
console.log(res, type, printerType)
|
|
|
if (res.type == 'application/json') {
|
|
@@ -106,7 +100,7 @@ export const hdPrint = function (printerType, type, url, params, fileName, callb
|
|
|
if (type == 'export') { // 导出
|
|
|
downloadExcel(res, fileName)
|
|
|
} else { // 打印
|
|
|
- jGPrint(res, type, printerType)
|
|
|
+ jGPrint(res, type, printerType, fileName)
|
|
|
}
|
|
|
}
|
|
|
callback()
|
|
@@ -132,7 +126,7 @@ export const lodopPrintView = function(data){
|
|
|
if(dlen > 1){
|
|
|
LODOP.SET_SHOW_MODE("HIDE_PBUTTIN_PREVIEW",1);//隐藏打印按钮
|
|
|
}
|
|
|
- LODOP.SET_PRINTER_INDEX(store.state.app.defaultPrint || '-1')
|
|
|
+ LODOP.SET_PRINTER_INDEX(store.state.app.defaultPrint)
|
|
|
LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', data[0])
|
|
|
LODOP.SET_PRINT_PAGESIZE(3,2090,dlen>1?0:50,"");
|
|
|
LODOP.PREVIEW()
|
|
@@ -140,7 +134,6 @@ export const lodopPrintView = function(data){
|
|
|
// 获取打印机列表
|
|
|
export const getPrintList = function(){
|
|
|
const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
|
|
|
- // 获取打印机列表
|
|
|
const printCount = LODOP.GET_PRINTER_COUNT()
|
|
|
const printList = []
|
|
|
for(let i=0;i<printCount;i++){
|
|
@@ -149,35 +142,37 @@ export const getPrintList = function(){
|
|
|
printList.push({name:pname,value:i})
|
|
|
}
|
|
|
}
|
|
|
- console.log(printCount,printList)
|
|
|
return printList
|
|
|
}
|
|
|
// pdf 直接打印
|
|
|
-export const pdfPrint = function (data){
|
|
|
+export const pdfPrint = function (data,index){
|
|
|
const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
|
|
|
LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', 1) // 隐藏底图上有模拟走纸板的条纹线
|
|
|
// LODOP.SET_PRINT_MODE('POS_BASEON_PAPER', true) // 可使输出以纸张边缘为基点
|
|
|
// 开始打印
|
|
|
const dlen = data.length
|
|
|
- for(let i=0;i<dlen;i++){
|
|
|
- LODOP.PRINT_INIT("")
|
|
|
- //这个语句设置网络共享打印机连接不通时是否提示一下
|
|
|
- LODOP.SET_PRINT_MODE("TRYLINKPRINTER_NOALERT",true);
|
|
|
- // 指定打印机
|
|
|
- LODOP.SET_PRINTER_INDEX(store.state.app.defaultPrint)
|
|
|
- LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', data[i])
|
|
|
- LODOP.SET_PRINT_PAGESIZE(3, 2090, (i==dlen-1)?50:0, '')
|
|
|
- LODOP.PRINT()
|
|
|
- }
|
|
|
+ LODOP.PRINT_INIT(store.state.app.printTaskName +index+'-')
|
|
|
+ //这个语句设置网络共享打印机连接不通时是否提示一下
|
|
|
+ LODOP.SET_PRINT_MODE("TRYLINKPRINTER_NOALERT",true);
|
|
|
+ //执行该语句之后,PRINT指令不再返回那个所谓“打印成功”,才能获取到打印状态
|
|
|
+ LODOP.SET_PRINT_MODE("CATCH_PRINT_STATUS",true);
|
|
|
+ //TaskID:任务id,Value:job代码
|
|
|
+ LODOP.On_Return=function(TaskID,Value){
|
|
|
+ console.log(TaskID,Value)
|
|
|
+ store.commit('SET_printTaskID',Value)
|
|
|
+ if(index+1 < dlen){
|
|
|
+ pdfPrint(data,index+1)
|
|
|
+ }
|
|
|
+ };
|
|
|
+ // 指定打印机
|
|
|
+ LODOP.SET_PRINTER_INDEX(store.state.app.defaultPrint)
|
|
|
+ LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', data[index])
|
|
|
+ LODOP.SET_PRINT_PAGESIZE(3, 2090, (index==dlen-1)?50:0, '')
|
|
|
+ LODOP.PRINT()
|
|
|
}
|
|
|
-// pdf 打印预览
|
|
|
-export const pdfPrintView = function(data){
|
|
|
- store.commit('SET_pdfPrintList', data)
|
|
|
- store.commit('SET_showPdfPrint', data)
|
|
|
-}
|
|
|
-
|
|
|
+
|
|
|
// 打印控件
|
|
|
-export const jGPrint = function (data, type, printerType) {
|
|
|
+export const jGPrint = function (data, type, printerType, taskName) {
|
|
|
if (!data) {
|
|
|
return
|
|
|
}
|
|
@@ -202,13 +197,19 @@ export const jGPrint = function (data, type, printerType) {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- if (type == 'preview') { // 预览
|
|
|
- // lodopPrintView(data.data)
|
|
|
- pdfPrintView(data.data)
|
|
|
- } else if (type == 'print') { // 打印
|
|
|
+ // pdf 打印预览
|
|
|
+ if (type == 'preview') {
|
|
|
+ store.commit('SET_pdfPrintList', data.data)
|
|
|
+ store.commit('SET_showPdfPrint', data.data)
|
|
|
+ store.commit('SET_printTaskName', taskName)
|
|
|
+ } else if (type == 'print') { // pdf 打印
|
|
|
+ // console.log(store.state.app.printTaskID)
|
|
|
+ // PRINT_STATUS_BUSY
|
|
|
+ // LODOP.GET_VALUE("PRINT_STATUS_OK",store.state.app.printTaskID);
|
|
|
// 先选择打印机
|
|
|
store.commit('SET_pdfPrintList', data.data)
|
|
|
store.commit('SET_showSelectPrint', true)
|
|
|
+ store.commit('SET_printTaskName', taskName)
|
|
|
}
|
|
|
} else {
|
|
|
// 喷墨打印
|