| | |
| | | @check="handleCheckChange" |
| | | ref="estreeRef" |
| | | v-if="treeData.length" |
| | | :default-checked-keys="DefaultId" |
| | | > |
| | | <template #default="{ node, data }"> |
| | | <span class="custom-tree-node"> |
| | |
| | | // 当前选中的节点 id |
| | | const selectedNodeId = ref(null as any); //做类型断言处理 |
| | | const emits = defineEmits(["setCloseLayer"]); |
| | | |
| | | //默认选中id |
| | | const DefaultId = ref([15]); |
| | | //图层设置弹框 |
| | | const layerSetBox = () => { |
| | | layerSetIsshow.value = !layerSetIsshow.value; |
| | |
| | | }; |
| | | //编辑图层树 |
| | | const addlayer = (res) => { |
| | | console.log(res); |
| | | let node; |
| | | layerListData.value.forEach((e) => { |
| | | if (e.id == res.id) { |
| | |
| | | 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)); |
| | |
| | | return father.pid == 0; // 返回一级菜单 |
| | | }); |
| | | } |
| | | getLayer(); |
| | | onMounted(() => { |
| | | getLayer(); |
| | | console.log(treeData.value); |
| | | console.log(estreeRef.value); |
| | | }); |
| | | </script> |
| | | |