月球大数据地理空间分析展示平台-【前端】-月球2期前端
WX
2023-07-24 e2abcc58249920af74fc5fa04e90554274c208d5
src/views/layer/layerManage.vue
@@ -23,6 +23,7 @@
        @check="handleCheckChange"
        ref="estreeRef"
        v-if="treeData.length"
        :default-checked-keys="DefaultId"
      >
        <template #default="{ node, data }">
          <span class="custom-tree-node">
@@ -176,7 +177,8 @@
// 当前选中的节点 id
const selectedNodeId = ref(null as any); //做类型断言处理
const emits = defineEmits(["setCloseLayer"]);
//默认选中id
const DefaultId = ref([15]);
//图层设置弹框
const layerSetBox = () => {
  layerSetIsshow.value = !layerSetIsshow.value;
@@ -307,7 +309,6 @@
};
//编辑图层树
const addlayer = (res) => {
  console.log(res);
  let node;
  layerListData.value.forEach((e) => {
    if (e.id == res.id) {
@@ -358,6 +359,15 @@
      return a.sort - b.sort;
    });
    layerListData.value = dt.result;
    //添加默认选中图层
    dt.result.forEach((e) => {
      DefaultId.value.forEach((v) => {
        if (e.id == v) {
          setVisiable(e, true);
        }
      });
    });
  }
  // treeData.value = JSON.parse(JSON.stringify(treeData.value));
@@ -383,8 +393,10 @@
    return father.pid == 0; // 返回一级菜单
  });
}
getLayer();
onMounted(() => {
  getLayer();
  console.log(treeData.value);
  console.log(estreeRef.value);
});
</script>