调整代码

This commit is contained in:
fan 2019-10-22 16:05:58 +08:00
parent e89211a873
commit 0e23a62b39
6 changed files with 226 additions and 149 deletions

View File

@ -37,6 +37,7 @@ import TrainingRuleEdit from '@/views/lesson/trainingRule/detail/index';
import Trainingmanage from '@/views/lesson/trainingmanage/index';
import LessonEdit from '@/views/lesson/lessoncategory/index';
import LessonHome from '@/views/lesson/home';
import LessonDetail from '@/views/lesson/details';
import ScriptmanageHome from '@/views/scriptManage/home';
import ScriptDisplay from '@/views/scriptManage/display/index';
@ -358,11 +359,11 @@ export const asyncRouter = [
component: Mapedit,
hidden: true
},
{
path: 'lesson/edit/:type',
component: LessonEdit,
hidden: true
},
// {
// path: 'lesson/edit/:type',
// component: LessonEdit,
// hidden: true
// },
{
path: 'runPlan/detail/:mapId',
component: PlanMonitorDetail,
@ -381,6 +382,18 @@ export const asyncRouter = [
component: LessonHome,
hidden: true
},
{
path: 'lesson/details',
component: LessonDetail,
hidden: true,
children: [
{
path: 'edit/:type',
component: LessonEdit,
hidden: true
}
]
},
{
path: 'lesson/training/:trainingId/:trainingName',
component: TrainingrecordManage,

View File

@ -1,100 +1,101 @@
<template>
<el-dialog
:title="this.$t('approval.courseDetails')"
:visible.sync="showDetail"
top="20px"
width="90%"
:before-do-close="doClose"
:close-on-click-modal="false"
>
<div>
<el-card v-loading="loading">
<div slot="header" style="text-align: center;">
<b>{{ $t('global.courseName') }}: {{ lessonName }}</b>
</div>
<div style="margin:50px">
<p style="font-size: 14px; margin-bottom: 20px"> {{ $t('approval.courseDescription')}}:
<span style="color: #808080 !important;">{{ lessonRemark }}</span>
</p>
</div>
</el-card>
<el-card v-loading="loading">
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height -60 + 'px'}">
<el-table
:data="tableData"
row-key="id"
border
default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table-column
prop="name"
border
:label="this.$t('approval.chapterTrainingName')">
</el-table-column>
<el-table-column
prop="remarks"
border
:label="this.$t('approval.instructions')">
</el-table-column>
</el-table>
</el-scrollbar>
</el-card>
<el-dialog
:title="this.$t('approval.courseDetails')"
:visible.sync="showDetail"
top="20px"
width="90%"
:before-do-close="doClose"
:close-on-click-modal="false"
>
<div>
<el-card v-loading="loading">
<div slot="header" style="text-align: center;">
<b>{{ $t('global.courseName') }}: {{ lessonName }}</b>
</div>
</el-dialog>
<div style="margin:50px">
<p style="font-size: 14px; margin-bottom: 20px"> {{ $t('approval.courseDescription') }}:
<span style="color: #808080 !important;">{{ lessonRemark }}</span>
</p>
</div>
</el-card>
<el-card v-loading="loading">
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height -60 + 'px'}">
<el-table
:data="tableData"
row-key="id"
border
default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column
prop="name"
border
:label="this.$t('approval.chapterTrainingName')"
/>
<el-table-column
prop="remarks"
border
:label="this.$t('approval.instructions')"
/>
</el-table>
</el-scrollbar>
</el-card>
</div>
</el-dialog>
</template>
<script>
import {reviewLessonDetail} from '@/api/designPlatform';
import {reviewLessonDetail} from '@/api/designPlatform';
export default {
name: 'LessonApprovalDetail',
components: {
export default {
name: 'LessonApprovalDetail',
components: {
},
watch: {
},
data() {
return {
loading: false,
tableData: [],
lessonName: '',
lessonRemark: '',
showDetail: false
};
},
computed: {
height() {
return this.$store.state.app.height - 260;
}
},
watch: {
},
computed: {
height() {
return this.$store.state.app.height - 260;
}
},
data() {
return{
loading: false,
tableData: [],
lessonName: '',
lessonRemark: '',
showDetail: false
}
},
created() {
},
mounted() {
// this.loadInitData();
},
beforeDestroy(){
},
created() {
},
mounted() {
// this.loadInitData();
},
beforeDestroy() {
},
methods: {
show(lessonId){
this.showDetail = true;
this.loadInitData(lessonId);
},
loadInitData(lessonId) {
this.loading =true;
reviewLessonDetail(lessonId).then(response =>{
this.tableData = response.data[0].children;
this.lessonName = response.data[0].name;
this.lessonRemark = response.data[0].remarks;
this.loading = false;
}).catch(error=>{
this.$messageBox(this.$t('approval.failedToGetCourseData'))
});
},
doClose() {
}
}
}
},
methods: {
show(lessonId) {
this.showDetail = true;
this.loadInitData(lessonId);
},
loadInitData(lessonId) {
this.loading =true;
reviewLessonDetail(lessonId).then(response =>{
this.tableData = response.data[0].children;
this.lessonName = response.data[0].name;
this.lessonRemark = response.data[0].remarks;
this.loading = false;
}).catch(()=>{
this.$messageBox(this.$t('approval.failedToGetCourseData'));
});
},
doClose() {
}
}
};
</script>

View File

@ -1,31 +1,50 @@
<template>
<div>
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: (height-125) +'px' }">
<el-tree
ref="tree"
:data="treeList"
node-key="id"
:props="defaultProps"
highlight-current
:span="22"
:filter-node-method="filterNode"
:default-expanded-keys="expandList"
@node-click="clickEvent"
/>
</el-scrollbar>
<transition>
<router-view :style="{ position:'relative', left:widthLeft+'px', width: (width - widthLeft)+'px'}" :product-list="productList" />
</transition>
</div>
<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>
</template>
<script>
import { getLessonTree } from '@/api/jmap/lessondraft';
import { DeviceMenu } from '@/scripts/ConstDic';
export default {
name: 'LessonDetail',
data() {
return {
treeList: [],
defaultProps: {
children: 'children',
label: 'name',
disabled: this.showNode
},
name: '',
lessonId: '',
expandList: []
};
},
computed: {
@ -33,7 +52,7 @@ export default {
return this.$store.state.app.width - 481 - this.widthLeft;
},
height() {
return this.$store.state.app.height - 90;
return this.$store.state.app.height - 120;
}
},
mounted() {
@ -41,8 +60,53 @@ export default {
},
methods: {
initPageData() {
getLessonTree(this.$route.query.lessonId);
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 });
}
}
}
};
</script>
<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>

View File

@ -342,6 +342,7 @@ export default {
},
goDetail(index, row) {
// this.$refs.lessonDetail.show(row.id);
this.$router.push({path: `/design/lesson/details`, query: {lessonId: row.id, skinCode: this.$route.params.skinCode}});
}
}
};

View File

@ -44,12 +44,12 @@
<div class="draft">
<el-button-group>
<template v-if="!isEdit">
<el-button v-if="courseModel.skinCode" type="primary" @click="create">{{$t('global.create')}}</el-button>
<el-button type="primary" @click="back">{{$t('global.back')}}</el-button>
<el-button v-if="courseModel.skinCode" type="primary" @click="create">{{ $t('global.create') }}</el-button>
<el-button type="primary" @click="back">{{ $t('global.back') }}</el-button>
</template>
<template v-else>
<el-button type="primary" @click="update">{{$t('global.update')}}</el-button>
<el-button type="primary" @click="back">{{$t('global.back')}}</el-button>
<el-button type="primary" @click="update">{{ $t('global.update') }}</el-button>
<el-button type="primary" @click="back">{{ $t('global.back') }}</el-button>
</template>
</el-button-group>
</div>
@ -178,7 +178,7 @@ export default {
this.courseModel = {
id: data.id,
skinCode: this.$route.query.skinCode,
prdCode: data.prdCode,
prdCode: data.prdCode,
name: data.name,
remarks: data.remarks
};
@ -187,9 +187,9 @@ export default {
});
}
},
back() {
this.$router.back();
}
back() {
this.$router.back();
}
}
};
</script>

View File

@ -1,7 +1,7 @@
<template>
<div class="mainContext">
<div class="draftContext">
<!--:style="{width: width +'px'} -->
<!--:style="{width: width +'px'} -->
<div v-if="lessonShow">
<lesson-edit ref="lesson" :height="height" @refresh="refresh" />
</div>
@ -16,7 +16,6 @@
</template>
<script>
import CourceCategory from './category/tree';
import LessonEdit from './edit/lesson/index';
import ChapterEdit from './edit/chapter/index';
import SortTree from './edit/sorttree/index';
@ -25,7 +24,6 @@ import localStore from 'storejs';
export default {
name: 'LessonDraft',
components: {
CourceCategory,
LessonEdit,
ChapterEdit,
SortTree
@ -45,29 +43,29 @@ export default {
return this.$store.state.app.width - localStore.get('LeftWidth');
},
height() {
return this.$store.state.app.height - 102;
return this.$store.state.app.height - 125;
}
},
mounted() {
const data = this.$route.query;
switch (this.$route.params.type) {
case 'lessonCreate':
this.lessonCreate(data);
break;
case 'lessonEdit':
this.lessonEdit(data);
break;
case 'chapterCreate':
this.chapterCreate(data);
break;
case 'chapterEdit':
this.chapterEdit(data);
break;
case 'treeSort':
this.treeSort(data);
break;
}
},
mounted() {
const data = this.$route.query;
switch (this.$route.params.type){
case 'lessonCreate':
this.lessonCreate(data);
break;
case 'lessonEdit':
this.lessonEdit(data);
break;
case 'chapterCreate':
this.chapterCreate(data);
break;
case 'chapterEdit':
this.chapterEdit(data);
break;
case 'treeSort':
this.treeSort(data);
break;
}
},
methods: {
exchangeShow(model) {
['lessonShow', 'chapterShow', 'treeShow'].forEach(elem => {
@ -113,8 +111,8 @@ export default {
this.$refs.sortTree.initData(data);
});
},
refresh(filterSelect) {
}
refresh(filterSelect) {
}
}
};
</script>