|
@@ -121,34 +121,50 @@ export const blobToBaseByPdf = function(data,callback){
|
|
|
callback(reader.result)
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
+// lodop 打印预览
|
|
|
+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);//隐藏打印按钮
|
|
|
+ }
|
|
|
+ LODOP.SET_PRINTER_INDEX(store.state.app.defaultPrint || '-1')
|
|
|
+ LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', data[0])
|
|
|
+ LODOP.SET_PRINT_PAGESIZE(3,2090,dlen>1?0:50,"");
|
|
|
+ LODOP.PREVIEW()
|
|
|
+}
|
|
|
+// 获取打印机列表
|
|
|
+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++){
|
|
|
+ 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})
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(printCount,printList)
|
|
|
+ return printList
|
|
|
+}
|
|
|
// pdf 直接打印
|
|
|
export const pdfPrint = function (data){
|
|
|
const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
|
|
|
- if (!LODOP) {
|
|
|
- confirm({
|
|
|
- title: '提示?',
|
|
|
- content: h => <div>打印控件未安装,请先下载并安装。安装完成后,刷新页面即可打印。</div>,
|
|
|
- okText: '立即下载',
|
|
|
- okType: 'danger',
|
|
|
- cancelText: '暂不打印',
|
|
|
- onOk () {
|
|
|
- var agent = navigator.userAgent.toLowerCase();
|
|
|
- if (agent.indexOf("win32") >= 0 || agent.indexOf("wow32") >= 0) {
|
|
|
- window.open('https://iscm.360arrow.com/electron/CLodop.exe')
|
|
|
- }else if (agent.indexOf("win64") >= 0 || agent.indexOf("wow64") >= 0) {
|
|
|
- window.open('https://iscm.360arrow.com/electron/CLodop.exe')
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
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()
|
|
@@ -157,38 +173,7 @@ export const pdfPrint = function (data){
|
|
|
// pdf 打印预览
|
|
|
export const pdfPrintView = function(data){
|
|
|
store.commit('SET_pdfPrintList', data)
|
|
|
-}
|
|
|
-// lodop 打印预览
|
|
|
-export const lodopPrintView = function(data){
|
|
|
- const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
|
|
|
- if (!LODOP) {
|
|
|
- confirm({
|
|
|
- title: '提示?',
|
|
|
- content: h => <div>打印控件未安装,请先下载并安装。安装完成后,刷新页面即可打印。</div>,
|
|
|
- okText: '立即下载',
|
|
|
- okType: 'danger',
|
|
|
- cancelText: '暂不打印',
|
|
|
- onOk () {
|
|
|
- var agent = navigator.userAgent.toLowerCase();
|
|
|
- if (agent.indexOf("win32") >= 0 || agent.indexOf("wow32") >= 0) {
|
|
|
- window.open('https://iscm.360arrow.com/electron/CLodop.exe')
|
|
|
- }else if (agent.indexOf("win64") >= 0 || agent.indexOf("wow64") >= 0) {
|
|
|
- window.open('https://iscm.360arrow.com/electron/CLodop.exe')
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', 1) // 隐藏底图上有模拟走纸板的条纹线
|
|
|
- // LODOP.SET_PRINT_MODE('POS_BASEON_PAPER', true) // 可使输出以纸张边缘为基点
|
|
|
- // 预览
|
|
|
- const dlen = data.length
|
|
|
- if(dlen > 1){
|
|
|
- LODOP.SET_SHOW_MODE("HIDE_PBUTTIN_PREVIEW",1);//隐藏打印按钮
|
|
|
- }
|
|
|
- LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', data[0])
|
|
|
- LODOP.SET_PRINT_PAGESIZE(3,2090,dlen>1?0:50,"");
|
|
|
- LODOP.PREVIEW()
|
|
|
+ store.commit('SET_showPdfPrint', data)
|
|
|
}
|
|
|
|
|
|
// 打印控件
|
|
@@ -198,11 +183,32 @@ export const jGPrint = function (data, type, printerType) {
|
|
|
}
|
|
|
// 针式打印
|
|
|
if (printerType == 'NEEDLE') {
|
|
|
+ const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
|
|
|
+ if (!LODOP) {
|
|
|
+ confirm({
|
|
|
+ title: '提示?',
|
|
|
+ content: h => <div>打印控件未安装,请先下载并安装。安装完成后,刷新页面即可打印。</div>,
|
|
|
+ okText: '立即下载',
|
|
|
+ okType: 'danger',
|
|
|
+ cancelText: '暂不打印',
|
|
|
+ onOk () {
|
|
|
+ var agent = navigator.userAgent.toLowerCase();
|
|
|
+ if (agent.indexOf("win32") >= 0 || agent.indexOf("wow32") >= 0) {
|
|
|
+ window.open('https://iscm.360arrow.com/electron/CLodop.exe')
|
|
|
+ }else if (agent.indexOf("win64") >= 0 || agent.indexOf("wow64") >= 0) {
|
|
|
+ window.open('https://iscm.360arrow.com/electron/CLodop.exe')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
if (type == 'preview') { // 预览
|
|
|
// lodopPrintView(data.data)
|
|
|
pdfPrintView(data.data)
|
|
|
} else if (type == 'print') { // 打印
|
|
|
- pdfPrint(data.data)
|
|
|
+ // 先选择打印机
|
|
|
+ store.commit('SET_pdfPrintList', data.data)
|
|
|
+ store.commit('SET_showSelectPrint', true)
|
|
|
}
|
|
|
} else {
|
|
|
// 喷墨打印
|