月球大数据地理空间分析展示平台-【前端】-月球2期前端
Surpriseplus
2023-08-17 384fe106ad1efd66ef0910a824bff907322570ea
src/views/layer/layerManage.vue
@@ -59,7 +59,7 @@
    </div>
  </div>
  <layer-set
    v-if="layerSetIsshow"
    v-show="layerSetIsshow"
    @SETstate="SETstate"
    :layerTree="treeData"
    @addlayer="addlayer"
@@ -102,49 +102,7 @@
const transparence = ref(0);
var treeData = ref([]);
var layerListData = ref([]);
let menuOption = reactive([
  {
    id: 1,
    name: "测试",
    isShow: false,
    checkedAll: false,
    type: 1,
    parentId: null,
  },
  {
    id: 2,
    layerState: false,
    name: "图层名称",
    layerUrl: "",
    type: 2,
    parentId: 1,
  },
  {
    id: 3,
    layerState: false,
    name: "图层菜单",
    layerUrl: "",
    type: 1,
    parentId: 1,
  },
  {
    id: 5,
    layerState: false,
    name: "图层名称11",
    layerUrl: "",
    type: 2,
    parentId: 3,
  },
  {
    id: 4,
    name: "测试1",
    isShow: false,
    checkedAll: true,
    layerState: false,
    type: 1,
    parentId: null,
  },
]);
let menuOption = reactive([]);
const layerSetIsshow = ref(false);
const layerAttributeIsshow = ref(false);
@@ -158,7 +116,7 @@
const selectedNodeId = ref(null as any); //做类型断言处理
const emits = defineEmits(["setCloseLayer"]);
//默认选中id
const DefaultId = ref([15]);
const DefaultId = ref([]);
//图层设置弹框
const layerSetBox = () => {
  layerSetIsshow.value = !layerSetIsshow.value;
@@ -209,10 +167,7 @@
    DefaultId.value.forEach((v) => {
      if (e.id == v) {
        setVisiable(e, true);
      } else {
        if (e.children) {
          defaultLayer(e.children);
        }
        // return;
      }
    });
  });
@@ -276,8 +231,6 @@
  // menuOption = menuOption.filter((item) => {
  //   return item.id != res;
  // });
  // console.log(res);
  // console.log(menuOption);
  // treeData = handleTree(menuOption, "id", "pid", "children");
};
@@ -287,10 +240,25 @@
    treeData.value = setTreeData(dt.result).sort(function (a, b) {
      return a.sort - b.sort;
    });
    console.log(treeData.value);
    var std = [];
    var terrainId = null;
    dt.result.filter((res) => {
      if (res.isLayer == 1 && res.status == 1) {
        if (res.type == 1 && res.data == 2) {
          if (!terrainId) {
            terrainId = res.id;
            std.push(res.id);
          }
        } else {
          std.push(res.id);
        }
      }
    });
    DefaultId.value = std;
    //添加默认选中图层
    layerListData.value = dt.result;
    defaultLayer(treeData.value);
    defaultLayer(dt.result);
    nextTick(() => {
      let son = estreeRef.value.getCheckedNodes();