|
@@ -101,6 +101,7 @@ export default {
|
101
|
101
|
leftTimes: {},
|
102
|
102
|
business: false,
|
103
|
103
|
caseid: '',
|
|
104
|
+ websockets: {},
|
104
|
105
|
interval: () => { }
|
105
|
106
|
}
|
106
|
107
|
},
|
|
@@ -135,6 +136,7 @@ export default {
|
135
|
136
|
},
|
136
|
137
|
methods: {
|
137
|
138
|
init () {
|
|
139
|
+ console.log('init')
|
138
|
140
|
var param = []
|
139
|
141
|
if (!this.caseid) {
|
140
|
142
|
this.$message({
|
|
@@ -216,15 +218,8 @@ export default {
|
216
|
218
|
type: 'success',
|
217
|
219
|
message: '确认订单成功'
|
218
|
220
|
})
|
219
|
|
- this.init()
|
220
|
|
- // this.updateList({ list: this.list.splice(index, 1) }).then(() => {
|
221
|
|
- // // newList.forEach((it) => {
|
222
|
|
- // // this.printPdf(`item_${it.OrdersId}`)
|
223
|
|
- // // this.putPrintGoodsOrder({
|
224
|
|
- // // id: it.OrdersId
|
225
|
|
- // // })
|
226
|
|
- // // })
|
227
|
|
- // })
|
|
221
|
+ this.list.splice(index, 1)
|
|
222
|
+ this.updateList({ list: this.list })
|
228
|
223
|
})
|
229
|
224
|
}).catch((res) => {
|
230
|
225
|
this.$message({
|
|
@@ -244,7 +239,8 @@ export default {
|
244
|
239
|
type: 'success',
|
245
|
240
|
message: '取消订单成功'
|
246
|
241
|
})
|
247
|
|
- this.init()
|
|
242
|
+ this.list.splice(index, 1)
|
|
243
|
+ this.updateList({ list: this.list })
|
248
|
244
|
})
|
249
|
245
|
}).catch((res) => {
|
250
|
246
|
this.$message({
|
|
@@ -264,23 +260,13 @@ export default {
|
264
|
260
|
LODOP.ADD_PRINT_HTM(0, 0, document.getElementsByClassName(cl)[0].offsetWidth, document.getElementsByClassName(cl)[0].offsetHeight, document.getElementsByClassName(cl)[0].innerHTML)
|
265
|
261
|
},
|
266
|
262
|
initWebSocket () {
|
|
263
|
+ console.log('initWebSocket')
|
267
|
264
|
// console.log(this.user)
|
268
|
265
|
let caseid = this.caseid
|
269
|
266
|
let id = this.userInfo.UserId
|
270
|
267
|
const wsPath = this.$api.system.notify.newGoodsOrders.url
|
271
|
268
|
const wsRealPath = replaceURLParams(wsPath, { grps: caseid, id })
|
272
|
|
- const wsuri = `${window.location.origin.replace('http', 'ws')}${wsRealPath}?token=${localStorage.getItem('JWT')}`
|
273
|
|
- // const wsuri = `ws://192.168.0.11/api/guest/MQ/websocket/${caseid}/${id}`
|
274
|
|
- try {
|
275
|
|
- this.websock = new WebSocket(wsuri)
|
276
|
|
- } catch (e) {
|
277
|
|
- console.log(e)
|
278
|
|
- }
|
279
|
|
- this.websock.onopen = console.log
|
280
|
|
- this.websock.onmessage = this.websocketonmessage
|
281
|
|
- this.websock.onclose = console.log
|
282
|
|
-
|
283
|
|
- setInterval(() => this.websock.send(10), 120000)
|
|
269
|
+ this.newWebsocket(wsRealPath)
|
284
|
270
|
},
|
285
|
271
|
websocketonmessage (e) {
|
286
|
272
|
// let oldList = this.list
|
|
@@ -288,6 +274,7 @@ export default {
|
288
|
274
|
// let newinfo = newList.filter(x => this.list.filter(item => item.OrdersId === x.OrdersId).length === 0)
|
289
|
275
|
this.updateList({ list: this.list.concat(newList) }).then(() => {
|
290
|
276
|
newList.forEach((it) => {
|
|
277
|
+ // console.log('it:', it)
|
291
|
278
|
this.printPdf(`item_${it.OrdersId}`)
|
292
|
279
|
this.putPrintGoodsOrder({
|
293
|
280
|
id: it.OrdersId
|
|
@@ -295,6 +282,17 @@ export default {
|
295
|
282
|
})
|
296
|
283
|
})
|
297
|
284
|
},
|
|
285
|
+ newWebsocket (wsRealPath) {
|
|
286
|
+ const ws = this.websockets[wsRealPath]
|
|
287
|
+ if (!ws) {
|
|
288
|
+ const url = `${window.location.origin.replace('http', 'ws')}${wsRealPath}?token=${localStorage.getItem('JWT')}`
|
|
289
|
+ this.websockets[wsRealPath] = new WebSocket(url)
|
|
290
|
+ this.websockets[wsRealPath].onopen = console.log
|
|
291
|
+ this.websockets[wsRealPath].onmessage = this.websocketonmessage
|
|
292
|
+ this.websockets[wsRealPath].onclose = console.log
|
|
293
|
+ setInterval(() => this.websockets[wsRealPath].send(10), 120000)
|
|
294
|
+ }
|
|
295
|
+ },
|
298
|
296
|
open () {
|
299
|
297
|
if (!this.caseid) {
|
300
|
298
|
this.$message({
|