课程发布审批流程暂存

This commit is contained in:
fan 2019-10-11 08:55:02 +08:00
parent e31bd2730f
commit 5a21420a18
7 changed files with 169 additions and 21 deletions

View File

@ -58,7 +58,7 @@ export function runUserPlanNotify({ planId }) {
/** 管理员获取需审核的课程列表 */
export function reviewLessonList(params) {
return request({
url: `/api/review/lesson`,
url: `/api/review/query/lesson`,
method: 'get',
params
});
@ -76,7 +76,7 @@ export function adminPublishLesson(data, id) {
/** 管理员驳回课程发布申请 */
export function rejectedLessonRelease(data, id) {
return request({
url: `/api/review/${id}`,
url: `/api/review/lesson/${id}`,
method: 'post',
data: data
});
@ -85,7 +85,7 @@ export function rejectedLessonRelease(data, id) {
/** 普通用户申请发布和撤销申请 */
export function releaseOrCancel(id, status) {
return request({
url: `/api/review/releaseOrCancel/${id}/${status}`,
url: `/api/review/lesson/releaseOrCancel/${id}/${status}`,
method: 'get'
});
}

View File

@ -36,7 +36,8 @@
</el-table-column>
<template v-for="(column, index) in queryList.columns">
<el-table-column
v-if="checkColumnTyep(column, 'basic')"
v-if="
(column, 'basic')"
:key="index"
:prop="column.prop"
:label="column.title"

View File

@ -108,9 +108,10 @@ import UserTraining from '@/views/management/userTraining/index';
import UserExam from '@/views/management/userExam/index';
import UserSimulation from '@/views/management/userSimulation/index';
import ExistingSimulation from '@/views/management/existingSimulation/index';
import CacheControl from '@/views/management/cacheControl/index';
import LessonApproval from '@/views/approval/lesson/index';
/**
* Note: sub-menu only appear when route children.length >= 1
* Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
@ -1046,7 +1047,7 @@ export const asyncRouter = [
children: [
{
path: 'lesson',
component: SkinCode,
component: LessonApproval,
meta: {
i18n: 'router.courseApplication'
}

View File

@ -1,24 +1,110 @@
<template>
<div>
<QueryListPage></QueryListPage>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList"></QueryListPage>
</div>
</template>
<script>
import {adminPublishLesson,rejectedLessonRelease,reviewLessonList} from '@/api/designPlatform';
import { listPublishMap } from '@/api/jmap/map';
export default {
name: 'LessonApproval',
components: {
},
data() {
formModel = {
name: '',
creator: '',
data: ''
return{
formModel: {
name: '',
creator: '',
data: ''
},
mapList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
reset: true,
queryObject: {
mapId: {
type: 'select',
label: '地图:',
config: {
data: []
}
},
lessonName: {
type: 'text',
label: this.$t('lesson.courseName')
},
userName: {
type: 'text',
label: '申请人:'
}
}
},
queryList: {
query: reviewLessonList,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('lesson.courseName'),
prop: 'name'
},
{
title: '地图',
prop: 'mapId ',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.mapId , this.mapList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: '课程说明',
prop: 'remarks'
},
{
title: '申请人',
prop: 'userName'
},
{
title: '申请时间',
prop: 'uploadTime',
type: 'tag',
columnValue: (row) => { return this.handleTime(row.uploadTime)},
tagType: (row) => { return ''; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
buttons: [
{
name: '通过',
handleClick: this.pass,
type: ''
},
{
name: '驳回',
handleClick: this.noPass,
type: ''
}
]
}
]
}
}
},
created(){
listPublishMap().then(response=>{
response.data.forEach(elem => {
this.mapList.push({ value: elem.id, label: elem.name });
});
this.queryForm.queryObject.mapId.config.data = this.mapList;
});
},
mounted(){
@ -35,6 +121,16 @@
},
goDetail() {
this.$router.push({path:``});
},
pass(index,row) {
},
noPass(index,row) {
},
handleTime(time) {
let timeList = time.split("T");
return timeList[0] + ' ' +timeList[1];
}
}
}

View File

@ -0,0 +1,32 @@
<template>
<div>
</div>
</template>
<script>
export default {
name: 'LessonApprovalReject',
components: {
},
watch: {
},
data() {
},
created() {
},
mounted() {
},
beforeDestroy(){
},
methods: {
}
}
</script>

View File

@ -21,33 +21,39 @@
border
:label="this.$t('lesson.lesson')">
</el-table-column>
<el-table-column
prop="status"
label="状态"
>
</el-table-column>
<el-table-column
:label="this.$t('global.operate')">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
v-if="scope.row.status!=='1'"
@click="createChapter(scope.row)"
>{{ scope.row.type==='lesson'? $t('lesson.createChapter'):$t('lesson.updateChapter')}}</el-button>
<el-button
size="mini"
type="primary" plain
v-if="scope.row.type === 'lesson'"
v-if="scope.row.type === 'lesson' && scope.row.status!=='1'"
@click="treeSort(scope.row)"
>{{$t('lesson.contentSorting')}}</el-button>
<el-button size="mini"
type="info"
v-if="scope.row.type === 'lesson'"
v-if="scope.row.type === 'lesson'&& scope.row.status!=='1'"
@click="editLesson(scope.row)"
>{{$t('lesson.editCourse')}}</el-button>
<el-button size="mini"
type="primary"
v-if="scope.row.type === 'lesson'"
v-if="scope.row.type === 'lesson'&& scope.row.status!=='1'"
@click="publish(scope.row)"
>{{hasRelease?$t('global.release'):$t('lesson.applicationForRelease')}}</el-button>
<el-button size="mini"
type="danger"
v-if="scope.row.type === 'lesson'"
v-if="scope.row.type === 'lesson'&& scope.row.status!=='1'"
@click="deleteLesson(scope.row)"
>{{$t('global.delete')}}</el-button>
</template>

View File

@ -16,7 +16,7 @@
</el-select>
</el-form-item>
<el-form-item :label="this.$t('lesson.publishCourseName')" prop="name">
<el-input v-model="editModel.name"></el-input>
<el-input v-model="editModel.name" :disabled="this.disabled"></el-input>
</el-form-item>
</el-form>
</div>
@ -30,8 +30,7 @@
<script>
import { getPublishMapListBySkinCode } from '@/api/jmap/map';
import { getLessonNameByMapIdAndLessonId } from '@/api/jmap/lessondraft';
import { publishLesson } from '@/api/jmap/lessondraft';
import { adminPublishLesson } from '@/api/designPlatform';
import { adminPublishLesson,releaseOrCancel } from '@/api/designPlatform';
export default {
name: 'LessonPublish',
@ -68,6 +67,10 @@
{ required: true, message: this.$t('rules.pleaseEnterMapName'), trigger: 'change' }
],
}
},
hasRelease() {
return this.$store.state.user.roles.includes('04') ||
this.$store.state.user.roles.includes('05');
}
},
methods: {
@ -119,8 +122,17 @@
doSave() {
this.loading = true;
this.$refs['form'].validate((valid) => {
if (valid) {
publishLesson(this.editModel).then(response => {
if (valid && this.hasRelease) {
adminPublishLesson(this.editModel,this.editModel.id).then(response => {
this.loading = false;
this.$message.success(this.$t('tip.coursePublishSuccessful'));
this.doClose();
}).catch(error => {
this.loading = false;
this.$messageBox(this.$t('tip.coursePublishFailed'));
});
}else if(valid && !this.hasRelease){
releaseOrCancel(this.editModel.id,"1").then(response => {
this.loading = false;
this.$message.success(this.$t('tip.coursePublishSuccessful'));
this.doClose();