课程创建迁移&调度电话调整
This commit is contained in:
parent
e630f870e2
commit
dfa815fe6d
@ -56,23 +56,12 @@ 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}`);
|
||||
});
|
||||
getPublishLessonListByMapId({mapId:this.mapId}).then(response => {
|
||||
this.lessonList = response.data.map(elem => { return { code: elem.id, name: elem.name }; });
|
||||
}).catch(error => {
|
||||
this.$messageBox(`${this.$t('error.refreshFailed')}, ${error.message}`);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
doShow(node) {
|
||||
this.dialogShow = true;
|
||||
},
|
||||
doClose() {
|
||||
this.dialogShow = false;
|
||||
},
|
||||
create() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
@ -91,6 +80,9 @@ export default {
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
doClose() {
|
||||
this.dialogShow = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -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];
|
||||
@ -1010,7 +1022,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);
|
||||
}
|
||||
},
|
||||
|
@ -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) {
|
||||
|
@ -1,163 +1,67 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="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')"
|
||||
<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-form-item>
|
||||
</el-form>
|
||||
<el-form v-if="editType === 'updateChapter' || editType === 'createChapter'" ref="form" :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-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-form-item>
|
||||
<el-form-item :label="this.$t('lesson.associatedTraining')">
|
||||
<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="!isEdit">
|
||||
<el-button v-if="courseModel.mapId" 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"
|
||||
@routeSelected="routeSelected"
|
||||
/>
|
||||
</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, updateLesson, getLessonDetail } from '@/api/jmap/lessondraft';
|
||||
import { getLessonTree, deleteLessonChapter } from '@/api/jmap/lessondraft';
|
||||
import { createLesson } 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 '@/views/lesson/lessoncategory/edit/chapter/list';
|
||||
|
||||
export default {
|
||||
name: 'CourseEdit',
|
||||
components: {
|
||||
OperateMenu,
|
||||
TrainList
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isEdit: false,
|
||||
dialogVisible: false,
|
||||
display: 1,
|
||||
mapIdList: [],
|
||||
@ -168,32 +72,7 @@ export default {
|
||||
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'
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -206,7 +85,7 @@ export default {
|
||||
? productTypeList.map(elem => { return { value: elem.value, label: elem.enlabel }; })
|
||||
: productTypeList.map(elem => { return { value: elem.value, label: elem.label }; });
|
||||
},
|
||||
courseRules() {
|
||||
rules() {
|
||||
const baseRules = {
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.enterCourseName'), trigger: 'change' }
|
||||
@ -222,17 +101,6 @@ export default {
|
||||
]
|
||||
};
|
||||
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;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -242,7 +110,7 @@ export default {
|
||||
handleClose() {
|
||||
this.dialogVisible = false;
|
||||
this.courseModel.id = '';
|
||||
this.$refs.form.resetFields();
|
||||
this.$refs.form && this.$refs.form.resetFields();
|
||||
},
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
@ -261,27 +129,13 @@ export default {
|
||||
}
|
||||
},
|
||||
clickEvent(obj, node, ele) {},
|
||||
doShow(data) {
|
||||
doShow() {
|
||||
this.mapIdList = [];
|
||||
this.isEdit = false;
|
||||
getPublishMapListOnline().then(response => {
|
||||
this.mapIdList = response.data;
|
||||
this.dialogVisible = true;
|
||||
this.courseModel.mapId = this.$route.query.mapId;
|
||||
this.courseModel.prdType = this.$route.query.prdType;
|
||||
if (data) {
|
||||
this.isEdit = true;
|
||||
this.courseModel.id = data.id;
|
||||
this.courseModel.name = data.name;
|
||||
this.courseModel.remarks = data.remarks;
|
||||
}
|
||||
});
|
||||
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;
|
||||
}
|
||||
});
|
||||
},
|
||||
create() {
|
||||
@ -302,91 +156,6 @@ export default {
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
update() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
const model = {
|
||||
id: this.courseModel.id,
|
||||
prdType: this.courseModel.prdType,
|
||||
name: this.courseModel.name,
|
||||
mapId: this.courseModel.mapId,
|
||||
remarks: this.courseModel.remarks
|
||||
};
|
||||
updateLesson(model).then(response => {
|
||||
this.$emit('refresh');
|
||||
this.$message.success(this.$t('tip.updateSuccessfully'));
|
||||
this.handleClose();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.updateFailed'));
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
refresh(query) {
|
||||
if (query) {
|
||||
getLessonDetail(query).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'));
|
||||
});
|
||||
}
|
||||
},
|
||||
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
|
||||
});
|
||||
});
|
||||
},
|
||||
changeRouter(params) {
|
||||
switch (params.event) {
|
||||
case '01':
|
||||
this.editType = 'editLesson';
|
||||
break;
|
||||
case '02':
|
||||
this.editType = 'createChapter';
|
||||
break;
|
||||
case '03':
|
||||
this.editType = 'updateChapter';
|
||||
break;
|
||||
case '04':
|
||||
this.editType = 'createChapter';
|
||||
break;
|
||||
case '05':
|
||||
this.deleteChapter(params.node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
522
src/views/teach/draftDetail.vue
Normal file
522
src/views/teach/draftDetail.vue
Normal file
@ -0,0 +1,522 @@
|
||||
<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.name;
|
||||
this.chapterModel.parentId = 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;
|
||||
}
|
||||
}
|
||||
|
||||
.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>
|
@ -13,6 +13,7 @@
|
||||
<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>
|
||||
@ -20,14 +21,14 @@
|
||||
<script>
|
||||
import { releaseOrCancel } from '@/api/designPlatform';
|
||||
import { getLessonDrftList } from '@/api/jmap/lessondraft';
|
||||
import { UrlConfig } from '@/scripts/ConstDic';
|
||||
import PublishCreate from '@/views/lesson/lessoncategory/edit/create';
|
||||
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',
|
||||
@ -36,7 +37,8 @@ export default {
|
||||
PublishLesson,
|
||||
LessonDetail,
|
||||
draftCreate,
|
||||
sortTree
|
||||
sortTree,
|
||||
draftDetail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -229,7 +231,7 @@ export default {
|
||||
this.$refs.lessonDetail.show(row.id);
|
||||
},
|
||||
goDetail(index, row) {
|
||||
this.$refs.draftCreate.doShow(row);
|
||||
this.$refs.draftDetail.doShow(row);
|
||||
},
|
||||
back() {
|
||||
this.$router.go(-1);
|
||||
|
247
src/views/teach/trainingList.vue
Normal file
247
src/views/teach/trainingList.vue
Normal 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>
|
Loading…
Reference in New Issue
Block a user