2019-09-26 15:08:53 +08:00
|
|
|
<template>
|
2019-09-29 15:55:01 +08:00
|
|
|
<div style="height: 100%; overflow: hidden">
|
|
|
|
<el-card>
|
|
|
|
<div class="button_group">
|
2019-10-10 13:02:43 +08:00
|
|
|
<el-button size="mini" v-if="hasRelease" @click="trainingManage">{{$t('lesson.trainingManage')}}</el-button>
|
|
|
|
<el-button size="mini" v-if="hasRelease" @click="taskManage">{{$t('lesson.taskManage')}}</el-button>
|
|
|
|
<el-button size="mini" v-if="hasRelease" @click="operationManage">{{$t('lesson.trainingRule')}}</el-button>
|
|
|
|
<el-button size="mini" type="primary" @click="lessonCreateByPublish">{{$t('lesson.createNewCoursesFromRelease')}}</el-button>
|
|
|
|
<el-button size="mini" type="primary" @click="lessonCreate">{{$t('lesson.newConstruction')}}</el-button>
|
2019-09-29 15:55:01 +08:00
|
|
|
</div>
|
|
|
|
</el-card>
|
|
|
|
<el-card v-loading="loading">
|
|
|
|
<el-table
|
|
|
|
:data="tableData"
|
|
|
|
row-key="id"
|
|
|
|
border
|
|
|
|
default-expand-all
|
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
|
|
|
|
<el-table-column
|
|
|
|
prop="name"
|
|
|
|
border
|
2019-10-10 13:02:43 +08:00
|
|
|
:label="this.$t('lesson.lesson')">
|
2019-09-29 15:55:01 +08:00
|
|
|
</el-table-column>
|
2019-10-11 08:55:02 +08:00
|
|
|
<el-table-column
|
2019-10-12 17:14:03 +08:00
|
|
|
:label="this.$t('global.status')"
|
2019-10-11 08:55:02 +08:00
|
|
|
>
|
2019-10-12 17:14:03 +08:00
|
|
|
<template slot-scope="scope">
|
|
|
|
<span>{{handlerStatus(scope.row)}}</span>
|
|
|
|
</template>
|
2019-10-11 08:55:02 +08:00
|
|
|
</el-table-column>
|
2019-09-29 15:55:01 +08:00
|
|
|
<el-table-column
|
2019-10-12 17:14:03 +08:00
|
|
|
prop="explanation"
|
|
|
|
:label="this.$t('lesson.rejectReason')"
|
|
|
|
>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column
|
|
|
|
width="500"
|
2019-10-10 13:02:43 +08:00
|
|
|
:label="this.$t('global.operate')">
|
2019-09-29 15:55:01 +08:00
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="primary"
|
2019-10-11 08:55:02 +08:00
|
|
|
v-if="scope.row.status!=='1'"
|
2019-09-30 13:24:47 +08:00
|
|
|
@click="createChapter(scope.row)"
|
2019-10-10 13:02:43 +08:00
|
|
|
>{{ scope.row.type==='lesson'? $t('lesson.createChapter'):$t('lesson.updateChapter')}}</el-button>
|
2019-09-29 15:55:01 +08:00
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="primary" plain
|
2019-10-11 08:55:02 +08:00
|
|
|
v-if="scope.row.type === 'lesson' && scope.row.status!=='1'"
|
2019-09-30 13:24:47 +08:00
|
|
|
@click="treeSort(scope.row)"
|
2019-10-10 13:02:43 +08:00
|
|
|
>{{$t('lesson.contentSorting')}}</el-button>
|
2019-09-29 15:55:01 +08:00
|
|
|
<el-button size="mini"
|
|
|
|
type="info"
|
2019-10-11 08:55:02 +08:00
|
|
|
v-if="scope.row.type === 'lesson'&& scope.row.status!=='1'"
|
2019-09-30 16:20:31 +08:00
|
|
|
@click="editLesson(scope.row)"
|
2019-10-10 13:02:43 +08:00
|
|
|
>{{$t('lesson.editCourse')}}</el-button>
|
2019-09-30 13:24:47 +08:00
|
|
|
<el-button size="mini"
|
|
|
|
type="primary"
|
2019-10-12 17:14:03 +08:00
|
|
|
v-if="scope.row.type === 'lesson'&& scope.row.status==='0'"
|
2019-09-30 13:24:47 +08:00
|
|
|
@click="publish(scope.row)"
|
2019-10-10 13:02:43 +08:00
|
|
|
>{{hasRelease?$t('global.release'):$t('lesson.applicationForRelease')}}</el-button>
|
2019-09-30 13:24:47 +08:00
|
|
|
<el-button size="mini"
|
|
|
|
type="danger"
|
2019-10-11 08:55:02 +08:00
|
|
|
v-if="scope.row.type === 'lesson'&& scope.row.status!=='1'"
|
2019-09-30 13:24:47 +08:00
|
|
|
@click="deleteLesson(scope.row)"
|
|
|
|
>{{$t('global.delete')}}</el-button>
|
2019-10-12 17:14:03 +08:00
|
|
|
<el-button size="mini"
|
|
|
|
type="danger"
|
|
|
|
v-if="scope.row.status ==='1'"
|
|
|
|
@click="revertLesson(scope.row)"
|
|
|
|
>
|
|
|
|
{{$t('lesson.withdraw')}}
|
|
|
|
</el-button>
|
2019-09-29 15:55:01 +08:00
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
</el-card>
|
2019-09-30 16:20:31 +08:00
|
|
|
<publish-create @refresh="refresh" ref="publishCreate" />
|
2019-10-12 17:14:03 +08:00
|
|
|
<publish-lesson ref="publishLesson" @refresh="refresh" />
|
2019-09-29 14:27:58 +08:00
|
|
|
</div>
|
2019-09-26 15:08:53 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-10-12 17:14:03 +08:00
|
|
|
import { getDraftLesson,releaseOrCancel } from '@/api/designPlatform';
|
2019-09-30 13:24:47 +08:00
|
|
|
import { UrlConfig } from '@/router/index';
|
|
|
|
import PublishCreate from './lessoncategory/edit/create';
|
|
|
|
import PublishLesson from './lessoncategory/edit/lesson/publish';
|
|
|
|
import { delLesson } from '@/api/jmap/lessondraft';
|
|
|
|
|
2019-09-26 15:08:53 +08:00
|
|
|
export default {
|
2019-09-29 14:27:58 +08:00
|
|
|
name: 'LessonHome',
|
2019-09-26 15:08:53 +08:00
|
|
|
components: {
|
2019-09-30 13:24:47 +08:00
|
|
|
PublishCreate,
|
|
|
|
PublishLesson
|
2019-09-26 15:08:53 +08:00
|
|
|
},
|
|
|
|
computed: {
|
2019-09-29 14:27:58 +08:00
|
|
|
mapId() {
|
|
|
|
return this.$route.params.mapId;
|
2019-10-10 13:02:43 +08:00
|
|
|
},
|
|
|
|
hasRelease() {
|
|
|
|
return this.$store.state.user.roles.includes('04') ||
|
|
|
|
this.$store.state.user.roles.includes('05');
|
2019-09-26 15:08:53 +08:00
|
|
|
}
|
|
|
|
},
|
2019-09-29 14:27:58 +08:00
|
|
|
data() {
|
|
|
|
return {
|
2019-09-29 15:55:01 +08:00
|
|
|
tableData: [],
|
2019-09-30 13:24:47 +08:00
|
|
|
loading: false,
|
|
|
|
showEdit: false
|
2019-09-29 14:27:58 +08:00
|
|
|
};
|
2019-09-26 15:08:53 +08:00
|
|
|
},
|
2019-09-30 17:56:16 +08:00
|
|
|
watch: {
|
|
|
|
$route() {
|
|
|
|
this.refresh();
|
|
|
|
}
|
|
|
|
},
|
2019-09-26 15:08:53 +08:00
|
|
|
mounted() {
|
2019-09-29 15:55:01 +08:00
|
|
|
this.loading = true;
|
2019-09-29 14:27:58 +08:00
|
|
|
this.loadInitData();
|
2019-09-26 15:08:53 +08:00
|
|
|
},
|
|
|
|
methods: {
|
2019-09-29 14:27:58 +08:00
|
|
|
loadInitData() {
|
|
|
|
getDraftLesson({},this.mapId).then(response=> {
|
2019-09-30 13:24:47 +08:00
|
|
|
response.data.forEach(elem => {
|
|
|
|
if (elem.children) {
|
|
|
|
elem.children.forEach( it => {
|
|
|
|
it.parentId = elem.id;
|
|
|
|
} )
|
|
|
|
}
|
|
|
|
});
|
2019-09-29 15:55:01 +08:00
|
|
|
this.tableData = response.data;
|
|
|
|
this.loading = false;
|
2019-10-12 17:14:03 +08:00
|
|
|
}).catch(error=>{
|
|
|
|
this.$messageBox(this.$t('error.getDraftCourseDataFailed'))
|
2019-09-29 14:27:58 +08:00
|
|
|
});
|
2019-09-30 13:24:47 +08:00
|
|
|
},
|
2019-10-12 17:14:03 +08:00
|
|
|
refuse() {
|
|
|
|
this.loading = true;
|
|
|
|
getDraftLesson({},this.mapId).then(response=> {
|
|
|
|
response.data.forEach(elem => {
|
|
|
|
if (elem.children) {
|
|
|
|
elem.children.forEach( it => {
|
|
|
|
it.parentId = elem.id;
|
|
|
|
} )
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.tableData = response.data;
|
|
|
|
this.loading = false;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handlerStatus(row) {
|
|
|
|
let lessonStatus = '';
|
|
|
|
switch (row.status){
|
|
|
|
case '0':
|
|
|
|
lessonStatus = this.$t('lesson.notRelease');
|
|
|
|
break;
|
|
|
|
case '1':
|
|
|
|
lessonStatus = this.$t('lesson.pendingReview');
|
|
|
|
break;
|
|
|
|
case '2':
|
|
|
|
lessonStatus = this.$t('lesson.published');
|
|
|
|
break;
|
|
|
|
case '3':
|
|
|
|
lessonStatus = this.$t('lesson.rejected');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return lessonStatus;
|
|
|
|
},
|
2019-09-30 16:20:31 +08:00
|
|
|
refresh() {
|
|
|
|
this.loading = true;
|
|
|
|
this.loadInitData();
|
|
|
|
},
|
|
|
|
editLesson(row) {
|
|
|
|
this.$router.push( {path: `${UrlConfig.design.lessonEdit}/lessonEdit`, query: {id: row.id, skinCode: row.code}} )
|
2019-09-30 13:24:47 +08:00
|
|
|
},
|
|
|
|
lessonCreate() {
|
|
|
|
this.$router.push({ path: `${UrlConfig.design.lessonEdit}/lessonCreate`,query: {skinCode: this.$route.params.skinCode} })
|
|
|
|
},
|
|
|
|
lessonCreateByPublish() {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs.publishCreate.doShow();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
publish(row) {
|
|
|
|
row.skinCode = this.$route.params.skinCode;
|
2019-10-10 16:07:13 +08:00
|
|
|
row.cityCode = this.$route.query.cityCode;
|
2019-09-30 13:24:47 +08:00
|
|
|
this.$refs.publishLesson.doShow(row);
|
|
|
|
},
|
|
|
|
deleteLesson(row) {
|
|
|
|
delLesson(row).then(response => {
|
|
|
|
this.$message.success(this.$t('tip.successfullyDelete'));
|
2019-09-30 16:20:31 +08:00
|
|
|
this.loading = true;
|
|
|
|
this.loadInitData();
|
2019-09-30 13:24:47 +08:00
|
|
|
}).catch(error => {
|
|
|
|
this.$messageBox(this.$t('tip.failDelete'))
|
|
|
|
});
|
|
|
|
},
|
|
|
|
createChapter(row) {
|
2019-09-30 16:20:31 +08:00
|
|
|
if (row.type === 'lesson') {
|
|
|
|
this.$router.push({path: `${UrlConfig.design.lessonEdit}/chapterCreate`, query: {lessonId: row.id}});
|
|
|
|
} else if (row.type === 'chapter') {
|
|
|
|
this.$router.push( {path: `${UrlConfig.design.lessonEdit}/chapterEdit`,query: {id: row.id, lessonId: row.parentId}} )
|
|
|
|
}
|
2019-09-30 13:24:47 +08:00
|
|
|
},
|
|
|
|
treeSort(row){
|
2019-09-30 16:20:31 +08:00
|
|
|
this.$router.push({path: `${UrlConfig.design.lessonEdit}/treeSort`, query: row});
|
2019-09-30 13:24:47 +08:00
|
|
|
},
|
|
|
|
taskManage() {
|
2019-10-10 09:33:56 +08:00
|
|
|
this.$router.push({path: `${UrlConfig.design.taskManage}`, query: {mapId: this.$route.params.mapId, skinCode: this.$route.params.skinCode}})
|
2019-09-30 13:24:47 +08:00
|
|
|
},
|
|
|
|
trainingManage() {
|
2019-10-09 15:14:00 +08:00
|
|
|
this.$router.push({path: `${UrlConfig.design.trainingManage}/${this.$route.params.skinCode}`, query: {mapId: this.$route.params.mapId}})
|
2019-09-30 13:24:47 +08:00
|
|
|
},
|
|
|
|
operationManage() {
|
2019-10-10 09:33:56 +08:00
|
|
|
this.$router.push({path: `${UrlConfig.design.trainingRule}`, query: {mapId: this.$route.params.mapId, skinCode: this.$route.params.skinCode}})
|
2019-10-12 17:14:03 +08:00
|
|
|
},
|
|
|
|
revertLesson(row) {
|
|
|
|
this.$confirm(this.$t('tip.cancelCoursePublicationHint'), this.$t('global.tips'), {
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
releaseOrCancel(row.id,"0").then(response => {
|
|
|
|
this.loading = false;
|
|
|
|
this.$message.success(this.$t('tip.cancelTheSuccessfulApplicationOfTheCourseRelease'));
|
|
|
|
this.refuse();
|
|
|
|
}).catch(error => {
|
|
|
|
this.loading = false;
|
|
|
|
this.$messageBox(this.$t('tip.cancellationOfCoursePublicationApplicationFailed'));
|
|
|
|
this.refuse();
|
|
|
|
});
|
|
|
|
});
|
2019-09-26 15:08:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
2019-09-29 14:27:58 +08:00
|
|
|
.draft {
|
|
|
|
width: 400px;
|
2019-09-26 15:08:53 +08:00
|
|
|
text-align: center;
|
2019-09-29 14:27:58 +08:00
|
|
|
margin: 20px auto;
|
2019-09-26 15:08:53 +08:00
|
|
|
}
|
2019-09-29 15:55:01 +08:00
|
|
|
.button_group {
|
|
|
|
float: right;
|
2019-09-30 13:24:47 +08:00
|
|
|
margin: 20px 10px;
|
2019-09-29 15:55:01 +08:00
|
|
|
}
|
2019-09-26 15:08:53 +08:00
|
|
|
</style>
|