|
@@ -0,0 +1,144 @@
|
|
|
+<template>
|
|
|
+ <div class="sideTree" :class="{'sideTree-collapse':collapse}">
|
|
|
+ <div class="side-header">
|
|
|
+ <el-icon color="#f2f2f2" size="25" style="width:50px">
|
|
|
+ <Histogram />
|
|
|
+ </el-icon>
|
|
|
+ <div style="flex:1;">系统井</div>
|
|
|
+ <el-icon color="#f2f2f2" size="25" style="width:50px;cursor:pointer;" @click="changeTree">
|
|
|
+ <DCaret />
|
|
|
+ </el-icon>
|
|
|
+ </div>
|
|
|
+ <div class="side-body">
|
|
|
+ <el-scrollbar style="height:100%;padding:5px;box-sizing: border-box;">
|
|
|
+ <el-tree :data="treedatas" :props="defaultProps" :highlight-current="true" class="tree">
|
|
|
+ <template #default="{ node, data }">
|
|
|
+ <span class="custom-tree-node">
|
|
|
+ <block v-if="node.isLeaf">
|
|
|
+ <el-icon><help-filled/></el-icon><span style="margin-left:2px;">{{ node.label }}</span>
|
|
|
+ </block>
|
|
|
+
|
|
|
+ <span v-else>{{ node.label }}</span>
|
|
|
+
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-tree>
|
|
|
+ </el-scrollbar>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+ import {ref} from 'vue'
|
|
|
+ import {storeToRefs} from 'pinia'
|
|
|
+ import {useHomeStore} from "../store/home.js"
|
|
|
+ import { fetchData } from "../api/sidetree.js"
|
|
|
+
|
|
|
+
|
|
|
+ const store = useHomeStore()
|
|
|
+ const {collapse} = storeToRefs(store)
|
|
|
+
|
|
|
+ const changeTree = () => {
|
|
|
+ alert();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const defaultProps = {
|
|
|
+ children: 'children',
|
|
|
+ label: 'label',
|
|
|
+ isLeaf:'leaf'
|
|
|
+ }
|
|
|
+
|
|
|
+ const treedatas = ref([])
|
|
|
+
|
|
|
+ const getData = () => {
|
|
|
+ fetchData({}).then((res) => {
|
|
|
+ treedatas.value=res
|
|
|
+ });
|
|
|
+ };
|
|
|
+ getData();
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+ :root{
|
|
|
+ --el-color-primary-light-9:#598fbe;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sideTree {
|
|
|
+ display: block;
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ top: 60px;
|
|
|
+ bottom: 0;
|
|
|
+ width: 220px;
|
|
|
+ -webkit-transition: left .3s ease-in-out;
|
|
|
+ transition: left .3s ease-in-out;
|
|
|
+
|
|
|
+ background-color: #324157;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ .sideTree-collapse {
|
|
|
+ left: -220px;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ .sideTree::-webkit-scrollbar {
|
|
|
+ width: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sideTree:deep(.el-scrollbar__thumb) {
|
|
|
+ background-color: #7294c5;
|
|
|
+ }
|
|
|
+
|
|
|
+ .side-header {
|
|
|
+ height: 45px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background-color: #3c4c68;
|
|
|
+ line-height: 45px;
|
|
|
+ color: #f2f2f2;
|
|
|
+ text-align: center;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ .side-body {
|
|
|
+ position: absolute;
|
|
|
+ top: 45px;
|
|
|
+ bottom: 0;
|
|
|
+ width: 100%;
|
|
|
+
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+
|
|
|
+ .tree {
|
|
|
+ background-color: #324157;
|
|
|
+ color: #c2c2d2;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ .side-body:deep(.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content) {
|
|
|
+
|
|
|
+ background-color: #659ed6 !important;
|
|
|
+ color: #e2e2e2;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ .side-body:deep(.el-tree-node__content:hover) {
|
|
|
+ background-color: #4b7ba2 !important;
|
|
|
+ color: #e2e2e2;
|
|
|
+ }
|
|
|
+ .side-body:deep(.el-tree-node:focus>.el-tree-node__content){
|
|
|
+ background-color: #598fbe !important;
|
|
|
+ color: #e2e2e2;
|
|
|
+ }
|
|
|
+</style>
|