sunzehao il y a 5 jours
Parent
commit
4de6e3d143
1 fichiers modifiés avec 52 ajouts et 52 suppressions
  1. 52 52
      src/views/cesiumComponents/windMap3D.vue

+ 52 - 52
src/views/cesiumComponents/windMap3D.vue

@@ -529,17 +529,17 @@ export default {
       let fjLonLatJson = [];
       this.fjLonLatJsonArr = [];
 
-    //   webSocketService.connect({
-    //     url: `ws/${this.getWsUrl(stationName)}`,
-    //     autoReconnect: true,
-    //     maxReconnectAttempts: 5,
-    //     reconnectInterval: 3000,
-    //     onOpen: (event) => {
-    //       console.log("✅ WebSocket 连接成功", event);
-    //     },
-    //     onError: (error) => {
-    //       console.log("❌ WebSocket 错误:", error);
-    //       return;
+      webSocketService.connect({
+        url: `ws/${this.getWsUrl(stationName)}`,
+        autoReconnect: true,
+        maxReconnectAttempts: 5,
+        reconnectInterval: 3000,
+        onOpen: (event) => {
+          console.log("✅ WebSocket 连接成功", event);
+        },
+        onError: (error) => {
+          console.log("❌ WebSocket 错误:", error);
+          return;
           if (stationName === "MYFDC") {
             fjLonLatJson = JSON.parse(JSON.stringify(fjMYLonLatJson));
           } else if (stationName === "JNWHZ") {
@@ -575,47 +575,47 @@ export default {
               this.changeZb(Object.assign({}, jwdItem, fjzbItem));
             });
           }, 1000);
-    //     },
-    //   });
-
-    //   webSocketService.on("message", (res) => {
-    //     if (stationName === "MYFDC") {
-    //       fjLonLatJson = JSON.parse(JSON.stringify(fjMYLonLatJson));
-    //     } else if (stationName === "JNWHZ") {
-    //       fjLonLatJson = JSON.parse(JSON.stringify(fjWHZLonLatJson));
-    //     } else if (stationName === "JNYPL") {
-    //       fjLonLatJson = JSON.parse(JSON.stringify(fjYPLLonLatJson));
-    //     } else if (stationName === "JNSMS") {
-    //       fjLonLatJson = JSON.parse(JSON.stringify(fjSMSLonLatJson));
-    //     }
-
-    //     let wtArray = JSON.parse(JSON.stringify(res.windMachineList));
-
-    //     if (this.isFirstAdd) {
-    //       fjLonLatJson.data.forEach((e) => {
-    //         let fjItem =
-    //           wtArray.find((findEle) => {
-    //             return findEle.fjbh === e.fjbh;
-    //           }) || {};
-    //         const fjMix = Object.assign({}, e, fjItem);
-    //         fjMix.status = this.getStatus(fjMix.fjzt);
-    //         e = fjMix;
-
-    //         this.showStatuswind(viewer, e);
-    //       });
-    //     }
-
-    //     this.fjLonLatJsonArr = fjLonLatJson;
-    //     this.isFirstAdd = false;
-
-    //     wtArray.forEach((fjzbItem) => {
-    //       const jwdItem =
-    //         fjLonLatJson.data.find((findEle) => {
-    //           return findEle.fjbh === fjzbItem.fjbh;
-    //         }) || {};
-    //       this.changeZb(Object.assign({}, jwdItem, fjzbItem));
-    //     });
-    //   });
+        },
+      });
+
+      webSocketService.on("message", (res) => {
+        if (stationName === "MYFDC") {
+          fjLonLatJson = JSON.parse(JSON.stringify(fjMYLonLatJson));
+        } else if (stationName === "JNWHZ") {
+          fjLonLatJson = JSON.parse(JSON.stringify(fjWHZLonLatJson));
+        } else if (stationName === "JNYPL") {
+          fjLonLatJson = JSON.parse(JSON.stringify(fjYPLLonLatJson));
+        } else if (stationName === "JNSMS") {
+          fjLonLatJson = JSON.parse(JSON.stringify(fjSMSLonLatJson));
+        }
+
+        let wtArray = JSON.parse(JSON.stringify(res.windMachineList));
+
+        if (this.isFirstAdd) {
+          fjLonLatJson.data.forEach((e) => {
+            let fjItem =
+              wtArray.find((findEle) => {
+                return findEle.fjbh === e.fjbh;
+              }) || {};
+            const fjMix = Object.assign({}, e, fjItem);
+            fjMix.status = this.getStatus(fjMix.fjzt);
+            e = fjMix;
+
+            this.showStatuswind(viewer, e);
+          });
+        }
+
+        this.fjLonLatJsonArr = fjLonLatJson;
+        this.isFirstAdd = false;
+
+        wtArray.forEach((fjzbItem) => {
+          const jwdItem =
+            fjLonLatJson.data.find((findEle) => {
+              return findEle.fjbh === fjzbItem.fjbh;
+            }) || {};
+          this.changeZb(Object.assign({}, jwdItem, fjzbItem));
+        });
+      });
 
       this.resetWindViewport();
     },