Browse Source

Merge branch 'master' of http://114.244.114.158:8802/siwei/real3d-portalsite

zpf 11 months ago
parent
commit
f3d0ad4901

+ 2 - 0
src/components/Combinations/LayerManage/LayerManage.vue

@@ -263,6 +263,7 @@ export default {
       }
       store.setVectorLayerList(this.vectorlayerlist);
       store.setModelLayerList(this.modellayerlist);
+      store.setlayerparamsList(this.layerparams);
     },
     checkedChange(obj) {
       let imageryLayers = viewer.imageryLayers;
@@ -296,6 +297,7 @@ export default {
               })
             );
             this.layerparams[obj.id] = layer;
+            
             // viewer.flyTo(layer);
             break;
           case "Vector": //矢量

+ 24 - 2
src/components/Combinations/LayerManage/LayerManageSplit.vue

@@ -144,6 +144,9 @@ import { Collect, GetResourceTree, GetMyCollect } from "@/api/map";
 export default {
   name: "LayerManageSplit",
   props: {
+    type: {
+      type: String,
+    },
     splitId: {
       type: Number,
       default: false,
@@ -194,8 +197,14 @@ export default {
       this.$refs.tree.setCheckedKeys(keys);
     },
     filterNode(value, data) {
-      if (!value) return true;
-      return data.label.indexOf(value) !== -1;
+      let addjudge = true;
+      if (this.$props.type == "split") {
+        addjudge = data.type !== "Terrain";
+      } else if (this.$props.type == "roller") {
+        addjudge = data.type == "IMG" || data.type == "Vector";
+      }
+      if (!value) return addjudge;
+      return data.label.indexOf(value) !== -1 && addjudge;
     },
     favoriteHandle(data) {
       // this.$emit("favoriteHandle", data);
@@ -289,6 +298,19 @@ export default {
     treeSearchText(val) {
       this.$refs.tree.filter(val);
     },
+    LayerManageShow: {
+      handler() {
+        if (this.LayerManageShow && this.$props.type) {
+          setTimeout(() => {
+            if (this.$refs.tree) this.$refs.tree.filter("");
+          }, 500);
+          // this.$nextTick(() => {
+          //   if (this.$refs.tree) this.$refs.tree.filter("");
+          // });
+        }
+      },
+      immediate: true,
+    },
   },
 };
 </script>

+ 147 - 19
src/components/Query/clickQuery/clickQuery.vue

@@ -6,9 +6,19 @@
     </div>
     <!-- <div class="sm-function-module-content-btn"> -->
     <div class="btnList">
-      <span v-for="(item, index) in actionOptions" :key="index" class="icon-span" :title="item.lable"
-        :class="item.isSelect ? 'selected-icon' : ''" @click="changleQueryItem(item)">
-        <i class="iconfont iconSize" :class="item.iconName" style="margin-top: 0px"></i>
+      <span
+        v-for="(item, index) in actionOptions"
+        :key="index"
+        class="icon-span"
+        :title="item.lable"
+        :class="item.isSelect ? 'selected-icon' : ''"
+        @click="changleQueryItem(item)"
+      >
+        <i
+          class="iconfont iconSize"
+          :class="item.iconName"
+          style="margin-top: 0px"
+        ></i>
       </span>
       <!-- <el-button type="primary" size="small" @click.stop="mapLayerQuery"
         >点击</el-button
@@ -19,21 +29,44 @@
     </div>
     <div class="sm-function-module-content-tabs">
       <el-tabs @tab-click="handleTabClick" v-model="activeLayerId">
-        <el-tab-pane :label="item.label" :name="item.id" v-for="(item, index) in layerList" :key="index"></el-tab-pane>
+        <el-tab-pane
+          :label="item.label"
+          :name="item.id"
+          v-for="(item, index) in layerList"
+          :key="index"
+        ></el-tab-pane>
       </el-tabs>
     </div>
     <div class="sm-function-module-content-table">
-      <el-collapse :value="activeNames" @change="handleCollapseChange" v-if="activeLayerId &&
-        queryResults[activeLayerId] &&
-        queryResults[activeLayerId].length > 0
-        ">
-        <el-collapse-item :title="'查询结果' + (index + 1)" :name="'查询结果' + (index + 1)"
-          v-for="(item, index) in queryResults[activeLayerId]" :key="index">
+      <el-collapse
+        :value="activeNames"
+        @change="handleCollapseChange"
+        v-if="
+          activeLayerId &&
+          queryResults[activeLayerId] &&
+          queryResults[activeLayerId].length > 0
+        "
+      >
+        <el-collapse-item
+          :title="'查询结果' + (index + 1)"
+          :name="'查询结果' + (index + 1)"
+          v-for="(item, index) in queryResults[activeLayerId]"
+          :key="index"
+        >
           <template slot="title">
             查询结果{{ index + 1
-            }}<i title="定位" class="header-icon el-icon-s-promotion flyBtn2" @click.stop="flyTo(index)"></i>
+            }}<i
+              title="定位"
+              class="header-icon el-icon-s-promotion flyBtn2"
+              @click.stop="flyTo(index)"
+            ></i>
           </template>
-          <el-table :data="item" :show-header="false" border style="width: 100%">
+          <el-table
+            :data="item"
+            :show-header="false"
+            border
+            style="width: 100%"
+          >
             <el-table-column prop="name" label="字段" width="100">
             </el-table-column>
             <el-table-column prop="value" label="值" width="208">
@@ -104,9 +137,7 @@ export default {
       return store.state.toolBar[9];
     },
   },
-  created() {
-
-  },
+  created() {},
   watch: {
     activeLayerId(val) {
       if (val && val != "0") {
@@ -132,9 +163,61 @@ export default {
       this.handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
       this.dataSourceLayer = new Cesium.CustomDataSource("query");
       this.viewer.dataSources.add(this.dataSourceLayer);
-    })
+    });
   },
   methods: {
+    text() {
+      let buildingLayer = scene.layers.find("ResultNetWork@管线#1");
+      buildingLayer.indexedDBSetting.isAttributesSave = true; //保存属性
+
+      var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
+      handler.setInputAction(function (evt) {
+        var position = scene.pickPosition(evt.position);
+
+        if (buildingLayer.getSelection().length > 0) {
+          const selectedId = Number(buildingLayer.getSelection()[0]);
+          buildingLayer.getAttributesById([selectedId]).then(function (atts) {
+            if (atts) {
+              console.log(atts);
+
+              viewer.entities.removeAll();
+
+              var length = Object.keys(atts).length;
+              var des;
+              for (var i = 0; i < length; i++) {
+                var key = Object.keys(atts)[i];
+                var value = atts[key];
+
+                console.log(key);
+                console.log(value);
+
+                var index = i.toString();
+                if (i == 0) {
+                  des =
+                    '<table class="cesium-infoBox-defaultTable"><tbody>' +
+                    "<tr><th>" +
+                    key +
+                    "</th><td>" +
+                    value +
+                    "</td></tr>";
+                } else if (i == length - 1) {
+                  des +=
+                    "<tr><th>" +
+                    key +
+                    "</th><td>" +
+                    value +
+                    "</td></tr>" +
+                    "</tbody></table>";
+                } else {
+                  des += "<tr><th>" + key + "</th><td>" + value + "</td></tr>";
+                }
+              }
+            }
+          });
+        }
+      }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
+    },
+
     toggleVisibility() {
       this.removeMapLayerQuery();
       store.setToolBarAction(9);
@@ -234,14 +317,57 @@ export default {
       that.dataSourceLayer.entities.removeAll();
       //拾取模型
       let pickedFeature = scene.pick(movement.position);
+      console.log("ighui",pickedFeature);
+      let eneityName = pickedFeature.primitive.name
+      let Pid =''
+      // "ResultNetWork@管线#1"///"ResultNetWork_Node@管线#1"
+      if (eneityName.indexOf('管线') > 0) {
+        let buildingLayer = scene.layers.find(eneityName);
+        buildingLayer.indexedDBSetting.isAttributesSave = true; //保存属性
+        if (buildingLayer.getSelection().length > 0) {
+          const selectedId = Number(buildingLayer.getSelection()[0]);
+          console.log(selectedId,'selectedId');
+          buildingLayer.getAttributesById([selectedId]).then(function (atts) {
+            if (atts) {
+              console.log(atts);
+              // var Pid = atts['管线段']
+              console.log(atts["管线段"]);
+              console.log(atts["物探点"]);
+              Pid = atts["管线段"] || atts["物探点"]
+              // viewer.entities.removeAll();
+
+              // var length = Object.keys(atts).length;
+              // var des;
+              // for (var i = 0; i < length; i++) {
+              //   var key = Object.keys(atts)[i];
+              //   var value = atts[key];
+              //   console.log(key);
+              //   console.log(value);
+
+              //   var index = i.toString();
+              //   if (i == 0) {
+              //     des = '<table class="cesium-infoBox-defaultTable"><tbody>' + '<tr><th>' + key + '</th><td>' + value + '</td></tr>';
+              //   } else if (i == length - 1) {
+              //     des += '<tr><th>' + key + '</th><td>' + value + '</td></tr>' + "</tbody></table>";
+              //   } else {
+              //     des += '<tr><th>' + key + '</th><td>' + value + '</td></tr>';
+              //   }
+              // }
+            }
+          });
+        }
+      }
+     
       if (
         scene.pickPositionSupported &&
         Cesium.defined(pickedFeature) &&
         pickedFeature != null &&
         pickedFeature.primitive
       ) {
+
+
         //解构赋值点击对象的id
-        let Pid = pickedFeature.getProperty("id");
+        // let Pid = pickedFeature.getProperty("id");
         let commaIndex = pickedFeature.primitive.url.indexOf("=");
         let substring = "";
         if (commaIndex !== -1) {
@@ -255,7 +381,7 @@ export default {
         if (Pid.indexOf("_") < 0) {
           gwtype = 1;
         } else {
-          Pid = Pid.replace("_", "-");
+          // Pid = Pid.replace("_", "-");
           gwtype = 2;
         }
         GetGDlnfo({ type: gwtype, key: Pid }).then((res) => {
@@ -382,7 +508,8 @@ export default {
               e.features[u].fieldNames.forEach((fieldName, i) => {
                 if (
                   fieldName.toLowerCase().indexOf("shape") < 0 &&
-                  fieldName.toLowerCase().indexOf("sm") && e.features[u].fieldValues[i] != ''
+                  fieldName.toLowerCase().indexOf("sm") &&
+                  e.features[u].fieldValues[i] != ""
                 ) {
                   cur.push({
                     name: fieldName,
@@ -578,6 +705,7 @@ export default {
     changleQueryItem(item) {
       switch (item.index) {
         case 1: {
+          // this.text();
           this.mapQuerys("mapLayerQuery"); //图层点击事件
           break;
         }

+ 4 - 1
src/components/Viewer/smViewer.vue

@@ -8,13 +8,16 @@
     <china-epidemic-map></china-epidemic-map>
     <world-epidemic-map></world-epidemic-map> -->
     <split-screen></split-screen>
+    <rollerScreen></rollerScreen>
   </div>
 </template>
 
 <script>
 import Config from "@/common/js/webServeConfig.js";
+import rollerScreen from '../sceneAtttribute/splitScreen/rollerScreen'
 export default {
   name: "sm-viewer",
+  components:{ rollerScreen },
   props: {
     combination: {
       //组合接口
@@ -129,7 +132,7 @@ export default {
       // viewer.scene.globe.enableLighting = true;
 
       if (window.baseImgLayer) {
-        viewer.imageryLayers.addImageryProvider(
+       viewer.imageryLayers.addImageryProvider(
           new Cesium.SuperMapImageryProvider({
             url: window.baseImgLayer,
           })

+ 2 - 1
src/components/sceneAtttribute/otherOptions/otherOptions.vue

@@ -180,6 +180,7 @@ export default {
       }
     },
     setImageryRollerMode: function () {
+      store.setrollerType(rollerShutterConfig.splitDirection)
       let imageryLayers = viewer.imageryLayers;
       if (this.imageryRoller) {
         for (let i = 0; i < imageryLayers.length; i++) {
@@ -368,7 +369,7 @@ export default {
     },
     imageryRoller(val) {
       this.setImageryRollerMode();
-      this.setRollerShutterSplit();
+      // this.setRollerShutterSplit();
     },
     lrtbRoller(val) {
       let verticalSlider = document.getElementById("verticalSlider");

+ 193 - 0
src/components/sceneAtttribute/splitScreen/rollerScreen.vue

@@ -0,0 +1,193 @@
+
+<template>
+  <div id="screenDiv" style="position: absolute; height: 100%; width: 100%">
+    <div
+      v-for="(k, i) in layers"
+      :key="k"
+      class="splitScreen"
+      :class="{
+        w50: type == 1 || type == 2,
+        h50: type == -1 || type == -2,
+      }"
+    >
+      <li
+        class="sm-btn sm-tool-btn"
+        title="资源目录"
+        @click="$set(layers, i, !layers[i])"
+      >
+        <span class="iconfont icontuceng"></span>
+      </li>
+      <layer-manage-split
+        ref="splitManage"
+        type="roller"
+        :splitId="k"
+        :isshow="layers[i]"
+        :checkedKeys="checkedKeys[i]"
+        @close="$set(layers, i, false)"
+        @handleCheckChange="handleCheckChange"
+      ></layer-manage-split>
+      <input v-model="toolTitle[i]" type="text" class="sm-toolTitle" />
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "rollerScreen",
+  data() {
+    return {
+      layers: [],
+      checkedKeys: [],
+      toolTitle: [],
+    };
+  },
+  computed: {
+    type() {
+      return store.state.rollerType;
+    },
+  },
+  watch: {
+    type() {
+      this.layers = Array(2);
+      this.checkedKeys = Array(2);
+      this.toolTitle = Array(2);
+      this.setCheckeds();
+    },
+  },
+  // inject: ["checkedChange"],
+  mounted() {},
+  methods: {
+    setCheckeds() {
+      if (!store.state.checkedData) return;
+      for (let i = 0; i < this.checkedKeys.length; i++) {
+        this.checkedKeys[i] = [store.state.checkedData.id];
+        this.toolTitle[i] = [store.state.checkedData.title];
+      }
+      this.$set(this.checkedKeys, this.checkedKeys);
+      this.$set(this.toolTitle, this.toolTitle);
+    },
+    handleCheckChange(obj, checked, splitId) {
+      if (obj.children && obj.children.length > 0) {
+        for (let i = 0; i < obj.children.length; i++) {
+          this.handleCheckChange(obj.children[i], checked);
+        }
+      } else {
+        if (checked) {
+          store.setCheckedData(obj);
+          this.$set(this.toolTitle, splitId - 1, obj.title);
+        }
+        let sceneLayer = store.state.layerparamslist[obj.id];
+        if (sceneLayer) {
+          this.setImageryRollerMode([sceneLayer]);
+        } else {
+          this.bus.$emit("checkedChange", obj);
+          if (obj.checked) {
+            for (let i = 0; i < this.checkedKeys.length; i++) {
+              if (!this.checkedKeys[i]) {
+                this.checkedKeys[i] = [];
+              }
+              if (i != splitId - 1) {
+                this.checkedKeys[i].push(obj.id);
+              }
+            }
+            this.$set(this.checkedKeys, this.checkedKeys);
+          }
+        }
+      }
+    },
+    setImageryRollerMode(imageryLayers) {
+      // let imageryLayers = viewer.imageryLayers;
+      if (this.imageryRoller) {
+        for (let i = 0; i < imageryLayers.length; i++) {
+          // let imageryLayer =imageryLayers[i] //imageryLayers.get(i);
+          switch (rollerShutterConfig.splitDirection) {
+            case Cesium.SplitDirection.LEFT:
+              imageryLayer.splitDirection = new Cesium.Cartesian2(
+                Cesium.ImagerySplitDirection.RIGHT,
+                Cesium.ImagerySplitDirection.NONE
+              );
+              break;
+            case Cesium.SplitDirection.RIGHT:
+              imageryLayer.splitDirection = new Cesium.Cartesian2(
+                Cesium.ImagerySplitDirection.LEFT,
+                Cesium.ImagerySplitDirection.NONE
+              );
+              break;
+            case Cesium.SplitDirection.TOP:
+              imageryLayer.splitDirection = new Cesium.Cartesian2(
+                Cesium.ImagerySplitDirection.NONE,
+                Cesium.ImagerySplitDirection.BOTTOM
+              );
+              break;
+            case Cesium.SplitDirection.BOTTOM:
+              imageryLayer.splitDirection = new Cesium.Cartesian2(
+                Cesium.ImagerySplitDirection.NONE,
+                Cesium.ImagerySplitDirection.TOP
+              );
+              break;
+            default:
+              imageryLayer.splitDirection = new Cesium.Cartesian2(
+                Cesium.ImagerySplitDirection.NONE,
+                Cesium.ImagerySplitDirection.NONE
+              );
+              break;
+          }
+        }
+      } else {
+        for (let i = 0; i < imageryLayers.length; i++) {
+          let imageryLayer = imageryLayers.get(i);
+          imageryLayer.splitDirection = new Cesium.Cartesian2(
+            Cesium.ImagerySplitDirection.NONE,
+            Cesium.ImagerySplitDirection.NONE
+          );
+        }
+      }
+    },
+  },
+};
+</script>
+<style lang="scss" >
+.splitScreen {
+  float: left;
+  height: 100%;
+  width: 100%;
+  position: relative;
+
+  .sm-btn {
+    position: absolute;
+    top: 60px;
+    background-color: transparent;
+    // font-size: 30px;
+    z-index: 100;
+  }
+  .sm-panel {
+    max-width: 300px;
+    height: 400px; //75%;
+    max-height: 80%;
+    top: 60px;
+    left: 50px;
+  }
+}
+
+.w50 {
+  width: 50%;
+}
+.h50 {
+  height: 50%;
+}
+.sm-toolTitle {
+  width: 400px;
+  // height: 80px;
+
+  position: absolute;
+  top: 100px;
+  left: calc(50% - 300px);
+  z-index: 100;
+  text-align: center;
+  font-size: 24px;
+  color: aqua;
+  background: transparent;
+  border-color: transparent;
+}
+</style>
+

+ 2 - 0
src/components/sceneAtttribute/splitScreen/splitScreen.vue

@@ -22,6 +22,7 @@
       </li>
       <layer-manage-split
         ref="splitManage"
+        type="split"
         :splitId="k"
         :isshow="layers[i]"
         :checkedKeys="checkedKeys[i]"
@@ -73,6 +74,7 @@ export default {
   mounted() {},
   methods: {
     setCheckeds() {
+      if (!store.state.checkedData) return;
       for (let i = 0; i < this.checkedKeys.length; i++) {
         this.checkedKeys[i] = [store.state.checkedData.id];
         this.toolTitle[i] = [store.state.checkedData.title];

+ 8 - 0
src/store/store.js

@@ -29,10 +29,12 @@ var store2 = {
         isEditZ: false,
         vectorlayerlist: [],
         modellayerlist: [],
+        layerparamslist:[],//影像
         chooseLayer: [],
         flattenNames: [],//存储压平的名称数组
         S3MList: [],
         splitType: 'NONE',//分屏类型
+        rollerType: '',//影像卷帘
         checkedData: null,
         sceneLayerlist: [],
         flattenNames: [],//存储压平的名称数组
@@ -107,6 +109,9 @@ var store2 = {
     setModelLayerList(newValue) {
         this.state.modellayerlist = newValue;
     },
+    setlayerparamsList(newValue) {
+        this.state.layerparamslist = newValue;
+    },
     setToolBarShow(newValue) {
         this.state.ToolBarShow = newValue;
     },
@@ -150,6 +155,9 @@ var store2 = {
     setsplitType(newValue) {
         this.state.splitType = newValue;
     },
+    setrollerType(newValue) {
+        this.state.rollerType = newValue;
+    },
     setCheckedData(newValue) {
         this.state.checkedData = newValue;
     },