许成详 před 6 roky
rodič
revize
e8f53f5af0
2 změnil soubory, kde provedl 54 přidání a 49 odebrání
  1. 1
    1
      dist/index.html
  2. 53
    48
      src/pages/system/newOrder/newOrderList/index.vue

+ 1
- 1
dist/index.html Zobrazit soubor

@@ -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.3701d2ecdb620da25b5f579564321337.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.4cecf8ef134122787596.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.d5f386196173a3f10c0560c57608d41f.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.cc3de450188108f8e07b.js></script></body></html>

+ 53
- 48
src/pages/system/newOrder/newOrderList/index.vue Zobrazit soubor

@@ -139,7 +139,7 @@ export default {
139 139
   beforeRouteLeave (to, from, next) {
140 140
     // 导航离开该组件的对应路由时调用
141 141
     // 可以访问组件实例 `this`
142
-    console.log(this.websockets)
142
+    // console.log(this.websockets)
143 143
     this.needReload = false
144 144
     Object.keys(this.websockets).forEach((key) => {
145 145
       this.destroyWebsocket(this.websockets[key])
@@ -149,51 +149,54 @@ export default {
149 149
   },
150 150
   methods: {
151 151
     init () {
152
-      this.needReload = false
153
-      Object.keys(this.websockets).forEach((key) => {
154
-        this.destroyWebsocket(this.websockets[key])
155
-      })
156
-      this.websockets = {}
157
-      this.needReload = true
158
-      // console.log('init')
159
-      var param = []
160
-      if (!this.CaseId) {
161
-        this.$message({
162
-          type: 'info',
163
-          message: '请先选择案场'
152
+      if (this.needReload) {
153
+        this.needReload = false
154
+        Object.keys(this.websockets).forEach((key) => {
155
+          // console.log(key, this.websockets[key])
156
+          this.websockets[key].close()
164 157
         })
165
-        return
166
-      }
167
-      clearInterval(this.interval)
168
-      console.log(this.CaseId)
169
-      this.GetOrdersList({ caseid: this.CaseId }).then((res) => {
170
-        for (var n = 0; n < (res.list || []).length; n++) {
171
-          if (res.list[n].IsIntimidate === 0) {
172
-            param.push(res.list[n].OrdersId)
173
-          }
158
+        this.websockets = {}
159
+        // console.log('init')
160
+        var param = []
161
+        if (!this.CaseId) {
162
+          this.$message({
163
+            type: 'info',
164
+            message: '请先选择案场'
165
+          })
166
+          return
174 167
         }
175
-        var bool = true
176
-        var timer = setInterval(() => {
177
-          if (param.length && bool) {
178
-            bool = false
179
-            this.printPdf(`item_${param[0]}`)
180
-            this.putPrintGoodsOrder({
181
-              id: param[0]
182
-            }).then(() => {
183
-              param.splice(0, 1)
184
-              bool = true
185
-            })
186
-          } else {
187
-            clearInterval(timer)
188
-          }
189
-        }, 300)
190
-        this.getBusinessStatus(this.CaseId).then(() => {
191
-          if (this.businessStatus) {
192
-            this.initWebSocket()
168
+        clearInterval(this.interval)
169
+        // console.log(this.CaseId)
170
+        this.GetOrdersList({ caseid: this.CaseId }).then((res) => {
171
+          for (var n = 0; n < (res.list || []).length; n++) {
172
+            if (res.list[n].IsIntimidate === 0) {
173
+              param.push(res.list[n].OrdersId)
174
+            }
193 175
           }
176
+          var bool = true
177
+          var timer = setInterval(() => {
178
+            if (param.length && bool) {
179
+              bool = false
180
+              this.printPdf(`item_${param[0]}`)
181
+              this.putPrintGoodsOrder({
182
+                id: param[0]
183
+              }).then(() => {
184
+                param.splice(0, 1)
185
+                bool = true
186
+              })
187
+            } else {
188
+              this.needReload = true
189
+              clearInterval(timer)
190
+            }
191
+          }, 300)
192
+          this.getBusinessStatus(this.CaseId).then(() => {
193
+            if (this.businessStatus) {
194
+              this.initWebSocket()
195
+            }
196
+          })
194 197
         })
195
-      })
196
-      this.refreshList()
198
+        this.refreshList()
199
+      }
197 200
     },
198 201
     refreshList () {
199 202
       this.interval = setInterval(() => {
@@ -294,9 +297,9 @@ export default {
294 297
       // let newinfo = newList.filter(x => this.list.filter(item => item.OrdersId === x.OrdersId).length === 0)
295 298
       this.updateList({ list: this.list.concat(newList) }).then(() => {
296 299
         newList.forEach((it) => {
297
-          console.log(it)
300
+          // console.log(it)
298 301
           if (!it.IsIntimidate) {
299
-            console.log('print')
302
+            // console.log('print')
300 303
             this.putPrintGoodsOrder({
301 304
               id: it.OrdersId
302 305
             }).then(() => {
@@ -308,7 +311,7 @@ export default {
308 311
     },
309 312
     newWebsocket (wsRealPath) {
310 313
       const ws = this.websockets[wsRealPath]
311
-      console.log('newWebsocket', ws)
314
+      // console.log('newWebsocket', ws)
312 315
       if (!ws) {
313 316
         const url = `${window.location.origin.replace('http', 'ws')}${wsRealPath}?token=${localStorage.getItem('JWT')}`
314 317
         this.websockets[wsRealPath] = new WebSocket(url)
@@ -317,12 +320,14 @@ export default {
317 320
         this.websockets[wsRealPath].onclose = ((ws) => {
318 321
           return e => this.reloadWebSocket(e, ws)
319 322
         })(this.websockets[wsRealPath])
320
-        this.websockets[wsRealPath].interval = setInterval(() => this.websockets[wsRealPath].send(10), 120000)
323
+        this.websockets[wsRealPath].interval = setInterval(() => {
324
+          try { this.websockets[wsRealPath].send(10) } catch (err) { console.log(err) }
325
+        }, 120000)
321 326
       }
322 327
     },
323 328
     reloadWebSocket (e, ws) {
324 329
       if (e.target.readyState >= 2) {
325
-        console.log(e.currentTarget.url)
330
+        // console.log(e.currentTarget.url)
326 331
         Object.keys(this.websockets).forEach((key) => {
327 332
           // this.websockets[key].close()
328 333
           clearInterval(this.websockets[key].interval)
@@ -338,7 +343,7 @@ export default {
338 343
     },
339 344
     destroyWebsocket (ws) {
340 345
       ws.onclose = ((ws) => {
341
-        console.log('close')
346
+        // console.log('close')
342 347
       })(ws)
343 348
       ws.close()
344 349
       clearInterval(ws.interval)