|
@@ -179,12 +179,12 @@ export default {
|
179
|
179
|
var timer = setInterval(() => {
|
180
|
180
|
if (param.length && bool) {
|
181
|
181
|
bool = false
|
|
182
|
+ this.printPdf(`item_${param[0]}`)
|
182
|
183
|
this.putPrintGoodsOrder({
|
183
|
184
|
id: param[0]
|
184
|
185
|
}).then(() => {
|
185
|
186
|
param.splice(0, 1)
|
186
|
187
|
bool = true
|
187
|
|
- this.printPdf(`item_${param[0]}`)
|
188
|
188
|
})
|
189
|
189
|
} else {
|
190
|
190
|
clearInterval(timer)
|
|
@@ -298,7 +298,7 @@ export default {
|
298
|
298
|
this.updateList({ list: this.list.concat(newList) }).then(() => {
|
299
|
299
|
newList.forEach((it) => {
|
300
|
300
|
console.log(it)
|
301
|
|
- if (it.IsIntimidate === 0) {
|
|
301
|
+ if (!it.IsIntimidate) {
|
302
|
302
|
console.log('print')
|
303
|
303
|
this.putPrintGoodsOrder({
|
304
|
304
|
id: it.OrdersId
|
|
@@ -316,19 +316,26 @@ export default {
|
316
|
316
|
this.websockets[wsRealPath] = new WebSocket(url)
|
317
|
317
|
this.websockets[wsRealPath].onopen = console.log
|
318
|
318
|
this.websockets[wsRealPath].onmessage = this.websocketonmessage
|
319
|
|
- this.websockets[wsRealPath].onclose = this.reloadWebSocket
|
320
|
|
- this.websockets[wsRealPath].onerror = this.reloadWebSocket
|
|
319
|
+ this.websockets[wsRealPath].onclose = ((ws) => {
|
|
320
|
+ return e => this.reloadWebSocket(e, ws)
|
|
321
|
+ })(this.websockets[wsRealPath])
|
321
|
322
|
this.websockets[wsRealPath].interval = setInterval(() => this.websockets[wsRealPath].send(10), 120000)
|
322
|
323
|
}
|
323
|
324
|
},
|
324
|
|
- reloadWebSocket (e) {
|
325
|
|
- console.log(e.currentTarget.url)
|
326
|
|
- Object.keys(this.websockets).forEach((key) => {
|
327
|
|
- clearInterval(this.websockets[key].interval)
|
328
|
|
- })
|
329
|
|
- if (this.needReload) { // 此变量判断是否需要重连
|
330
|
|
- this.websockets = {}
|
331
|
|
- this.initWebSocket()
|
|
325
|
+ reloadWebSocket (e, ws) {
|
|
326
|
+ if (e.target.readyState >= 2) {
|
|
327
|
+ console.log(e.currentTarget.url)
|
|
328
|
+ Object.keys(this.websockets).forEach((key) => {
|
|
329
|
+ // this.websockets[key].close()
|
|
330
|
+ clearInterval(this.websockets[key].interval)
|
|
331
|
+ })
|
|
332
|
+ ws = null
|
|
333
|
+ setTimeout(() => {
|
|
334
|
+ if (this.needReload) { // 此变量判断是否需要重连
|
|
335
|
+ this.websockets = {}
|
|
336
|
+ this.initWebSocket()
|
|
337
|
+ }
|
|
338
|
+ }, 5000)
|
332
|
339
|
}
|
333
|
340
|
},
|
334
|
341
|
open () {
|