2019-10-22 13:40:42 +08:00
|
|
|
<template>
|
2019-10-22 16:05:58 +08:00
|
|
|
<el-card>
|
|
|
|
<div slot="header" style="text-align: center;">
|
|
|
|
<b>{{ $t('lesson.courseName') + ': '+ name }}</b>
|
|
|
|
</div>
|
|
|
|
<div style="display: flex;align-items:flex-start">
|
|
|
|
<div class="tree_box">
|
|
|
|
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: (height-50) +'px' }">
|
|
|
|
<el-tree
|
|
|
|
ref="tree"
|
|
|
|
style="width: 380px"
|
|
|
|
: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"
|
|
|
|
/>
|
|
|
|
</el-scrollbar>
|
|
|
|
</div>
|
|
|
|
<transition>
|
|
|
|
<router-view />
|
|
|
|
</transition>
|
|
|
|
</div>
|
|
|
|
</el-card>
|
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 13:40:42 +08:00
|
|
|
export default {
|
|
|
|
name: 'LessonDetail',
|
|
|
|
data() {
|
|
|
|
return {
|
2019-10-22 16:05:58 +08:00
|
|
|
treeList: [],
|
|
|
|
defaultProps: {
|
|
|
|
children: 'children',
|
|
|
|
label: 'name',
|
|
|
|
disabled: this.showNode
|
|
|
|
},
|
|
|
|
name: '',
|
|
|
|
lessonId: '',
|
|
|
|
expandList: []
|
2019-10-22 13:40:42 +08:00
|
|
|
};
|
|
|
|
},
|
2019-10-22 14:28:22 +08:00
|
|
|
computed: {
|
|
|
|
width() {
|
|
|
|
return this.$store.state.app.width - 481 - this.widthLeft;
|
|
|
|
},
|
|
|
|
height() {
|
2019-10-22 16:05:58 +08:00
|
|
|
return this.$store.state.app.height - 120;
|
2019-10-22 14:28:22 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.initPageData();
|
|
|
|
},
|
2019-10-22 13:40:42 +08:00
|
|
|
methods: {
|
2019-10-22 14:28:22 +08:00
|
|
|
initPageData() {
|
2019-10-22 16:05:58 +08:00
|
|
|
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();
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
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.treeList[0].id, skinCode: this.$route.query.skinCode}} );
|
|
|
|
},
|
|
|
|
showNode(obj) {
|
|
|
|
return obj.type !== 'Training';
|
|
|
|
},
|
|
|
|
showContextMenu(e, obj, node, vueElem) {
|
|
|
|
if (obj && obj.type === 'TrainingType' || obj.type === 'Training') {
|
|
|
|
e.preventDefault();
|
|
|
|
this.point = {
|
|
|
|
x: e.clientX,
|
|
|
|
y: e.clientY
|
|
|
|
};
|
|
|
|
this.node = node;
|
|
|
|
const menu = DeviceMenu.Training;
|
|
|
|
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
|
|
|
|
}
|
2019-10-22 14:28:22 +08:00
|
|
|
}
|
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";
|
|
|
|
|
|
|
|
.tree_box{
|
|
|
|
position: relative;
|
|
|
|
left: 10px;
|
|
|
|
width: 400px;
|
|
|
|
padding-right: 10px;
|
|
|
|
}
|
|
|
|
.right_box{
|
|
|
|
}
|
|
|
|
</style>
|