rt-sim-training-client/src/views/system/iscsDesign/demonList.vue

187 lines
5.2 KiB
Vue
Raw Normal View History

2020-01-15 10:11:26 +08:00
<template>
<div v-loading="loading" class="joylink-card map-list-main">
<div class="clearfix">
2020-01-15 13:27:07 +08:00
<span>我的iscs系统列表</span>
2020-01-15 10:11:26 +08:00
</div>
<div class="text_item">
<el-input v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable />
<div class="tree_box">
<el-tree ref="tree" :data="treeList" node-key="id" :props="defaultProps" highlight-current :span="22" :filter-node-method="filterNode" @node-click="clickEvent" @node-contextmenu="showContextMenu">
<span slot-scope="{ node:tnode, data }">
<span class="el-icon-tickets" :style="{color: data.valid ? 'green':''}" />
<span>&nbsp;{{ tnode.label }}</span>
</span>
</el-tree>
</div>
<div class="buttonList">
<el-button size="small" type="primary" class="eachButton" @click="createMap">{{ $t('map.newConstruction') }}</el-button>
</div>
</div>
</div>
</template>
<script>
import { DeviceMenu } from '@/scripts/ConstDic';
import { removeSessionStorage } from '@/utils/auth';
export default {
name: 'UserMapList',
components: {
},
props: {
width: {
type: Number,
required: true
}
},
data() {
return {
loading: false,
defaultShowKeys: [],
filterText: '',
treeList: [],
selected: {},
defaultProps: {
children: 'children',
label: 'name'
},
point: {
x: 0,
y: 0
},
editModel: {},
lineCode: ''
};
},
computed: {
// role() {
// return this.$store.state.user.roles.includes('04') ||
// this.$store.state.user.roles.includes('05') ||
// this.$store.state.user.roles.includes('01');
// }
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
}
},
beforeDestroy () {
removeSessionStorage('demonList');
},
mounted() {
this.loadInitData();
},
methods: {
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
createMap() {
this.$emit('createMap');
},
async loadInitData() {
this.treeList = [];
this.treeList = [
{
name: 'iscs系统',
id: 0,
2020-01-15 13:27:07 +08:00
type: 'system',
2020-01-15 10:11:26 +08:00
children: [
{
2020-01-16 16:25:33 +08:00
name: 'FAS界面',
mode: 'fas',
2020-01-15 13:27:07 +08:00
id: '1',
type: 'interface'
2020-01-15 17:56:31 +08:00
},
{
name: 'BAS界面',
mode: 'bas',
id: '2',
type: 'interface'
2020-01-16 16:25:33 +08:00
},
{
name: 'PSD界面',
mode: 'psd',
id: '3',
type: 'interface'
2020-01-17 14:15:14 +08:00
},
{
name: 'cctv界面',
mode: 'cctv',
id: '4',
type: 'interface'
2020-01-15 10:11:26 +08:00
}
]
}
];
},
clickEvent(obj, data, ele) {
2020-01-15 13:27:07 +08:00
switch (obj.type) {
case 'system' :
break;
case 'interface':
this.$router.push({ path: `/system/iscs/design/edit/${obj.id}/${obj.mode}` });
break;
}
2020-01-15 10:11:26 +08:00
},
showContextMenu(e, obj, node, vueElem) {
if (obj && obj.type == 'map') {
e.preventDefault();
const menu = DeviceMenu.Map;
this.point = {
x: e.clientX,
y: e.clientY
};
this.editModel = obj;
this.editModel.lineCode = obj.lineCode;
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
}
}
}
};
</script>
<style lang="scss" scoped>
.clearfix{
padding: 0 20px;
border-bottom: 1px solid #EBEEF5;
box-sizing: border-box;
height: 47px;
line-height: 47px;
}
.text_item{
height: calc(100% - 47px);
.tree_box{
height: calc(100% - 89px);
overflow-y: auto;
}
}
.buttonList{
padding: 8px 0px 8px 0px;
border-top: 1px #ccc solid;
}
.eachButton{
margin-left:10px;
}
.uploadDemo {
position: relative;
overflow: hidden;
// float: right;
padding: 9px 15px;
margin-right: 3px;
cursor: pointer;
input {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
opacity: 0;
cursor: pointer;
}
}
.map-list-main{
text-align:left;
height: 100%;
}
</style>