2019-07-26 13:32:43 +08:00
|
|
|
|
<template>
|
2019-10-29 13:15:57 +08:00
|
|
|
|
<div style="height: 100%; overflow-y: auto;">
|
2019-08-08 15:27:30 +08:00
|
|
|
|
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
|
|
|
|
<training-draft
|
|
|
|
|
ref="draftTrain"
|
2019-10-30 18:07:09 +08:00
|
|
|
|
:map-id-list="mapIdList"
|
2019-08-08 15:27:30 +08:00
|
|
|
|
:training-type-list="trainingTypeList"
|
|
|
|
|
:training-operate-type-map="trainingOperateTypeMap"
|
|
|
|
|
@refresh="reloadTable"
|
|
|
|
|
/>
|
2019-10-17 18:27:49 +08:00
|
|
|
|
<div class="draft">
|
|
|
|
|
<el-button-group>
|
|
|
|
|
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
|
|
|
|
|
</el-button-group>
|
|
|
|
|
</div>
|
2019-08-08 15:27:30 +08:00
|
|
|
|
</div>
|
2019-07-26 13:32:43 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2019-08-08 15:27:30 +08:00
|
|
|
|
import { pageQueryTraining } from '@/api/jmap/training';
|
|
|
|
|
import { trainingNotify } from '@/api/simulation';
|
|
|
|
|
import { getCommodityMapProduct, getProductList } from '@/api/management/mapprd';
|
|
|
|
|
import { launchFullscreen } from '@/utils/screen';
|
2019-11-08 16:22:05 +08:00
|
|
|
|
import { getPublishMapListOnline } from '@/api/jmap/map';
|
2019-08-08 15:27:30 +08:00
|
|
|
|
import { UrlConfig } from '@/router/index';
|
|
|
|
|
import TrainingDraft from './draft';
|
|
|
|
|
import localStore from 'storejs';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
|
2019-08-08 15:27:30 +08:00
|
|
|
|
export default {
|
2019-10-29 13:15:57 +08:00
|
|
|
|
name: 'TrainingGeneration',
|
|
|
|
|
components: {
|
|
|
|
|
TrainingDraft
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2019-10-30 18:07:09 +08:00
|
|
|
|
mapIdList: [],
|
2019-10-29 13:15:57 +08:00
|
|
|
|
trainingTypeList: [],
|
|
|
|
|
prdTypeList: [],
|
|
|
|
|
trainingOperateTypeMap: {},
|
|
|
|
|
pagerConfig: {
|
|
|
|
|
pageSize: 'pageSize',
|
|
|
|
|
pageIndex: 'pageNum'
|
|
|
|
|
},
|
|
|
|
|
queryForm: {
|
|
|
|
|
labelWidth: '120px',
|
|
|
|
|
queryObject: {
|
2019-11-07 15:54:49 +08:00
|
|
|
|
prdId: {
|
2019-10-29 13:15:57 +08:00
|
|
|
|
type: 'select',
|
|
|
|
|
label: this.$t('lesson.product'),
|
|
|
|
|
change: this.prdChoose,
|
|
|
|
|
config: {
|
|
|
|
|
data: []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
type: {
|
|
|
|
|
type: 'select',
|
|
|
|
|
label: this.$t('lesson.trainingType'),
|
|
|
|
|
change: this.typeChoose,
|
|
|
|
|
config: {
|
|
|
|
|
data: []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
operateType: {
|
|
|
|
|
type: 'select',
|
|
|
|
|
label: this.$t('lesson.operationType'),
|
|
|
|
|
config: {
|
|
|
|
|
data: []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/* generateType: {
|
2019-08-08 15:27:30 +08:00
|
|
|
|
type: 'select',
|
2019-08-29 17:16:33 +08:00
|
|
|
|
label: this.$t('lesson.automaticOrManual'),
|
2019-08-08 15:27:30 +08:00
|
|
|
|
config: {
|
2019-08-29 17:16:33 +08:00
|
|
|
|
data: [{ value: '02', label: this.$t('lesson.manual') }, { value: '01', label: this.$t('lesson.automatic') }]
|
2019-08-08 15:27:30 +08:00
|
|
|
|
}
|
2019-10-21 11:15:15 +08:00
|
|
|
|
},*/
|
2019-10-29 13:15:57 +08:00
|
|
|
|
name: {
|
|
|
|
|
type: 'text',
|
|
|
|
|
label: this.$t('lesson.trainingName')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
queryList: {
|
|
|
|
|
query: this.queryFunction,
|
|
|
|
|
selectCheckShow: false,
|
|
|
|
|
indexShow: true,
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('lesson.trainingName'),
|
|
|
|
|
prop: 'name'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('lesson.product'),
|
2019-11-07 15:54:49 +08:00
|
|
|
|
prop: 'prdId',
|
2019-10-29 13:15:57 +08:00
|
|
|
|
type: 'tag',
|
2019-11-08 18:57:27 +08:00
|
|
|
|
columnValue: (row) => { return this.$convertField(row.prdId, this.prdTypeList, ['id', 'name']); },
|
2019-10-29 13:15:57 +08:00
|
|
|
|
tagType: (row) => { return 'success'; }
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('lesson.trainingType'),
|
|
|
|
|
prop: 'type',
|
|
|
|
|
type: 'tag',
|
|
|
|
|
columnValue: (row) => { return this.$convertField(row.type, this.trainingTypeList, ['code', 'name']); },
|
|
|
|
|
tagType: (row) => { return 'success'; }
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('lesson.operationType'),
|
|
|
|
|
prop: 'operateType',
|
|
|
|
|
type: 'tag',
|
|
|
|
|
columnValue: (row) => { return this.$convertField(row.operateType, this.trainingOperateTypeMap[row.type], ['code', 'name']); },
|
|
|
|
|
tagType: (row) => { return 'success'; }
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('lesson.minDuration'),
|
|
|
|
|
prop: 'minDuration'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('lesson.maxDuration'),
|
|
|
|
|
prop: 'maxDuration'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('lesson.remarks'),
|
|
|
|
|
prop: 'remarks'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'button',
|
|
|
|
|
title: this.$t('global.operate'),
|
|
|
|
|
width: '250',
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
|
name: this.$t('lesson.demonstration'),
|
|
|
|
|
handleClick: this.demoDisplay,
|
|
|
|
|
type: ''
|
|
|
|
|
}
|
|
|
|
|
/* {
|
2019-10-21 10:02:49 +08:00
|
|
|
|
name: this.$t('lesson.trainingRecord'),
|
2019-10-18 17:32:14 +08:00
|
|
|
|
handleClick: this.trainingRecord,
|
|
|
|
|
type: ''
|
2019-10-21 11:15:15 +08:00
|
|
|
|
}*/
|
2019-10-29 13:15:57 +08:00
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
actions: [
|
|
|
|
|
{ text: this.$t('lesson.generateTraining'), btnCode: 'employee_auto', handler: this.autoMaticTrainging },
|
|
|
|
|
{ text: this.$t('lesson.updateTraining'), btnCode: 'employee_edit', handler: this.editTrainingByType, type: 'warning'},
|
|
|
|
|
{ text: this.$t('lesson.deleteTraining'), btnCode: 'employee_delete', handler: this.delAutoMaticTrainging, type: 'danger'}
|
|
|
|
|
/* { text: this.$t('lesson.addTraining'), btnCode: 'employee_add', handler: this.addingTraining, type: 'primary' }*/
|
|
|
|
|
]
|
|
|
|
|
},
|
2019-07-26 13:32:43 +08:00
|
|
|
|
|
2019-10-29 13:15:57 +08:00
|
|
|
|
currentModel: {}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
async created() {
|
|
|
|
|
await this.loadInitData();
|
|
|
|
|
const json = localStore.get(this.$route.path);
|
|
|
|
|
json.type = '';
|
2019-11-07 15:54:49 +08:00
|
|
|
|
json.prdId = '';
|
2019-10-29 13:15:57 +08:00
|
|
|
|
json.operateType = '';
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async loadInitData() {
|
2019-10-30 18:07:09 +08:00
|
|
|
|
this.mapIdList = [];
|
2019-11-07 15:54:49 +08:00
|
|
|
|
this.queryForm.queryObject.prdId.config.data = [];
|
2019-11-08 16:22:05 +08:00
|
|
|
|
getPublishMapListOnline().then(response => {
|
2019-10-30 18:07:09 +08:00
|
|
|
|
this.mapIdList = response.data;
|
2019-10-29 13:15:57 +08:00
|
|
|
|
});
|
2019-10-30 17:41:29 +08:00
|
|
|
|
getCommodityMapProduct(this.$route.query.mapId).then((response) => {
|
2019-10-29 13:15:57 +08:00
|
|
|
|
const productList = response.data;
|
|
|
|
|
if (productList && productList.length > 0) {
|
|
|
|
|
productList.forEach(elem => {
|
|
|
|
|
// 过滤综合演练产品
|
|
|
|
|
if (elem.prdType != '03') {
|
2019-11-08 18:57:27 +08:00
|
|
|
|
this.queryForm.queryObject.prdId.config.data.push({ value: elem.id, label: elem.name });
|
2019-10-29 13:15:57 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
2019-11-11 13:10:23 +08:00
|
|
|
|
// debugger;
|
|
|
|
|
// this.typeChoose({type:this.queryForm.queryObject.type.config.data[0].value});
|
2019-10-29 13:15:57 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
2019-07-26 13:32:43 +08:00
|
|
|
|
|
2019-10-29 13:15:57 +08:00
|
|
|
|
this.prdTypeList = [];
|
|
|
|
|
getProductList({ pageSize: 500, pageNum: 1 }).then(res => {
|
|
|
|
|
const list = res.data.list;
|
|
|
|
|
if (list && list.length > 0) {
|
|
|
|
|
this.prdTypeList = list.filter(elem => { return elem.prdType != '03'; });
|
|
|
|
|
}
|
|
|
|
|
});
|
2019-07-26 13:32:43 +08:00
|
|
|
|
|
2019-10-29 13:15:57 +08:00
|
|
|
|
// 获取实训类型
|
|
|
|
|
this.trainingTypeList = [];
|
|
|
|
|
this.$Dictionary.trainingType().then(list => {
|
|
|
|
|
this.trainingTypeList = list;
|
|
|
|
|
list.forEach(elem => {
|
|
|
|
|
this.queryForm.queryObject.type.config.data.push({ value: elem.code, label: elem.name });
|
|
|
|
|
});
|
|
|
|
|
});
|
2019-07-26 13:32:43 +08:00
|
|
|
|
|
2019-10-29 13:15:57 +08:00
|
|
|
|
this.trainingOperateTypeMap = {};
|
|
|
|
|
const list01 = await this.$Dictionary.stationControl();
|
|
|
|
|
this.trainingOperateTypeMap['01'] = list01; // 控制权实训
|
|
|
|
|
const list02 = await this.$Dictionary.signalOperation();
|
|
|
|
|
this.trainingOperateTypeMap['02'] = list02; // 信号机实训
|
|
|
|
|
const list03 = await this.$Dictionary.switchOperation();
|
|
|
|
|
this.trainingOperateTypeMap['03'] = list03; // 道岔实训
|
|
|
|
|
const list04 = await this.$Dictionary.sectionOperation();
|
|
|
|
|
this.trainingOperateTypeMap['04'] = list04; // 区段实训
|
|
|
|
|
const list05 = await this.$Dictionary.stationStandOperation();
|
|
|
|
|
this.trainingOperateTypeMap['05'] = list05; // 站台实训
|
|
|
|
|
const list06 = await this.$Dictionary.trainPlanOperation();
|
|
|
|
|
this.trainingOperateTypeMap['06'] = list06; // 行车计划实训
|
|
|
|
|
const list07 = await this.$Dictionary.trainOperation();
|
|
|
|
|
this.trainingOperateTypeMap['07'] = list07; // 列车实训
|
|
|
|
|
const list08 = await this.$Dictionary.limitOperation();
|
|
|
|
|
this.trainingOperateTypeMap['08'] = list08; // 限速实训
|
|
|
|
|
this.reloadTable();
|
|
|
|
|
},
|
|
|
|
|
prdChoose(form) {
|
|
|
|
|
form.type = '';
|
|
|
|
|
form.operateType = '';
|
|
|
|
|
},
|
|
|
|
|
typeChoose(form) {
|
|
|
|
|
this.queryForm.queryObject.operateType.config.data = [];
|
|
|
|
|
form.operateType = '';
|
|
|
|
|
if (form && form.type) {
|
|
|
|
|
this.trainingOperateTypeMap[form.type].forEach(elem => {
|
|
|
|
|
this.queryForm.queryObject.operateType.config.data.push({ value: elem.code, label: elem.name });
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
autoMaticTrainging() {
|
|
|
|
|
this.$refs.draftTrain.show({ event: '01', title: this.$t('lesson.automaticGenerationOfTraining') });
|
|
|
|
|
},
|
|
|
|
|
editTrainingByType() {
|
|
|
|
|
this.$refs.draftTrain.show({ event: '02', title: this.$t('lesson.modifyTrainingByCategory') });
|
|
|
|
|
},
|
|
|
|
|
delAutoMaticTrainging() {
|
|
|
|
|
this.$refs.draftTrain.show({ event: '03', title: this.$t('lesson.deleteAutoGeneratedTraining') });
|
|
|
|
|
},
|
|
|
|
|
// addingTraining() {
|
|
|
|
|
// this.$refs.draftTrain.show({ event: '04', title: this.$t('lesson.addTraining') });
|
|
|
|
|
// },
|
|
|
|
|
demoDisplay(index, node) {
|
|
|
|
|
trainingNotify({ trainingId: node.id }).then(resp => {
|
|
|
|
|
/** 区分演示和正式,需要在演示时设置lessonId为0*/
|
2019-11-01 11:28:10 +08:00
|
|
|
|
const query = { group: resp.data, trainingId: node.id, lessonId: 0, mapId: this.$route.query.mapId};
|
2019-10-29 13:15:57 +08:00
|
|
|
|
this.$router.push({ path: `${UrlConfig.display}/manage`, query: query });
|
|
|
|
|
launchFullscreen();
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
reloadTable() {
|
|
|
|
|
this.queryList.reload();
|
|
|
|
|
},
|
|
|
|
|
turnback() {
|
|
|
|
|
this.$router.go(-1);
|
|
|
|
|
},
|
|
|
|
|
trainingRecord(index, node) {
|
|
|
|
|
trainingNotify({ trainingId: node.id }).then(resp => {
|
|
|
|
|
this.group = resp.data;
|
|
|
|
|
this.$router.push({ path: `${UrlConfig.design.trainingRecord}/${node.id}/${node.name}`, query: { group: resp.data } });
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
this.$messageBox(`${this.$t('error.createSimulationFailed')}: ${error.message}`);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
queryFunction(params) {
|
|
|
|
|
params['mapId'] = this.$route.query.mapId;
|
|
|
|
|
return pageQueryTraining(params);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-08 15:27:30 +08:00
|
|
|
|
};
|
|
|
|
|
</script>
|
2019-09-30 16:20:31 +08:00
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
|
.draft {
|
|
|
|
|
width: 400px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
margin: 20px auto;
|
|
|
|
|
}
|
|
|
|
|
</style>
|