From 19a4741002f4208bf7fc951cbf3219897af5699a Mon Sep 17 00:00:00 2001
From: surprise <15810472099@163.com>
Date: 星期四, 26 十月 2023 16:41:22 +0800
Subject: [PATCH] 标绘查询修改

---
 /dev/null                              |    0 
 src/components/BarGraph.vue            |   59 ++++-----
 src/views/plotting/plottingInquire.vue |  237 +++++++++++++++++++++++++--------------
 public/SmartEarthSDK/SmartEarth.js     |    2 
 public/config/config.js                |    4 
 src/views/plotting/plotting.vue        |    2 
 6 files changed, 184 insertions(+), 120 deletions(-)

diff --git a/public/SmartEarthSDK/SmartEarth.js b/public/SmartEarthSDK/SmartEarth.js
index 5a00fce..cf9a5a4 100644
--- a/public/SmartEarthSDK/SmartEarth.js
+++ b/public/SmartEarthSDK/SmartEarth.js
@@ -73586,7 +73586,7 @@
         option.editProp !== undefined && (this.editProp = option.editProp);
 
         let enableDelete = this._core.defaultValue(option.enableDelete, false);
-debugger
+ 
         if (this.editHandler) {
             this.editHandler.destroy();
             this.editHandler = undefined;
diff --git a/public/config/config.js b/public/config/config.js
index 740f303..2559267 100644
--- a/public/config/config.js
+++ b/public/config/config.js
@@ -3,8 +3,8 @@
 //鏄惁涓虹敓浜х幆澧�
 const webUrl = location.href.indexOf("/web") > -1 ? "/web" : "";
 
-var webHost = isWeb ? "103.85.165.99" + ":28888" : '192.168.20.106' + ":9000";
-// var webHost = isWeb ? "103.85.165.99" + ":28888" : '192.168.20.83' + ":8888";
+// var webHost = isWeb ? "103.85.165.99" + ":28888" : '192.168.20.106' + ":9000";
+var webHost = isWeb ? "103.85.165.99" + ":28888" : '192.168.20.83' + ":8888";
 // var webHost = isWeb ? "103.85.165.99" + ":28888" : '100.10.1.169' + ":8088";
 // WebSocket 鏈嶅姟鍦板潃
 var socketUrl = 'ws://' + webHost + '/MoonServer/ws/select';
diff --git a/public/mapscreen/images/css_globe_halo.zip b/public/mapscreen/images/css_globe_halo.zip
deleted file mode 100644
index 9500bdb..0000000
--- a/public/mapscreen/images/css_globe_halo.zip
+++ /dev/null
Binary files differ
diff --git a/src/components/BarGraph.vue b/src/components/BarGraph.vue
index 9611642..b1d5c64 100644
--- a/src/components/BarGraph.vue
+++ b/src/components/BarGraph.vue
@@ -1,7 +1,5 @@
 <template>
-  <div class="title">
-    {{ layerData.layerName }}
-  </div>
+  <div class="title">{{ layerData.layerName }}</div>
   <div id="myEcharts" :style="{ width: width, height: height }"></div>
 </template>
 <script lang="ts" setup>
@@ -69,31 +67,33 @@
 onMounted(() => {
   // console.log(props.layerData);
   xAxisData.value = [];
-  props.layerData.points.forEach((e, i) => {
-    xAxisData.value.push(e.len);
-  });
-  data = trans(props.layerData.points);
-  optionData = props.layerData.points;
-  seriesData.value = [];
-  data.forEach((e) => {
-    seriesData.value.push({
-      data: e,
-      type: "line",
-      smooth: true,
-
-      label: {
-        label: {
-          show: false,
-          position: "top",
-          formatter: "{c}",
-        },
-      },
+  if (props.layerData && props.layerData.points) {
+    props.layerData.points.forEach((e, i) => {
+      xAxisData.value.push(e.len);
     });
-  });
+    data = trans(props.layerData.points);
+    optionData = props.layerData.points;
+    seriesData.value = [];
+    data.forEach((e) => {
+      seriesData.value.push({
+        data: e,
+        type: "line",
+        smooth: true,
 
-  nextTick(() => {
-    initChart();
-  });
+        label: {
+          label: {
+            show: false,
+            position: "top",
+            formatter: "{c}",
+          },
+        },
+      });
+    });
+
+    nextTick(() => {
+      initChart();
+    });
+  }
 });
 
 onUnmounted(() => {
@@ -118,9 +118,8 @@
   }
   var valXData = [];
   xAxisData.value.filter((rs) => {
-
     valXData.push((parseFloat(rs) / 1000).toFixed(3));
-  })
+  });
   myChart = myEcharts.init(
     document.getElementById(`myEcharts`),
     "purple-passion"
@@ -153,7 +152,7 @@
       axisTick: {
         show: true, // 涓嶆樉绀哄潗鏍囪酱鍒诲害绾�
       },
- 
+
       axisLine: {
         show: true, // 涓嶆樉绀哄潗鏍囪酱绾�
       },
@@ -161,7 +160,6 @@
         show: true, // 涓嶆樉绀哄潗鏍囪酱涓婄殑鏂囧瓧
         showMinLabel: true, // 寮哄埗鏄剧ず鏈�灏忓�兼爣绛�
         showMaxLabel: true, // 寮哄埗鏄剧ず鏈�澶у�兼爣绛�
-     
       },
       splitLine: {
         show: false, // 涓嶆樉绀虹綉鏍肩嚎
@@ -186,7 +184,6 @@
               optionData[val.dataIndex].len == res.len &&
               res.vals[0] == val.data
             ) {
-
               return (
                 "鏁板�硷細 " +
                 res.vals[0] +
diff --git a/src/views/plotting/plotting.vue b/src/views/plotting/plotting.vue
index 80a8df4..73a8ea8 100644
--- a/src/views/plotting/plotting.vue
+++ b/src/views/plotting/plotting.vue
@@ -286,6 +286,7 @@
 watch(
   () => store.state.plottingInquireData,
   (nVal, oVal) => {
+    if(!nVal)return
     if (nVal.isshow == false) {
       //鍒楄〃鍒犻櫎鑱斿姩
       if (nVal.entitiesData != {} && nVal.entitiesData.name) {
@@ -295,6 +296,7 @@
             break;
           }
         }
+        store.state.plottingInquireData = null
       }
     }
   },
diff --git a/src/views/plotting/plottingInquire.vue b/src/views/plotting/plottingInquire.vue
index bb13cdf..e320d13 100644
--- a/src/views/plotting/plottingInquire.vue
+++ b/src/views/plotting/plottingInquire.vue
@@ -318,7 +318,7 @@
 let layerNameNum = 0;
 let geoWkt = ref(null);
 let geoWktFlag = ref(false);
-let ws = ref(null);
+let wktType = ref(null);
 //鏂板鍥捐〃
 const addCharts = () => {
   layerArr.value.push({ layerName: `null${layerNameNum}`, points: [] });
@@ -347,17 +347,25 @@
   // if (store.state.plottingInquireData.entitiesData.icon == "d.png") {
 
   // }
-  selectPoint({
-    pixel: val,
-    wkt: store.state.plottingInquireData.entitiesData.wkt,
-  });
+  // selectPoint({
+  //   pixel: val,
+  //   wkt: store.state.plottingInquireData.entitiesData.wkt,
+  // });
+  setOptionStart();
+  setWebScoKet("Point", store.state.plottingInquireData.entitiesData.wkt, val);
 };
 //鑺傜偣閫夋嫨
 const nodesChange = (val) => {
-  selectPolyline({
-    nodes: val,
-    wkt: store.state.plottingInquireData.entitiesData.wkt,
-  });
+  setOptionStart();
+  setWebScoKet(
+    "PolyLine",
+    store.state.plottingInquireData.entitiesData.wkt,
+    val
+  );
+  // selectPolyline({
+  //   nodes: val,
+  //   wkt: store.state.plottingInquireData.entitiesData.wkt,
+  // });
 };
 
 //鍥惧眰閫夋嫨
@@ -414,8 +422,10 @@
     e.min = e.minList.toString();
     e.lng = store.state.plottingInquireData.entitiesData.lng;
     e.lat = store.state.plottingInquireData.entitiesData.lat;
+
     resultList.value.push(e);
   });
+  console.log(resultList.value);
 };
 //闈㈡煡璇㈡帴鍙�
 const selectPolygon = async (res) => {
@@ -463,12 +473,12 @@
       });
     });
   });
-
+  console.log(dt.result);
   layeroptions.value = dt.result;
 
   layerValue.value = layeroptions.value[0].layerName;
   layerArr.value.push(dt.result[0]);
-  chartIsshow.value = true;
+
   layerData.value = dt.result[0];
 
   // dt.result.forEach((e) => {
@@ -505,6 +515,12 @@
       };
       //   store.commit("SET_plotting", obj);
       store.state.plottingInquireData = obj;
+    
+      setCloseWebSocket();
+      inquireData.value = {
+        name: "path #9",
+        icon: "q.png",
+      };
       isShow.value = false;
       break;
     }
@@ -515,101 +531,150 @@
 //     emits("setCloseplotting", false);
 //   };
 let chartIsshow = ref(false);
-const setMenuClose = ()=>{
+const setMenuClose = () => {
+  isShow.value = false;
   setCloseWebSocket();
-  isShow.value=false;
-}
-const setCloseWebSocket = () => {
-  if( Window.ws){
-    Window.ws.close();
-  Window.ws.onclose = () => {
-    console.log("鏈嶅姟鍣ㄥ叧闂�");
+  store.state.plottingInquireData = null;
+  inquireData.value = {
+    name: "path #9",
+    icon: "q.png",
   };
-  Window.ws = null;
+};
+const setCloseWebSocket = () => {
+  if (Window.ws) {
+    Window.ws.close();
+    Window.ws.onclose = () => {
+      console.log("鏈嶅姟鍣ㄥ叧闂�");
+    };
+    Window.ws = null;
   }
-
 };
 const setWebScoKet = async (type, wkt, node) => {
   const data = await rasterAnalysis_selectByWktForPost({
     wkt: wkt,
     size: node,
   });
-  console.log(data)
+
   if (data) {
     return;
-  } else {
-   
-    Window.ws.option = () => {};
-    Window.ws.onmessage = (msg) => {
-      // console.log('鏉ヨ嚜鏈嶅姟鍣ㄧ鐨勬暟鎹細' + msg.data); //鐩戝惉鎺ュ彈鏉ヨ嚜鏈嶅姟绔殑淇℃伅
-      if (msg.data != "杩炴帴鎴愬姛") {
-        var val = JSON.parse(msg.data);
-        console.log(val);
-  
-        if (val.analysisForPost) {
-          console.log(val);
-        }
-      } else {
-        console.log(msg.data);
-      }
-    };
   }
+};
+const setOptionStart = () => {
+  resultList.value = [];
+  layerArr.value = [];
+
+  layeroptions.value = [];
+};
+const setWebSocketStart = () => {
+  // if (Window.ws) {
+  //   setCloseWebSocket();
+  // }
+  setOptionStart();
+  var token = getToken();
+  var url = socketUrl + "?token=" + token;
+  Window.ws = new WebSocket(url);
+  Window.ws.option = () => {};
+  Window.ws.onmessage = (msg) => {
+    // console.log('鏉ヨ嚜鏈嶅姟鍣ㄧ鐨勬暟鎹細' + msg.data); //鐩戝惉鎺ュ彈鏉ヨ嚜鏈嶅姟绔殑淇℃伅
+    if (msg.data != "杩炴帴鎴愬姛") {
+      var val = JSON.parse(msg.data);
+
+      if (val.analysisForPost && val.analysisForPost.token == token) {
+        var data = val.analysisForPost;
+        switch (wktType.value) {
+          case "Point":
+            setWebSocketPoint(data);
+            break;
+          case "Polygon":
+            setWebSocketPoint(data);
+            break;
+          case "LineString":
+            setWebSocketPLine(data);
+            break;
+        }
+      }
+    }
+  };
+};
+const setWebSocketPoint = (res) => {
+  var obj = {
+    avg: res.avgList.length <= 0 ? "--" : res.avgList.toString(),
+    layerName: res.layerName,
+    max: res.maxList.length <= 0 ? "--" : res.maxList.toString(),
+    min: res.minList.length <= 0 ? "--" : res.minList.toString(),
+    lng: store.state.plottingInquireData.entitiesData.lng,
+    lat: store.state.plottingInquireData.entitiesData.lat,
+  };
+  resultList.value.push(obj);
+};
+const setWebSocketPLine = (res) => {
+  res.points.forEach((element) => {
+    element.vals.forEach((v) => {
+      v = keepThreeNum(v);
+    });
+  });
+  layeroptions.value.push(res);
+  var data = layeroptions.value[0];
+  layerValue.value = data.layerName;
+  layerArr.value.push(data);
+  layerData.value = data;
 };
 watch(
   () => store.state.plottingInquireData,
   (nVal, oVal) => {
-    if (Window.ws) {
-      setCloseWebSocket();
-    }
-    var url = socketUrl+"?token=" + getToken();
-    Window.ws = new WebSocket(url);
-    isShow.value = nVal.isshow;
-    inquireData.value = nVal.entitiesData;
-    geoWktFlag.value = false;
-    if (inquireData.value.wkt) {
-      var wkt = WKT.parse(inquireData.value.wkt);
+    if (!nVal) return;
+    setOptionStart();
+    if (nVal.entitiesData.name != inquireData.value.name) {
+      isShow.value = nVal.isshow;
+      inquireData.value = nVal.entitiesData;
+      geoWktFlag.value = false;
+      if (inquireData.value.wkt) {
+        var wkt = WKT.parse(inquireData.value.wkt);
+        wktType.value = wkt.type;
+        if (wkt.type == "Point") {
+          geoWkt.value =
+            wkt.coordinates[0].toFixed(6) + " " + wkt.coordinates[1].toFixed(6);
+          geoWktFlag.value = true;
+        }
+        if (wkt.type == "Polygon") {
+          var Polygon = turf.multiPolygon([wkt.coordinates]);
+          var center = turf.center(Polygon);
+          geoWkt.value =
+            center.geometry.coordinates[0].toFixed(6) +
+            " " +
+            center.geometry.coordinates[1].toFixed(6);
+          geoWktFlag.value = true;
+        }
+      }
+      setWebSocketStart();
 
-      if (wkt.type == "Point") {
-        geoWkt.value =
-          wkt.coordinates[0].toFixed(6) + " " + wkt.coordinates[1].toFixed(6);
-        geoWktFlag.value = true;
+      if (nVal.entitiesData.icon == "x.png") {
+        pixelIsShow.value = true;
+        chartIsshow.value = true;
+        setWebScoKet("pline", nVal.entitiesData.wkt, ScopeBox.value.nodes);
+        // selectPolyline({
+        //   nodes: ScopeBox.value.nodes,
+        //   wkt: nVal.entitiesData.wkt,
+        // });
       }
-      if (wkt.type == "Polygon") {
-        var Polygon = turf.multiPolygon([wkt.coordinates]);
-        var center = turf.center(Polygon);
-        geoWkt.value =
-          center.geometry.coordinates[0].toFixed(6) +
-          " " +
-          center.geometry.coordinates[1].toFixed(6);
-        geoWktFlag.value = true;
+      if (nVal.entitiesData.icon == "m.png") {
+        chartIsshow.value = false;
+        // if (nVal.entitiesData.name == oVal.entitiesData.name) {
+        //   return;
+        // }
+        pixelIsShow.value = false;
+        // selectPolygon({ wkt: nVal.entitiesData.wkt });
+        setWebScoKet("polygon", nVal.entitiesData.wkt, 0);
       }
-    }
-
-    if (nVal.entitiesData.icon == "x.png") {
-      pixelIsShow.value = true;
-      setWebScoKet("pline", nVal.entitiesData.wkt, ScopeBox.value.nodes);
-      // selectPolyline({
-      //   nodes: ScopeBox.value.nodes,
-      //   wkt: nVal.entitiesData.wkt,
-      // });
-    }
-    if (nVal.entitiesData.icon == "m.png") {
-      chartIsshow.value = false;
-      if (nVal.entitiesData.name == oVal.entitiesData.name) {
-        return;
+      if (nVal && nVal.entitiesData.icon == "d.png") {
+        chartIsshow.value = false;
+        pixelIsShow.value = true;
+        // selectPoint({
+        //   pixel: ScopeBox.value.pixel,
+        //   wkt: nVal.entitiesData.wkt,
+        // });
+        setWebScoKet("polygon", nVal.entitiesData.wkt, ScopeBox.value.pixel);
       }
-      pixelIsShow.value = false;
-      // selectPolygon({ wkt: nVal.entitiesData.wkt });
-      setWebScoKet("polygon", nVal.entitiesData.wkt, 0);
-    }
-    if (nVal && nVal.entitiesData.icon == "d.png") {
-      chartIsshow.value = false;
-      pixelIsShow.value = true;
-      // selectPoint({
-      //   pixel: ScopeBox.value.pixel,
-      //   wkt: nVal.entitiesData.wkt,
-      // });
-      setWebScoKet("polygon", nVal.entitiesData.wkt, ScopeBox.value.pixel);
     }
   },
   { deep: true }

--
Gitblit v1.9.3