This commit is contained in:
joylink_cuiweidong 2021-01-08 16:43:24 +08:00
commit ae722ee86f
12 changed files with 1625 additions and 23 deletions

View File

@ -139,6 +139,7 @@ const PreTheoryImport = () => import('@/views/competitionManage/bankList/preImpo
const PlanScheduleWicket = () => import('@/views/newMap/displayNew/demon/planSchedule');
const MessageBoard = () => import('@/views/messageBoard/index');
const BoardManage = () => import('@/views/messageBoard/manage');
const DraftLessonManage = () => import('@/views/teach/draftLessonManage');
const OrganizationManage = () => import('@/views/organization/index');
// import { GenerateRouteProjectList } from '@/scripts/ProjectConfig';
@ -563,6 +564,11 @@ export const asyncRouter = [
component: TeachDetail,
hidden: true
},
{ // 草稿课程
path: 'draftTeach/:subSystem',
component: DraftLessonManage,
hidden: true
},
{ // 试卷列表
path: 'course/:subSystem',
component: ExamCourseDetail,

View File

@ -46,6 +46,9 @@ export default {
]
};
return baseRules;
},
mapId() {
return this.$route.params.mapId || this.$route.query.mapId;
}
},
mounted() {
@ -53,22 +56,19 @@ export default {
},
methods: {
doShow(node) {
getPublishLessonListByMapId({mapId:this.$route.params.mapId}).then(response => {
getPublishLessonListByMapId({mapId:this.mapId}).then(response => {
this.lessonList = response.data.map(elem => { return { code: elem.id, name: elem.name }; });
this.dialogShow = true;
}).catch(error => {
this.$messageBox(`${this.$t('error.refreshFailed')}, ${error.message}`);
});
this.dialogShow = true;
},
doClose() {
this.dialogShow = false;
},
create() {
this.$refs.form.validate((valid) => {
if (valid) {
const model = {
id: this.courseModel.code,
mapId:this.$route.params.mapId,
mapId:this.mapId,
name: this.courseModel.name
};
createLessonFromPublish(model).then(response => {
@ -80,6 +80,9 @@ export default {
});
}
});
},
doClose() {
this.dialogShow = false;
}
}
};

View File

@ -68,6 +68,7 @@
:message-list="messageList"
:my-member-id="myMemberId"
:simulation-users="simulationUsers"
:conversition-state-map="conversitionStateMap"
:common-conversation="commonConversation"
:user-role="userRole"
@changeMessageList="changeMessageList"
@ -125,6 +126,7 @@
:message-list="messageList"
:my-member-id="myMemberId"
:simulation-users="simulationUsers"
:conversition-state-map="conversitionStateMap"
:common-conversation="commonConversation"
:user-role="userRole"
width="360px"
@ -238,7 +240,11 @@ export default {
return (this.conversitionStateMap[this.myMemberId] || {privateMemberList: []}).privateMemberList;
},
privateMessageList() {
return (this.conversitionStateMap[this.myMemberId] || {privateMessageList: []}).privateMessageList;
if (this.conversitionStateMap[this.myMemberId] && this.conversitionStateMap[this.myMemberId].connect) {
return (this.conversitionStateMap[this.myMemberId] || {privateMessageList: []}).privateMessageList;
} else {
return [];
}
},
isRecord() {
return !!this.$route.query.record;
@ -250,7 +256,13 @@ export default {
// this.$refs.tree.filter(val);
// }
// },
conversitionId(val) {
// conversitionId(val) {
// if (val) {
// this.conversitionMemberList = this.privateMemberList;
// this.messageList = [...this.privateMessageList];
// }
// },
connect(val) {
if (val) {
this.conversitionMemberList = this.privateMemberList;
this.messageList = [...this.privateMessageList];
@ -1038,7 +1050,7 @@ export default {
}
if (this.commonConversation) {
this.messageList.push(data.message);
} else if (!this.commonConversation && this.conversitionId === data.id) {
} else if (!this.commonConversation && this.conversitionId === data.id && this.conversitionStateMap[this.myMemberId] && this.conversitionStateMap[this.myMemberId].connect) {
this.messageList.push(data.message);
}
},

View File

@ -36,6 +36,10 @@ export default {
type:Array,
required:true
},
conversitionStateMap: {
type: Object,
required: true
},
isAnswering:{
type:Boolean,
required:true
@ -89,7 +93,7 @@ export default {
const member = this.$store.state.training.memberData[val.message.memberId];
conversationInfo.message.src = `${conversationInfo.message.audioPath}`;
this.$emit('changeMessageList', conversationInfo);
if (this.conversitionId == val.id) {
if (this.conversitionId == val.id && this.conversitionStateMap[this.myMemberId] && this.conversitionStateMap[this.myMemberId].connect) {
if (member && member.userId != this.$store.state.user.id) {
this.currentAudioList.push({audioUrl:this.baseUrl + conversationInfo.message.audioPath, id:val.message.id});
if (!this.isPlay) {

234
src/views/teach/create.vue Normal file
View File

@ -0,0 +1,234 @@
<template>
<el-dialog
title="创建课程"
:visible.sync="dialogVisible"
width="1400px"
:before-close="handleClose"
:center="true"
>
<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')" :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')">
<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 type="primary" @click="handleClose">{{ $t('global.back') }}</el-button>
</el-button-group>
</div>
</el-dialog>
</template>
<script>
import { createLesson } from '@/api/jmap/lessondraft';
import { getPublishMapListOnline } from '@/api/jmap/map';
import { DeviceMenu } from '@/scripts/ConstDic';
import Cookies from 'js-cookie';
export default {
name: 'CourseEdit',
data() {
return {
dialogVisible: false,
display: 1,
mapIdList: [],
courseModel: {
id: '',
prdType: '',
product: [],
mapId: '',
name: '',
remarks: ''
}
};
},
computed: {
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() {
},
methods: {
handleClose() {
this.dialogVisible = false;
this.courseModel.id = '';
this.$refs.form && this.$refs.form.resetFields();
},
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
showContextMenu(e, obj, node, vueElem) {
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 });
}
},
clickEvent(obj, node, ele) {},
doShow() {
this.mapIdList = [];
getPublishMapListOnline().then(response => {
this.mapIdList = response.data;
this.dialogVisible = true;
this.courseModel.mapId = this.$route.query.mapId;
this.courseModel.prdType = this.$route.query.prdType;
});
},
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.$emit('refresh');
this.$message.success(this.$t('tip.createSuccess'));
this.handleClose();
}).catch(() => {
this.$messageBox(this.$t('tip.creatingFailed'));
});
}
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.card-box {
padding-top: 20px;
height: 100%;
margin: 0 auto;
}
.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);
}
}
}
.joylink-card{
height: 500px;
overflow-y: auto;
.title_box{
height: 47px;
line-height: 47px;
text-align: center;
border-bottom: 1px solid #EBEEF5;
}
.content_box{
height: calc(100% - 57px);
display: flex;
align-items: flex-start;
}
}
.tree_box{
position: relative;
left: 24px;
top: 10px;
width: 400px;
height: 100%;
.tree_content_box{
border: 2px dashed #B0C4DE;
height: 100%;
}
}
.draft {
width: 300px;
text-align: center;
margin: 20px auto;
}
</style>

View File

@ -7,7 +7,6 @@
<el-tabs v-model="activeName">
<el-tab-pane :label="$t('teach.courseDetails')" name="first">
<div>
<!--<el-scrollbar wrap-class="scrollbar-wrapper">-->
<el-tree
ref="tree"
:data="courseModel.treeList"
@ -28,7 +27,6 @@
<span v-else>&nbsp;{{ node.label }}</span>
</span>
</el-tree>
<!--</el-scrollbar>-->
</div>
</el-tab-pane>
<el-tab-pane :label="$t('teach.permissionsDetails')" name="second">

View File

@ -0,0 +1,523 @@
<template>
<el-dialog
v-loading="loading"
:title="title"
:visible.sync="dialogVisible"
width="1400px"
:before-close="handleClose"
:center="true"
>
<el-row>
<el-col :span="8">
<div class="joylink-card">
<div class="title_box">
<b>{{ $t('lesson.courseName') + ': '+ lessonName }}</b>
</div>
<div class="content_box">
<div class="tree_box">
<div class="tree_content_box">
<p>{{ this.$t('lesson.courseTree') }}</p>
<div style="height: calc(100% - 89px); overflow-y: auto;">
<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"
@node-click="clickEvent"
/>
</div>
</div>
</div>
</div>
</div>
</el-col>
<el-col :span="16">
<div style="height: 100%; overflow-y: auto;">
<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" />
</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>
<div class="draft">
<el-button-group>
<template v-if="editType === 'createChapter'">
<el-button type="primary" @click="create">{{ $t('global.create') }}</el-button>
<el-button type="primary" @click="handleClose"> </el-button>
</template>
<template v-else>
<el-button type="primary" @click="update">{{ $t('global.update') }}</el-button>
<el-button type="primary" @click="handleClose"> </el-button>
</template>
</el-button-group>
</div>
</el-col>
</el-row>
<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"
/>
</el-dialog>
</template>
<script>
import { createLessonChapter, updateLessonChapter, updateLesson, getLessonDetail, getLessonChapterDetail } from '@/api/jmap/lessondraft';
import { getLessonTree, deleteLessonChapter } from '@/api/jmap/lessondraft';
import { getPublishMapListOnline } from '@/api/jmap/map';
import { DeviceMenu } from '@/scripts/ConstDic';
import OperateMenu from './operateMenu';
import Cookies from 'js-cookie';
import TrainList from './trainingList';
export default {
name: 'CourseEdit',
components: {
OperateMenu,
TrainList
},
data() {
return {
dialogVisible: false,
display: 1,
mapIdList: [],
lineCode: '',
courseModel: {
id: '',
prdType: '',
product: [],
mapId: '',
name: '',
remarks: ''
},
chapterModel: {
trainingId: '',
lessonId: '',
name: '',
remarks: '',
trainings: [],
parentId: null,
parentName: ''
},
treeList: [],
defaultProps: {
children: 'children',
label: 'name'
},
detail: {
mapId: '',
prdType: ''
},
expandList: [],
lessonName: '',
lessonId: '',
node: {},
point: {},
title: '编辑课程',
editType: 'editLesson',
loading: false
};
},
computed: {
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;
this.mapIdList && this.mapIdList.forEach(item =>{
if (item.id === this.$route.query.mapId) {
this.lineCode = item.lineCode;
}
});
}).catch(() => {
this.$message.error('获取发布地图信息失败!');
});
},
methods: {
handleClose() {
this.dialogVisible = false;
this.courseModel.id = '';
this.$refs.form && this.$refs.form.resetFields();
this.$refs.formChapter && this.$refs.formChapter.resetFields();
},
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
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 });
}
},
clickEvent(obj, node, ele) {},
doShow(data) {
this.editType = 'editLesson';
getLessonTree(data.id).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.dialogVisible = true;
this.courseModel.mapId = this.$route.query.mapId;
this.courseModel.prdType = this.$route.query.prdType;
this.courseModel.id = data.id;
this.courseModel.name = data.name;
this.courseModel.remarks = data.remarks;
}
});
},
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;
});
}
});
}
},
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(() => {});
},
pushTrain() {
if (this.$refs && this.$refs.pathRoute) {
this.$refs.pathRoute.doShow();
}
},
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(() => {
this.$messageBox(this.$t('error.obtainChapterDataFailed'));
});
},
deleteRow(index, rows) {
rows.splice(index, 1);
},
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;
}
},
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;
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.card-box {
padding-top: 20px;
height: 100%;
margin: 0 auto;
}
.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);
}
}
}
.joylink-card{
height: 500px;
overflow-y: auto;
.title_box{
height: 47px;
line-height: 47px;
text-align: center;
border-bottom: 1px solid #EBEEF5;
}
.content_box{
height: calc(100% - 57px);
display: flex;
align-items: flex-start;
padding-bottom: 20px;
}
}
.tree_box{
position: relative;
left: 24px;
top: 10px;
width: 400px;
height: 100%;
.tree_content_box{
border: 2px dashed #B0C4DE;
height: 100%;
}
}
.draft {
width: 300px;
text-align: center;
margin: 20px auto;
}
</style>

View File

@ -0,0 +1,258 @@
<template>
<div class="joylink-card">
<div class="lesson-header">
<div class="lesson-list">草稿{{ $t('lesson.courseList') }}</div>
<div class="but-group">
<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>
<el-button size="mini" type="primary" @click="back">返回</el-button>
</div>
</div>
<QueryListPage ref="queryListPage" :card-padding="50" :query-form="queryForm" :pager-config="pagerConfig" :query-list="queryList" style="width: 91%;margin-left:4%;margin-top:20px;" />
<publish-create ref="publishCreate" @refresh="refresh" />
<publish-lesson ref="publishLesson" @refresh="refresh" />
<lesson-detail ref="lessonDetail" />
<draft-create ref="draftCreate" @refresh="refresh" />
<draft-detail ref="draftDetail" @refresh="refresh" />
<sort-tree ref="sortTree" />
</div>
</template>
<script>
import { releaseOrCancel } from '@/api/designPlatform';
import { getLessonDrftList } from '@/api/jmap/lessondraft';
import PublishCreate from '@/views/lesson/lessoncategory/edit/create/index';
import draftCreate from './create';
import sortTree from './sorttree';
import PublishLesson from '@/views/lesson/lessoncategory/edit/lesson/publish';
import { delLesson } from '@/api/jmap/lessondraft';
import LessonDetail from '@/views/approval/detail';
import ConstConfig from '@/scripts/ConstConfig';
import draftDetail from './draftDetail';
export default {
name: 'LessonHome',
components: {
PublishCreate,
PublishLesson,
LessonDetail,
draftCreate,
sortTree,
draftDetail
},
data() {
return {
loading: false,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
show: false
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('lesson.courseName'),
prop: 'name'
},
{
title: this.$t('lesson.courseDescription'),
prop: 'remarks'
},
{
title: this.$t('global.status'),
prop: 'status',
type: 'tag',
columnValue: (row) => {
return this.$convertField(row.status, ConstConfig.ConstSelect.releaseReview, ['value', 'label']);
},
tagType: (row) => { return 'success'; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '400',
buttons: [
{
name: this.$t('lesson.courseDetails'),
handleClick: this.goDetail,
type: 'primary',
showControl: (row) => {
return row.status !== '1';
}
},
{
name: this.$t('lesson.contentSorting'),
handleClick: this.treeSort,
type: 'primary',
showControl: (row) => {
return row.status !== '1';
}
},
{
name: this.$t('global.release'),
handleClick: this.publish,
type: 'primary',
showControl: (row) => {
return row.status === '0' && this.hasRelease;
}
},
{
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'),
handleClick: this.deleteLesson,
type: 'danger',
showControl: (row) => {
return row.status !== '1';
}
},
{
name: this.$t('lesson.withdraw'),
handleClick: this.revertLesson,
type: 'danger',
showControl: (row) => {
return row.status === '1';
}
}
]
}
]
}
};
},
computed: {
mapId() {
return this.$route.query.mapId;
},
isAdmin() {
return this.$store.state.user.roles.includes('04') || this.$store.state.user.roles.includes('05');
},
hasRelease() {
return this.$store.state.user.roles.includes('04') ||
this.$store.state.user.roles.includes('05') || this.$store.state.user.roles.includes('03');
}
},
watch: {
$route() {
this.refresh();
}
},
mounted() {
},
methods: {
queryFunction(params) {
return getLessonDrftList(this.mapId, params);
},
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;
},
refresh() {
this.$refs.queryListPage.refresh(true);
},
lessonCreate() {
this.$refs.draftCreate.doShow();
},
lessonCreateByPublish() {
this.$nextTick(() => {
this.$refs.publishCreate.doShow();
});
},
publish(index, row) {
row.mapId = this.mapId;
row.cityCode = this.$route.query.cityCode;
this.$refs.publishLesson.doShow(row);
},
deleteLesson(index, row) {
delLesson(row).then(response => {
this.$message.success(this.$t('tip.successfullyDelete'));
this.loading = true;
this.refresh();
this.loading = false;
}).catch(() => {
this.$messageBox(this.$t('tip.failDelete'));
});
},
treeSort(index, row) {
this.$refs.sortTree.doShow(row);
},
revertLesson(index, 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.refresh();
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('tip.cancellationOfCoursePublicationApplicationFailed'));
this.refresh();
});
});
},
review(index, row) {
this.$refs.lessonDetail.show(row.id);
},
goDetail(index, row) {
this.$refs.draftDetail.doShow(row);
},
back() {
this.$router.go(-1);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.joylink-card{
height: 100%;
overflow: auto;
}
.lesson-header{
display:inline-block;margin-top:40px;width: 90%;margin-left:5%;
}
.lesson-list{
display:inline-block;padding:7px 0px
}
.but-group{
float: right;
margin-right:20px;
}
</style>

View File

@ -4,6 +4,7 @@
<div slot="header" class="lessonHeader">
{{ $t('global.lessonSystem') }}
</div>
<el-button size="mini" type="primary" style="position: absolute;right: 10px;top: 10px;" @click="draftLessonManage">草稿课程管理</el-button>
</el-card>
<el-card v-loading="loading">
<el-table :data="tableData" border style="width: 100%">
@ -16,16 +17,15 @@
<el-table-column prop="remarks" show-overflow-tooltip :label="this.$t('teach.courseDescription')" />
<el-table-column :label="this.$t('global.operate')">
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="goLesson(scope.row)">
{{ $t('teach.enterTheCourse') }}
</el-button>
<el-button v-if="project.endsWith('gzb') && isTeacher && userId === scope.row.creatorId" size="mini" type="danger" @click="handleDelete(scope.row)">
删除课程
</el-button>
<el-button size="mini" type="primary" @click="goLesson(scope.row)">{{ $t('teach.enterTheCourse') }}</el-button>
<el-button v-if="(isLessonCreator && userId === scope.row.creatorId) || isAdmin" size="mini" type="primary" @click="handleEdit(scope.row)">编辑</el-button>
<el-button v-if="(isLessonCreator && userId === scope.row.creatorId) || isAdmin" size="mini" type="warning" @click="handleSoldOut(scope.row)">下架</el-button>
<el-button v-if="(isLessonCreator && userId === scope.row.creatorId) || isAdmin" size="mini" type="danger" @click="handleDelete(scope.row)">删除课程</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<update-operate ref="updateLesson" :title="$t('publish.updateLesson')" @create="handleUpdate" />
</div>
</template>
@ -34,23 +34,37 @@ import { getSubSystemDetail } from '@/api/trainingPlatform';
import { UrlConfig } from '@/scripts/ConstDic';
import { forceDeleteLesson } from '@/api/jmap/lesson';
import { getSessionStorage } from '@/utils/auth';
import { lessonCreater } from '@/router/index_APP_TARGET';
import { lessonCreater, superAdmin, admin } from '@/router/index_APP_TARGET';
import { putLessonOffLine, updatePublishLesson } from '@/api/jmap/lesson';
import UpdateOperate from '@/views/publish/publishLesson/draft.vue';
import localStore from 'storejs';
export default {
name: 'TeachHome',
components:{
UpdateOperate
},
data() {
return {
tableData: [],
loading: false,
project: '',
isTeacher: false,
userId: ''
mapId: '',
prdType: ''
};
},
computed: {
isGzbShow() {
return getSessionStorage('project').startsWith('gzb');
},
userId() {
return this.$store.state.user.id;
},
isLessonCreator() {
return this.$store.state.user.roles.includes(lessonCreater);
},
isAdmin() {
return this.$store.state.user.roles.includes(admin) || this.$store.state.user.roles.includes(superAdmin);
}
},
watch: {
@ -61,14 +75,14 @@ export default {
mounted() {
this.loadInitPage();
this.project = getSessionStorage('project');
this.isTeacher = this.$store.state.user.roles.includes(lessonCreater);
this.userId = this.$store.state.user.id;
},
methods: {
loadInitPage() {
if (this.$route.params.subSystem) {
getSubSystemDetail(this.$route.params.subSystem).then(resp =>{
if (resp.data) {
this.mapId = resp.data.mapId;
this.prdType = resp.data.prdType;
this.tableData = resp.data.lessonList;
} else {
this.tableData = [];
@ -88,6 +102,36 @@ export default {
goLesson(row) {
this.$router.push({ path: `${UrlConfig.trainingPlatform.teachDetail}/${this.$route.params.subSystem}`, query: {lessonId: row.id, mapId: row.mapId, prdType: row.prdType}});
},
handleSoldOut(row) {
this.$confirm(this.$t('publish.wellSoldOutTraining'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
putLessonOffLine(row.id).then(response => {
this.$message.success(this.$t('publish.operationSuccess'));
this.reloadTable();
}).catch(() => {
this.reloadTable();
this.$messageBox(this.$t('error.operationFailure'));
});
}).catch(() => { });
},
handleEdit(row) {
this.$refs.updateLesson.doShow(row);
},
handleUpdate(data) {
updatePublishLesson(data).then(response => {
this.loadInitPage();
this.$message.success(this.$t('publish.updateSuccess'));
}).catch(() => {
this.$messageBox(this.$t('error.updateFailed'));
});
},
draftLessonManage() {
const query = {mapId: this.mapId, prdType: this.prdType};
this.$router.push({ path: `/trainingPlatform/draftTeach/${this.$route.params.subSystem}`, query: query });
},
handleDelete(row) {
this.$confirm('此操作将删除课程及所有对应的试卷,且无法恢复,是否继续?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),

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,143 @@
<template>
<el-dialog
title="实训排序"
:visible.sync="dialogVisible"
width="1000px"
:before-close="handleClose"
:center="true"
>
<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>
</el-dialog>
</template>
<script>
import { getLessonTree, dragSortLessonChapter } from '@/api/jmap/lessondraft';
export default {
name: 'SortTree',
data() {
return {
display: 1,
dialogVisible: false,
treeData: [],
defaultProps: {
children: 'children',
label: 'name'
}
};
},
methods: {
doShow(data) {
this.dialogVisible = true;
getLessonTree(data.id).then(response => {
this.treeData = response.data;
}).catch(() => {
this.$messageBox(this.$t('error.refreshFailed'));
});
},
handleClose() {
this.dialogVisible = false;
},
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, ev) {
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');
});
}
}
}
};
</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>

View File

@ -0,0 +1,247 @@
<template>
<el-dialog
v-dialogDrag
:title="this.$t('lesson.trainingList')"
:visible.sync="show"
top="20px"
width="90%"
:before-do-close="doClose"
:close-on-click-modal="false"
append-to-body
>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</el-dialog>
</template>
<script>
import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie';
import { pageQueryTrainingNew } from '@/api/jmap/training';
import localStore from 'storejs';
import { getCmdList } from '@/api/management/dictionary';
import { getTrainingOperateTypeMap } from '@/scripts/ConstDic';
export default {
name: 'TrainList',
props: {
trainings: {
type: Array,
default() { return null; }
},
detail: {
type: Object,
default() { return null; }
},
mapIdList: {
type: Array,
default() { return []; }
},
lineCode: {
type: String,
default() { return ''; }
}
},
data() {
return {
show: false,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
trainingTypeList: [],
trainingOperateTypeMap: {},
queryForm: {
labelWidth: '100px',
reset: true,
queryObject: {
type: {
type: 'select',
label: this.$t('lesson.trainingType'),
change: this.typeChoose,
config: {
data: []
}
},
operateType: {
type: 'select',
label: this.$t('lesson.operationType'),
config: {
data: []
}
},
generateType: {
type: 'select',
label: this.$t('lesson.automaticOrManual'),
config: {
data: [{ value: '02', label: this.$t('lesson.automatic') }, { value: '01', label: this.$t('lesson.manual') }]
}
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('lesson.trainingName'),
prop: 'name'
},
{
title: this.$t('lesson.mapName'),
prop: 'mapId',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.mapId, this.mapIdList, ['id', 'name']); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('lesson.prdType'),
prop: 'prdType',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.prdType, this.prdTypeList, ['value', 'label']); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('lesson.trainingType'),
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.type, this.trainingTypeList, ['value', 'label']); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('lesson.operationType'),
prop: 'operateType',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.operateType, this.trainingOperateTypeMap[row.type], ['value', 'label']); },
tagType: (row) => { return 'success'; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '200',
buttons: [
{
name: this.$t('global.append'),
handleClick: this.addObj,
showControl: (row) => { return !row.isShow; }
},
{
name: this.$t('global.remove'),
handleClick: this.delObj,
type: 'warning',
showControl: (row) => { return row.isShow; }
}
]
}
],
selectAllClick: this.selectAll
}
};
},
computed:{
prdTypeList() {
const productTypeList = ConstConfig.ConstSelect.prdType;
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 }; });
}
},
mounted() {
this.loadInitData();
},
methods: {
doShow() {
this.show = true;
this.reloadTable();
},
doClose() {
this.show = false;
},
async queryFunction(params) {
params['mapId'] = this.detail.mapId;
params['prdType'] = this.detail.prdType;
let res = '';
res = await pageQueryTrainingNew(params);
res.data.list.forEach(item => {
item.isShow = false;
this.trainings.forEach(ele => {
if (item.id == ele.trainingId) {
item.isShow = true;
}
});
});
return res;
},
async loadInitData() {
this.trainingTypeList = [];
this.trainingOperateTypeMap = getTrainingOperateTypeMap();
const res = await getCmdList(this.lineCode, {});
const trainingOperateList = [];
const trainingOperateConfigList = [];
const operateTypeMap = {
Switch: [],
Section: [],
Signal: [],
Stand: [],
Station: [],
ControlConvertMenu: [],
TrainWindow: [],
LimitControl: [],
Driver: []
};
if (res && res.code === 200) {
res.data.forEach(item => {
(this.trainingOperateTypeMap[item.operateObject] || []).forEach(ele => {
if (ele.value == item.operate && !operateTypeMap[item.operateObject].includes(ele)) {
operateTypeMap[item.operateObject].push(ele);
}
});
if (!trainingOperateList.includes(item.operateObject)) {
trainingOperateList.push(item.operateObject);
const objectLabel = ConstConfig.ConstSelect.trainingDeviceType[item.operateObject] || {};
trainingOperateConfigList.push({value: item.operateObject, label: Cookies.get('user_lang') == 'en' ? objectLabel.enlabel : objectLabel.label});
}
});
this.queryForm.queryObject.type.config.data = trainingOperateConfigList;
this.trainingTypeList = trainingOperateConfigList;
this.trainingOperateTypeMap = operateTypeMap;
} else {
this.$message.error(this.$t('error.failedToObtainTrainingType'));
}
const json = localStore.get(this.$route.path);
if (json && json.type) {
this.typeChoose(json);
}
},
typeChoose(form) {
this.queryForm.queryObject.operateType.config.data = [];
if (form && form.type) {
form.operateType = '';
this.queryForm.queryObject.operateType.config.data = this.trainingOperateTypeMap[form.type];
}
},
addObj(index, row) {
const data = [];
row.isShow = true;
data.push(row);
this.$emit('routeSelected', data);
},
delObj(index, row) {
row.isShow = false;
this.trainings.forEach((el, i) => {
if (el.trainingId == row.id) {
this.trainings.splice(i, 1);
}
});
},
selectAll(data) {
this.$emit('routeSelected', data);
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
}
}
};
</script>