yuantianjiao 6 년 전
부모
커밋
3c25cd2798
3개의 변경된 파일22개의 추가작업 그리고 24개의 파일을 삭제
  1. 1
    1
      dist/index.html
  2. 20
    22
      src/pages/system/newOrder/newOrderList/index.vue
  3. 1
    1
      src/store/goods/order.js

+ 1
- 1
dist/index.html 파일 보기

@@ -1 +1 @@
1
-<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel=stylesheet href=//at.alicdn.com/t/font_775069_dwqa9wy3lkh.css><link rel="shortcut icon" href=favorite.ico><title>城的空间后台管理系统</title><link href=./static/css/app.19c065ab27033add0d3440c8995f4538.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.992319e39e0ff64940a3.js></script><script type=text/javascript src=./static/js/app.dd4c8e249dbb71f88232.js></script></body></html>
1
+<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel=stylesheet href=//at.alicdn.com/t/font_775069_dwqa9wy3lkh.css><link rel="shortcut icon" href=favorite.ico><title>城的空间后台管理系统</title><link href=./static/css/app.85c080049d66448ec8863ffb5e92df5c.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.7e921535e20f729cf046.js></script><script type=text/javascript src=./static/js/app.8a38139dab302970d822.js></script></body></html>

+ 20
- 22
src/pages/system/newOrder/newOrderList/index.vue 파일 보기

@@ -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({

+ 1
- 1
src/store/goods/order.js 파일 보기

@@ -62,7 +62,7 @@ export default {
62 62
     updateList ({ commit }, data) {
63 63
       return new Promise((resolve) => {
64 64
         commit('updateList', data)
65
-        resolve()
65
+        resolve(data)
66 66
       })
67 67
     },
68 68
     openBusiness ({ commit }, caseid) {