rt-sim-training-client/src/views/lesson/details.vue

165 lines
5.1 KiB
Vue
Raw Normal View History

2019-10-22 13:40:42 +08:00
<template>
<div class="joylink-card">
<div class="title_box">
2019-10-22 16:05:58 +08:00
<b>{{ $t('lesson.courseName') + ': '+ name }}</b>
</div>
<div class="content_box">
2019-10-22 16:05:58 +08:00
<div class="tree_box">
<div class="tree_content_box">
2019-10-23 15:01:25 +08:00
<p>{{ this.$t('lesson.courseTree') }}</p>
<div style="height: calc(100% - 89px); overflow-y: auto;">
2019-10-23 15:01:25 +08:00
<el-tree
ref="tree"
style="width: 370px"
:data="treeList"
node-key="id"
:props="defaultProps"
default-expand-all
highlight-current
:span="22"
:filter-node-method="filterNode"
:default-expanded-keys="expandList"
@node-contextmenu="showContextMenu"
@node-click="clickEvent"
/>
</div>
2019-10-23 15:01:25 +08:00
</div>
2019-10-22 16:05:58 +08:00
</div>
<transition>
2019-10-22 17:24:41 +08:00
<router-view @refresh="refresh" />
2019-10-22 16:05:58 +08:00
</transition>
</div>
2019-10-22 17:24:41 +08:00
<operate-menu ref="menu" :point="point" :node="node" @refresh="refresh" @changeRouter="changeRouter" />
</div>
2019-10-22 13:40:42 +08:00
</template>
<script>
2019-10-22 14:28:22 +08:00
import { getLessonTree } from '@/api/jmap/lessondraft';
2019-10-22 16:05:58 +08:00
import { DeviceMenu } from '@/scripts/ConstDic';
2019-10-22 17:24:41 +08:00
import OperateMenu from './operateMenu';
2019-10-22 13:40:42 +08:00
export default {
2019-10-29 13:15:57 +08:00
name: 'LessonDetail',
components: {
OperateMenu
},
data() {
return {
treeList: [],
defaultProps: {
children: 'children',
label: 'name'
},
name: '',
lessonId: '',
expandList: [],
point: {
x: 0,
y: 0
},
node: {
}
};
},
computed: {
width() {
return this.$store.state.app.width - 481 - this.widthLeft;
}
},
mounted() {
this.initPageData();
},
methods: {
initPageData() {
getLessonTree(this.$route.query.lessonId || this.$route.query.id).then(resp => {
if (resp.data && resp.data[0]) {
this.name = resp.data[0].name;
this.lessonId = resp.data[0].id;
this.treeList = resp.data;
}
this.editLesson();
});
2019-10-22 16:05:58 +08:00
2019-10-29 13:15:57 +08:00
},
clickEvent(obj, node, ele) {
},
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
editLesson() {
this.$router.push( {path: `/design/lesson/details/edit/lessonEdit`, query: {id: this.lessonId, cityCode: this.$route.query.cityCode, mapId: this.$route.query.mapId, drawWay: this.$route.query.drawWay, lineCode:this.$route.query.lineCode}} );
2019-10-29 13:15:57 +08:00
},
createChapte(node) {
this.$router.push({path: `/design/lesson/details/edit/chapterCreate`, query: {id: node.data.id, type:node.data.type, lessonId: this.lessonId, cityCode: this.$route.query.cityCode, mapId: this.$route.query.mapId, drawWay: this.$route.query.drawWay, lineCode:this.$route.query.lineCode}});
2019-10-29 13:15:57 +08:00
},
updateChapte(node) {
this.$router.push( {path: `/design/lesson/details/edit/chapterEdit`, query: {id: node.data.id, type:node.data.type, lessonId: this.lessonId, cityCode: this.$route.query.cityCode, mapId: this.$route.query.mapId, drawWay: this.$route.query.drawWay, lineCode:this.$route.query.lineCode}});
2019-10-29 13:15:57 +08:00
},
showContextMenu(e, obj, node, vueElem) {
if (obj && obj.type === 'Lesson' || obj.type === 'Chapter') {
e.preventDefault();
this.point = {
x: e.clientX,
y: e.clientY
};
this.node = node;
const menu = DeviceMenu.Lesson;
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
}
},
changeRouter(params) {
switch (params.event) {
case '01':
this.editLesson();
break;
case '02':
this.createChapte(params.node);
break;
case '03':
this.updateChapte(params.node);
break;
case '04':
this.createChapte(params.node);
break;
}
},
refresh() {
this.initPageData();
}
}
2019-10-22 13:40:42 +08:00
};
</script>
2019-10-22 16:05:58 +08:00
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.joylink-card{
height: 100%;
overflow-y: auto;
.title_box{
height: 47px;
line-height: 47px;
text-align: center;
border-bottom: 1px solid #EBEEF5;
}
.content_box{
height: calc(100% - 47px);
display: flex;
align-items: flex-start;
}
}
2019-10-22 16:05:58 +08:00
.tree_box{
position: relative;
left: 10px;
width: 400px;
2019-10-23 15:01:25 +08:00
padding-right: 20px;
padding-top: 20px;
height: 100%;
.tree_content_box{
border: 2px dashed #B0C4DE;
height: 100%;
}
2019-10-22 16:05:58 +08:00
}
</style>