组织管理调整

This commit is contained in:
fan 2021-04-01 16:28:30 +08:00
parent f1824ad324
commit a5b3f9cf04
25 changed files with 94 additions and 1679 deletions

View File

@ -227,21 +227,6 @@ export function createStudent(orgId, data) {
data
});
}
/** 获取班级关联课程 */
export function getClassAssociatedLessons(orgId) {
return request({
url: `/api/company/orgLesson/${orgId}/list`,
method: 'get'
});
}
/** 关联课程班级 */
export function setClassAssociatedLessons(orgId, data) {
return request({
url: `/api/company/orgLesson/${orgId}/update`,
method: 'put',
data
});
}
/** 创建修改 规则 */
export function createRule(data) {
return request({
@ -309,21 +294,6 @@ export function getCanApplyToList(ruleId) {
method: 'get'
});
}
/** 给班级安排考试 */
export function applyExamToClass(clsId, data) {
return request({
url: `/api/company/orgExam/${clsId}`,
method: 'post',
data
});
}
/** 查询班级下的考试 */
export function getExamListInClass(clsId) {
return request({
url: `api/company/orgExam/${clsId}/list`,
method: 'get'
});
}
/** 查询组织树结构 */
export function getOrgTreeById(orgId) {
return request({

View File

@ -43,7 +43,7 @@ export default {
return this.$store.state.user.companyAdmin;
},
isSameProject() {
return this.$store.state.user.companyProject === (getSessionStorage('project').toUpperCase());
return this.$store.state.user.companyProjectList.includes(getSessionStorage('project').toUpperCase());
}
},
mounted() {

View File

@ -143,7 +143,6 @@ 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');
const OrgClassManage = () => import('@/views/organization/classManage/index');
const OrgDraftLessonManage = () => import('@/views/organization/draftLessonManage/index');
@ -704,11 +703,6 @@ export const asyncRouter = [
component: TeachDetail,
hidden: true
},
{ // 草稿课程
path: 'draftTeach/:subSystem',
component: DraftLessonManage,
hidden: true
},
{ // 运行图设计
path: 'runPlan/:mapId',
component: PlanMonitorDetail,

View File

@ -20,7 +20,7 @@ const user = {
companyId: '',
companyAdmin: false,
companyName: '',
companyProject: '',
companyProjectList: [],
baseUrl:''
},
@ -61,8 +61,8 @@ const user = {
SET_COMPANYNAME: (state, companyName) => {
state.companyName = companyName;
},
SET_COMPANYPROJECT: (state, companyProject) => {
state.companyProject = companyProject;
SET_COMPANYPROJECTLIST: (state, companyProjectList) => {
state.companyProjectList = companyProjectList;
},
CLEAR_AUTO_PARAMS: () => {
Cookies.remove('UserDesignName');
@ -139,7 +139,7 @@ const user = {
commit('SET_COMPANYID', user.companyId);
commit('SET_COMPANYADMIN', user.companyAdmin);
commit('SET_COMPANYNAME', user.companyName);
commit('SET_COMPANYPROJECT', user.projectCode);
commit('SET_COMPANYPROJECTLIST', user.projectCodes);
resolve(user);
}).catch(error => {
reject(error);

View File

@ -12,16 +12,6 @@
<el-form-item :label="$t('lesson.publishCourseName')" prop="name">
<el-input v-model="editModel.name" :disabled="!hasRelease" />
</el-form-item>
<el-form-item v-if="showClassSelect" label="课程所属班级:" prop="classIdList">
<el-select v-model="editModel.classIdList" multiple placeholder="请选择">
<el-option
v-for="item in calssList"
:key="item.departmentId"
:label="item.departmentName"
:value="item.departmentId"
/>
</el-select>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
@ -33,7 +23,6 @@
<script>
import { adminPublishLesson, releaseOrCancel } from '@/api/designPlatform';
import { getCompanyDeptInfo } from '@/api/company';
export default {
name: 'LessonPublish',
data() {
@ -47,8 +36,7 @@ export default {
name: '',
mapId: '',
prdType: '',
cityCode: '',
classIdList: []
cityCode: ''
}
};
},
@ -66,18 +54,12 @@ export default {
],
name: [
{ required: true, message: this.$t('rules.pleaseEnterMapName'), trigger: 'change' }
],
classIdList: [
{ required: true, message: '请选择课程归属班级', trigger: 'change' }
]
};
},
hasRelease() {
return this.$store.state.user.roles.includes('04') ||
this.$store.state.user.roles.includes('05') || this.$store.state.user.roles.includes('03');
},
showClassSelect() {
return this.$store.state.user.companyId && this.$store.state.user.companyAdmin;
}
},
methods: {
@ -87,17 +69,9 @@ export default {
name: model.name,
mapId: this.$route.query.mapId || this.$route.params.mapId,
prdType: model.prdType,
cityCode: model.cityCode,
classIdList: []
cityCode: model.cityCode
};
this.dialogShow = true;
if (this.showClassSelect) {
getCompanyDeptInfo(this.$store.state.user.companyId).then(resp => {
this.calssList = resp.data;
}).catch(() =>{
this.$message.error('获取班级数据失败!');
});
}
},
doClose() {
this.$refs.form.resetFields();
@ -129,7 +103,6 @@ export default {
this.loading = false;
}
});
}
}
};

View File

@ -82,7 +82,6 @@
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { refreshExamList } from '@/api/management/userexam';
// loadTrainingInSimulation
import { getTrainingDetailNew } from '@/api/jmap/training';
export default {
@ -167,7 +166,6 @@ export default {
}
});
if (obj) {
// if (type) {
getTrainingDetailNew(obj.trainingId).then(resp => {
this.courseModel = {
id: resp.data.id,
@ -183,24 +181,6 @@ export default {
}).catch(error => {
this.$message.error(this.$t('display.exam.getTestInformation') + ':' + error.message);
});
// } else {
// loadTrainingInSimulation(this.$route.query.group, this.$route.query.trainingId).then(resp => {
// // getTrainingDetailNew(obj.trainingId).then(res => {
// this.courseModel = {
// id: resp.data.id,
// name: resp.data.name,
// maxDuration: resp.data.maxDuration,
// remarks: resp.data.remarks,
// minDuration: resp.data.minDuration,
// updateTime: resp.data.updateTime
// };
// this.$store.dispatch('training/setPrdType', this.prdTypeMap[resp.data.prdType]);
// this.$store.dispatch('exam/setCenter', resp.data.locateDeviceCode);
// this.$store.dispatch('training/setTrainingData', resp.data); //
// }).catch(error => {
// this.$message.error(this.$t('display.exam.getTestInformation') + ':' + error.message);
// });
// }
}
this.jump(obj);
},

View File

@ -1,97 +0,0 @@
<template>
<el-dialog v-dialogDrag title="班级排考试" :visible.sync="dialogShow" width="400px" :before-close="doClose">
<el-form ref="form" :model="classModel" :rules="rules" label-width="120px" size="mini">
<el-form-item label="班级名称:" prop="name">
<el-input v-model="classModel.name" style="width: 220px;" :disabled="true" />
</el-form-item>
<el-form-item label="安排考试:" prop="lessonIds">
<el-select v-model="classModel.examIds" multiple placeholder="请选择">
<el-option
v-for="item in examList"
:key="item.id"
:label="item.name"
:value="item.id+''"
/>
</el-select>
</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 { getExamListProjectUnpage } from '@/api/management/exam';
import { getExamListInClass, applyExamToClass } from '@/api/company';
export default {
name: 'CreateClass',
data() {
return {
dialogShow: false,
loading: false,
examList: [],
classModel: {
id: '',
name: '',
examIds: []
}
};
},
computed: {
rules() {
const baseRules = {
name: [
{ required: true, message: '请输入班级名称', trigger: 'blur' }
],
examIds: [
{ required: true, message: '请选择安排考试', trigger: 'change' }
]
};
return baseRules;
}
},
methods: {
async doShow(row) {
try {
this.examList = [];
const resp = await getExamListProjectUnpage({ status: '1' });
this.examList = resp.data;
const rest = await getExamListInClass(row.id);
this.classModel.id = row.id;
this.classModel.name = row.name;
this.classModel.examIds = rest.data;
this.dialogShow = true;
} catch {
this.$message.error('获取试卷列表或班级数据异常!');
}
},
create() {
this.$refs.form.validate((valid) => {
if (valid) {
applyExamToClass( this.classModel.id, this.classModel.examIds).then(response => {
this.doClose();
this.$message.success('班级安排考试成功!');
}).catch(() => {
this.$message.error('班级安排考试失败!');
});
}
});
},
doClose() {
this.$refs.form.resetFields();
this.dialogShow = false;
}
}
};
</script>
<style>
.option-group {
margin: 10px 100px;
}
</style>

View File

@ -1,101 +0,0 @@
<template>
<el-dialog v-dialogDrag title="班级排课" :visible.sync="dialogShow" width="400px" :before-close="doClose">
<el-form ref="form" :model="classModel" :rules="rules" label-width="120px" size="mini">
<el-form-item label="班级名称:" prop="name">
<el-input v-model="classModel.name" style="width: 220px;" :disabled="true" />
</el-form-item>
<el-form-item label="安排课程:" prop="lessonIds">
<el-select v-model="classModel.lessonIds" multiple placeholder="请选择">
<el-option
v-for="item in lessonList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</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 { getLessonProjectListNoPage } from '@/api/jmap/lesson';
import { getClassAssociatedLessons, setClassAssociatedLessons } from '@/api/company';
export default {
name: 'CreateClass',
data() {
return {
dialogShow: false,
loading: false,
lessonList: [],
classModel: {
id: '',
name: '',
lessonIds: []
}
};
},
computed: {
rules() {
const baseRules = {
name: [
{ required: true, message: '请输入班级名称', trigger: 'blur' }
],
lessonIds: [
{ required: true, message: '请选择安排课程', trigger: 'change' }
]
};
return baseRules;
}
},
methods: {
async doShow(row) {
try {
this.lessonList = [];
const resp = await getLessonProjectListNoPage({ status: '1' });
this.lessonList = resp.data;
const rest = await getClassAssociatedLessons(row.id);
this.classModel.id = row.id;
this.classModel.name = row.name;
this.classModel.lessonIds = [];
rest.data && rest.data.forEach(item => {
this.classModel.lessonIds.push(item.id);
});
this.dialogShow = true;
} catch {
this.$message.error('获取课程列表或班级数据异常!');
}
},
create() {
this.$refs.form.validate((valid) => {
if (valid) {
setClassAssociatedLessons( this.classModel.id, this.classModel.lessonIds).then(response => {
this.doClose();
this.$message.success('班级排课成功!');
}).catch((error) => {
this.$message.error('班级排课失败:' + error.message);
});
// setClassAssociatedLessons( this.classModel.id, this.classModel.lessonIds)
}
});
},
doClose() {
this.$refs.form.resetFields();
this.dialogShow = false;
}
}
};
</script>
<style>
.option-group {
margin: 10px 100px;
}
</style>

View File

@ -8,22 +8,16 @@
style="width:96%;margin: 0 auto;"
/>
<create-class ref="createClass" @refresh="classRefresh" />
<bind-lessons ref="bindLessons" />
<bind-exams ref="bindExams" />
</div>
</template>
<script>
import { getClassListPage, deleteDeptInfo } from '@/api/company';
import CreateClass from './createClass';
import BindLessons from './bindLessons';
import BindExams from './bindExams';
export default {
name: 'ClassManage',
components: {
CreateClass,
BindLessons,
BindExams
CreateClass
},
data() {
return {
@ -93,16 +87,6 @@ export default {
handleClick: this.handleGradeCheck,
type: 'primary'
},
// {
// name: '',
// handleClick: this.handleBindLesson,
// type: 'primary'
// },
// {
// name: '',
// handleClick: this.handleBindExam,
// type: 'primary'
// },
{
name: '删除',
handleClick: this.handleDeleteClass,
@ -155,14 +139,8 @@ export default {
handleStudentDetail( index, row ) {
this.$router.push({ path: '/info/studentManage', query: { classId: row.id, className: row.name, creatorId: row.creatorId} });
},
handleBindLesson(index, row) {
this.$refs.bindLessons.doShow(row);
},
classCreate() {
this.$refs.createClass.doShow();
},
handleBindExam(index, row) {
this.$refs.bindExams.doShow(row);
}
}
};

View File

@ -137,7 +137,7 @@ 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 TrainList from './trainingList';
import Cookies from 'js-cookie';
export default {

View File

@ -17,7 +17,7 @@ import ConstConfig from '@/scripts/ConstConfig';
import { getLessonDraftListSelf, delLesson } from '@/api/jmap/lessondraft';
import CreateByPublished from './createByPublished';
import PublishLesson from './publishLesson';
import { getPublishMapInfo } from '@/api/jmap/map';
import { getPublishMapInfo, getPublishMapListOnline } from '@/api/jmap/map';
export default {
name: 'Index',
@ -28,6 +28,7 @@ export default {
data() {
return {
lineCode: '',
mapIdList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
@ -48,12 +49,37 @@ export default {
draftLessonQueryList: {
query: getLessonDraftListSelf,
selectCheckShow: false,
indexShow: true,
indexShow: false,
columns: [
{
title: this.$t('lesson.courseName'),
prop: 'name'
},
{
title: '课程地图',
prop: 'mapId',
type: 'tag',
width: '250',
columnValue: (row) => {
return this.$convertField(row.mapId, this.mapIdList, ['id', 'name']);
},
tagType: (row) => { return 'success'; }
},
{
title: '产品类型',
prop: 'prdType',
type: 'tag',
columnValue: (row) => {
if (row.prdType === '01') {
return '现地工作站';
} else if (row.prdType === '02') {
return '行调工作站';
} else {
return '';
}
},
tagType: (row) => { return ''; }
},
{
title: this.$t('lesson.courseDescription'),
prop: 'remarks'
@ -111,6 +137,12 @@ export default {
}
};
},
mounted() {
this.mapIdList = [];
getPublishMapListOnline().then(response => {
this.mapIdList = response.data;
});
},
methods: {
lessonCreate() {
this.$router.push({ path: `/info/createLesson` });

View File

@ -11,7 +11,6 @@
</template>
<script>
import { getClassListUnPage } from '@/api/company';
import { getExamListProject, setExamEffectivey, setExamEfficacy } from '@/api/management/exam';
import localStore from 'storejs';
import { getPublishMapListOnline } from '@/api/jmap/map';
@ -55,7 +54,7 @@ export default {
examQueryList: {
query: getExamListProject,
selectCheckShow: false,
indexShow: true,
indexShow: false,
columns: [
{
title: '试卷名称',
@ -65,6 +64,7 @@ export default {
title: '归属地图',
prop: 'mapId',
type: 'tag',
width: '200',
columnValue: (row) => { return this.$convertField(row.mapId, this.mapIdList, ['id', 'name']); },
tagType: (row) => { return ''; }
},
@ -72,6 +72,7 @@ export default {
title: '产品类型',
prop: 'prdType',
type: 'tag',
width: '110',
columnValue: (row) => { if (row.prdType === '01') { return '现地工作站'; } else if (row.prdType === '02') { return '行调工作站'; } },
tagType: (row) => { return ''; }
},
@ -79,18 +80,12 @@ export default {
title: '启用/禁用',
prop: 'status',
type: 'tag',
width: '80',
columnValue: (row) => {
return row.status == '1' ? '启用' : '禁用';
},
tagType: (row) => { return ''; }
},
{
title: '班级',
prop: 'clsIds',
type: 'tagMore',
columnValue: (row) => { return this.$convertField(row.clsIds || [], this.classList || [], ['id', 'name'], true); },
tagType: (row) => { return 'success'; }
},
{
title: '开始时间',
prop: 'startTime'
@ -176,9 +171,6 @@ export default {
const params = localStore.get(this.$route.path) || {};
if (!params.status) { params.status = '1'; }
localStore.set(this.$route.path, params);
getClassListUnPage().then(response => {
this.classList = response.data;
});
this.mapIdList = [];
getPublishMapListOnline().then(response => {
this.mapIdList = response.data;

View File

@ -58,7 +58,7 @@ export default {
lessonQueryList: {
query: getLessonProjectList,
selectCheckShow: false,
indexShow: true,
indexShow: false,
columns: [
{
title: this.$t('lesson.courseName'),

View File

@ -12,15 +12,16 @@
</el-select>
</el-form-item>
<el-form-item :label="$t('publish.questionNumbers')" prop="number">
<el-input
<el-input-number
v-model="form.number"
placeholder=""
:precision="0"
:min="0"
style="width: calc(100% - 280px); float: left; margin-right: 10px;"
/>
<span style="width: 190px; float: left;">{{ $t('publish.allNumberTipOne') }} {{ topicNum }} {{ $t('publish.allNumberTipTwo') }}</span>
</el-form-item>
<el-form-item :label="$t('publish.scorePerQuestion')" prop="mark">
<el-input-number v-model="form.mark" :precision="0" style="width:200px" />
<el-input-number v-model="form.mark" :precision="0" :min="0" style="width:200px" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -76,14 +77,9 @@ export default {
var mark = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('publish.inputScorePerQuestion')));
} else {
callback();
}
setTimeout(() => {
if (!Number(value)) {
callback(new Error(this.$t('publish.inputNumericType')));
} else {
callback();
}
}, 100);
};
return {
title: this.$t('publish.addRules'),
@ -115,9 +111,9 @@ export default {
methods: {
show(detail) {
this.dialogShow = true;
if (detail) {
this.$nextTick(() => {
this.$refs.form.resetFields();
this.$nextTick(() => {
this.$refs.form.resetFields();
if (detail) {
this.title = this.$t('publish.modifyRules');
this.editOk = true;
this.changeCourse(detail.trainingType);
@ -128,38 +124,24 @@ export default {
mark: detail.point
};
this.changeOperation(detail.operateType);
});
}
} else {
this.title = this.$t('publish.addRules');
}
});
},
handleOk() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.editOk) {
//
this.$emit('editRuleList', this.form);
setTimeout(() => {
this.handleCancel();
}, 300);
} else {
//
this.$emit('addRuleList', this.form);
setTimeout(() => {
this.handleCancel();
}, 300);
}
this.topicNum = 0;
} else {
this.dialogShow = true;
return false;
this.$emit( this.editOk ? 'editRuleList' : 'addRuleList', this.form);
this.handleCancel();
}
});
},
handleCancel() {
this.$refs['form'].resetFields();
this.dialogShow = false;
this.editOk = false;
this.topicNum = 0;
this.operationTypeList = [];
this.dialogShow = false;
},
changeCourse(val) {
this.operationTypeList = this.operationTypeMap[val];

View File

@ -24,8 +24,7 @@ export default {
formModel: {
name: '',
id: '',
code: '',
projectCode: ''
projectCodes: []
},
update: false
};
@ -36,8 +35,7 @@ export default {
labelWidth: '100px',
items: [
{ prop: 'name', label: '名称', type: 'text' },
{ prop: 'code', label: '单位编号', type: 'text', disabled: this.update },
{ prop: 'projectCode', label: '关联项目', type: 'select', options: this.projectListNew}
{ prop: 'projectCodes', label: '关联项目', type: 'select', multiple:true, options: this.projectListNew}
]
};
return form;
@ -48,10 +46,7 @@ export default {
{ required: true, message: '请输入单位名称', trigger: 'blur' },
{ min: 1, max: 25, message: this.$t('rules.strLength1To25'), trigger: 'blur' }
],
code: [
{ required: true, message: '请输入单位编号', trigger: 'blur' }
],
projectCode: [
projectCodes: [
{ required: true, message: '请选择关联项目', trigger: 'change'}
]
};
@ -71,9 +66,8 @@ export default {
this.update = true;
this.formModel = {
id: data.id,
code: data.code,
name: data.name,
projectCode: data.projectCode
projectCodes: data.projectCodes
};
}
});
@ -84,7 +78,6 @@ export default {
this.formModel = {
name: '',
id: '',
code: '',
projectCode: ''
};
},

View File

@ -29,7 +29,7 @@ export default {
queryObject: {
}
},
projectMap: {},
// projectMap: {},
projectListNew: [],
queryList: {
query: getCompanyListPaging,
@ -48,15 +48,11 @@ export default {
// title: '',
// prop: 'address'
// },
{
title: '组织编号',
prop: 'code'
},
{
title: '关联项目',
prop: 'projectCode',
type: 'tag',
columnValue: (row) => { return this.projectMap[row.projectCode]; },
prop: 'projectCodes',
type: 'tagMore',
columnValue: (row) => { return this.$convertField(row.projectCodes, this.projectListNew, ['value', 'label'], true); },
tagType: (row) => { return 'success'; }
},
// {
@ -101,7 +97,7 @@ export default {
},
created() {
ProjectList.forEach(elem => {
this.projectMap[elem.value.toUpperCase()] = elem.label;
// this.projectMap[elem.value.toUpperCase()] = elem.label;
this.projectListNew.push({value: elem.value.toUpperCase(), label: elem.label});
});
},

View File

@ -12,7 +12,7 @@
</div>
<el-tree
ref="tree"
style="width: 500px;margin: 20px 10px 0;"
style="width: 500px;margin: 20px 10px 0;height: calc(100vh - 250px);overflow-y: scroll;"
:data="treeData"
:default-expanded-keys="defaultExpandedKeys"
node-key="keyId"
@ -44,7 +44,6 @@ import { getOrgTreeById, deleteDepartUserRelation } from '@/api/company';
import localStore from 'storejs';
export default {
name: 'OrgDetail',
data() {
return {
filterText: '',
@ -108,14 +107,12 @@ export default {
},
nodeExpand(obj, node, ele) {
this.expandedKeys.push(obj.keyId);
console.log(this.expandedKeys, obj);
},
nodeCollapse(obj, node, ele) {
const index = this.expandedKeys.indexOf(obj.keyId);
if (index !== -1) {
this.expandedKeys.splice(index, 1);
}
console.log(this.expandedKeys, index);
},
back() {
this.$router.go(-1);

View File

@ -43,6 +43,25 @@ export default {
config: {
data: this.$ConstSelect.roleList
}
},
nickname: {
type: 'text',
label: '昵称'
},
mobile: {
type: 'text',
label: '手机号'
},
email: {
type: 'text',
label: '邮箱'
},
companyId: {
type: 'select',
label: '组织',
config: {
data: []
}
}
}
@ -115,6 +134,7 @@ export default {
this.companyMap[item.id] = item.name;
this.companyList.push({label: item.name, value: parseInt(item.id)});
});
this.queryForm.queryObject.companyId.config.data = this.companyList;
}
}).catch((error) => {
console.error(error);

View File

@ -1,234 +0,0 @@
<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

@ -1,524 +0,0 @@
<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();
this.$emit('refresh');
},
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

@ -1,258 +0,0 @@
<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,7 +4,6 @@
<div slot="header" class="lessonHeader">
{{ $t('global.lessonSystem') }}
</div>
<el-button v-if="isAdmin && project !== 'cgy'" size="mini" type="primary" style="position: absolute;right: 10px;top: 10px;" @click="draftLessonManage">草稿课程管理</el-button>
</el-card>
<el-card v-loading="loading">
<el-row style="padding: 10px;display: flex;align-items: center;justify-content: flex-end;">
@ -137,10 +136,6 @@ export default {
this.$messageBox(this.$t('error.updateFailed'));
});
},
draftLessonManage() {
const query = {mapId: this.mapId, prdType: this.prdType, cityCode: this.cityCode};
this.$router.push({ path: `/trainingPlatform/draftTeach/${this.$route.params.subSystem}`, query: query });
},
changeInput(val) {
localStore.set(this.$route.path, val);
},

View File

@ -1,130 +0,0 @@
<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

@ -1,143 +0,0 @@
<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>