管道基础大数据平台系统开发-【前端】-新系統界面
13693261870
2023-05-29 30fe4cd9c36002c112c5025dcf05819034f71233
src/views/Tools/LayerTree.vue
@@ -76,6 +76,11 @@
           v-show="shwoHistogram">
        <i class="el-icon-tickets"></i>&nbsp;&nbsp;钻孔柱状图
      </div>
      <div class="edit"
           v-show="shwoTileDown"
           @click="tileDownload()">
        <i class="el-icon-download"></i>&nbsp;&nbsp;瓦片下载
      </div>
    </el-card>
  </div>
</template>
@@ -85,7 +90,7 @@
import queryinfo from "./queryinfo.vue";
import { Vector as VectorSource } from "ol/source";
import { Vector as VectorLayer } from "ol/layer";
import { perms_selectLayers, comprehensive_selectPubById, project_selectDirAll, project_selectByDirid, } from "../../api/api.js";
import { perms_selectLayers, comprehensive_selectPubById, project_selectDirAll } from "../../api/api.js";
export default {
  name: "tree",
@@ -98,6 +103,7 @@
      shwoHistogram: false, // 钻孔柱状图
      showLocal: false, // 定位
      showOpacity: false, // 不透明度
      shwoTileDown: false, // 瓦片下载
      menuVisible: false, // 菜单
      levelArray: [ // 高程数组
        0, 40000000, 20000000, 10000000, 5000000, 2000000, 1000000, 500000,
@@ -245,7 +251,8 @@
      this.shwoHistogram = this.showProp && object.enName == "s_explorationpoint"; // 钻孔柱状图
      this.showLocal = ["Tileset", "3DML", "Mpt", "TMS", "DOM", "DEM"].indexOf(object.serveType) > -1; // 定位
      this.showOpacity = ["Tileset", "3DML"].indexOf(object.serveType) > -1; // 不透明度
      this.menuVisible = this.showProp || this.shwoHistogram || this.showLocal || this.showOpacity; // 菜单
      this.shwoTileDown = ["TMS", "DOM"].indexOf(object.serveType) > -1 && object.pubid; // 瓦片下载
      this.menuVisible = this.showProp || this.shwoHistogram || this.showLocal || this.showOpacity || this.shwoTileDown; // 菜单
      this.$refs.card.$el.style.left = event.pageX + 20 + "px";
      this.$refs.card.$el.style.top = event.pageY + "px";
@@ -312,6 +319,33 @@
      if (level > -1 && level < 23) return this.levelArray[level];
      return this.levelArray[this.levelArray.length - 1];
    },
    // 瓦片下载
    tileDownload () {
      this.rmListener();
      var that = this;
      sgworld.Creator.createSimpleGraphic(
        "rectangle", {},
        function (entity) {
          that.getTileRectangle(entity);
          sgworld.Creator.SimpleGraphic.clear();
        }
      );
    },
    // 获取瓦片四至范围
    getTileRectangle (res) {
      var value = res.rectangle.coordinates.getValue();
      var val = {
        pubid: this.currentData.pubid,
        pwd: "",
        title: "",
        xmax: Cesium.Math.toDegrees(value.east),
        xmin: Cesium.Math.toDegrees(value.west),
        ymax: Cesium.Math.toDegrees(value.north),
        ymin: Cesium.Math.toDegrees(value.south)
      }
      this.$bus.$emit("titleDown", val);
    },
    // 图层选中事件
    handleCheckChange (data, checked) {
@@ -543,7 +577,7 @@
          continue;
        }
      }
      debugger
      let url = arr.length ? arr[arr.length - 1] : null;
      this.addDEMLayers(url, null == url);
    },
@@ -631,20 +665,20 @@
    // 切换项目
    prjChanged (code) {
      this.$store.state.pigCode = code;
      if (code) {
        this.isBusy = true;
        let checkedLayers = this.getCheckedLayersByCode(code);
      //if (code) {
      this.isBusy = true;
      let checkedLayers = this.getCheckedLayersByCode(code);
        let checkedKeys = [];
        for (let i in checkedLayers) {
          checkedKeys.push(checkedLayers[i].id);
        }
        this.$refs.tree.setCheckedKeys(checkedKeys);
        sessionStorage.setItem("checkedLayers", JSON.stringify(checkedLayers));
        this.isBusy = false;
      let checkedKeys = [];
      for (let i in checkedLayers) {
        checkedKeys.push(checkedLayers[i].id);
      }
      this.$refs.tree.setCheckedKeys(checkedKeys);
      sessionStorage.setItem("checkedLayers", JSON.stringify(checkedLayers));
      this.isBusy = false;
      //}
      for (let i = 0, c = this.treeData.length; i < c; i++) {
        this.handleCheckChange(this.treeData[i], true);
      }