surprise
2024-01-09 9398f14feea7ad8b7d00ce7d2bb2e5362cec59d3
src/components/left/layerTree/Layer.vue
@@ -97,7 +97,7 @@
import AddOnlineMap from "./AddOnlineMap.vue";
import GetScene from "./GetScene.vue";
import SaveScene from "./SaveScene.vue";
import { Op_SelectByPage, Op_Insert, Op_UpdateById } from '../../../api/api.js'
import { Op_SelectByPage, Op_Insert, Op_UpdateById, Img_SelectByPage, Img_DeleteByIds } from '../../../api/api.js'
import model from "../../../assets/js/Layer/model";
import mapOL from "../../../assets/js/Layer/mapOL";
// 工程树工具
@@ -154,6 +154,16 @@
    };
  },
  mounted() {
    Bus.$on("reastLayer", (type) => {
      this.setTreeData([]);
      this.initData({});
      model.deleteAll();
      setTimeout(() => {
        this.histotyPlotting();
      }, 100);
    });
    // 获取本地配置文件
    if (this.$route.query.hasOwnProperty("layer")) {
      axios
@@ -196,12 +206,13 @@
      Bus.$emit("checkTab", "index/add/treeLayer", false);
    },
    closeLayer() {
      this.$store.state.isShowLayer= false
      this.$store.state.isShowLayer = false
      // this.$parent.hideLayer();
    },
    // 定义中转站事件
    initBusEvent() {
      Bus.$off("addLayer");
      Bus.$on("addLayer", (type) => {
        this.selectNode = this.$refs.tree && this.$refs.tree.getCurrentNode();
        this.openThisTypePop(type);
@@ -394,7 +405,9 @@
      this.setTreeData([]);
      this.initData({});
      model.deleteAll();
      var finalPlotting = [];
      const data = await Op_SelectByPage({ pageSize: 1000000, pageIndex: 1, name: '' });
      const data1 = await Img_SelectByPage({ pageSize: 1000000, pageIndex: 1, name: '' });
      if (data.status == 200 && data.data.length > 0) {
        var val_data = data.data;
        for (var i in val_data) {
@@ -405,7 +418,7 @@
            let plottingArr = [];
            plottingArr.push(val[0]);
            const newArr = arrGroup(plottingArr, (item) => item.name);
            let finalPlotting = [];
            newArr.map((a) => {
              let newObj = {};
              a.map((b) => {
@@ -417,16 +430,33 @@
              });
              finalPlotting.push(newObj);
            });
            let json = {
              name: "江苏交控智慧高速",
              id: 1,
              open: true,
              children: finalPlotting,
            };
            this.initData(json);
          }
        }
      }
      if (data1.status == 200) {
        var img_data = data1.data;
        if (img_data && img_data.length > 0) {
          for (var i = 0; i < img_data.length; i++) {
            var item = img_data[i]
            item.sourceType = 'imgUp'
            item.sid = item.id;
            item.id = new Date().getTime() + i;
            item.checked = true;
            finalPlotting[0].children.push(item)
          }
        }
      }
      var json = {
        name: "江苏交控智慧高速",
        id: 1,
        open: true,
        children: finalPlotting
      };
      this.initData(json);
      // const downloading = this.$loading({
      //   lock: true,
      //   text: "会议保障历史数据加载中,请稍后",
@@ -555,7 +585,7 @@
        if (addData && node._children) {
          node._children.forEach((item) => {
            _treeTool.addData(item);
            console.log(item)
            this.setAddGLBLayer(item);
          });
        } else {
@@ -823,6 +853,8 @@
        model.addModelLayer(res);
      } else if (res.sourceType == "SimpleGraphic" && res.checked) {
        mapOL.addLayerData(res);
      } else if (res.sourceType == "imgUp" && res.checked) {
        model.addImgUpLayer(res);
      }
    },
    // 添加演示动画
@@ -941,6 +973,9 @@
    // 右键菜单元素
    rightClick(e, data, node, comp) {
      this.isClickParent = !!data.children;
      if (data.sourceType == 'imgUp') {
        this.isClickParent = true;
      }
      this.selectNode = data;
      this.rightClickMenuStyle = { top: e.pageY + "px", left: e.pageX + "px" };
      this.rightClickMenuDisplay = true;
@@ -957,16 +992,15 @@
      if (this.selectNode.sourceType === "GLB") {
        model.setDelGLBModel(this.selectNode)
      }
       if (this.selectNode.sourceType === "SimpleGraphic") {
      if (this.selectNode.sourceType === "SimpleGraphic") {
        mapOL.removeLayerData(this.selectNode)
      }
      if (this.selectNode.sourceType === "imgUp") {
        this.removeimgUpData(this.selectNode)
      }
      this.remove(this.selectNode);
      this.$refs.tree && this.$refs.tree.setCurrentKey(null);
      this.selectNode = undefined;
    },
    // 右键编辑按钮编辑树节点
    editTreeNode() {
@@ -993,6 +1027,18 @@
        }
      }
    },
    async removeimgUpData(res) {
      const data = await Img_DeleteByIds(res.sid);
      if (data.status == 200) {
      }
    },
    // 添加目录
    addFold() {
      let newChild = {