2020-05-15 16:01:16 +08:00
|
|
|
<template>
|
|
|
|
<div v-loading="loading" class="joylink-card map-list-main">
|
|
|
|
<div class="clearfix">
|
|
|
|
<span>{{ $t('global.mapList') }}</span>
|
|
|
|
</div>
|
|
|
|
<div class="left-map-list">
|
|
|
|
<div style="height: calc(100% - 76px); overflow: auto;">
|
|
|
|
<el-tree
|
|
|
|
ref="tree"
|
|
|
|
:data="treeList"
|
|
|
|
node-key="key"
|
|
|
|
:props="defaultProps"
|
|
|
|
highlight-current
|
|
|
|
:span="22"
|
|
|
|
:filter-node-method="filterNode"
|
|
|
|
:default-expanded-keys="expandList"
|
|
|
|
@node-click="clickEvent"
|
|
|
|
@node-expand="nodeExpand"
|
|
|
|
@node-collapse="nodeCollapse"
|
|
|
|
>
|
|
|
|
<span slot-scope="{ node }">
|
2020-05-15 16:55:00 +08:00
|
|
|
<span class="el-icon-tickets" />
|
2020-05-15 16:01:16 +08:00
|
|
|
<span v-if="node.data.id ==='Simulation'"> 仿真系统</span>
|
|
|
|
<span v-else> {{ node.data.name }}</span>
|
|
|
|
</span>
|
|
|
|
</el-tree>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import localStore from 'storejs';
|
|
|
|
import { getSessionStorage } from '@/utils/auth';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'DemonList',
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
treeList: [],
|
|
|
|
defaultProps: {
|
|
|
|
children: 'children',
|
|
|
|
label: 'name'
|
|
|
|
},
|
|
|
|
mapId: '',
|
|
|
|
expandList: [],
|
|
|
|
filterSelect: ''
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
userId() {
|
|
|
|
return this.$store.state.user.id;
|
|
|
|
},
|
|
|
|
project() {
|
|
|
|
return getSessionStorage('project');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
},
|
|
|
|
beforeDestroy () {
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
filterNode(value, data) {
|
|
|
|
if (!value) return true;
|
|
|
|
return data.name.indexOf(value) !== -1;
|
|
|
|
},
|
|
|
|
clickEvent(obj, data, ele) {
|
|
|
|
localStore.set('trainingPlatformCheckId' + this.filterSelect + this.userId, obj.id);
|
|
|
|
while (data) {
|
|
|
|
if (data.data.type === 'Map') {
|
|
|
|
this.mapId = data.data.id;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
data = data.parent;
|
|
|
|
}
|
|
|
|
console.log(obj, data, ele);
|
|
|
|
},
|
|
|
|
setLocalRoute(path) {
|
|
|
|
localStore.set('trainingPlatformRoute' + this.userId, path);
|
|
|
|
},
|
|
|
|
nodeExpand(obj, node, ele) {
|
|
|
|
const key = obj.id + obj.type;
|
|
|
|
this.expandList = this.expandList.filter(item => item !== key);
|
|
|
|
this.expandList.push(key);
|
|
|
|
localStore.set('trainIngPlatformExpandList' + this.filterSelect + this.userId, this.expandList);
|
|
|
|
},
|
|
|
|
nodeCollapse(obj, node, ele) {
|
|
|
|
const key = obj.id + obj.type;
|
|
|
|
this.expandList = this.expandList.filter(item => item !== key);
|
|
|
|
localStore.set('trainIngPlatformExpandList' + this.filterSelect + this.userId, this.expandList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
.clearfix{
|
|
|
|
width:100%;
|
|
|
|
height: 47px;
|
|
|
|
line-height: 47px;
|
|
|
|
padding-left: 17px;
|
|
|
|
position:absolute;
|
|
|
|
}
|
|
|
|
.back-home {
|
|
|
|
float: right;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color: #3ea726;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.left-map-list{
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
padding-top: 47px;
|
|
|
|
}
|
|
|
|
.map-list-main{
|
|
|
|
text-align:left;
|
|
|
|
height: 100%;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<style>
|
|
|
|
.el-tree {
|
|
|
|
overflow-x: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-tree-node.is-current>.el-tree-node__content {
|
|
|
|
background-color: #e4e3e3 !important;
|
|
|
|
}
|
|
|
|
</style>
|