md
This commit is contained in:
parent
b18faee2ae
commit
cd2b58c072
@ -15,7 +15,7 @@ VUE_APP_BASE_API = 'http://47.96.189.20:58089/api/bizsvr'
|
|||||||
|
|
||||||
VUE_APP_WS_HOST = 'ws://47.96.189.20:58089/api/bizsvr'
|
VUE_APP_WS_HOST = 'ws://47.96.189.20:58089/api/bizsvr'
|
||||||
|
|
||||||
VUE_APP_PRINTER_HOST = '192.168.88.100:17080'
|
VUE_APP_PRINTER_HOST = '192.168.88.189:17080'
|
||||||
|
|
||||||
|
|
||||||
# 路由懒加载
|
# 路由懒加载
|
||||||
|
|||||||
@ -21,14 +21,13 @@ class TanexPrinterSdk {
|
|||||||
|
|
||||||
VERSION="1.0.0"
|
VERSION="1.0.0"
|
||||||
MAX_SENT_RETRY_COUNT = 9;
|
MAX_SENT_RETRY_COUNT = 9;
|
||||||
WS_URL = 'ws://'+process.env.VUE_APP_PRINTER_HOST+'/ws';
|
XD_PRINTER_HOST = process.env.VUE_APP_PRINTER_HOST;
|
||||||
// WS_URL = "ws://192.168.88.189:17080/ws";
|
|
||||||
HTTP_GET_PDF = 'http://'+process.env.VUE_APP_PRINTER_HOST+'/api/downPdfFile';
|
|
||||||
|
|
||||||
|
// WS_URL = 'ws://'+this.XD_PRINTER_HOST+'/ws';
|
||||||
|
// HTTP_GET_PDF = 'http://'+this.XD_PRINTER_HOST+'/api/downPdfFile';
|
||||||
|
|
||||||
// HTTP_GET_PDF = "http://192.168.88.100:17080/api/downPdfFile";
|
// HTTP_GET_PDF = "http://192.168.88.100:17080/api/downPdfFile";
|
||||||
|
|
||||||
|
|
||||||
AUTH_TOKEN=null;
|
AUTH_TOKEN=null;
|
||||||
|
|
||||||
WS_INIT = 0;
|
WS_INIT = 0;
|
||||||
@ -96,6 +95,23 @@ class TanexPrinterSdk {
|
|||||||
this.start();
|
this.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPrinterHost(){
|
||||||
|
return this.XD_PRINTER_HOST;
|
||||||
|
}
|
||||||
|
|
||||||
|
restPrinterHost(host){
|
||||||
|
this.XD_PRINTER_HOST=host;
|
||||||
|
if (this.ws && this.getWSReadyState() != this.WS_CLOSING && this.getWSReadyState() != this.WS_CLOSE) {
|
||||||
|
this.ws.close();
|
||||||
|
this.ws=null;
|
||||||
|
}else{
|
||||||
|
this.ws=null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.connect();
|
||||||
|
this.start();
|
||||||
|
}
|
||||||
|
|
||||||
setOnOpen(callback){
|
setOnOpen(callback){
|
||||||
this.onOpenCallback.push(callback);
|
this.onOpenCallback.push(callback);
|
||||||
|
|
||||||
@ -389,7 +405,9 @@ class TanexPrinterSdk {
|
|||||||
|
|
||||||
if (!this.ws || this.getWSReadyState() === this.WS_CLOSING || this.getWSReadyState() === this.WS_CLOSE) {
|
if (!this.ws || this.getWSReadyState() === this.WS_CLOSING || this.getWSReadyState() === this.WS_CLOSE) {
|
||||||
try {
|
try {
|
||||||
this.ws = new WebSocket(this.WS_URL);
|
let wsUrl = 'ws://'+this.XD_PRINTER_HOST+'/ws';
|
||||||
|
|
||||||
|
this.ws = new WebSocket(wsUrl);
|
||||||
|
|
||||||
this.ws.onerror = () => {
|
this.ws.onerror = () => {
|
||||||
// console.log("ws onerror!");
|
// console.log("ws onerror!");
|
||||||
|
|||||||
@ -47,11 +47,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="printerStatus==1" style="display: inline-flex;">
|
<div v-if="printerStatus==1" style="display: inline-flex;">
|
||||||
<!-- <span style="color: green;font-weight: 600;font-size:13px;">【Printer Online】</span> -->
|
<!-- <span style="color: green;font-weight: 600;font-size:13px;">【Printer Online】</span> -->
|
||||||
<span style="color: #b12e29;font-size:23px;" class="icon iconfont icon-printer" title="Printer Online"></span>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-if="printerStatus==0" style="display: inline-flex;">
|
<div v-if="printerStatus==0" style="display: inline-flex;">
|
||||||
<a :href="printerDownUrl" style="color: blue;font-weight: 600;font-size:13px;text-decoration: underline">下载打印组件</a>
|
<a :href="printerDownUrl" style="color: blue;font-weight: 600;font-size:13px;text-decoration: underline">下载打印组件</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<span style="color: #b12e29;font-size:23px;cursor: pointer" class="icon iconfont icon-printer" title="" @click="configPrinter"></span>
|
||||||
|
<!-- <el-button type="text" size="mini" style="padding: 7px 5px;" icon="el-icon-setting" @click="configPrinter"></el-button> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -69,6 +72,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog title="设置打印机" :visible.sync="openShowConfig" width="30%">
|
||||||
|
<el-form ref="form" :model="form" size="mini" :rules="rules" @submit.native.prevent>
|
||||||
|
<el-row :gutter="0" style="display: flex;flex-wrap: wrap;">
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-alert
|
||||||
|
title="注意"
|
||||||
|
type="info"
|
||||||
|
description="配置打印服务器地址,不要轻易更改!"
|
||||||
|
show-icon
|
||||||
|
:closable="false"
|
||||||
|
style="margin-bottom: 10px;"
|
||||||
|
>
|
||||||
|
</el-alert>
|
||||||
|
<el-form-item label="打印机地址" prop="printerHost">
|
||||||
|
<el-input v-model="form.printerHost" type="text" placeholder="" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer" style="text-align: center;margin-bottom:20px">
|
||||||
|
<el-button type="primary" size="mini" @click="setupPrinter">设置</el-button>
|
||||||
|
<el-button size="mini" @click="openShowConfig = false">关 闭</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -152,7 +179,17 @@
|
|||||||
|
|
||||||
currentSelection:[],
|
currentSelection:[],
|
||||||
|
|
||||||
pdfUtils:new PdfUtils({})
|
openShowConfig:false,
|
||||||
|
|
||||||
|
pdfUtils:new PdfUtils({}),
|
||||||
|
|
||||||
|
form:{
|
||||||
|
printerHost:null,
|
||||||
|
},
|
||||||
|
|
||||||
|
rules:{
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -170,6 +207,18 @@
|
|||||||
// this.tanexPrinter.close();
|
// this.tanexPrinter.close();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
configPrinter(){
|
||||||
|
this.form.printerHost=this.$tanexPrinter.getPrinterHost();
|
||||||
|
console.log("===>===>",this.form.printerHost);
|
||||||
|
this.openShowConfig=true;
|
||||||
|
},
|
||||||
|
setupPrinter(){
|
||||||
|
console.log("===>===>",this.form.printerHost);
|
||||||
|
if(this.form.printerHost){
|
||||||
|
this.$tanexPrinter.restPrinterHost(this.form.printerHost);
|
||||||
|
}
|
||||||
|
this.openShowConfig=false;
|
||||||
|
},
|
||||||
getUUID() {
|
getUUID() {
|
||||||
return Math.random().toString(36).substring(3,10);
|
return Math.random().toString(36).substring(3,10);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -161,7 +161,9 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<!-- <el-table-column prop="goodsName" label="品牌" align="center" width="60" :show-overflow-tooltip="true">
|
<!--
|
||||||
|
|
||||||
|
<el-table-column prop="goodsName" label="品牌" align="center" width="60" :show-overflow-tooltip="true">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row.brand" size="mini" placeholder=""></el-input>
|
<el-input v-model="scope.row.brand" size="mini" placeholder=""></el-input>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user