许成详 před 6 roky
rodič
revize
9f57ef3c4e
1 změnil soubory, kde provedl 44 přidání a 42 odebrání
  1. 44
    42
      src/pages/system/newOrder/newOrderList/index.vue

+ 44
- 42
src/pages/system/newOrder/newOrderList/index.vue Zobrazit soubor

@@ -151,52 +151,54 @@ export default {
151 151
   },
152 152
   methods: {
153 153
     init () {
154
-      this.needReload = false
155
-      Object.keys(this.websockets).forEach((key) => {
156
-        console.log(key, this.websockets[key])
157
-        this.websockets[key].close()
158
-      })
159
-      this.websockets = {}
160
-      this.needReload = true
161
-      // console.log('init')
162
-      var param = []
163
-      if (!this.CaseId) {
164
-        this.$message({
165
-          type: 'info',
166
-          message: '请先选择案场'
154
+      if (this.needReload) {
155
+        this.needReload = false
156
+        Object.keys(this.websockets).forEach((key) => {
157
+          // console.log(key, this.websockets[key])
158
+          this.websockets[key].close()
167 159
         })
168
-        return
169
-      }
170
-      clearInterval(this.interval)
171
-      console.log(this.CaseId)
172
-      this.GetOrdersList({ caseid: this.CaseId }).then((res) => {
173
-        for (var n = 0; n < (res.list || []).length; n++) {
174
-          if (res.list[n].IsIntimidate === 0) {
175
-            param.push(res.list[n].OrdersId)
176
-          }
160
+        this.websockets = {}
161
+        // console.log('init')
162
+        var param = []
163
+        if (!this.CaseId) {
164
+          this.$message({
165
+            type: 'info',
166
+            message: '请先选择案场'
167
+          })
168
+          return
177 169
         }
178
-        var bool = true
179
-        var timer = setInterval(() => {
180
-          if (param.length && bool) {
181
-            bool = false
182
-            this.printPdf(`item_${param[0]}`)
183
-            this.putPrintGoodsOrder({
184
-              id: param[0]
185
-            }).then(() => {
186
-              param.splice(0, 1)
187
-              bool = true
188
-            })
189
-          } else {
190
-            clearInterval(timer)
191
-          }
192
-        }, 300)
193
-        this.getBusinessStatus(this.CaseId).then(() => {
194
-          if (this.businessStatus) {
195
-            this.initWebSocket()
170
+        clearInterval(this.interval)
171
+        // console.log(this.CaseId)
172
+        this.GetOrdersList({ caseid: this.CaseId }).then((res) => {
173
+          for (var n = 0; n < (res.list || []).length; n++) {
174
+            if (res.list[n].IsIntimidate === 0) {
175
+              param.push(res.list[n].OrdersId)
176
+            }
196 177
           }
178
+          var bool = true
179
+          var timer = setInterval(() => {
180
+            if (param.length && bool) {
181
+              bool = false
182
+              this.printPdf(`item_${param[0]}`)
183
+              this.putPrintGoodsOrder({
184
+                id: param[0]
185
+              }).then(() => {
186
+                param.splice(0, 1)
187
+                bool = true
188
+              })
189
+            } else {
190
+              this.needReload = true
191
+              clearInterval(timer)
192
+            }
193
+          }, 300)
194
+          this.getBusinessStatus(this.CaseId).then(() => {
195
+            if (this.businessStatus) {
196
+              this.initWebSocket()
197
+            }
198
+          })
197 199
         })
198
-      })
199
-      this.refreshList()
200
+        this.refreshList()
201
+      }
200 202
     },
201 203
     refreshList () {
202 204
       this.interval = setInterval(() => {