|
@@ -16,60 +16,62 @@ export const JGPrintTag = function (width, height, data) {
|
|
|
cancelText: '暂不打印',
|
|
|
zIndex: 100000,
|
|
|
onOk () {
|
|
|
- var agent = navigator.userAgent.toLowerCase();
|
|
|
- if (agent.indexOf("win32") >= 0 || agent.indexOf("wow32") >= 0) {
|
|
|
- window.open('https://demo.lodop.net:8443/Lodop6.226_Clodop6.594.zip')
|
|
|
- }else if (agent.indexOf("win64") >= 0 || agent.indexOf("wow64") >= 0) {
|
|
|
- window.open('https://www.lodop.net/download/CLodop_Setup_for_Win64NT_6.611EN.zip')
|
|
|
+ var agent = navigator.userAgent.toLowerCase()
|
|
|
+ if (agent.indexOf('win32') >= 0 || agent.indexOf('wow32') >= 0) {
|
|
|
+ window.open('https://demo.lodop.net:8443/Lodop6.226_Clodop6.594.zip')
|
|
|
+ } else if (agent.indexOf('win64') >= 0 || agent.indexOf('wow64') >= 0) {
|
|
|
+ window.open('https://www.lodop.net/download/CLodop_Setup_for_Win64NT_6.611EN.zip')
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- LODOP.PRINT_INITA("0mm","0mm",width,height,"标签");
|
|
|
+ LODOP.PRINT_INITA('0mm', '0mm', width, height, '标签')
|
|
|
LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', 1) // 隐藏底图上有模拟走纸板的条纹线
|
|
|
LODOP.SET_PRINT_MODE('POS_BASEON_PAPER', true) // 可使输出以纸张边缘为基点
|
|
|
- const top = 3;
|
|
|
- const tline = (data.dealerName.length > 14 ? 2 : 1);
|
|
|
- const tline1 = (data.shelfName.length > 17 ? 2 : 1);
|
|
|
- const top0 = top + tline * 5;
|
|
|
- const top1 = top0 + 5;
|
|
|
- const top2 = top1 + 10;
|
|
|
- const top3 = top2 + 6;
|
|
|
+ const top = 3
|
|
|
+ const tline = (data.dealerName.length > 14 ? 2 : 1)
|
|
|
+ const tline1 = (data.shelfName.length > 17 ? 2 : 1)
|
|
|
+ const top0 = top + tline * 5
|
|
|
+ const top1 = top0 + 5
|
|
|
+ const top2 = top1 + 10
|
|
|
+ const top3 = top2 + 6
|
|
|
// 经销商名称
|
|
|
- LODOP.SET_PRINT_STYLE("TextNeatRow",true);
|
|
|
- LODOP.SET_PRINT_STYLE("FontSize",10);
|
|
|
- LODOP.ADD_PRINT_TEXT(top+'mm',"3mm","54mm","10mm",data.dealerName);
|
|
|
- LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
|
|
|
- LODOP.SET_PRINT_STYLEA(0,"Horient",2);
|
|
|
+ LODOP.SET_PRINT_STYLE('TextNeatRow', true)
|
|
|
+ LODOP.SET_PRINT_STYLE('FontSize', 10)
|
|
|
+ LODOP.ADD_PRINT_TEXT(top + 'mm', '3mm', '54mm', '10mm', data.dealerName)
|
|
|
+ LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
|
|
|
+ LODOP.SET_PRINT_STYLEA(0, 'Horient', 2)
|
|
|
// 货架名称
|
|
|
- LODOP.SET_PRINT_STYLE("TextNeatRow",true);
|
|
|
- LODOP.SET_PRINT_STYLE("FontSize",9);
|
|
|
- LODOP.ADD_PRINT_TEXT(top0+'mm',"3mm","54mm","10mm",tline1>1?data.shelfName.substring(0,14)+'...':data.shelfName);
|
|
|
- LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
|
|
|
- LODOP.SET_PRINT_STYLEA(0,"Horient",2);
|
|
|
+ LODOP.SET_PRINT_STYLE('TextNeatRow', true)
|
|
|
+ LODOP.SET_PRINT_STYLE('FontSize', 9)
|
|
|
+ LODOP.ADD_PRINT_TEXT(top0 + 'mm', '3mm', '54mm', '10mm', tline1 > 1 ? data.shelfName.substring(0, 14) + '...' : data.shelfName)
|
|
|
+ LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
|
|
|
+ LODOP.SET_PRINT_STYLEA(0, 'Horient', 2)
|
|
|
// 货位号
|
|
|
- LODOP.SET_PRINT_STYLE("TextNeatRow",true);
|
|
|
- LODOP.SET_PRINT_STYLE("FontSize",30);
|
|
|
- LODOP.ADD_PRINT_TEXT(top1+'mm',"50%","28mm","15mm",data.shelfPlaceCode);
|
|
|
+ LODOP.SET_PRINT_STYLE('TextNeatRow', true)
|
|
|
+ LODOP.SET_PRINT_STYLE('FontSize', 30)
|
|
|
+ LODOP.ADD_PRINT_TEXT(top1 + 'mm', '50%', '28mm', '15mm', data.shelfPlaceCode)
|
|
|
// 产品编码
|
|
|
- LODOP.SET_PRINT_STYLE("TextNeatRow",true);
|
|
|
- LODOP.SET_PRINT_STYLE("FontSize",12);
|
|
|
- LODOP.ADD_PRINT_TEXT(top2+'mm',"50%","30mm","15mm",data.productCode);
|
|
|
+ LODOP.SET_PRINT_STYLE('TextNeatRow', true)
|
|
|
+ LODOP.SET_PRINT_STYLE('FontSize', 12)
|
|
|
+ LODOP.ADD_PRINT_TEXT(top2 + 'mm', '50%', '30mm', '15mm', data.productCode)
|
|
|
// 二维码
|
|
|
- LODOP.ADD_PRINT_BARCODE(top1+'mm','6mm',80,80,"QRCode",data.qrCodeContent)
|
|
|
- LODOP.SET_PRINT_STYLE("QRCodeVersion",5)
|
|
|
+ LODOP.ADD_PRINT_BARCODE(top1 + 'mm', '6mm', 80, 80, 'QRCode', data.qrCodeContent)
|
|
|
+ LODOP.SET_PRINT_STYLE('QRCodeVersion', 5)
|
|
|
// 时间
|
|
|
- LODOP.SET_PRINT_STYLE("TextNeatRow",true);
|
|
|
- LODOP.SET_PRINT_STYLE("FontSize",9);
|
|
|
- LODOP.ADD_PRINT_TEXT(top3+'mm',"50%","30mm","15mm",data.printTime);
|
|
|
+ LODOP.SET_PRINT_STYLE('TextNeatRow', true)
|
|
|
+ LODOP.SET_PRINT_STYLE('FontSize', 9)
|
|
|
+ LODOP.ADD_PRINT_TEXT(top3 + 'mm', '50%', '30mm', '15mm', data.printTime)
|
|
|
// LODOP.SET_PRINT_STYLE("QRCodeErrorLevel",'H')
|
|
|
+ // 指定打印机
|
|
|
+ LODOP.SET_PRINTER_INDEX(store.state.app.printDefNeedle)
|
|
|
LODOP.SET_PRINT_COPIES(data.printQty)// 指定份数
|
|
|
LODOP.SET_PRINT_PAGESIZE(1, width, height)
|
|
|
// LODOP.PREVIEW()
|
|
|
LODOP.PRINT()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
export const demoGetBASE64 = function (dataArray) {
|
|
|
var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
|
|
|
var strData = ''
|
|
@@ -134,7 +136,7 @@ export const hdPrint = function (printerType, type, url, params, fileName, callb
|
|
|
if (type == 'export') { // 导出
|
|
|
downloadExcel(res, fileName)
|
|
|
} else { // 打印
|
|
|
- const taskName = fileName+'-'+(params.sn||params.checkWarehouseSn||params.settleClientSn)+'-'
|
|
|
+ const taskName = fileName + '-' + (params.sn || params.checkWarehouseSn || params.settleClientSn) + '-'
|
|
|
jGPrint(res, type, printerType, taskName)
|
|
|
}
|
|
|
}
|
|
@@ -143,7 +145,7 @@ export const hdPrint = function (printerType, type, url, params, fileName, callb
|
|
|
}
|
|
|
|
|
|
// pdf blob 转 base64
|
|
|
-export const blobToBaseByPdf = function(data,callback){
|
|
|
+export const blobToBaseByPdf = function (data, callback) {
|
|
|
const reader = new FileReader()
|
|
|
reader.readAsDataURL(new Blob([data], { type: 'application/pdf' }))
|
|
|
reader.addEventListener('load', () => {
|
|
@@ -151,124 +153,124 @@ export const blobToBaseByPdf = function(data,callback){
|
|
|
})
|
|
|
}
|
|
|
// lodop 打印预览
|
|
|
-export const lodopPrintView = function(data){
|
|
|
+export const lodopPrintView = function (data) {
|
|
|
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
|
|
|
LODOP.PRINT_INIT('')
|
|
|
- if(dlen > 1){
|
|
|
- LODOP.SET_SHOW_MODE("HIDE_PBUTTIN_PREVIEW",1);//隐藏打印按钮
|
|
|
+ if (dlen > 1) {
|
|
|
+ LODOP.SET_SHOW_MODE('HIDE_PBUTTIN_PREVIEW', 1)// 隐藏打印按钮
|
|
|
}
|
|
|
LODOP.SET_PRINTER_INDEX(store.state.app.printDefNeedle)
|
|
|
LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', data[0])
|
|
|
- LODOP.SET_PRINT_PAGESIZE(3,2090,dlen>1?0:50,"");
|
|
|
+ LODOP.SET_PRINT_PAGESIZE(3, 2090, dlen > 1 ? 0 : 50, '')
|
|
|
LODOP.PREVIEW()
|
|
|
}
|
|
|
// 获取打印机列表
|
|
|
-export const getPrintList = function(){
|
|
|
+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++){
|
|
|
+ for (let i = 0; i < printCount; i++) {
|
|
|
const pname = LODOP.GET_PRINTER_NAME(i)
|
|
|
- if(pname.indexOf('Microsoft')<0&&pname.indexOf('OneNote')<0&&pname.indexOf('Fax')<0&&pname.indexOf('导出')<0){
|
|
|
- printList.push({name:pname,value:i})
|
|
|
+ if (pname.indexOf('Microsoft') < 0 && pname.indexOf('OneNote') < 0 && pname.indexOf('Fax') < 0 && pname.indexOf('导出') < 0) {
|
|
|
+ printList.push({ name: pname, value: i })
|
|
|
}
|
|
|
}
|
|
|
// store.state.app.printDefNeedle = LODOP.GET_PRINTER_NAME(-1)
|
|
|
return printList
|
|
|
}
|
|
|
// 获取打印机状态
|
|
|
-export const getStatusValue = function (ValueType,ValueIndex,callback){
|
|
|
- const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
|
|
|
- if (LODOP.CVERSION) {
|
|
|
- LODOP.On_Return=function(TaskID,Value){
|
|
|
- callback(Value)
|
|
|
- };
|
|
|
+export const getStatusValue = function (ValueType, ValueIndex, callback) {
|
|
|
+ const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
|
|
|
+ if (LODOP.CVERSION) {
|
|
|
+ LODOP.On_Return = function (TaskID, Value) {
|
|
|
+ callback(Value)
|
|
|
}
|
|
|
- var strResult=LODOP.GET_VALUE(ValueType,ValueIndex);
|
|
|
- if (!LODOP.CVERSION) return callback(strResult); else return callback('');
|
|
|
- }
|
|
|
+ }
|
|
|
+ var strResult = LODOP.GET_VALUE(ValueType, ValueIndex)
|
|
|
+ if (!LODOP.CVERSION) return callback(strResult); else return callback('')
|
|
|
+}
|
|
|
// pdf 直接打印
|
|
|
-export const pdfPrint = function (data,index){
|
|
|
+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
|
|
|
// 打印进入队列开始
|
|
|
- store.commit('SET_printLoading',true)
|
|
|
+ store.commit('SET_printLoading', true)
|
|
|
console.log(store.state.app.printTaskName)
|
|
|
- LODOP.PRINT_INIT(store.state.app.printTaskName + (dlen>1 ? ('第'+(index+1)+'页') : ''))
|
|
|
- //这个语句设置网络共享打印机连接不通时是否提示一下
|
|
|
- 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)
|
|
|
- }else{
|
|
|
- // 打印进入队列结束
|
|
|
- store.commit('SET_printLoading',false)
|
|
|
- }
|
|
|
- };
|
|
|
+ LODOP.PRINT_INIT(store.state.app.printTaskName + (dlen > 1 ? ('第' + (index + 1) + '页') : ''))
|
|
|
+ // 这个语句设置网络共享打印机连接不通时是否提示一下
|
|
|
+ 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)
|
|
|
+ } else {
|
|
|
+ // 打印进入队列结束
|
|
|
+ store.commit('SET_printLoading', false)
|
|
|
+ }
|
|
|
+ }
|
|
|
// 指定打印机
|
|
|
LODOP.SET_PRINTER_INDEX(store.state.app.printDefNeedle)
|
|
|
LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', data[index])
|
|
|
// store.state.app.printDefPageSize
|
|
|
- LODOP.SET_PRINT_PAGESIZE(3, 2090, (index==dlen-1)?50:0, '')
|
|
|
+ LODOP.SET_PRINT_PAGESIZE(3, 2090, (index == dlen - 1) ? 50 : 0, '')
|
|
|
LODOP.PRINT()
|
|
|
}
|
|
|
// 判断当前单据是否已存在打印任务列表中
|
|
|
- export const hasExitTaskByName = function(noCallback){
|
|
|
- const printTaskID = store.state.app.printTaskID
|
|
|
- const printLoading = store.state.app.printLoading
|
|
|
- if(printLoading){
|
|
|
- Modal.info({
|
|
|
- title: '提示',
|
|
|
- content: '打印机正在打印中...',
|
|
|
- okText: '知道了',
|
|
|
- okType: 'danger',
|
|
|
- centered: true,
|
|
|
- zIndex: 100000
|
|
|
- })
|
|
|
- }else{
|
|
|
- noCallback()
|
|
|
- // if(printTaskID){
|
|
|
- // getStatusValue('PRINT_STATUS_BUSY',printTaskID,function(isExist){
|
|
|
- // console.log(isExist)
|
|
|
- // if(isExist.length){
|
|
|
- // if(isExist != '0'){
|
|
|
- // confirm({
|
|
|
- // title: '提示',
|
|
|
- // content: h => <div style='font-size:14px;'><div>打印机正在打印中或有未完成的打印任务</div><div>是否继续添加打印任务?</div></div>,
|
|
|
- // okText: '继续打印',
|
|
|
- // okType: 'danger',
|
|
|
- // cancelText: '取消',
|
|
|
- // centered: true,
|
|
|
- // zIndex: 100000,
|
|
|
- // onOk () {
|
|
|
- // noCallback()
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }else{
|
|
|
- // noCallback()
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }else{
|
|
|
- // noCallback()
|
|
|
- // }
|
|
|
- }
|
|
|
- }
|
|
|
+export const hasExitTaskByName = function (noCallback) {
|
|
|
+ const printTaskID = store.state.app.printTaskID
|
|
|
+ const printLoading = store.state.app.printLoading
|
|
|
+ if (printLoading) {
|
|
|
+ Modal.info({
|
|
|
+ title: '提示',
|
|
|
+ content: '打印机正在打印中...',
|
|
|
+ okText: '知道了',
|
|
|
+ okType: 'danger',
|
|
|
+ centered: true,
|
|
|
+ zIndex: 100000
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ noCallback()
|
|
|
+ // if(printTaskID){
|
|
|
+ // getStatusValue('PRINT_STATUS_BUSY',printTaskID,function(isExist){
|
|
|
+ // console.log(isExist)
|
|
|
+ // if(isExist.length){
|
|
|
+ // if(isExist != '0'){
|
|
|
+ // confirm({
|
|
|
+ // title: '提示',
|
|
|
+ // content: h => <div style='font-size:14px;'><div>打印机正在打印中或有未完成的打印任务</div><div>是否继续添加打印任务?</div></div>,
|
|
|
+ // okText: '继续打印',
|
|
|
+ // okType: 'danger',
|
|
|
+ // cancelText: '取消',
|
|
|
+ // centered: true,
|
|
|
+ // zIndex: 100000,
|
|
|
+ // onOk () {
|
|
|
+ // noCallback()
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }else{
|
|
|
+ // noCallback()
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }else{
|
|
|
+ // noCallback()
|
|
|
+ // }
|
|
|
+ }
|
|
|
+}
|
|
|
// 打印控件
|
|
|
export const jGPrint = function (data, type, printerType, taskName) {
|
|
|
- console.log(data,taskName)
|
|
|
+ console.log(data, taskName)
|
|
|
if (!data) {
|
|
|
return
|
|
|
}
|
|
@@ -283,11 +285,11 @@ export const jGPrint = function (data, type, printerType, taskName) {
|
|
|
okType: 'danger',
|
|
|
cancelText: '暂不打印',
|
|
|
onOk () {
|
|
|
- var agent = navigator.userAgent.toLowerCase();
|
|
|
- if (agent.indexOf("win32") >= 0 || agent.indexOf("wow32") >= 0) {
|
|
|
- window.open('https://demo.lodop.net:8443/Lodop6.226_Clodop6.594.zip')
|
|
|
- }else if (agent.indexOf("win64") >= 0 || agent.indexOf("wow64") >= 0) {
|
|
|
- window.open('https://www.lodop.net/download/CLodop_Setup_for_Win64NT_6.594EN.zip')
|
|
|
+ var agent = navigator.userAgent.toLowerCase()
|
|
|
+ if (agent.indexOf('win32') >= 0 || agent.indexOf('wow32') >= 0) {
|
|
|
+ window.open('https://demo.lodop.net:8443/Lodop6.226_Clodop6.594.zip')
|
|
|
+ } else if (agent.indexOf('win64') >= 0 || agent.indexOf('wow64') >= 0) {
|
|
|
+ window.open('https://www.lodop.net/download/CLodop_Setup_for_Win64NT_6.594EN.zip')
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -295,20 +297,20 @@ export const jGPrint = function (data, type, printerType, taskName) {
|
|
|
}
|
|
|
store.commit('SET_printTaskName', taskName)
|
|
|
// pdf 打印预览
|
|
|
- if (type == 'preview') {
|
|
|
+ if (type == 'preview') {
|
|
|
store.commit('SET_pdfPrintList', data.data)
|
|
|
store.commit('SET_showPdfPrint', data.data)
|
|
|
} else if (type == 'print') { // pdf 打印
|
|
|
// 选择打印机
|
|
|
const printDefNeedle = store.state.app.printDefNeedle
|
|
|
const hasPrint = getPrintList().find(item => item.name == printDefNeedle)
|
|
|
- console.log(printDefNeedle,hasPrint)
|
|
|
+ console.log(printDefNeedle, hasPrint)
|
|
|
// 已经设置默认打印机
|
|
|
- if(hasPrint){
|
|
|
+ if (hasPrint) {
|
|
|
hasExitTaskByName(function () {
|
|
|
pdfPrint(data.data, 0)
|
|
|
})
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
// 没有设置默认打印机时,请选择打印机
|
|
|
store.commit('SET_pdfPrintList', data.data)
|
|
|
store.commit('SET_printUseing', 1)
|
|
@@ -326,4 +328,4 @@ export const jGPrint = function (data, type, printerType, taskName) {
|
|
|
window.frames['printfsqd'].print()
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+}
|