教学管理暂提

This commit is contained in:
fan 2021-03-12 18:44:43 +08:00
parent 32e7155fb0
commit e97a5a88a1
14 changed files with 1498 additions and 128 deletions

View File

@ -180,3 +180,27 @@ export function deleteDepartUserRelation(data) {
data data
}); });
} }
/** 修改班级-课程关系 */
export function updateClassLessonRelation(orgId, data) {
return request({
url: `/api/company/orgLesson/${orgId}/update`,
method: 'put',
data
});
}
/** 给班级添加学生 */
export function addStudentToClass(orgId, data) {
return request({
url: `/api/company/orgUser/${orgId}/addStudent`,
method: 'post',
data
});
}
/** 分页获取班级 */
export function getClassListPage(orgId, params) {
return request({
url: `/api/company/paged/${orgId}/cls`,
method: 'get',
params
});
}

View File

@ -102,3 +102,18 @@ export function getExamClassList(lessonId) {
method: 'get' method: 'get'
}); });
} }
/** 获取本系统下发布课程列表 */
export function getLessonListSystem(params) {
return request({
url: '/api/lesson/paged/list',
method: 'get',
params
});
}
/** 获取本系统下发布课程列表不分页 */
export function getLessonListsSystemNoPage() {
return request({
url: '/api/lesson/unPaged/list',
method: 'get'
});
}

View File

@ -101,3 +101,10 @@ export function getLessonDrftList(mapId, params) {
params: params params: params
}); });
} }
export function getLessonDraftListNoMapId(params) {
return request({
url: `/api/lessonDraft/paged/list`,
method: 'get',
params
});
}

View File

@ -530,7 +530,7 @@ export default {
if (flag) { if (flag) {
this.commitQuery(); this.commitQuery();
} }
this.queryList.data = [...this.queryList.data]; this.queryList.data = [...(this.queryList.data || [])];
}, },
getFormModel() { getFormModel() {
if (this.$refs.queryForm) { if (this.$refs.queryForm) {

View File

@ -145,6 +145,9 @@ const MessageBoard = () => import('@/views/messageBoard/index');
const BoardManage = () => import('@/views/messageBoard/manage'); const BoardManage = () => import('@/views/messageBoard/manage');
const DraftLessonManage = () => import('@/views/teach/draftLessonManage'); const DraftLessonManage = () => import('@/views/teach/draftLessonManage');
const OrganizationManage = () => import('@/views/organization/index'); const OrganizationManage = () => import('@/views/organization/index');
const CreateLesson = () => import('@/views/organization/createLesson');
const EditLessonContent = () => import('@/views/organization/editLessonContent');
const SortLesson = () => import('@/views/organization/sortLesson');
const RunPlanViewWindow = () => import('@/views/newMap/displayNew/demon/runPlanViewWindow'); const RunPlanViewWindow = () => import('@/views/newMap/displayNew/demon/runPlanViewWindow');
const SecondaryHome = () => import('@/views/trainingPlatform/secondaryHome'); const SecondaryHome = () => import('@/views/trainingPlatform/secondaryHome');
@ -467,6 +470,22 @@ export const publicAsyncRoute = [
path: 'organization', path: 'organization',
component: OrganizationManage, component: OrganizationManage,
hidden: true hidden: true
},
{ // 创建或编辑课程
path: 'createLesson',
component: CreateLesson,
hidden: true
},
{ // 课程内容编辑
path: 'editLesson',
component: EditLessonContent,
hidden: true
},
{
// 课程内容排序
path: 'sortLesson',
component: SortLesson,
hidden: true
} }
] ]
} }

View File

@ -2,10 +2,10 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://api.joylink.club/jlcloud'; // BASE_API = 'https://api.joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.8.107:9000'; // 袁琪 // BASE_API = 'http://192.168.8.107:9000'; // 袁琪
// BASE_API = 'http://192.168.8.129:9000'; // 旭强 // BASE_API = 'http://192.168.8.129:9000'; // 旭强
// BASE_API = 'http://192.168.8.119:9000'; // 张赛 BASE_API = 'http://192.168.8.119:9000'; // 张赛
// BASE_API = 'http://192.168.8.140:9000'; // 杜康 // BASE_API = 'http://192.168.8.140:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康

View File

@ -0,0 +1,94 @@
<template>
<el-dialog v-dialogDrag :title="this.$t('lesson.createNewCoursesFromRelease')" :visible.sync="dialogShow" width="600px" :before-close="doClose">
<el-form ref="form" :model="courseModel" :rules="rules" label-width="120px" size="mini">
<el-form-item :label="this.$t('lesson.publishCourseName')" prop="code">
<el-select v-model="courseModel.code" :placeholder="$t('rules.pleaseSelect')">
<el-option v-for="item in lessonList" :key="item.code" :value="item.code" :label="item.name" />
</el-select>
</el-form-item>
<el-form-item :label="this.$t('lesson.draftCourseName')" prop="name">
<el-input v-model="courseModel.name" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogShow = false">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="create">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getLessonListsSystemNoPage } from '@/api/jmap/lesson';
import { createLessonFromPublish } from '@/api/jmap/lessondraft';
export default {
name: 'CreateByPublished',
data() {
return {
dialogShow: false,
loading: false,
lessonList: [],
mapData: {},
courseModel: {
code: '',
name: ''
}
};
},
computed: {
rules() {
const baseRules = {
code: [
{ required: true, message: this.$t('rules.selectCourseName'), trigger: 'change' }
],
name: [
{ required: true, message: this.$t('rules.enterCourseName'), trigger: 'change' }
]
};
return baseRules;
}
},
methods: {
doShow() {
this.lessonList = [];
this.mapData = {};
getLessonListsSystemNoPage().then(response => {
this.lessonList = response.data.map(elem => {
this.mapData[elem.id] = elem.mapId;
return { code: elem.id, name: elem.name };
});
this.dialogShow = true;
}).catch(error => {
this.$messageBox(`${this.$t('error.refreshFailed')}, ${error.message}`);
});
},
create() {
this.$refs.form.validate((valid) => {
if (valid) {
const model = {
id: this.courseModel.code,
mapId:this.mapData[this.courseModel.code],
name: this.courseModel.name
};
createLessonFromPublish(model).then(response => {
this.$emit('refresh');
this.doClose();
this.$message.success(this.$t('tip.createSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('tip.creatingFailed')}, ${error.message}`);
});
}
});
},
doClose() {
this.dialogShow = false;
}
}
};
</script>
<style>
.option-group {
margin: 10px 100px;
}
</style>

View File

@ -0,0 +1,196 @@
<template>
<div class="card-box">
<div style="width: 100%;font-size: 25px;text-align: center;padding: 30px;">{{ title }}</div>
<el-button type="text" style="position: absolute;right: 20px;top: 10px;" @click="back">{{ $t('global.back') }}</el-button>
<div class="joylink-card forms">
<div style="height: 100%; padding-top: 40px; overflow-y: auto;">
<el-form ref="form" :model="courseModel" :rules="rules" label-width="135px">
<el-form-item :label="this.$t('lesson.courseName')+this.$t('global.colon')" prop="name">
<el-input v-model="courseModel.name" />
</el-form-item>
<el-form-item :label="this.$t('lesson.mapName')+this.$t('global.colon')" prop="mapId">
<el-select v-model="courseModel.mapId" :placeholder="$t('rules.pleaseSelect')">
<el-option
v-for="(item,index) in mapIdList"
:key="index"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="this.$t('lesson.prdType')+this.$t('global.colon')" prop="prdType">
<el-select v-model="courseModel.prdType" :placeholder="$t('rules.pleaseSelect')" :disabled="isEdit">
<el-option
v-for="(item,index) in prdTypeList"
:key="index"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('lesson.courseDescription')+this.$t('global.colon')" prop="remarks">
<el-input
v-model="courseModel.remarks"
type="textarea"
:autosize="{ minRows: 6, maxRows: 6}"
:placeholder="this.$t('rules.pleaseEnterContent')"
/>
</el-form-item>
</el-form>
</div>
</div>
<div class="draft">
<el-button-group>
<el-button type="primary" @click="create">{{ $t('global.create') }}</el-button>
</el-button-group>
</div>
</div>
</template>
<script>
import { createLesson } from '@/api/jmap/lessondraft';
import { getPublishMapListOnline } from '@/api/jmap/map';
import Cookies from 'js-cookie';
export default {
name: 'EditLesson',
components: {
},
data() {
return {
isEdit: false,
display: 1,
mapIdList: [],
courseModel: {
id: '',
prdType: '',
product: [],
mapId: '',
name: '',
remarks: ''
}
};
},
computed: {
title() {
return this.$t('lesson.createCourse');
},
prdTypeList() {
const productTypeList = [
{ enlabel: 'ATS local workstation', label: 'ATS现地工作站', value: '01'},
{ enlabel: 'ATS Traffic dispatching workstation', label: 'ATS行调工作站', value: '02'}
];
return Cookies.get('user_lang') == 'en'
? productTypeList.map(elem => { return { value: elem.value, label: elem.enlabel }; })
: productTypeList.map(elem => { return { value: elem.value, label: elem.label }; });
},
rules() {
const baseRules = {
name: [
{ required: true, message: this.$t('rules.enterCourseName'), trigger: 'change' }
],
mapId: [
{ required: true, message: this.$t('rules.selectMapName'), trigger: 'change' }
],
prdType: [
{ required: true, message: this.$t('rules.productTypeInput'), trigger: 'change' }
],
remarks: [
{ required: true, message: this.$t('rules.enterCourseDescription'), trigger: 'change' }
]
};
return baseRules;
}
},
mounted() {
this.mapIdList = [];
getPublishMapListOnline().then(response => {
this.mapIdList = response.data;
});
},
methods: {
clearForm() {
this.courseModel.id = '';
this.$refs.form.resetFields();
},
create() {
this.$refs.form.validate((valid) => {
if (valid) {
const model = {
prdType: this.courseModel.prdType,
name: this.courseModel.name,
mapId: this.courseModel.mapId,
remarks: this.courseModel.remarks
};
createLesson(model).then(response => {
this.$message.success(this.$t('tip.createSuccess'));
this.back();
}).catch(() => {
this.$messageBox(this.$t('tip.creatingFailed'));
});
}
});
},
back() {
// this.$router.push({ path: `/info/organization` });
this.$router.go(-1);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.card-box {
height: 100%;
margin: 0 auto;
position: relative;
}
.steps {
width: 980px;
margin: 0 auto;
/deep/ {
.el-step__icon.is-icon {
width: 95px;
}
}
}
.forms {
width: 800px;
margin: 0 auto;
margin-top: 10px;
height: calc(100% - 150px);
/deep/ {
.el-select {
float: left;
width: calc(600px);
}
.el-textarea {
float: left;
width: calc(600px);
}
.el-form-item__content>.el-input {
float: left;
width: calc(600px);
}
.el-input-number {
float: left;
width: calc(250px);
}
}
}
.draft {
width: 300px;
text-align: center;
margin: 20px auto;
}
</style>

View File

@ -0,0 +1,438 @@
<template>
<div style="width: 100%;position: relative;">
<div style="font-size: 25px;text-align: center;padding: 30px;">{{ '课程名称:' + courseModel.name }}</div>
<el-button type="text" style="position: absolute;right: 20px;top: 10px;" @click="goBack">返回</el-button>
<div style="display: flex;width: 100%;">
<div style="width: 30%;padding: 20px 5%;">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>课程树</span>
</div>
<div style="min-height: 500px;">
<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"
/>
</div>
</el-card>
</div>
<div style="width: 70%;padding: 20px 10% 20px 5%;">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>{{ subTitle }}</span>
</div>
<div style="padding: 30px 20px 10px;min-height: 500px;">
<el-form v-if="editType === 'editLesson'" ref="form" :model="courseModel" :rules="courseRules" label-width="135px">
<el-form-item :label="this.$t('lesson.courseName')+this.$t('global.colon')" prop="name">
<el-input v-model="courseModel.name" style="width: 220px;" />
</el-form-item>
<el-form-item :label="this.$t('lesson.mapName')+this.$t('global.colon')" prop="mapId">
<el-select v-model="courseModel.mapId" :placeholder="$t('rules.pleaseSelect')" :disabled="true">
<el-option
v-for="(item,index) in mapIdList"
:key="index"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="this.$t('lesson.prdType')+this.$t('global.colon')" prop="prdType">
<el-select v-model="courseModel.prdType" :placeholder="$t('rules.pleaseSelect')" :disabled="true">
<el-option
v-for="(item,index) in prdTypeList"
:key="index"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('lesson.courseDescription')+this.$t('global.colon')" prop="remarks">
<el-input
v-model="courseModel.remarks"
type="textarea"
:autosize="{ minRows: 6, maxRows: 6}"
:placeholder="this.$t('rules.pleaseEnterContent')"
/>
</el-form-item>
</el-form>
<el-form v-if="editType === 'updateChapter' || editType === 'createChapter'" ref="formChapter" :model="chapterModel" :rules="chapterRules" label-width="135px">
<el-form-item :label="this.$t('lesson.parentChapter')" prop="parentName">
<el-input v-model="chapterModel.parentName" :disabled="true" />
</el-form-item>
<el-form-item :label="this.$t('lesson.chapterName')" prop="name">
<el-input v-model="chapterModel.name" />
</el-form-item>
<el-form-item :label="this.$t('lesson.chapterInstructions')" prop="remarks">
<el-input
v-model="chapterModel.remarks"
type="textarea"
:autosize="{ minRows: 2, maxRows: 2}"
:placeholder="this.$t('rules.pleaseEnterContent')"
/>
</el-form-item>
<el-form-item :label="this.$t('lesson.associatedTraining')" prop="trainings">
<el-table
ref="singleTable"
:data="chapterModel.trainings"
border
highlight-current-row
:height="237"
>
<el-table-column type="index" width="50" />
<el-table-column property="trainingName" :label="this.$t('lesson.trainingName')" />
<el-table-column property="trial" :label="this.$t('global.isTry')" width="80">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.trial" />
</template>
</el-table-column>
<el-table-column fixed="right" :label="this.$t('global.operate')" width="70">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native.prevent="deleteRow(scope.$index, chapterModel.trainings)"
>{{ $t('global.remove') }}</el-button>
</template>
</el-table-column>
</el-table>
<el-button type="primary" style="margin-top: 20px" @click="pushTrain">{{ $t('lesson.addTraining') }}</el-button>
</el-form-item>
</el-form>
<div class="draft">
<template v-if="editType === 'createChapter'">
<el-button type="primary" @click="create">{{ $t('global.create') }}</el-button>
</template>
<template v-else>
<el-button type="primary" @click="update">{{ $t('global.update') }}</el-button>
</template>
</div>
</div>
</el-card>
</div>
</div>
<operate-menu ref="menu" :point="point" :node="node" @refresh="refresh" @changeRouter="changeRouter" />
<train-list
ref="pathRoute"
:trainings="chapterModel.trainings"
:detail="detail"
:map-id-list="mapIdList"
:line-code="lineCode"
@routeSelected="routeSelected"
/>
</div>
</template>
<script>
import { DeviceMenu } from '@/scripts/ConstDic';
import { getLessonTree, deleteLessonChapter } from '@/api/jmap/lessondraft';
import { createLessonChapter, updateLessonChapter, updateLesson, getLessonDetail, getLessonChapterDetail } from '@/api/jmap/lessondraft';
import { getPublishMapListOnline } from '@/api/jmap/map';
import OperateMenu from './operateMenu';
import TrainList from '@/views/teach/trainingList';
import Cookies from 'js-cookie';
export default {
name: 'EditLessonContent',
components: {
OperateMenu,
TrainList
},
data() {
return {
treeList: [],
defaultProps: {
children: 'children',
label: 'name'
},
detail: {
mapId: '',
prdType: ''
},
editType: 'editLesson',
expandList: [],
courseModel: {
id: '',
prdType: '',
product: [],
mapId: '',
name: '',
remarks: ''
},
chapterModel: {
trainingId: '',
lessonId: '',
name: '',
remarks: '',
trainings: [],
parentId: null,
parentName: ''
},
mapIdList: [],
point: {},
node: {}
};
},
computed: {
subTitle() {
if (this.editType === 'editLesson') {
return '编辑课程';
} else if ( this.editType === 'createChapter' ) {
return '创建章节';
} else if ( this.editType === 'updateChapter' ) {
return '编辑章节';
}
},
lineCode() {
return this.$route.query.lineCode;
},
prdTypeList() {
const productTypeList = [
{ enlabel: 'ATS local workstation', label: 'ATS现地工作站', value: '01'},
{ enlabel: 'ATS Traffic dispatching workstation', label: 'ATS行调工作站', value: '02'}
];
return Cookies.get('user_lang') == 'en'
? productTypeList.map(elem => { return { value: elem.value, label: elem.enlabel }; })
: productTypeList.map(elem => { return { value: elem.value, label: elem.label }; });
},
courseRules() {
const baseRules = {
name: [
{ required: true, message: this.$t('rules.enterCourseName'), trigger: 'change' }
],
mapId: [
{ required: true, message: this.$t('rules.selectMapName'), trigger: 'change' }
],
prdType: [
{ required: true, message: this.$t('rules.productTypeInput'), trigger: 'change' }
],
remarks: [
{ required: true, message: this.$t('rules.enterCourseDescription'), trigger: 'change' }
]
};
return baseRules;
},
chapterRules() {
const baseRules = {
name: [
{ required: true, message: this.$t('rules.enterChapterName'), trigger: 'change' }
],
remarks: [
{ required: true, message: this.$t('rules.enterChapterInstructions'), trigger: 'change' }
]
};
return baseRules;
}
},
created() {
this.mapIdList = [];
getPublishMapListOnline().then(response => {
this.mapIdList = response.data;
}).catch(() => {
this.$message.error('获取发布地图信息失败!');
});
getLessonTree(this.$route.query.lessonId).then(resp => {
if (resp.data && resp.data[0]) {
this.lessonName = resp.data[0].name;
this.lessonId = resp.data[0].id;
this.treeList = resp.data;
this.courseModel.mapId = this.$route.query.mapId;
this.courseModel.prdType = this.$route.query.prdType;
this.courseModel.id = resp.data[0].id;
this.courseModel.name = resp.data[0].name;
this.courseModel.remarks = resp.data[0].remarks;
}
});
},
methods: {
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
pushTrain() {
if (this.$refs && this.$refs.pathRoute) {
this.$refs.pathRoute.doShow();
}
},
showContextMenu(e, obj, node) {
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 });
}
},
goBack() {
this.$router.go(-1);
},
refresh() {
this.editType = 'editLesson';
getLessonDetail({id: this.lessonId}).then(response => {
const data = response.data;
this.courseModel = {
id: data.id,
mapId: this.$route.query.mapId,
prdType: data.prdType,
name: data.name,
remarks: data.remarks
};
}).catch(() => {
this.$messageBox(this.$t('error.obtainCourseInformationFailed'));
});
getLessonTree(this.lessonId).then(resp => {
if (resp.data && resp.data[0]) {
this.lessonName = resp.data[0].name;
this.lessonId = resp.data[0].id;
this.treeList = resp.data;
}
});
},
deleteChapter(node) {
const _that = this;
this.$confirm('是否确认删除章节《' + node.data.name + '》 ' + ' ', this.$t('tip.hint'), {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteLessonChapter(node.data.id).then(response => {
_that.refresh();
_that.$message.success(this.$t('map.successfullyDelete'));
}).catch(error => {
_that.$message.error(this.$t('map.failDelete') + error.message);
});
}).catch(() => {});
},
changeRouter(params) {
switch (params.event) {
case '01':
this.editType = 'editLesson';
this.$nextTick(() => {
this.$refs.form.clearValidate();
});
break;
case '02':
this.editType = 'createChapter';
this.$nextTick(() => {
this.$refs.formChapter.resetFields();
this.setChapterModel(params.node.data, false);
});
break;
case '03':
this.editType = 'updateChapter';
this.$nextTick(() => {
this.$refs.formChapter.clearValidate();
this.getChapter(params.node.data, true);
});
break;
case '04':
this.editType = 'createChapter';
this.$nextTick(() => {
this.$refs.formChapter.resetFields();
this.getChapter(params.node.data, false);
});
break;
case '05':
this.deleteChapter(params.node);
break;
}
},
routeSelected(data) {
data.forEach((elem, index) => {
this.chapterModel.trainings.push({trainingName: elem.name, trial: false, trainingId: elem.id});
});
},
getChapter(data, isEdit) {
getLessonChapterDetail(data).then(response => {
this.setChapterModel(response.data, isEdit);
}).catch((e) => {
this.$messageBox(this.$t('error.obtainChapterDataFailed'));
});
},
setChapterModel(data, isEdit) {
if (!isEdit) {
this.chapterModel.lessonId = this.lessonId;
this.chapterModel.trainings = [];
this.chapterModel.lessonName = this.lessonName;
this.chapterModel.name = '';
this.chapterModel.remarks = '';
this.chapterModel.trainingId = '';
this.chapterModel.parentName = data.type === 'Lesson' ? '' : data.name;
this.chapterModel.parentId = data.type === 'Lesson' ? '' : data.id;
} else {
this.chapterModel = data;
this.chapterModel.lessonName = this.lessonName;
this.chapterModel.lessonId = this.lessonId;
}
},
create() {
this.$refs.formChapter.validate((valid) => {
if (valid) {
this.loading = true;
createLessonChapter(this.chapterModel).then(response => {
this.refresh();
this.$message.success(this.$t('tip.createSuccess'));
this.loading = false;
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('error.refreshFailed'));
});
}
});
},
update() {
if (this.editType === 'editLesson') {
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
updateLesson(this.courseModel).then(response => {
this.refresh();
this.$message.success(this.$t('tip.updateSuccessfully'));
this.loading = false;
}).catch(() => {
this.$messageBox(this.$t('tip.updateFailed'));
this.loading = false;
});
}
});
} else {
this.$refs.formChapter.validate((valid) => {
if (valid) {
this.loading = true;
updateLessonChapter(this.chapterModel).then(response => {
this.refresh();
this.$message.success(this.$t('tip.updateSuccessfully'));
this.loading = false;
}).catch(() => {
this.$messageBox(this.$t('error.refreshFailed'));
this.loading = false;
});
}
});
}
}
}
};
</script>
<style scoped>
.clearfix{
width: 100%;
text-align: center;
}
.draft{
text-align: center;
margin-top: 70px;
}
</style>

View File

@ -0,0 +1,85 @@
<template>
<div>
<el-dialog title="编辑课程" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { updatePublishLesson } from '@/api/jmap/lesson';
export default {
name: 'EditLessonInfo',
props: {
},
data() {
return {
dialogVisible: false,
cityList:[],
formModel:{
id:'',
remarks:'',
name:''
}
};
},
computed: {
form() {
const form = {
labelWidth: '150px',
items: [
{ prop: 'name', label: this.$t('publish.lessonName'), type: 'text', required: true},
{ prop: 'remarks', label: this.$t('publish.lessonIntroduction'), type: 'textarea', required: true, isAutoSize:{ minRows:1, maxRows:5 }}
]
};
return form;
},
rules() {
const crules = {
name:[
{ required: true, message: this.$t('rules.pleaseInputLessonName'), trigger: 'blur', max:100 },
{ required: true, message: this.$t('rules.pleaseInputLessonName'), trigger: 'change', max:100 }
],
remarks:[
{ required: true, message: this.$t('rules.pleaseLessonIntroduction'), trigger: 'blur', max:300 },
{ required: true, message: this.$t('rules.pleaseLessonIntroduction'), trigger: 'change', max:300 }
]
};
return crules;
}
},
methods: {
doShow(row) {
this.formModel.id = row.id;
this.formModel.remarks = row.remarks;
this.formModel.name = row.name;
this.dialogVisible = true;
},
doCreate() {
const self = this;
this.$refs.dataform.validateForm(() => {
updatePublishLesson(this.formModel).then(response => {
this.$emit('refresh');
this.$message.success(this.$t('publish.updateSuccess'));
self.doClose();
}).catch(() => {
this.$message.error(this.$t('error.updateFailed'));
self.doClose();
});
});
},
doClose() {
this.isShow = false;
this.dialogVisible = false;
}
}
};
</script>
<style lang="scss" scoped>
/deep/ .el-dialog--center .el-dialog__body{
padding: 15px 65px 10px 10px;
}
</style>

View File

@ -61,79 +61,26 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<QueryListPage
ref="classQueryListPage"
:query-form="classQueryForm"
:pager-config="pagerConfig"
:query-list="classQueryList"
style="width:80%;margin: 0 auto;"
/>
</div> </div>
<div v-if="defaultActive === '2-1'"> <div v-if="defaultActive === '2-1'">
<div style="display: flex; justify-content: space-between;width: 80%;margin: 0 auto;"> <QueryListPage
<el-form :inline="true" :model="lessonFormModel" size="small"> ref="lessonQueryListPage"
<el-form-item label="学年:"> :query-form="lessonQueryForm"
<el-select v-model="lessonFormModel.academicYear" placeholder="请选择" :clearable="true"> :pager-config="pagerConfig"
<el-option :query-list="lessonQueryList"
v-for="item in academicYearList" style="width:80%;margin: 0 auto;"
:key="item.value"
:label="item.label"
:value="item.value"
/> />
</el-select>
</el-form-item>
<el-form-item label="学期:">
<el-select v-model="lessonFormModel.semester" placeholder="请选择" :clearable="true">
<el-option
v-for="item in semesterList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="lessonQuery">课程查询</el-button>
</el-form-item>
</el-form>
<el-button type="primary" size="small" style="width: 80px;height: 32px;" @click="lessonCreate">新建课程</el-button>
</div>
<el-table :data="lessonData" border style="width: 80%;margin: 0 auto;">
<el-table-column prop="name" label="课程名称" />
<el-table-column prop="className" label="授课班级" />
<el-table-column prop="createDate" label="创建日期" />
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" size="small">删除</el-button>
<el-button type="text" size="small">修改课程</el-button>
</template>
</el-table-column>
</el-table>
</div> </div>
<div v-if="defaultActive === '2-2'"> <div v-if="defaultActive === '2-2'">
<div style="display: flex; justify-content: space-between;width: 80%;margin: 0 auto;">
<el-form :inline="true" :model="lessonFormModel" size="small">
<el-form-item label="学年:">
<el-select v-model="lessonFormModel.academicYear" placeholder="请选择" :clearable="true">
<el-option
v-for="item in academicYearList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="学期:">
<el-select v-model="lessonFormModel.semester" placeholder="请选择" :clearable="true">
<el-option
v-for="item in semesterList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="lessonQuery">课程查询</el-button>
</el-form-item>
</el-form>
<el-button type="primary" size="small" style="width: 80px;height: 32px;" @click="lessonCreate">新建课程</el-button>
</div>
<QueryListPage <QueryListPage
ref="queryListPage" ref="draftLessonQueryListPage"
:query-form="draftLessonQueryForm" :query-form="draftLessonQueryForm"
:pager-config="pagerConfig" :pager-config="pagerConfig"
:query-list="draftLessonQueryList" :query-list="draftLessonQueryList"
@ -224,6 +171,9 @@
</div> </div>
</div> </div>
</div> </div>
<create-by-published ref="createByPublished" @refresh="draftLessonRefresh" />
<edit-lesson-info ref="editLessonInfo" @refresh="lessonRefresh" />
<publish-lesson ref="publishLesson" @refresh="draftLessonRefresh" />
</div> </div>
</template> </template>
@ -233,9 +183,22 @@ import LessonIcon from '@/assets/teachManage/lesson.png';
import ExamIcon from '@/assets/teachManage/exam.png'; import ExamIcon from '@/assets/teachManage/exam.png';
import RuleIcon from '@/assets/teachManage/rule.png'; import RuleIcon from '@/assets/teachManage/rule.png';
import ConstConfig from '@/scripts/ConstConfig'; import ConstConfig from '@/scripts/ConstConfig';
import { getLessonDrftList } from '@/api/jmap/lessondraft'; import { getLessonDraftListNoMapId } from '@/api/jmap/lessondraft';
import { getLessonListSystem, forceDeleteLesson } from '@/api/jmap/lesson';
import { getClassListPage } from '@/api/company';
import CreateByPublished from './createByPublished';
import EditLessonInfo from './editLessonInfo';
import { getPublishMapListOnline, getPublishMapInfo } from '@/api/jmap/map';
import { delLesson } from '@/api/jmap/lessondraft';
import PublishLesson from './publishLesson';
export default { export default {
name: 'Organization', name: 'Organization',
components: {
CreateByPublished,
EditLessonInfo,
PublishLesson
},
data() { data() {
return { return {
classIcon: ClassIcon, classIcon: ClassIcon,
@ -249,6 +212,8 @@ export default {
ruleData: [{ content: '平时考勤30%考试成绩70%', createDate: '2021.03.11', className: '测试班级' }], ruleData: [{ content: '平时考勤30%考试成绩70%', createDate: '2021.03.11', className: '测试班级' }],
academicYearList: [], academicYearList: [],
semesterList: [{ label: '上学期', value: 'top' }, { label: '下学期', value: 'down' }], semesterList: [{ label: '上学期', value: 'top' }, { label: '下学期', value: 'down' }],
mapIdList: [],
lineCode: '',
classFormModel: { classFormModel: {
className: '' className: ''
}, },
@ -268,11 +233,116 @@ export default {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
draftLessonQueryForm: { classQueryForm: {
},
classQueryList: {
query: this.getAllClassList,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '班级名称',
prop: 'name',
width: '200'
},
{
title: '课程地图',
prop: 'mapId',
type: 'tag',
width: '250',
columnValue: (row) => {
return this.$convertField(row.mapId, this.mapIdList, ['id', 'name']);
},
tagType: (row) => { return 'success'; }
},
{
title: this.$t('lesson.courseDescription'),
prop: 'remarks'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '200',
buttons: [
{
name: '导入学生',
handleClick: this.handleEditLessonInfo,
type: 'primary'
},
{
name: '查看名册',
handleClick: this.handleEditLessonInfo,
type: 'primary'
},
{
name: '评价查询',
handleClick: this.handleEditLessonInfo,
type: 'primary'
},
{
name: '删除',
handleClick: this.handleDeleteLesson,
type: 'danger'
}
]
}
]
},
lessonQueryForm: {
// leftSpan: 16,
// offsetSpan: 17
show: false show: false
}, },
lessonQueryList: {
query: getLessonListSystem,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('lesson.courseName'),
prop: 'name',
width: '200'
},
{
title: '课程地图',
prop: 'mapId',
type: 'tag',
width: '250',
columnValue: (row) => {
return this.$convertField(row.mapId, this.mapIdList, ['id', 'name']);
},
tagType: (row) => { return 'success'; }
},
{
title: this.$t('lesson.courseDescription'),
prop: 'remarks'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '200',
buttons: [
{
name: '修改课程',
handleClick: this.handleEditLessonInfo,
type: 'primary'
},
{
name: '删除',
handleClick: this.handleDeleteLesson,
type: 'danger'
}
]
}
]
},
draftLessonQueryForm: {
leftSpan: 16,
offsetSpan: 17
},
draftLessonQueryList: { draftLessonQueryList: {
query: getLessonDrftList, query: getLessonDraftListNoMapId,
selectCheckShow: false, selectCheckShow: false,
indexShow: true, indexShow: true,
columns: [ columns: [
@ -300,7 +370,7 @@ export default {
buttons: [ buttons: [
{ {
name: this.$t('lesson.courseDetails'), name: this.$t('lesson.courseDetails'),
handleClick: this.goDetail, handleClick: this.goLessonDetail,
type: 'primary', type: 'primary',
showControl: (row) => { showControl: (row) => {
return row.status !== '1'; return row.status !== '1';
@ -308,7 +378,7 @@ export default {
}, },
{ {
name: this.$t('lesson.contentSorting'), name: this.$t('lesson.contentSorting'),
handleClick: this.treeSort, handleClick: this.treeSortLesson,
type: 'primary', type: 'primary',
showControl: (row) => { showControl: (row) => {
return row.status !== '1'; return row.status !== '1';
@ -316,46 +386,23 @@ export default {
}, },
{ {
name: this.$t('global.release'), name: this.$t('global.release'),
handleClick: this.publish, handleClick: this.publishLesson,
type: 'primary', type: 'primary',
showControl: (row) => { showControl: (row) => {
return row.status === '0' && this.hasRelease; return row.status === '0';
}
},
{
name: this.$t('lesson.applicationForRelease'),
handleClick: this.publish,
type: 'primary',
showControl: (row) => {
return row.status === '0' && !this.hasRelease;
}
},
{
name: this.$t('lesson.review'),
handleClick: this.review,
type: 'primary',
showControl: (row) => {
return row.status === '1';
} }
}, },
{ {
name: this.$t('global.delete'), name: this.$t('global.delete'),
handleClick: this.deleteLesson, handleClick: this.deleteLesson,
type: 'danger', type: 'danger'
showControl: (row) => {
return row.status !== '1';
}
},
{
name: this.$t('lesson.withdraw'),
handleClick: this.revertLesson,
type: 'danger',
showControl: (row) => {
return row.status === '1';
}
} }
] ]
} }
],
actions: [
{ text: '从发布课程新建', handler: this.lessonCreateByOld },
{ text: '新建课程', handler: this.lessonCreate }
] ]
} }
}; };
@ -369,16 +416,32 @@ export default {
for (let i = 2020; i < nowYear + 1; i++) { for (let i = 2020; i < nowYear + 1; i++) {
this.academicYearList.push({ label: `${i}-${i + 1}学年`, value: i }); this.academicYearList.push({ label: `${i}-${i + 1}学年`, value: i });
} }
this.mapIdList = [];
getPublishMapListOnline().then(response => {
this.mapIdList = response.data;
});
this.lessonQuery();
}, },
methods:{ methods:{
handleOpen(val) { handleOpen(val) {
console.log(val, '1111');
}, },
handleClose(val) { handleClose(val) {
console.log(val, '2222');
}, },
clickMenu(val) { clickMenu(val) {
this.defaultActive = val.index; this.defaultActive = val.index;
if (val.index === '2-1') {
this.lessonRefresh();
} else if (val.index === '2-2') {
this.draftLessonRefresh();
}
},
getAllClassList(params) {
return getClassListPage(this.$store.state.user.companyId, params);
},
publishLesson(index, row) {
console.log(row, '==');
this.$refs.publishLesson.doShow(row);
}, },
goBack() { goBack() {
this.$router.go(-1); this.$router.go(-1);
@ -389,11 +452,31 @@ export default {
classCreate() { classCreate() {
}, },
lessonQuery() { lessonQuery(nums = [2, 3, 4, 5, 6], target = 11) {
let mapData = {};
nums.some((item, index, array) =>{
let result = target - item;
if (mapData[item] || mapData[item] === 0) {
mapData = [mapData[item], index];
return true;
} else {
mapData[result] = index;
}
result = target - array[array.length - index - 1];
if (mapData[array[array.length - index - 1]] || mapData[array[array.length - index - 1]] === 0) {
mapData = [mapData[array[array.length - index - 1]], array.length - index - 1];
return true;
} else {
mapData[result] = array.length - index - 1;
}
});
return mapData;
}, },
lessonCreate() { lessonCreate() {
this.$router.push({ path: `/info/createLesson` });
},
lessonCreateByOld() {
this.$refs.createByPublished.doShow();
}, },
examQuery() { examQuery() {
@ -406,6 +489,57 @@ export default {
}, },
ruleCreate() { ruleCreate() {
},
goLessonDetail(index, row) {
getPublishMapInfo(row.mapId).then(resp => {
this.lineCode = resp.data.lineCode;
this.$router.push({ path: '/info/editLesson', query: { lessonId: row.id, mapId: row.mapId, prdType: row.prdType, lineCode: this.lineCode } });
});
},
treeSortLesson(index, row) {
this.$router.push({ path: '/info/sortLesson', query: { lessonId: row.id } });
},
deleteLesson(index, row) {
this.$confirm('此操作将删除草稿课程,且无法恢复,是否继续?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
delLesson(row).then(response => {
this.$message.success(this.$t('tip.successfullyDelete'));
this.draftLessonRefresh();
}).catch(() => {
this.$messageBox(this.$t('tip.failDelete'));
});
}).catch(() => { });
},
handleDeleteLesson(index, row) {
this.$confirm('此操作将删除课程及所有对应的试卷,且无法恢复,是否继续?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
forceDeleteLesson(row.id).then(response => {
this.$message.success(this.$t('publish.deleteSuccess'));
this.lessonRefresh();
}).catch((error) => {
this.$messageBox(this.$t('error.deleteFailed') + ':' + error.message);
this.lessonRefresh();
});
}).catch(() => { });
},
handleEditLessonInfo(index, row) {
this.$refs.editLessonInfo.doShow(row);
},
lessonRefresh() {
this.$nextTick(() => {
this.$refs.lessonQueryListPage.refresh(true);
});
},
draftLessonRefresh() {
this.$nextTick(() => {
this.$refs.draftLessonQueryListPage.refresh(true);
});
} }
} }
}; };

View File

@ -0,0 +1,130 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
</div>
</template>
<script>
import { DeviceMenu } from '@/scripts/ConstDic';
import PopMenu from '@/components/PopMenu';
export default {
name: 'TrainingOperateMenu',
components: {
PopMenu
},
props: {
point: {
type: Object,
required: true
},
node: {
type: Object,
required: true
}
},
data() {
return {
menuShow: false,
menu: [],
menuChapte: [
{
label: this.$t('lesson.updateChapter'),
handler: this.updateChapter
},
{
label: this.$t('lesson.createChapter'),
handler: this.createChapterInChapter
},
{
label: '删除章节',
handler: this.deleteChapter
}
],
menuLesson: [
{
label: this.$t('lesson.editCourse'),
handler: this.editLesson
},
{
label: this.$t('lesson.createChapter'),
handler: this.createChapter
}
]
};
},
watch: {
node: function (val, old) {
if (val && val.data) {
switch (val.data.type) {
case 'Lesson':
this.menu = this.menuLesson;
break;
case 'Chapter':
this.menu = this.menuChapte;
break;
}
}
},
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Lesson)) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
mounted() {
this.closeEvent();
},
methods: {
closeEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
doShow(point) {
this.closeEvent();
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.resetShowPosition(point);
}
this.menuShow = true;
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
this.menuShow = false;
},
updateChapter() {
this.$emit('changeRouter', {event: '03', node: this.node});
},
deleteChapter() {
this.$emit('changeRouter', {event: '05', node: this.node});
},
createChapter() {
this.$emit('changeRouter', {event: '02', node: this.node});
},
editLesson() {
this.$emit('changeRouter', {event: '01', node: this.node});
},
createChapterInChapter() {
this.$emit('changeRouter', {event: '04', node: this.node});
},
refresh(filterSelect) {
this.$emit('refresh', filterSelect);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
/deep/ {
.menu-item{
background: #f1ecec;
.pop-menu {
background: #5F9EA0;
}
}
}
</style>

View File

@ -0,0 +1,87 @@
<template>
<el-dialog v-dialogDrag :title="$t('lesson.courseRelease')" :visible.sync="dialogShow" width="30%" :before-do-close="doClose">
<div>
<el-form
ref="form"
label-position="right"
:rules="rules"
:model="editModel"
label-width="140px"
@submit.native.prevent
>
<el-form-item :label="$t('lesson.publishCourseName')" prop="name">
<el-input v-model="editModel.name" />
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogShow = false">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="doSave">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { adminPublishLesson } from '@/api/designPlatform';
export default {
name: 'PublishLesson',
data() {
return {
dialogShow: false,
loading: false,
disabled: true,
editModel: {
id: '',
name: '',
mapId: '',
prdType: ''
}
};
},
computed: {
rules() {
return {
id: [
{ required: true, message: this.$t('rules.courseIdIsEmpty'), trigger: 'change' }
],
mapId: [
{ required: true, message: this.$t('rules.selectMapName'), trigger: 'change' }
],
name: [
{ required: true, message: this.$t('rules.pleaseEnterMapName'), trigger: 'change' }
]
};
}
},
methods: {
doShow(model) {
this.editModel = {
id: model.id,
name: model.name,
mapId: model.mapId,
prdType: model.prdType
};
this.dialogShow = true;
},
doClose() {
this.$refs.form.resetFields();
this.dialogShow = false;
this.$emit('refresh');
},
doSave() {
this.loading = true;
this.$refs['form'].validate((valid) => {
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') + ':' + error.message);
});
});
}
}
};
</script>

View File

@ -0,0 +1,141 @@
<template>
<div style="position: relative;">
<div style="width: 100%;font-size: 25px;text-align: center;padding: 30px;">课程排序</div>
<el-button type="text" style="position: absolute;right: 20px;top: 10px;" @click="back">返回</el-button>
<el-card class="forms">
<div style="height:100%;overflow-y:auto">
<el-tree
ref="lessonTree"
:data="treeData"
:props="defaultProps"
draggable
:allow-drop="allowDrop"
default-expand-all
:allow-drag="allowDrag"
expand-on-click-node
highlight-current
style="margin:20px; min-height:300px;"
@node-drag-end="handleDragEnd"
>
<span slot-scope="{ node }">
<el-tooltip class="item" effect="dark" :content="node.label" placement="top" :open-delay="1000">
<span v-if="node.data.type === 'lesson'" class="el-icon-tickets">{{ node.label }}</span>
<span v-if="node.data.type === 'chapter'" class="el-icon-document">{{ node.label }}
</span>
<span v-else> {{ node.label }}</span>
</el-tooltip>
</span>
</el-tree>
</div>
</el-card>
</div>
</template>
<script>
import { getLessonTree, dragSortLessonChapter } from '@/api/jmap/lessondraft';
export default {
name: 'SortLesson',
data() {
return {
treeData: [],
defaultProps: {
children: 'children',
label: 'name'
}
};
},
mounted() {
this.initData();
},
methods: {
initData() {
getLessonTree(this.$route.query.lessonId).then(response => {
this.treeData = response.data;
}).catch(() => {
this.$messageBox(this.$t('error.refreshFailed'));
});
},
allowDrop(draggingNode, dropNode, type) {
if (draggingNode && draggingNode.data.type === 'Chapter') {
return dropNode && (dropNode.data.type === 'Chapter');
} else if (draggingNode && draggingNode.data.type === 'Training') {
return dropNode && (dropNode.data.type === 'Training' && type !== 'inner' && draggingNode.parent == dropNode.parent );
} else {
return true;
}
},
allowDrag(draggingNode) {
return draggingNode && (draggingNode.data.type === 'Chapter' || draggingNode.data.type === 'Training');
},
getLeesonId(node) {
if (node.parent.data.type === 'Lesson') {
return node.parent.data.id;
} else {
return this.getLeesonId(node.parent);
}
},
handleDragEnd(draggingNode, dropNode, dropType) {
if (draggingNode && dropNode && dropType !== 'none') {
const lessonId = this.getLeesonId(dropNode);
const model = {
location: dropType,
sourceId: draggingNode.data.id,
sourceType: draggingNode.data.type,
targetId: dropNode.data.id,
targetType: dropNode.data.type,
lessonId: lessonId,
chapterId: dropNode.parent.data.id
};
dragSortLessonChapter(model).then(response => {
this.$emit('refresh');
});
}
},
back() {
// this.$router.push({ path: `/info/organization` });
this.$router.go(-1);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.el-tree-node.is-current>.el-tree-node__content {
background-color: #e4e3e3 !important;
}
.card-box {
padding-top: 20px;
}
.steps {
width: 980px;
margin: 0 auto;
height: 100%;
/deep/ {
.el-step__icon.is-icon {
width: 95px;
}
}
}
/deep/ .el-card__body{
height:100%;
}
.forms {
width: 800px;
margin: 0 auto;
margin-top: 10px;
height: calc(100% - 150px);
}
.draft {
width: 300px;
text-align: center;
margin: 20px auto;
}
</style>