|
@@ -79,10 +79,10 @@
|
79
|
79
|
|
80
|
80
|
<script>
|
81
|
81
|
import { createNamespacedHelpers, mapState, mapActions } from 'vuex'
|
82
|
|
-
|
83
|
82
|
import { getLodop } from '@/util/LodopFuncs'
|
84
|
|
-
|
85
|
83
|
import { formatTimeBySeconds } from '@/util/util'
|
|
84
|
+import { replaceURLParams } from '@/util/ajax'
|
|
85
|
+
|
86
|
86
|
// const WebSocket = require('ws')
|
87
|
87
|
const { mapState: mapOrderState, mapActions: mapOrderActions } = createNamespacedHelpers('goodsorder')
|
88
|
88
|
|
|
@@ -257,9 +257,12 @@ export default {
|
257
|
257
|
},
|
258
|
258
|
initWebSocket () {
|
259
|
259
|
// console.log(this.user)
|
|
260
|
+ const wsPath = this.$api.system.notify.newGoodsOrders.url
|
|
261
|
+ const wsRealPath = replaceURLParams(wsPath, { grps: caseid, id })
|
|
262
|
+
|
260
|
263
|
let caseid = this.caseid
|
261
|
264
|
let id = this.userInfo.UserId
|
262
|
|
- const wsuri = `${window.location.origin.replace('http', 'ws')}/api-v2/common/MQ/websocket/${caseid}/${id}?token=${localStorage.getItem('JWT')}`
|
|
265
|
+ const wsuri = `${window.location.origin.replace('http', 'ws')}${wsRealPath}?token=${localStorage.getItem('JWT')}`
|
263
|
266
|
// const wsuri = `ws://192.168.0.11/api/guest/MQ/websocket/${caseid}/${id}`
|
264
|
267
|
try {
|
265
|
268
|
this.websock = new WebSocket(wsuri)
|
|
@@ -275,14 +278,14 @@ export default {
|
275
|
278
|
websocketonmessage (e) {
|
276
|
279
|
// let oldList = this.list
|
277
|
280
|
let newList = JSON.parse(e.data).data.refreshOnlineGoodsOrders
|
278
|
|
- let newinfo = newList.filter(x => this.list.filter(item => item.OrdersId === x.OrdersId).length === 0)
|
279
|
|
- this.updateList({ list: newList }).then(() => {
|
280
|
|
- for (let i = 0; i < newinfo.length; i++) {
|
281
|
|
- this.printPdf(`item_${newinfo[i].OrdersId}`)
|
|
281
|
+ // let newinfo = newList.filter(x => this.list.filter(item => item.OrdersId === x.OrdersId).length === 0)
|
|
282
|
+ this.updateList({ list: this.list.concat(newList) }).then(() => {
|
|
283
|
+ newList.forEach((it) => {
|
|
284
|
+ this.printPdf(`item_${it.OrdersId}`)
|
282
|
285
|
this.putPrintGoodsOrder({
|
283
|
|
- id: newinfo[i].OrdersId
|
|
286
|
+ id: it.OrdersId
|
284
|
287
|
})
|
285
|
|
- }
|
|
288
|
+ })
|
286
|
289
|
})
|
287
|
290
|
},
|
288
|
291
|
open () {
|