From 60db92bf4f1e4cf4491668eb1d4281f6ac99bc02 Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期一, 06 三月 2023 18:38:24 +0800
Subject: [PATCH] 前端添加柱状图显示

---
 src/views/Tools/LayerTree.vue          |   45 ++++++++
 src/store/index.js                     |    7 
 src/views/Synthesis/LeftMenu.vue       |   41 ++++---
 src/components/login.vue               |   12 +
 src/views/Tools/queryinfo.vue          |    6 +
 src/components/MapView/mapSpacePop.vue |  140 ++++++++++++++++++++++++++-
 src/views/datamanage/dataUpdata.vue    |    2 
 7 files changed, 216 insertions(+), 37 deletions(-)

diff --git a/src/components/MapView/mapSpacePop.vue b/src/components/MapView/mapSpacePop.vue
index 0ba1b6c..73d023e 100644
--- a/src/components/MapView/mapSpacePop.vue
+++ b/src/components/MapView/mapSpacePop.vue
@@ -1,7 +1,11 @@
 <template>
   <div class="menuPop">
     <div style="padding: 5px">
-      <el-form :inline="true" :model="formInline" class="demo-form-inline">
+      <el-form
+        :inline="true"
+        :model="formInline"
+        class="demo-form-inline"
+      >
         <el-form-item>
           <el-select
             v-model="formInline.name"
@@ -41,12 +45,16 @@
           ></el-input>
         </el-form-item>
         <el-form-item>
-          <el-button size="small" plain @click="setSpaceTableLayer"
-            >鏌ヨ</el-button
-          >
-          <el-button plain size="small" @click="restSpacePopLayer"
-            >閲嶇疆</el-button
-          >
+          <el-button
+            size="small"
+            plain
+            @click="setSpaceTableLayer"
+          >鏌ヨ</el-button>
+          <el-button
+            plain
+            size="small"
+            @click="restSpacePopLayer"
+          >閲嶇疆</el-button>
         </el-form-item>
       </el-form>
       <div class="centTable">
@@ -63,12 +71,30 @@
             label="搴忓彿"
             width="50"
           />
-          <el-table-column label="瀹氫綅" width="100" align="center">
+          <el-table-column
+            label="瀹氫綅"
+            width="100"
+            align="center"
+          >
             <template slot-scope="scope">
               <el-button
                 icon="el-icon-map-location"
                 size="small"
                 @click="spaceLocation(scope.$index, scope.row)"
+              ></el-button>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="鏌辩姸鍥�"
+            width="100"
+            align="center"
+            v-show="spaceLayer== 'spaceLayer'"
+          >
+            <template slot-scope="scope">
+              <el-button
+                icon="el-icon-map-location"
+                size="small"
+                @click="spaceHistogram(scope.$index, scope.row)"
               ></el-button>
             </template>
           </el-table-column>
@@ -197,6 +223,8 @@
     this.spaceLayer = this.$store.state.mapSpaceQueryLayer
     // this.showSpacePopLayer();
     //   this.getTableselectFields();
+
+
     this.getDomainsLayer()
   },
 
@@ -371,6 +399,102 @@
       this.tableData = data.result
       this.$refs.filterTable.doLayout()
     },
+    async spaceHistogram(index, row) {
+      if (this.$store.state.histogramLayer.length != 0) {
+        for (var i in this.$store.state.histogramLayer) {
+          Viewer.entities.remove(this.$store.state.histogramLayer[i])
+        }
+      }
+      var param = {
+        gid: row.gid,
+        name: this.spaceLayer,
+      }
+      const data1 = await dataQuerySelectWktById(param)
+      if (data1.code != 200) {
+        this.$message.error("鍒楄〃璋冪敤澶辫触")
+      }
+
+      var val1 = decr(data1.result)
+      var wkt = this.$wkt.parse(val1)
+      var coord = wkt.coordinates
+      var obj = {
+        pageIndex: 1,
+        pageSize: 10,
+        name: 'sexplorationpointstratum',
+        filter: "exppointid = '" + row.exppointid + "'"
+      }
+      var data = await dataQuerySelectByPage(obj)
+      if (data.code != 200) {
+      }
+      if (data.result) {
+        var val = data.result;
+        //鍐掓场鎺掑簭
+        for (var i = 0; i < val.length; i++) {
+          for (var u = i + 1; u < val.length; u++) {
+
+            if (val[i].botdepth > val[u].botdepth) {
+              var num = val[i];
+              val[i] = val[u];
+              val[u] = num;
+            }
+          }
+        }
+
+
+        var outlineList = [
+          'rgba(141,135,114,1)',
+          'rgba(248,235,179,1)',
+          'rgba(185,183,151,1)',
+          'rgba(224,222,94,1)',
+          'rgba(250,190,153,1)',
+          'rgba(197,222,130,1)',
+          'rgba(208,228,177,1)',
+        ]
+
+
+        var num = row.elev;
+        var height = 0;
+
+        for (var i = 0; i < val.length; i++) {
+          var fill, line;
+          if (i > outlineList.length) {
+            var len = outlineList.length - 1;
+            fill = outlineList[len];
+            line = outlineList[len];
+          } else {
+            fill = outlineList[i];
+            line = outlineList[i];
+          }
+
+          var height = num - val[i].botdepth
+          var layer = Viewer.entities.add({
+            position: Cesium.Cartesian3.fromDegrees(coord[0], coord[1]),
+            ellipse: {
+              semiMinorAxis: 1.0, //鐭酱
+              semiMajorAxis: 1.0, //闀胯酱
+              height: height, //鎷変几楂樺害    elev  gwaterdep
+              extrudedHeight: num, //绂诲湴楂樺害
+              rotation: Cesium.Math.toRadians(0), //鏃嬭浆
+              fill: true, //鏄惁鏄剧ず鍦嗙殑濉厖
+              material: Cesium.Color.fromCssColorString(line), //鍦嗙殑棰滆壊,
+              outline: false, //鏄惁鏄剧ず鍦嗚疆寤�
+
+            },
+          });
+          num -= val[i].botdepth;
+          this.$store.state.histogramLayer.push(layer)
+          sgworld.Navigate.flyToObj(layer)
+        }
+
+
+
+
+
+
+
+
+      }
+    },
     async spaceLocation(index, row) {
       var param = {
         gid: row.gid,
diff --git a/src/components/login.vue b/src/components/login.vue
index 8e34bfe..5194ac3 100644
--- a/src/components/login.vue
+++ b/src/components/login.vue
@@ -158,13 +158,16 @@
         callback();
       }
     };
-
+    // loginForm: {
+    //     uid: "admin",
+    //     pwd: "Admin@1234_lf",
+    //   }
     return {
       validCode: "",
       loading: false,
       loginForm: {
-        uid: "admin",
-        pwd: "Admin@1234_lf",
+        uid: "",
+        pwd: "",
       },
       rules: {
         uid: [{ validator: validUserName, trigger: "blur" }],
@@ -179,6 +182,9 @@
     this.getpublickey();
   },
   methods: {
+    handlePaste(e) {
+      e.preventDefault();
+    },
     //   鑾峰彇vuex涓瑼ctions閲岀殑鏂规硶
     ...mapActions(["login", "getpublickey"]),
     getCode(data) {
diff --git a/src/store/index.js b/src/store/index.js
index fc969b2..13ef0d6 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -38,8 +38,8 @@
     mapSpaceQueryLayer: null,
     mapMenuShpFile: null,
     propertiesFlag: null,
-    propertiesName:null,
-    propertiesInfo:null,
+    propertiesName: null,
+    propertiesInfo: null,
 
     //涓婚鍒囨崲
     theme: variables.theme,
@@ -61,7 +61,8 @@
     treeData: null,
     checkedKeys: [],
     queryInfo: [],
-    Map3: []
+    Map3: [],
+    histogramLayer: []
   },
   mutations: {
     //鑾峰彇鏉冮檺鍚堥泦
diff --git a/src/views/Synthesis/LeftMenu.vue b/src/views/Synthesis/LeftMenu.vue
index baf9642..50c31de 100644
--- a/src/views/Synthesis/LeftMenu.vue
+++ b/src/views/Synthesis/LeftMenu.vue
@@ -440,27 +440,30 @@
       }
 
       if (this.isMenuFlag != val) {
-        this.$store.state.mapMenuBoolean = false;
-        this.$store.state.mapMenuBoxFlag = null;
-        this.$store.state.mapPopBoolean = false;
-        this.$store.state.mapPopBoxFlag = null;
-        sgworld.Creator.SimpleGraphic.clear();
-        this.isMenuFlag = val;
-        if (this.entityaLayers.length != 0) {
-          for (var i in this.entityaLayers) {
-            sgworld.Viewer.entities.remove(this.entityaLayers[i]);
+        if (res.id != 'b9') {
+          this.$store.state.mapMenuBoolean = false;
+          this.$store.state.mapMenuBoxFlag = null;
+          this.$store.state.mapPopBoolean = false;
+          this.$store.state.mapPopBoxFlag = null;
+          sgworld.Creator.SimpleGraphic.clear();
+          this.isMenuFlag = val;
+          if (this.entityaLayers.length != 0) {
+            for (var i in this.entityaLayers) {
+              sgworld.Viewer.entities.remove(this.entityaLayers[i]);
+            }
+            this.entityaLayers = [];
           }
-          this.entityaLayers = [];
+          for (var i in this.$store.state.queryInfo) {
+            sgworld.Viewer.entities.remove(this.$store.state.queryInfo[i]);
+          }
+          this.$store.state.queryInfo = [];
+          if (this.$store.state.primitLayer != null) {
+            sgworld.Viewer.entities.remove(this.$store.state.primitLayer);
+            sgworld.Creator.DeleteObject(this.$store.state.primitLayer);
+            this.$store.state.primitLayer = null;
+          }
         }
-        for (var i in this.$store.state.queryInfo) {
-          sgworld.Viewer.entities.remove(this.$store.state.queryInfo[i]);
-        }
-        this.$store.state.queryInfo = [];
-        if (this.$store.state.primitLayer != null) {
-          sgworld.Viewer.entities.remove(this.$store.state.primitLayer);
-          sgworld.Creator.DeleteObject(this.$store.state.primitLayer);
-          this.$store.state.primitLayer = null;
-        }
+
       }
       this.showTwoMenuFlag = res.id;
 
diff --git a/src/views/Tools/LayerTree.vue b/src/views/Tools/LayerTree.vue
index d9411be..6334b9e 100644
--- a/src/views/Tools/LayerTree.vue
+++ b/src/views/Tools/LayerTree.vue
@@ -86,6 +86,13 @@
       >
         <i class="el-icon-tickets"></i>&nbsp;&nbsp;瀹氫綅
       </div>
+      <div
+        class="edit"
+        @click="histogram()"
+        v-show="shwoHistogram"
+      >
+        <i class="el-icon-tickets"></i>&nbsp;&nbsp;杞瓟鏌辩姸鍥�
+      </div>
       <!-- <div
         class="edit"
         @click="menuMoveF( 'up')"
@@ -169,12 +176,13 @@
 
 import View from "ol/View.js";
 import { Fill, Stroke, Style } from "ol/style.js";
-import { perms_selectLayers } from "../../api/api.js";
+import { perms_selectLayers, inquiry_selectDomains } from "../../api/api.js";
 export default {
   name: "tree",
   components: { queryinfo },
   data() {
     return {
+      shwoHistogram: false,
       showlocal: false,
       eleId: "",
       isShow: false,
@@ -217,6 +225,28 @@
     };
   },
   methods: {
+    //杞瓟鏌辩姸鍥�
+    async histogram() {
+      this.menuVisible = false
+      var layer = this.currentData.enName.replaceAll("_", "");
+      this.$store.state.mapSpaceQueryLayer = layer;
+      this.$store.state.mapPopBoxFlag = "2";
+      this.$refs && this.$refs.queryinfo && this.$refs.queryinfo.close();
+      this.$refs &&
+        this.$refs.queryinfo &&
+        this.$refs.queryinfo.open("灞炴��", null, {
+          close: () => {
+            if (this.$store.state.primitLayer != null) {
+              sgworld.Creator.DeleteObject(this.$store.state.primitLayer);
+              this.$store.state.primitLayer = null;
+            }
+
+            if (window.Viewer.scene.primitives.length != 0) {
+              window.Viewer.scene.primitives.removeAll();
+            }
+          },
+        });
+    },
     NodeBlur(Node, data) {
       if (data.label.length === 0) {
         this.$message.error("鑿滃崟鍚嶄笉鍙负绌猴紒");
@@ -250,6 +280,11 @@
     rightClick(event, object, Node, element) {
       this.currentData = object;
       this.currentNode = Node;
+      if (this.currentData.enName == "s_explorationpoint") {
+        this.shwoHistogram = true;
+      } else {
+        this.shwoHistogram = false;
+      }
       if (Node.level === 3) {
         this.firstLevel = false;
       } else {
@@ -286,6 +321,7 @@
     },
     // 澧炲姞鍚岀骇鑺傜偣浜嬩欢
     addSameLevelNode() {
+      this.menuVisible = false
       this.foo();
       if (this.currentNode.level == 2) {
         this.appendNodetitle = this.currentData.label;
@@ -299,6 +335,7 @@
     // 澧炲姞瀛愮骇鑺傜偣浜嬩欢
     addChildNode() {
       this.foo();
+      this.menuVisible = false
       // if (this.currentNode.level >= 2) {
       //   this.$message.error("鏈�澶氬彧鏀袱绾э紒");
       //   return false;
@@ -327,6 +364,7 @@
     // 鍒犻櫎鑺傜偣
     deleteNode() {
       this.foo();
+      this.menuVisible = false
       var label = this.currentNode.data.cnName;
       if (this.currentNode.data.serveType == "WMS") {
         for (var i in window.Viewer.imageryLayers._layers) {
@@ -370,10 +408,11 @@
     //灞炴�ф樉绀�
     showLayerAttribute(data) {
       this.foo();
+      this.menuVisible = false
       this.currentData = data ? data : this.currentData;
       var layer = this.currentData.enName.replaceAll("_", "");
       this.$store.state.mapSpaceQueryLayer = layer;
-      // this.$store.state.mapPopBoolean = true;
+
       this.$store.state.mapPopBoxFlag = "2";
       this.$refs && this.$refs.queryinfo && this.$refs.queryinfo.close();
       this.$refs &&
@@ -393,6 +432,7 @@
     },
     //妯″瀷瀹氫綅
     positioning() {
+      this.menuVisible = false
       for (var i in Viewer.scene.primitives._primitives) {
         if (
           Viewer.scene.primitives._primitives[i].id == this.currentData.cnName
@@ -404,6 +444,7 @@
     // 缂栬緫鑺傜偣
     editNode(data) {
       this.foo();
+      this.menuVisible = false
       this.currentData = data ? data : this.currentData;
       if (!this.currentData.isEdit) {
         this.$set(this.currentData, "isEdit", true);
diff --git a/src/views/Tools/queryinfo.vue b/src/views/Tools/queryinfo.vue
index 1b8e65c..2ad8ec1 100644
--- a/src/views/Tools/queryinfo.vue
+++ b/src/views/Tools/queryinfo.vue
@@ -76,7 +76,11 @@
         sgworld.Creator.DeleteObject(this.$store.state.primitLayer);
         this.$store.state.primitLayer = null
       }
-
+      if (this.$store.state.histogramLayer.length != 0) {
+        for (var i in this.$store.state.histogramLayer) {
+          Viewer.entities.remove(this.$store.state.histogramLayer[i])
+        }
+      }
     },
     // 鎵撳紑寮圭獥
     open(title, value, style = {}) {
diff --git a/src/views/datamanage/dataUpdata.vue b/src/views/datamanage/dataUpdata.vue
index 5ed4237..5389afc 100644
--- a/src/views/datamanage/dataUpdata.vue
+++ b/src/views/datamanage/dataUpdata.vue
@@ -1807,7 +1807,7 @@
         "bs.m_equipment_nameplate",
         "bs.m_hydraulic_protection",
         "bs.m_marker",
-        "bs.s_borehole",
+        "bs.s_explorationpoint",
       ];
       var std = [];
       this.enclosureData = [];

--
Gitblit v1.9.3