From c42e12bcc0877678cf09438b7a6bfb9ccd7342fa Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期五, 24 三月 2023 19:06:08 +0800
Subject: [PATCH] 转孔柱状图添加图例,官网一张图修改

---
 src/store/index.js                     |    3 
 src/components/MapView/mapMenuPop.vue  |   16 +
 src/components/mapsdk.vue              |   73 ++++
 src/views/Tools/queryinfo.vue          |    7 
 src/components/MapView/mapSpacePop.vue |  405 +++++++++++++++----------
 src/components/Screen/ProjectTree.vue  |  429 ++++++++++++++++++++++----
 6 files changed, 694 insertions(+), 239 deletions(-)

diff --git a/src/components/MapView/mapMenuPop.vue b/src/components/MapView/mapMenuPop.vue
index 1a65fa8..823de1a 100644
--- a/src/components/MapView/mapMenuPop.vue
+++ b/src/components/MapView/mapMenuPop.vue
@@ -735,6 +735,22 @@
       this.$refs.dialogPayChannel.doLayout()
       // this.showAllImage(data.result)
     },
+    //鏍煎紡鍖栨椂闂�
+    format(shijianchuo) {
+      //shijianchuo鏄暣鏁帮紝鍚﹀垯瑕乸arseInt杞崲
+      var time = new Date(shijianchuo);
+      var y = time.getFullYear();
+      var m = time.getMonth() + 1;
+      var d = time.getDate();
+      var h = time.getHours();
+      var mm = time.getMinutes();
+      var s = time.getSeconds();
+      return y + "-" + this.add0(m) + "-" + this.add0(d);
+    },
+    //鏍煎紡鍖栨椂闂�
+    add0(m) {
+      return m < 10 ? "0" + m : m;
+    },
     async showAllImage(res) {
       for (var i in res) {
         let properties = res[i]
diff --git a/src/components/MapView/mapSpacePop.vue b/src/components/MapView/mapSpacePop.vue
index b7e6ecc..309d420 100644
--- a/src/components/MapView/mapSpacePop.vue
+++ b/src/components/MapView/mapSpacePop.vue
@@ -3,6 +3,43 @@
     <div style="padding: 5px">
       <el-form
         :inline="true"
+        :model="ruleForm"
+        class="demo-form-inline"
+      >
+        <el-form-item>
+          <el-input
+            size="small"
+            style="width:47vh"
+            v-model="ruleForm.fileName"
+            disabled
+            placeholder="璇疯緭鍏�..."
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button
+            @click="conditionVisible = true"
+            size="small"
+            type="success"
+          >鏂板</el-button>
+          <el-button
+            size="small"
+            @click="resetForm"
+          >閲嶇疆</el-button>
+        </el-form-item>
+        <el-form-item v-if="spaceLayer == 'sexplorationpoint'">
+          <el-button
+            size="small"
+            @click="spaceHistogram( )"
+            plain
+          >鏌辩姸鍥�</el-button>
+          <!-- <el-button
+            plain
+            size="small"
+          >鍓栧垏鍥�</el-button> -->
+        </el-form-item>
+      </el-form>
+      <!-- <el-form
+        :inline="true"
         :model="formInline"
         class="demo-form-inline"
       >
@@ -66,9 +103,9 @@
           <!-- <el-button
             plain
             size="small"
-          >鍓栧垏鍥�</el-button> -->
-        </el-form-item>
-      </el-form>
+          >鍓栧垏鍥�</el-button>
+      </el-form-item>
+      </el-form> -->
       <div class="centTable">
         <el-table
           :data="tableData"
@@ -135,6 +172,81 @@
         </el-pagination>
       </div>
     </div>
+    <el-dialog
+      :visible.sync="conditionVisible"
+      title="楂樼骇鏌ヨ"
+      width="44%"
+      :close-on-click-modal="false"
+      :modal="false"
+    >
+
+      <el-form
+        :inline=" true"
+        :model="formSql"
+        class="demo-form-inline"
+        label-position="top"
+      >
+
+        <el-form-item>
+          <el-select
+            @change="fieldChange($event)"
+            v-model="formSql.field"
+            :popper-append-to-body="false"
+          >
+            <el-option
+              v-for="item in filedsOption"
+              :key="item.field"
+              :label="item.alias"
+              :value="item.field"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-select
+            :popper-append-to-body="false"
+            v-model="formSql.condition"
+          >
+            <el-option
+              v-for="item in condOption"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item v-show="!fromSqlflag">
+          <el-input v-model="formSql.value"></el-input>
+        </el-form-item>
+        <el-form-item v-show="fromSqlflag">
+          <el-date-picker
+            v-model="formSql.date"
+            type="date"
+            placeholder="閫夋嫨鏃ユ湡"
+            value-format="yyyy-MM-dd"
+          >
+          </el-date-picker>
+        </el-form-item>
+
+      </el-form>
+
+      <span
+        slot="footer"
+        class="dialog-footer"
+      >
+        <el-button
+          size="small"
+          @click="startFiledAndcondition"
+        >鍙� 娑�</el-button>
+        <el-button
+          class="primaries"
+          size="small"
+          @click="appendQueryFilter"
+        >纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -148,6 +260,7 @@
   encr,
 } from "../../api/api.js"
 import * as turf from "@turf/turf"
+import { conditions } from "../../views/Archive/Archive.js";
 export default {
   computed: {
     storeTime() {
@@ -156,6 +269,13 @@
   },
   data() {
     return {
+      conditionVisible: false,
+      filedsOption: [],
+      condOption: [],
+      ruleForm: {
+        fileName: "",
+      },
+      fromSqlflag: false,
       count: 0,
       listdata: {
         pageIndex: 1,
@@ -223,12 +343,21 @@
       imagePoint: null,
       domainsLayer: null,
       querytype: null,
+
+      formSql: {
+        field: "",
+        condition: "",
+        value: "",
+        type: "",
+        date: "",
+      },
     }
   },
   watch: {
     async storeTime(index) {
       this.spaceLayer = index
-      this.getDomainsLayer()
+      this.resetForm();
+      // this.getDomainsLayer()
       // this.getTableselectFields();
       // this.restSpacePopLayer();
     },
@@ -237,12 +366,43 @@
     this.spaceLayer = this.$store.state.mapSpaceQueryLayer
     // this.showSpacePopLayer();
     //   this.getTableselectFields();
-
-
-    this.getDomainsLayer()
+    this.resetForm();
+    // this.getDomainsLayer()
   },
 
   methods: {
+    fieldChange(value) {
+      var obj = {};
+      obj = this.filedsOption.find(function (item) {
+        return item.field === value;
+      });
+      this.conditionChange(obj);
+    },
+    conditionChange(res) {
+      this.formSql.field = res.field;
+      this.formSql.type = res.type;
+      if (res.type == "date" || res.type == "datetime") {
+        this.fromSqlflag = true;
+      } else {
+        this.fromSqlflag = false;
+      }
+      var std = [];
+      this.condOption = [];
+      if (res.type == "text" || res.type == "blob") {
+        std = conditions[0];
+      } else if (res.type == "date" || res.type == "datetime") {
+        std = conditions[2];
+      } else {
+        std = conditions[1];
+      }
+      for (var i in std) {
+        this.condOption.push({
+          label: std[i],
+          value: std[i],
+        });
+      }
+      this.formSql.condition = this.condOption[0].value;
+    },
     closeSpaceBox() {
       if (this.imagePoint != null) {
         sgworld.Creator.DeleteObject(this.imagePoint)
@@ -328,7 +488,7 @@
       if (data.code != 200) {
         this.$message.error("鍒楄〃璋冪敤澶辫触")
       }
-
+      this.filedsOption = [];
       this.optionx = []
       var valadata = data.result
       for (var i in valadata) {
@@ -340,10 +500,63 @@
             valadata[i].domainNa = this.getMatchDomainNa(valadata[i].domainNa)
           }
           this.optionx.push(valadata[i])
+          this.filedsOption.push(valadata[i])
           this.attributeData.push(valadata[i])
         }
       }
+      this.startFiledAndcondition();
       this.showSpacePopLayer()
+    },
+    appendQueryFilter() {
+      if (this.formSql.type == "date" || this.formSql.type == "datetime") {
+        if (this.formSql.date == null) {
+          this.$message.error("璇疯緭鍏ヨ鏌ヨ鐨勪俊鎭�!");
+          return;
+        }
+      } else {
+        if (this.formSql.value == "") {
+          this.$message.error("璇疯緭鍏ヨ鏌ヨ鐨勪俊鎭�!");
+          return;
+        }
+      }
+
+      if (this.ruleForm.fileName != "") {
+        this.ruleForm.fileName += " and ";
+      }
+      var val;
+
+      if (this.formSql.type == "long" || this.formSql.type == "integer") {
+        val = parseInt(this.formSql.value);
+      } else if (this.formSql.type == "double") {
+        if (this.formSql.value.indexOf(".") != -1) {
+          val = this.formSql.value;
+        } else {
+          val = parseFloat(this.formSql.value).toFixed(1);
+        }
+      } else if (
+        this.formSql.type == "date" ||
+        this.formSql.type == "datetime"
+      ) {
+        var time = new Date(this.formSql.date);
+        var m = time.getMonth() + 1;
+        var d = time.getDate();
+        var y = time.getFullYear();
+        val = "'" + y + "-" + this.add0(m) + "-" + this.add0(d) + "'";
+      } else {
+        val = "'" + this.formSql.value + "'";
+      }
+      this.ruleForm.fileName +=
+        this.formSql.field + " " + this.formSql.condition + " " + val;
+
+      this.startFiledAndcondition();
+      this.getSpaceTableLayer();
+    },
+
+    startFiledAndcondition() {
+      this.conditionVisible = false;
+      this.conditionChange(this.filedsOption[0]);
+      this.formSql.value = "";
+      this.formSql.date = new Date();
     },
     getMatchDomainNa(res) {
       var std = null
@@ -365,35 +578,27 @@
       this.setListDataStart()
       this.getTableselectFields()
     },
+
+
+
+    resetForm() {
+      this.ruleForm.fileName = "";
+      this.listdata.pageIndex = 1;
+      this.listdata.pageSize = 10;
+      //鑾峰彇table淇℃伅
+      this.getDomainsLayer()
+    },
+
     //鍒濆鍖栨煡璇㈣〃鏍间俊鎭�
     async getSpaceTableLayer() {
-      this.listdata.name = this.spaceLayer
-      if (this.formInline.input == undefined || this.formInline.input == null) {
-        this.listdata.filter = null
-      } else {
-        var val
-        var value = this.formInline.input
-        if (this.querytype == "long" || this.querytype == "integer") {
-          val = parseInt(value)
-        } else if (this.querytype == "double") {
-          if (this.formSql.value.indexOf(".") != -1) {
-            val = value
-          } else {
-            val = parseFloat(value).toFixed(1)
-          }
-        } else if (this.querytype == "date" || this.querytype == "datetime") {
-          var time = new Date(value)
-          var m = time.getMonth() + 1
-          var d = time.getDate()
-          var y = time.getFullYear()
-          val = "'" + y + "-" + this.add0(m) + "-" + this.add0(d) + "'"
-        } else {
-          val = "'" + value + "'"
-        }
 
-        this.listdata.filter =
-          this.formInline.name + " " + this.formInline.region + " " + val
+      this.listdata.name = this.spaceLayer
+      if (this.ruleForm.fileName != "") {
+        this.listdata.filter = this.ruleForm.fileName;
+      } else {
+        this.listdata.filter = null;
       }
+
 
       const data = await dataQuerySelectByPage(this.listdata)
       if (data.code != 200) {
@@ -480,6 +685,8 @@
       if (data.code != 200) {
         return this.$message.error("鍒楄〃璋冪敤澶辫触")
       }
+
+      this.count = data.count;
       if (data.result.length == 0) {
         return this.$message({
           message: '鏈煡璇㈠埌杞瓟鐐规暟鎹�',
@@ -520,7 +727,7 @@
           })
 
 
-          this.listdata.count = data.count;
+
           this.tableData = val;
 
           this.showHistogramLayer(data.count)
@@ -613,15 +820,7 @@
             }
           }
         }
-        // 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 outlineList = [
           { 'name': '绮夎川榛忓湡', 'color': 'rgba(139,106,77,1)' },
           { 'name': '娣ゆ偿璐ㄧ矇鍦�', 'color': 'rgba(141,85,69,1)' },
@@ -666,14 +865,14 @@
           this.$store.state.histogramLayer.push(layer)
         }
       }
-
+      this.$store.state.histLenged = true;
     },
 
 
 
 
     spaceHistogram() {
-      this.restSpacePopLayer();
+      this.resetForm();
       if (this.$store.state.histogramLayer.length != 0) {
         for (var i in this.$store.state.histogramLayer) {
           Viewer.entities.remove(this.$store.state.histogramLayer[i])
@@ -691,122 +890,6 @@
         that.setCartesianToEightFour(entity)
       });
 
-
-
-
-      // 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.length != 0) {
-      //   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]),
-      //       tag: 'Histogram',
-      //       properties: val[i],
-      //       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)
-      //   }
-      //   window.histogramHandler = new Cesium.ScreenSpaceEventHandler(
-      //     sgworld.Viewer.scene.canvas
-      //   )
-      //   var that = this;
-      //   window.histogramHandler.setInputAction((event) => {
-      //     // var ellipsoid = sgworld.Viewer.scene.globe.ellipsoid;
-      //     // var cartesian = sgworld.Viewer.scene.camera.pickEllipsoid(event.endPosition, ellipsoid);
-      //     var pick = sgworld.Viewer.scene.pick(event.endPosition);
-      //     var selectedEntity = null;
-
-      //     if (Cesium.defined(pick)) {
-      //       if (pick && pick.id && pick.id.tag && pick.id.tag == "Histogram") {
-
-      //         that.$store.state.propertiesInfo = {
-      //           title: pick.id.properties._exppointid._value,
-      //           name: pick.id.properties._geoname._value,
-      //           type: pick.id.properties.geotype._value,
-      //           botdepth: pick.id.properties._botdepth._value,
-      //           describe: pick.id.properties._describe._value,
-      //         }
-      //         that.$store.state.propertiesFlag = "2"
-      //       } else {
-      //         that.$store.state.propertiesFlag = null
-      //       }
-      //     } else {
-      //       that.$store.state.propertiesFlag = null
-      //     }
-
-      //   }, Cesium.ScreenSpaceEventType.MOUSE_MOVE)
-
-
-      // } else {
-      //   var msg = row.exppointid + " 娌″嫎鎺㈢偣鍦板眰琛ㄦ暟鎹紝鏃犳硶鐢熸垚鏌辩姸鍥�"
-      //   this.$message.error(msg);
-      // }
     },
     async spaceLocation(index, row) {
       var param = {
diff --git a/src/components/Screen/ProjectTree.vue b/src/components/Screen/ProjectTree.vue
index e237329..05e9259 100644
--- a/src/components/Screen/ProjectTree.vue
+++ b/src/components/Screen/ProjectTree.vue
@@ -10,6 +10,7 @@
       suffix-icon="el-icon-search"
       v-model="filterText"
       size="mini"
+      :filter-node-method="filterNode"
     >
     </el-input>
     <div class="tree-container">
@@ -23,6 +24,7 @@
         class="el-tree"
         @check="handleCheckChange"
         :filter-node-method="filterNode"
+        @node-click="handleLeftclick"
       >
         <div
           style="display: flex"
@@ -77,7 +79,7 @@
 <script>
 import { right_menu, right_list, image_layer } from "@/assets/js/index.js"
 
-import { perms_selectLayers } from "@/api/api.js"
+import { perms_selectLayers, comprehensive_selectPubById } from "@/api/api.js"
 
 export default {
   data() {
@@ -85,7 +87,7 @@
       treeData: [],
       defaultProps: {
         children: "children",
-        label: "label",
+        label: "cnName",
       },
       typeIndex: null,
       leftMenuOpen: false,
@@ -100,6 +102,7 @@
       isMenuLayer: true,
       openEcharts: false,
       filterText: "",
+      mptLayer: [],
     }
   },
 
@@ -119,6 +122,12 @@
     },
   },
   methods: {
+    // 鏌ヨ
+    filterNode(value, data) {
+
+      if (!value) return true;
+      return data.cnName.indexOf(value) !== -1;
+    },
     setShowCheckedLayer() {
       var value = this.$refs.tree.getCheckedNodes();
       var std = [];
@@ -136,79 +145,365 @@
       if (data.code != 200) {
         return this.$message.error("鍥惧眰鍒楄〃鏌ヨ澶辫触")
       }
-      var std = []
-      var layer_list = []
-      var layer_groups = []
-      var layerData = [];
-      for (var i in data.result) {
-        if (data.result[i].type == 1) {
-          layer_groups.push({
-            id: data.result[i].id,
-            label: data.result[i].cnName,
-            type: data.result[i].type,
-            isEdit: false,
-            children: [],
-          })
-        } else if (data.result[i].type == 2) {
-          if (data.result[i].url != null) {
-            var layer_entity = {
-              id: data.result[i].id,
-              pid: data.result[i].pid,
-              label: data.result[i].cnName,
-              resource: data.result[i].url,
-              type: data.result[i].type,
-              isEdit: false,
-            }
-            layer_list.push(layer_entity)
-            if (data.result[i].isShow == 1) {
-              std.push(data.result[i].id)
-              layerData.push(data.result[i])
-              // this.setAddImageLayer(layer_entity)
-            }
-          }
-        }
-      }
-      for (var i in layer_list) {
-        for (var j in layer_groups) {
-          if (layer_list[i].pid === layer_groups[j].id) {
-            layer_groups[j].children.push(layer_list[i])
-          }
-        }
-      }
-      this.treeData = layer_groups
+      var std = data.result;
+      var that = this;
+      var checkKey = [];
 
-      this.$refs.tree.setCheckedKeys(std)
-      this.setShowImageLayer(layerData)
+      var val = std.filter((str) => {
+        if (str.type == 1) {
+          return str;
+        }
+        if (str.url != null && str.type == 2) {
+          if (str.isShow == 1) {
+            checkKey.push(str.id);
+          }
+          return str;
+        }
+      });
+      var value = std.filter((str) => {
+        if (str.url != null && str.type == 2 && str.isShow == 1) {
+          return str;
+        }
+      })
+
+
+
+      this.$refs.tree.setCheckedKeys(checkKey)
+      var res = this.setTreeData(val);
+
+      this.treeData = res
+
+
+      this.setShowImageLayer(value)
+    },
+    setTreeData(source) {
+      let cloneData = JSON.parse(JSON.stringify(source)); // 瀵规簮鏁版嵁娣卞害鍏嬮殕
+      return cloneData.filter((father) => {
+        // 寰幆鎵�鏈夐」
+        let branchArr = cloneData.filter((child) => father.id == child.pid); // 瀵规瘮ID锛屽垎鍒笂涓嬬骇鑿滃崟锛屽苟杩斿洖鏁版嵁
+        branchArr.length > 0 ? (father.children = branchArr) : ""; // 缁欑埗绾ф坊鍔犱竴涓猚hildren灞炴�э紝骞惰祴鍊�
+        // 灞炰簬鍚屼竴瀵硅薄闂锛屼緥濡傦細浠� a=b銆乧=1 锛岀劧鍚庡啀浠� b.c=c 锛� 閭d箞 a.c=b.c=c=1 锛涘悓鐞嗭紝鍚庣画浠� c.d=2 ,閭d箞 a.c.d 涔熸槸=2锛�
+        // 鐢辨寰幆澶氭鍚庯紝灏辫兘褰㈡垚鐩稿簲鐨勬爲褰㈡暟鎹粨鏋�
+        return father.pid == 0; // 杩斿洖涓�绾ц彍鍗�
+      });
     },
     handleCheckChange(data, checked, indeterminate) {
-      // if (data.children != null) return
-      // var std = []
-      // for (var i = 0; i < Viewer.imageryLayers._layers.length; i++) {
-      //   var val_id = Viewer.imageryLayers._layers[i].imageryProvider.name
-      //   if (val_id == data.label) {
-      //     std.push(data.label)
-      //     const img_layer = Viewer.imageryLayers._layers[i]
-      //     img_layer.show = checked
+
+
+
+      // var wmsLayer = [];
+      // var tilesetLayer = [];
+      // var tmsLayer = [];
+      // var mptLayer = [];
+      // for (var i in data) {
+      //   if (data[i].type == 2) {
+      //     switch (data[i].serveType) {
+      //       case "WMS":
+      //         wmsLayer.push(data[i])
+      //         break;
+      //       case "Tileset":
+      //         tilesetLayer.push(data[i])
+      //         break;
+      //       case "TMS":
+      //         tmsLayer.push(data[i])
+      //         break;
+      //       case "Mpt":
+      //         mptLayer.push(data[i])
+      //         break;
+      //     }
       //   }
       // }
-      // if (std.length == 0 && checked == true) {
-      //   this.setAddImageLayer(data)
-      // }
-      this.setClearWmsLayer()
-      var value = this.$refs.tree.getCheckedNodes();
-      var url = [];
-      for (var i in value) {
-        if (value[i].resource && value[i].type == 2) {
 
-          url.push(value[i].resource)
+
+
+      if (data.type == 1) {
+        this.childOption = [];
+        this.getchilds(data);
+        var listWMS = [];
+        var listWFS = [];
+        var listTileset = [];
+        var listTMS = [];
+        var listMpt = [];
+        for (var i in this.childOption) {
+          switch (this.childOption[i].serveType) {
+            case 'WMS':
+              listWMS.push(this.childOption[i])
+              break;
+            case 'Tileset':
+              listTileset.push(this.childOption[i])
+              break;
+            case 'Mpt':
+              listMpt.push(this.childOption[i])
+              break;
+            case 'TMS':
+              listTMS.push(this.childOption[i])
+              break;
+
+          }
+        }
+        this.setShowWMSLayer(listWMS);
+        this.setShowTilesetLayer(listTileset);
+        this.setShowMptLayer(listMpt);
+        this.setShowTMSLayer(listTMS);
+      } else if (data.type == 2) {
+        if (data.serveType == "WMS") {
+          this.setShowWMSLayer([data]);
+        } else if (data.serveType == "Tileset") {
+          this.setShowTilesetLayer([data]);
+        } else if (data.serveType == "Mpt") {
+          this.setShowMptLayer([data]);
+        } else if (data.serveType == "TMS") {
+          this.setShowTMSLayer([data]);
+        }
+      }
+    },
+    handleLeftclick(data, node) {
+
+      if (node.checked == true) {
+        if (data.serveType == 'Tileset') {
+          for (var i in Viewer.scene.primitives._primitives) {
+            if (
+              Viewer.scene.primitives._primitives[i].id == data.cnName
+            ) {
+              Viewer.flyTo(Viewer.scene.primitives._primitives[i]);
+            }
+          }
+        }
+      }
+    },
+    getchilds(source) {
+      if (source.children) {
+        var child = source.children
+        for (var i in child) {
+          if (child[i].children) {
+            this.getchilds(child[i])
+          } else {
+            this.childOption.push(child[i])
+          }
+        }
+      } else {
+        this.childOption.push(source)
+      }
+    },
+    setAddTMSLayers(res) {
+      var url = res.url;
+      if (res.url.indexOf("{host}") != -1) {
+        url = res.url.replace("{host}", iisHost);
+      }
+
+      if (res.pubid && res.pubid > 0) {
+        this.setQueryPubid(res);
+      } else {
+        var layer = Viewer.imageryLayers.addImageryProvider(
+          new Cesium.UrlTemplateImageryProvider({
+            url: url,
+            maximumLevel: 18,
+          })
+        );
+        layer.name = res.cnName;
+        setTimeout(() => {
+          this.getWMSLayer();
+        }, 100);
+      }
+    },
+    async setQueryPubid(res) {
+      const data = await comprehensive_selectPubById({ id: res.pubid })
+      if (data.code != 200) {
+
+      } else {
+        var url = data.result.url;
+        if (res.url.indexOf("{host}") != -1) {
+          url = res.url.replace("{host}", iisHost);
+        }
+        var layer = Viewer.imageryLayers.addImageryProvider(
+          new Cesium.UrlTemplateImageryProvider({
+            url: url,
+            maximumLevel: 18,
+          })
+        );
+        layer.name = res.cnName;
+
+        if (data.result.geom) {
+          var wkt = this.$wkt.parse(data.result.geom);
+          Viewer.camera.flyTo({
+            destination: Cesium.Cartesian3.fromDegrees(wkt.coordinates[1], wkt.coordinates[0], 2000),
+          });
+        }
+        setTimeout(() => {
+          this.getWMSLayer();
+        }, 100);
+      }
+    },
+    setShowTMSLayer(result) {
+      var value = this.$refs.tree.getCheckedNodes();
+      var std = [];
+      for (var i in value) {
+        std.push(value[i].id)
+      }
+      for (var i in result) {
+        var tile = result[i]
+        if (std.indexOf(tile.id) != -1) {
+          this.setAddTMSLayers(tile)
+
+        } else {
+          for (var i = 0; i < window.Viewer.imageryLayers._layers.length; i++) {
+            var val_id = window.Viewer.imageryLayers._layers[i].name;
+            if (val_id == tile.cnName) {
+              window.Viewer.imageryLayers.remove(
+                window.Viewer.imageryLayers._layers[i]
+              );
+            }
+          }
+        }
+      }
+    },
+    setShowMptLayer(result) {
+      var value = this.$refs.tree.getCheckedNodes();
+      var std = [];
+      for (var i in value) {
+        std.push(value[i].id)
+      }
+      for (var i in result) {
+        var tile = result[i]
+        if (std.indexOf(tile.id) != -1) {
+          this.setAddMPTLayers(tile)
+
+        } else {
+          for (var i in this.mptLayer) {
+            if (this.mptLayer[i].treeobj.name == tile.cnName) {
+              this.mptLayer[i].deleteObject();
+              this.mptLayer.splice(i, 1)
+            }
+          }
+        }
+      }
+    },
+    setAddMPTLayers(res) {
+      if (res.url.indexOf("{host}") != -1) {
+        res.url = res.url.replace("{host}", iisHost);
+      }
+      var url = res.url.split(';')
+
+      var layer = sgworld.Creator.createImageryProvider(res.cnName, "wms", {
+        url: url[0],
+        layers: url[1]
+      }, "0", undefined, true, "");
+
+      this.mptLayer.push(layer)
+      setTimeout(() => {
+        this.getWMSLayer();
+      }, 100);
+    },
+    getWMSLayer() {
+      var value = this.$refs.tree.getCheckedNodes();
+      var std = [];
+      for (var i in value) {
+        if (value[i].type == 2 && value[i].serveType == "WMS") {
+          std.push(value[i])
+        }
+      }
+      this.setShowWMSLayer(std);
+    },
+
+
+
+
+
+
+    setShowTilesetLayer(result) {
+      var value = this.$refs.tree.getCheckedNodes();
+      var std = [];
+      for (var i in value) {
+        std.push(value[i].id)
+      }
+      for (var i in result) {
+        var tile = result[i]
+        if (std.indexOf(tile.id) != -1) {
+          this.setAddTilesetLayers(tile)
+        } else {
+          for (var j in Viewer.scene.primitives._primitives) {
+            if (Viewer.scene.primitives._primitives[j].id == tile.cnName) {
+              Viewer.scene.primitives.remove(Viewer.scene.primitives._primitives[j])
+            }
+          }
+        }
+      }
+
+    },
+    setAddTilesetLayers(res) {
+      var url;
+      if (res.url.indexOf("{host}") != -1) {
+        url = res.url.replace("{host}", iisHost);
+      } else {
+        url = modelUrl + "/" + res.url
+      }
+      var tileset = Viewer.scene.primitives.add(
+        new Cesium.Cesium3DTileset({
+          name: res.cnName,
+          url: url, //192.168.20.106,to4
+          maximumScreenSpaceError: 64, // 鏈�澶у睆骞曠┖闂撮敊璇細16
+          maximumMemoryUsage: 768, // 鏈�澶у唴瀛橈細512
+          dynamicScreenSpaceError: true, // 鍑忓皯绂荤浉鏈鸿緝杩滅殑灞忓箷绌洪棿閿欒锛歠alse
+          skipLevelOfDetail: true, // 鍦ㄩ亶鍘嗘椂鍊欒烦杩囪鎯咃細false
+        })
+      );
+      tileset.readyPromise.then((tileset) => {
+        tileset.id = res.cnName;
+        tileset.layerId = res.id;
+        this.getTilesetArgs(tileset, res);
+      });
+    },
+    async getTilesetArgs(tileset, res) {
+      if (res.pubid > 0) {
+        const data = await comprehensive_selectPubById({ id: res.pubid })
+        if (data.code != 200) {
+        } else {
+          this.reload(tileset, data.result.json)
+        }
+      } else {
+        this.tileSet(tileset, parseFloat(res.elev))
+      }
+    },
+    reload(tileset, res) {
+      var vm = JSON.parse(res)
+      var pos = Cesium.Cartesian3.fromDegrees(vm.lon, vm.lat, vm.height);
+      var converter = Cesium.Transforms.eastNorthUpToFixedFrame;
+      var hpr = new Cesium.HeadingPitchRoll(Cesium.Math.toRadians(vm.yaw), 0, 0);
+      var matrix = Cesium.Transforms.headingPitchRollToFixedFrame(pos, hpr, Cesium.Ellipsoid.WGS84, converter);
+      tileset._root.transform = matrix;
+      Viewer.flyTo(tileset);
+    },
+    tileSet(tileset, height) {
+      //3dtile妯″瀷鐨勮竟鐣岀悆浣�
+      var boundingSphere = tileset.boundingSphere;
+      //杩崱灏旂┖闂寸洿瑙掑潗鏍�=>鍦扮悊鍧愭爣锛堝姬搴﹀埗锛�
+      var cartographic_original = Cesium.Cartographic.fromCartesian(boundingSphere.center);
+      //鍦扮悊鍧愭爣锛堝姬搴﹀埗锛�=>杩崱灏旂┖闂寸洿瑙掑潗鏍�
+      var Cartesian3_original = Cesium.Cartesian3.fromRadians(cartographic_original.longitude, cartographic_original.latitude, cartographic_original.height);
+      var Cartesian3_offset = Cesium.Cartesian3.fromRadians(cartographic_original.longitude, cartographic_original.latitude, height);
+      //鑾峰緱鍦伴潰鍜宱ffset鐨勮浆鎹�
+      var translation = Cesium.Cartesian3.subtract(Cartesian3_offset, Cartesian3_original, new Cesium.Cartesian3());
+      //淇敼妯″瀷鐭╅樀
+      tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
+      Viewer.flyTo(tileset);
+    },
+
+
+
+
+    setShowWMSLayer(res) {
+      var url = [];
+      this.setClearWmsLayer();
+      for (var i in res) {
+        if (res[i].url) {
+          url.push(res[i].url)
         }
       }
       url = url.reverse();
       this.setAddImageLayer(url)
     },
-
     setShowImageLayer(res) {
-      this.setClearWmsLayer()
+
       var url = [];
       for (var i in res) {
         url.push(res[i].enName)
@@ -260,10 +555,10 @@
         Viewer.imageryLayers._layers[3].show = true
       }
     },
-    filterNode(value, data) {
-      if (!value) return true
-      return data.label.indexOf(value) !== -1
-    },
+    // filterNode(value, data) {
+    //   if (!value) return true
+    //   return data.label.indexOf(value) !== -1
+    // },
   },
 }
 </script>
diff --git a/src/components/mapsdk.vue b/src/components/mapsdk.vue
index 6e6ad87..34decec 100644
--- a/src/components/mapsdk.vue
+++ b/src/components/mapsdk.vue
@@ -337,14 +337,7 @@
         v-show="showLengendDialog"
       >
         <el-card class="box-card">
-          <!-- <div
-            class="lengend_color"
-            style="height:205px"
-          >
-
-          </div> -->
           <div class="lengendBox">
-
             <div>
               <img
                 class="lengendImg"
@@ -358,8 +351,65 @@
               <div>52.5掳</div>
               <div>70掳</div>
             </div>
-
           </div>
+        </el-card>
+      </div>
+      <div
+        class="HistLeng"
+        v-show="$store.state.histLenged"
+      >
+        <el-card class="box-card">
+          <table>
+            <tr>
+              <td>绮夎川榛忓湡</td>
+              <td>
+                <div style="width:100px;height:20px;background:rgba(139,106,77,1)">
+                </div>
+              </td>
+            </tr>
+            <tr>
+              <td>娣ゆ偿璐ㄧ矇鍦�</td>
+              <td>
+                <div style="width:100px;height:20px;background:rgba(141,85,69,1)">
+                </div>
+              </td>
+            </tr>
+            <tr>
+              <td>鍦嗙牼</td>
+              <td>
+                <div style="width:100px;height:20px;background:rgba(102,166,184,1)">
+                </div>
+              </td>
+            </tr>
+            <tr>
+              <td>鍗电煶</td>
+              <td>
+                <div style="width:100px;height:20px;background:rgba(54,83,173,1)">
+                </div>
+              </td>
+            </tr>
+            <tr>
+              <td>娉ュ博</td>
+              <td>
+                <div style="width:100px;height:20px;background:rgba(47,30,13,1)">
+                </div>
+              </td>
+            </tr>
+            <tr>
+              <td>缁嗙爞</td>
+              <td>
+                <div style="width:100px;height:20px;background:rgba(93,88,15,1)">
+                </div>
+              </td>
+            </tr>
+            <tr>
+              <td>涓爞</td>
+              <td>
+                <div style="width:100px;height:20px;background:rgba(164,140,21,1)">
+                </div>
+              </td>
+            </tr>
+          </table>
         </el-card>
       </div>
       <!--灞炴�т俊鎭脊绐�-->
@@ -1691,7 +1741,12 @@
       position: absolute;
       z-index: 40;
     }
-
+    .HistLeng {
+      z-index: 40;
+      position: absolute;
+      right: 115px;
+      bottom: 10px;
+    }
     .lengend {
       width: 300px;
       z-index: 40;
diff --git a/src/store/index.js b/src/store/index.js
index 1294515..c7791ed 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -70,7 +70,8 @@
     catModelInfo: null,
     showPopBoxFlag: false,
     pickoption: null,
-    previewLayer: null
+    previewLayer: null,
+    histLenged: false,
   },
   mutations: {
     //鑾峰彇鏉冮檺鍚堥泦
diff --git a/src/views/Tools/queryinfo.vue b/src/views/Tools/queryinfo.vue
index 456ce32..349ff1a 100644
--- a/src/views/Tools/queryinfo.vue
+++ b/src/views/Tools/queryinfo.vue
@@ -11,7 +11,10 @@
       top="calc(100% - 470px) "
     >
       <div>
-        <div style="width:940px;height:400px;" v-drag>
+        <div
+          style="width:940px;height:400px;"
+          v-drag
+        >
           <map-menu-pop v-if="$store.state.mapPopBoxFlag == '1'" />
           <map-space-pop v-if="$store.state.mapPopBoxFlag == '2'" />
           <pipe-line-analy v-if="$store.state.mapPopBoxFlag == '3'" />
@@ -120,6 +123,8 @@
         )
         window.histogramHandler = null
       }
+
+      this.$store.state.histLenged = false;
     },
     // 鎵撳紑寮圭獥
     open(title, value, style = {}) {

--
Gitblit v1.9.3