|
@@ -19,7 +19,6 @@
|
|
|
{{-- <button class="btn btn-success" @click="wsPrintImage">ClientWebSocket 打印</button>--}}
|
|
{{-- <button class="btn btn-success" @click="wsPrintImage">ClientWebSocket 打印</button>--}}
|
|
|
<button class="btn btn-outline-warning" @click="initClientWebSocket">ClientWebSocket 重置</button>
|
|
<button class="btn btn-outline-warning" @click="initClientWebSocket">ClientWebSocket 重置</button>
|
|
|
|
|
|
|
|
- <button class="btn btn-dark" @click="getImage">获取图片</button>
|
|
|
|
|
|
|
|
|
|
<button class="btn btn-dark" @click="printImage">打印图片</button>
|
|
<button class="btn btn-dark" @click="printImage">打印图片</button>
|
|
|
|
|
|
|
@@ -51,7 +50,7 @@
|
|
|
<p> 编号:@{{ item.task_id }}</p>
|
|
<p> 编号:@{{ item.task_id }}</p>
|
|
|
<p> 快递单号 :@{{ item.logistic_number }}</p>
|
|
<p> 快递单号 :@{{ item.logistic_number }}</p>
|
|
|
<div v-if="item.base64" class="position-relative">
|
|
<div v-if="item.base64" class="position-relative">
|
|
|
- <img :src="item.base64" alt="" style="width: 50%;height: 50%"
|
|
|
|
|
|
|
+ <img :src="'data:image/jpeg;base64,'+item.base64" alt="" style="width: 50%;height: 50%"
|
|
|
class="position-relative">
|
|
class="position-relative">
|
|
|
</div>
|
|
</div>
|
|
|
</li>
|
|
</li>
|
|
@@ -97,9 +96,8 @@
|
|
|
mounted() {
|
|
mounted() {
|
|
|
// 初始化 go 链接
|
|
// 初始化 go 链接
|
|
|
this.initClientWebSocket();
|
|
this.initClientWebSocket();
|
|
|
- // this.initPddWebSocket();
|
|
|
|
|
- // this.initCnWebSocket();
|
|
|
|
|
-
|
|
|
|
|
|
|
+ this.initPddWebSocket();
|
|
|
|
|
+ this.initCnWebSocket();
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
initPddWebSocket() {
|
|
initPddWebSocket() {
|
|
@@ -141,10 +139,11 @@
|
|
|
if (data.printStr.trim().length === 0) {
|
|
if (data.printStr.trim().length === 0) {
|
|
|
window.tempTip.show('输入后在获取')
|
|
window.tempTip.show('输入后在获取')
|
|
|
}
|
|
}
|
|
|
|
|
+ let _this =this;
|
|
|
window.axios.post(url, data).then(res => {
|
|
window.axios.post(url, data).then(res => {
|
|
|
this.printItems =this.printItems.concat(res.data.data);
|
|
this.printItems =this.printItems.concat(res.data.data);
|
|
|
- res.data.data.forEach((item)=>{
|
|
|
|
|
- console.log(item);
|
|
|
|
|
|
|
+ res.data.data.forEach((item)=>{
|
|
|
|
|
+ _this.previewLogisticFace(item);
|
|
|
})
|
|
})
|
|
|
this.$forceUpdate();
|
|
this.$forceUpdate();
|
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
@@ -155,15 +154,14 @@
|
|
|
receiveClientWebSocketMessage(meg) {
|
|
receiveClientWebSocketMessage(meg) {
|
|
|
let data = meg.data;
|
|
let data = meg.data;
|
|
|
data = JSON.parse(data);
|
|
data = JSON.parse(data);
|
|
|
- if (data['Status'] !== true){
|
|
|
|
|
- return ;
|
|
|
|
|
- }
|
|
|
|
|
- console.log(data);
|
|
|
|
|
- switch (data["processType"]) {
|
|
|
|
|
|
|
+ if (data['Status'] !== true){return ;}
|
|
|
|
|
+ let _this = this;
|
|
|
|
|
+ switch (data["ProcessType"]) {
|
|
|
case "getBase64Image":
|
|
case "getBase64Image":
|
|
|
- this.printItems.forEach((item,index,array)=>{
|
|
|
|
|
- if(item['taskID'] === data["TaskID"]){
|
|
|
|
|
- array[index]['base64'] = item;
|
|
|
|
|
|
|
+ this.printItems.forEach((item)=>{
|
|
|
|
|
+ if(item['task_id'] === data["task_id"]){
|
|
|
|
|
+ item['base64'] = data['Base64'];
|
|
|
|
|
+ _this.uploadPrintData(item);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
break;
|
|
break;
|
|
@@ -177,10 +175,7 @@
|
|
|
case "getPrinters":
|
|
case "getPrinters":
|
|
|
this.clientPrinters.printers = data["printes"];
|
|
this.clientPrinters.printers = data["printes"];
|
|
|
this.clientPrinters.defaultPrinter = (this.clientPrinters.printers).filter((item,i,array)=>{
|
|
this.clientPrinters.defaultPrinter = (this.clientPrinters.printers).filter((item,i,array)=>{
|
|
|
- if (item["IsDefault"] === true){
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ return item["IsDefault"] === true;
|
|
|
})
|
|
})
|
|
|
break
|
|
break
|
|
|
default:
|
|
default:
|
|
@@ -191,9 +186,19 @@
|
|
|
uploadPrintData(item) {
|
|
uploadPrintData(item) {
|
|
|
let url = "{{url("apiLocal/maintenance/print/uploadPrintData")}}";
|
|
let url = "{{url("apiLocal/maintenance/print/uploadPrintData")}}";
|
|
|
let data = {printData: [item]};
|
|
let data = {printData: [item]};
|
|
|
|
|
+ let _this = this;
|
|
|
window.axios.post(url, data).then(res => {
|
|
window.axios.post(url, data).then(res => {
|
|
|
- if (res.data.success) {
|
|
|
|
|
- res.data.data
|
|
|
|
|
|
|
+ if (res.data.success){
|
|
|
|
|
+ console.log(res.data.data);
|
|
|
|
|
+ this.printItems.forEach((item)=>{
|
|
|
|
|
+ res.data.data.forEach(node=>{
|
|
|
|
|
+ if(node['task_id'] === item["task_id"]){
|
|
|
|
|
+ item['base64'] = node['base64'];
|
|
|
|
|
+ _this.prin tImage(item);
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
|
alert(err);
|
|
alert(err);
|
|
@@ -234,6 +239,7 @@
|
|
|
if (data.type === "CAINIAO") {
|
|
if (data.type === "CAINIAO") {
|
|
|
let json = this.getCnPreviewTaskJson(data)
|
|
let json = this.getCnPreviewTaskJson(data)
|
|
|
if (this.cnWebSocket && this.cnWebSocket.readyState === 1) {
|
|
if (this.cnWebSocket && this.cnWebSocket.readyState === 1) {
|
|
|
|
|
+ console.log(json);
|
|
|
this.cnWebSocket.send(json)
|
|
this.cnWebSocket.send(json)
|
|
|
}
|
|
}
|
|
|
} else if (data.type === "PDD") {
|
|
} else if (data.type === "PDD") {
|
|
@@ -290,7 +296,6 @@
|
|
|
},
|
|
},
|
|
|
// 发送 菜鸟 预览信息
|
|
// 发送 菜鸟 预览信息
|
|
|
getCnPreviewTaskJson(item) {
|
|
getCnPreviewTaskJson(item) {
|
|
|
- let printer = this.clientPrinters.printers[0]['name'];
|
|
|
|
|
return JSON.stringify({
|
|
return JSON.stringify({
|
|
|
cmd: 'print',
|
|
cmd: 'print',
|
|
|
request_id: item['task_id'],
|
|
request_id: item['task_id'],
|
|
@@ -298,7 +303,7 @@
|
|
|
task: {
|
|
task: {
|
|
|
preview: true,
|
|
preview: true,
|
|
|
previewType: 'image',
|
|
previewType: 'image',
|
|
|
- printer: printer,
|
|
|
|
|
|
|
+ printer: item['printerName'],
|
|
|
taskID: item['task_id'],
|
|
taskID: item['task_id'],
|
|
|
firstDocumentNumber: 0,
|
|
firstDocumentNumber: 0,
|
|
|
totalDocumentCount: 1,
|
|
totalDocumentCount: 1,
|