This commit is contained in:
joylink_cuiweidong 2020-04-09 16:32:15 +08:00
commit 45e6a12825
17 changed files with 442 additions and 93 deletions

View File

@ -1,6 +1,6 @@
const mapDeviceStyle = { const mapDeviceStyle = {
'01': 'chengdu_01', '01': 'chengdu_01',
// '01': 'xian_02' // '01': 'xian_02',
'02': 'fuzhou_01', '02': 'fuzhou_01',
'03': 'bejing_01', '03': 'bejing_01',
'04': 'chengdu_03', '04': 'chengdu_03',

View File

@ -98,7 +98,8 @@ class SkinCode extends defaultStyle {
axle: { axle: {
radius: 3, // 计轴 半径 radius: 3, // 计轴 半径
distance: 5, // 计轴和区段之间的距离 (未用) distance: 5, // 计轴和区段之间的距离 (未用)
color: 'white', // 区段计轴颜色 color: '#808080', // 区段计轴颜色
occupyColor: '#FF0000', // 区段计轴占用颜色
resetColor: '#00FFFF', // 区段计轴预复位颜色 resetColor: '#00FFFF', // 区段计轴预复位颜色
Failure: '#E6A23C' // #FFFF00 计轴失效 Failure: '#E6A23C' // #FFFF00 计轴失效
}, },

View File

@ -332,6 +332,8 @@ class Jlmap {
} }
update(list) { update(list) {
this.setUpdateMapDevice(list || []); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息 this.setUpdateMapDevice(list || []); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息
const signalDeviceList = [];
const signalStatusList = [];
(list || []).forEach(elem => { (list || []).forEach(elem => {
const code = elem.code; const code = elem.code;
const type = elem._type; const type = elem._type;
@ -347,8 +349,12 @@ class Jlmap {
} }
const signalDevice = this.mapDevice[route.startSignalCode]; const signalDevice = this.mapDevice[route.startSignalCode];
const signalStatus = {atsControl: elem.atsControl, fleetMode: elem.fleetMode}; const signalStatus = {atsControl: elem.atsControl, fleetMode: elem.fleetMode};
if (this.hookHandle(signalDevice, signalStatus)) { const index = signalDeviceList.indexOf(signalDevice);
this.$painter.update(signalDevice); if (index === -1) {
signalDeviceList.push(signalDevice);
signalStatusList.push(signalStatus);
} else {
signalStatusList[index] = {atsControl: signalStatusList[index].atsControl && elem.atsControl, fleetMode: signalStatusList[index].fleetMode || elem.fleetMode};
} }
} else if (elem.deviceType === 'CYCLE') { } else if (elem.deviceType === 'CYCLE') {
store.dispatch('map/updateAutoReentryState', elem); store.dispatch('map/updateAutoReentryState', elem);
@ -385,13 +391,19 @@ class Jlmap {
} }
} }
}); });
this.handleRouteSignalStatus(signalDeviceList, signalStatusList);
// 状态后处理 // 状态后处理
this.postHandle(list || []); this.postHandle(list || []);
if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); } if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); }
} }
handleRouteSignalStatus(signalDeviceList, signalStatusList) {
signalDeviceList.forEach((item, index)=> {
if (item && this.hookHandle(item, signalStatusList[index])) {
this.$painter.update(item);
}
});
}
pullBack(payload) { pullBack(payload) {
if (payload.type === 'zoom') { if (payload.type === 'zoom') {
const zrWidth = this.$zr.getWidth(); const zrWidth = this.$zr.getWidth();

View File

@ -7,13 +7,17 @@ import Path from 'zrender/src/graphic/Path';
export const EAxle = Path.extend({ export const EAxle = Path.extend({
type: 'EAxle', type: 'EAxle',
shape: { shape: {
point: null // style: this.style,
// traingle: traingle11,
// drictx: 1,
// dricty: 1,
// point: this.model.points[0]
}, },
buildPath: function (ctx, model) { buildPath: function (ctx, model) {
if (model && model.style && model.traingle) { if (model && model.style && model.traingle) {
const axleLength = 2 * model.style.Section.axle.radius; const axleLength = 2 * model.style.Section.axle.radius;
const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength)); const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength) * 1.2);
const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength)); const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength) * 1.2);
// 圆弧 // 圆弧
const arcX = positionx - model.dricty * model.traingle.getSin(axleLength); const arcX = positionx - model.dricty * model.traingle.getSin(axleLength);
const arcY = positiony + model.drictx * model.traingle.getSin(axleLength); const arcY = positiony + model.drictx * model.traingle.getSin(axleLength);
@ -23,8 +27,8 @@ export const EAxle = Path.extend({
const x1 = positionx - model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength); const x1 = positionx - model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength);
const y1 = positiony + model.drictx * model.traingle.getSin(axleLength) - model.traingle.getSin(axleLength); const y1 = positiony + model.drictx * model.traingle.getSin(axleLength) - model.traingle.getSin(axleLength);
const x2 = positionx + model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength); const x2 = positionx + model.traingle.getCos(axleLength * 1.5) - model.dricty * model.traingle.getSin(axleLength);
const y2 = positiony + model.drictx * model.traingle.getSin(axleLength) + model.traingle.getSin(axleLength); const y2 = positiony + model.drictx * model.traingle.getSin(axleLength * 1.5) + model.traingle.getSin(axleLength);
ctx.moveTo(x1, y1); ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2); ctx.lineTo(x2, y2);
ctx.closePath(); ctx.closePath();

View File

@ -6,7 +6,7 @@ import ELines from './ELines'; // 创建多线条 曲线 (私有)
import EblockLines from './EblockLines'; // 区段封锁特有 import EblockLines from './EblockLines'; // 区段封锁特有
import ESeparator from './ESeparator'; // 分隔符 (私有) import ESeparator from './ESeparator'; // 分隔符 (私有)
import EMouse from './EMouse'; import EMouse from './EMouse';
// import { EAxle } from './EAxle'; // 创建计轴 (暂时不使用) import { EAxle } from './EAxle'; // 创建计轴 (暂时不使用)
import { EBackArrow, EBackArrowTriangle } from './EBackArrow'; // 折返进路箭头 import { EBackArrow, EBackArrowTriangle } from './EBackArrow'; // 折返进路箭头
import ELimitName from './ELimitName'; // 成都三号线 限速名称 import ELimitName from './ELimitName'; // 成都三号线 限速名称
import JTriangle from '../../utils/JTriangle'; import JTriangle from '../../utils/JTriangle';
@ -39,6 +39,23 @@ export default class Section extends Group {
this.creatRelease(); // 创建延时释放 this.creatRelease(); // 创建延时释放
this.createSeparator(); // 创建分隔符 this.createSeparator(); // 创建分隔符
this.createTurnBack(); // 创建成都三号线 折返箭头 this.createTurnBack(); // 创建成都三号线 折返箭头
// this.createAxles();
/* 计轴 */
// const traingle11 = new JTriangle(this.model.points[0], this.model.points[1]);
// this.axle = new EAxle({
// shape: {
// style: this.style,
// traingle: traingle11,
// drictx: 1,
// dricty: 1,
// point: this.model.points[0]
// },
// style: {
// fill: this.style.Section.axle.color,
// stroke: this.style.Section.axle.color
// }
// });
// this.add(this.axle);
} }
// 创建区段名称 // 创建区段名称
@ -209,6 +226,7 @@ export default class Section extends Group {
}); });
this.add(this.destinationText); this.add(this.destinationText);
} }
} }
} }

View File

@ -566,11 +566,11 @@ class Signal extends Group {
} }
setLowButtonActive() { setLowButtonActive() {
this.lowButton.setLowButtonActive(); this.lowButton && this.lowButton.setLowButtonActive();
} }
setLowButtonRecover() { setLowButtonRecover() {
this.lowButton.setLowButtonRecover(); this.lowButton && this.lowButton.setLowButtonRecover();
} }
} }

View File

@ -139,7 +139,7 @@ export default {
watch: { watch: {
'$store.state.menuOperation.setMenuChangeCount': function (val) { '$store.state.menuOperation.setMenuChangeCount': function (val) {
if (this.selected._type) { if (this.selected._type) {
if (this.selected._type == 'Section' && this.selected.type == '03') { if (this.selected._type == 'Section' && (this.selected.type == '03' || this.selected.type == '04')) { //
this.selected = this.selected.switch; this.selected = this.selected.switch;
} }
this.canCommand = true; this.canCommand = true;

View File

@ -693,11 +693,11 @@ export default {
operateType: 'Signal_Block', operateType: 'Signal_Block',
skinCode: '06', skinCode: '06',
trainingName: '信号封锁({5})', trainingName: '信号封锁({5})',
trainingRemark: '信号封', trainingRemark: '信号封',
trainingType: 'Signal', trainingType: 'Signal',
productTypes: ['01'], productTypes: ['01'],
stepVOList: [ stepVOList: [
{ deviceType: '04', orderNum: 1, operateCode: '306', tip: '鼠标右键菜单选择【信号封】' }, { deviceType: '04', orderNum: 1, operateCode: '306', tip: '鼠标右键菜单选择【信号封】' },
{ deviceType: '04', orderNum: 2, operateCode: '306', tip: '鼠标左键点击【确定】按钮' } { deviceType: '04', orderNum: 2, operateCode: '306', tip: '鼠标左键点击【确定】按钮' }
] ]
}, },

View File

@ -192,6 +192,8 @@ export function parser(data, skinCode, showConfig) {
if (cnodeSection && lnodeSection && rnodeSection) { if (cnodeSection && lnodeSection && rnodeSection) {
cnodeSection['switch'] = lnodeSection['switch'] = rnodeSection['switch'] = mapDevice[elem.code]; cnodeSection['switch'] = lnodeSection['switch'] = rnodeSection['switch'] = mapDevice[elem.code];
const sectionParent = mapDevice[cnodeSection.parentCode];
sectionParent['switch'] = mapDevice[elem.code];
if (cnodeSection.points[0].x == lnodeSection.points[lnodeSection.points.length - 1].x && cnodeSection.points[0].y == lnodeSection.points[lnodeSection.points.length - 1].y) { if (cnodeSection.points[0].x == lnodeSection.points[lnodeSection.points.length - 1].x && cnodeSection.points[0].y == lnodeSection.points[lnodeSection.points.length - 1].y) {
mapDevice[elem.code].intersection = { mapDevice[elem.code].intersection = {
x: cnodeSection.points[0].x, x: cnodeSection.points[0].x,

View File

@ -52,6 +52,7 @@ const Taskmanage = () => import('@/views/lesson/taskmanage/list');
const TrainingRuleList = () => import('@/views/lesson/trainingRule/list'); const TrainingRuleList = () => import('@/views/lesson/trainingRule/list');
const TrainingRuleEdit = () => import('@/views/lesson/trainingRule/detail/index'); const TrainingRuleEdit = () => import('@/views/lesson/trainingRule/detail/index');
const Trainingmanage = () => import('@/views/lesson/trainingmanage/index'); const Trainingmanage = () => import('@/views/lesson/trainingmanage/index');
const TrainingmanageOld = () => import('@/views/lesson/trainingmanage/oldMap');
const LessonEdit = () => import('@/views/lesson/lessoncategory/index'); const LessonEdit = () => import('@/views/lesson/lessoncategory/index');
const LessonHome = () => import('@/views/lesson/home'); const LessonHome = () => import('@/views/lesson/home');
const LessonDetail = () => import('@/views/lesson/details'); const LessonDetail = () => import('@/views/lesson/details');
@ -312,6 +313,11 @@ export const asyncRouter = [
component: Trainingmanage, component: Trainingmanage,
hidden: true hidden: true
}, },
{// 老地图实训管理
path: 'lesson/TrainingmanageOld',
component: TrainingmanageOld,
hidden: true
},
{ // 创建课程 { // 创建课程
path: 'lesson/edit/:type', path: 'lesson/edit/:type',
component: LessonEdit, component: LessonEdit,

View File

@ -2291,6 +2291,7 @@ export const UrlConfig = {
trainingRule: '/design/lesson/trainingRule', trainingRule: '/design/lesson/trainingRule',
trainingRuleDetail: '/design/lesson/trainingRule/detail', trainingRuleDetail: '/design/lesson/trainingRule/detail',
trainingManage: '/design/lesson/trainingManage', trainingManage: '/design/lesson/trainingManage',
trainingManageOld: '/design/lesson/trainingManageOld',
lessonTraining: '/design/lesson/training', lessonTraining: '/design/lesson/training',
trainingRecord: '/design/lesson/training', trainingRecord: '/design/lesson/training',
runPlan: '/design/runPlan/detail', runPlan: '/design/runPlan/detail',

View File

@ -209,7 +209,11 @@ export default {
this.$router.push({path: `${UrlConfig.design.taskManage}`, query: {mapId: this.$route.params.mapId}}); this.$router.push({path: `${UrlConfig.design.taskManage}`, query: {mapId: this.$route.params.mapId}});
}, },
trainingManage() { trainingManage() {
this.$router.push({path: `${UrlConfig.design.trainingManage}`, query: {mapId: this.$route.params.mapId, drawWay: this.$route.query.drawWay, lineCode: this.$route.query.lineCode}}); if (this.$route.query.drawWay + '' === 'true') {
this.$router.push({path: `${UrlConfig.design.trainingManage}`, query: {mapId: this.$route.params.mapId, drawWay: this.$route.query.drawWay, lineCode: this.$route.query.lineCode}});
} else {
this.$router.push({path: `${UrlConfig.design.trainingManageOld}`, query: {mapId: this.$route.params.mapId, drawWay: this.$route.query.drawWay, lineCode: this.$route.query.lineCode}});
}
}, },
operationManage() { operationManage() {
this.$router.push({path: `${UrlConfig.design.trainingRule}`, query: {mapId: this.$route.params.mapId, lineCode: this.$route.query.lineCode}}); this.$router.push({path: `${UrlConfig.design.trainingRule}`, query: {mapId: this.$route.params.mapId, lineCode: this.$route.query.lineCode}});

View File

@ -6,6 +6,7 @@
width="25%" width="25%"
:before-close="handleClose" :before-close="handleClose"
center center
:z-index="2000"
> >
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" /> <data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -96,19 +97,13 @@ export default {
const self = this; const self = this;
this.$refs.dataform.validateForm(() => { this.$refs.dataform.validateForm(() => {
if (this.isShow) { if (this.isShow) {
this.$confirm( this.$confirm(this.$t('lesson.wellClearOperate'), this.$t('global.tips'), {
this.$t('lesson.wellClearOperate'), confirmButtonText: this.$t('global.confirm'),
this.$t('global.tips'), cancelButtonText: this.$t('global.cancel'),
{ type: 'warning'
confirmButtonText: this.$t('global.confirm'), }).then(() => {
cancelButtonText: this.$t('global.cancel'), self.create();
type: 'warning' }).catch(() => {});
}
)
.then(() => {
self.create();
})
.catch(() => {});
} else { } else {
self.create(); self.create();
} }

View File

@ -2,12 +2,12 @@
<div style="height: 100%; overflow-y: auto;"> <div style="height: 100%; overflow-y: auto;">
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" style="width: 98%;margin-left:1%;margin-top:20px;" /> <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" style="width: 98%;margin-left:1%;margin-top:20px;" />
<!-- <training-draft <!-- <training-draft
ref="draftTrain" ref="draftTrain"
:map-id-list="mapIdList" :map-id-list="mapIdList"
:training-type-list="trainingTypeList" :training-type-list="trainingTypeList"
:training-operate-type-map="trainingOperateTypeMap" :training-operate-type-map="trainingOperateTypeMap"
@refresh="reloadTable" @refresh="reloadTable"
/> --> /> -->
<div class="draft"> <div class="draft">
<el-button-group> <el-button-group>
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button> <el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
@ -47,7 +47,6 @@ export default {
ControlConvertMenu: [], ControlConvertMenu: [],
TrainWindow: [] TrainWindow: []
}, },
isLeaving:false,
trainingTypeMap: {}, trainingTypeMap: {},
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
@ -138,15 +137,15 @@ export default {
type: '' type: ''
} }
/* { /* {
name: this.$t('lesson.trainingRecord'), name: this.$t('lesson.trainingRecord'),
handleClick: this.trainingRecord, handleClick: this.trainingRecord,
type: '' type: ''
}*/ }*/
] ]
} }
], ],
actions: [ actions: [
{ text: this.$t('lesson.generateTraining'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:false } { 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.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.deleteTraining'), btnCode: 'employee_delete', handler: this.delAutoMaticTrainging, type: 'danger'}
] ]
@ -171,12 +170,6 @@ export default {
await this.loadInitData(json); await this.loadInitData(json);
this.typeChoose(json); this.typeChoose(json);
}, },
mounted() {
this.interCheckGenerateStatus();
},
beforeDestroy() {
this.isLeaving = true;
},
methods: { methods: {
async loadInitData(queryData) { async loadInitData(queryData) {
this.mapIdList = []; this.mapIdList = [];
@ -217,28 +210,6 @@ export default {
this.reloadTable(); this.reloadTable();
}, },
interCheckGenerateStatus() {
createAllTrainingList(this.$route.query.mapId, false).then((data)=>{
if (data.data) {
this.queryList.actions.pop();
this.queryList.actions.push({ text: this.$t('lesson.trainingGenerating'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:true });
} else {
this.queryList.actions.pop();
this.queryList.actions.push({ text: this.$t('lesson.generateTraining'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:false });
}
setTimeout(() => {
if (!this.isLeaving) {
this.interCheckGenerateStatus(this.$route.query.mapId, false);
}
}, 30000);
}).catch(()=>{
setTimeout(() => {
if (!this.isLeaving) {
this.interCheckGenerateStatus(this.$route.query.mapId, false);
}
}, 30000);
});
},
async prdChoose(queryData) { async prdChoose(queryData) {
this.trainingTypeMap = {}; this.trainingTypeMap = {};
const lineCode = this.$route.query.lineCode; const lineCode = this.$route.query.lineCode;
@ -291,26 +262,15 @@ export default {
beforeClose: async (action, instance, done) => { beforeClose: async (action, instance, done) => {
if (action === 'confirm') { if (action === 'confirm') {
instance.confirmButtonLoading = true; instance.confirmButtonLoading = true;
// instance.confirmButtonText = '...'; instance.confirmButtonText = '生成中...';
this.queryList.actions.pop();
this.queryList.actions.push({ text: this.$t('lesson.trainingGenerating'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:true });
try { try {
const data = await createAllTrainingList(this.$route.query.mapId, true); await createAllTrainingList(this.$route.query.mapId);
this.$message.success('实训生成中...'); this.$message.success('生成实训成功');
instance.confirmButtonLoading = false;
if (!data.data) {
this.queryList.actions.pop();
this.queryList.actions.push({ text: this.$t('lesson.generateTraining'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:false });
}
done(); done();
} catch (error) { } catch (error) {
instance.confirmButtonLoading = false;
this.$message.error(`生成实训失败: ${error.message}`); this.$message.error(`生成实训失败: ${error.message}`);
this.queryList.actions.pop();
this.queryList.actions.push({ text: this.$t('lesson.generateTraining'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:false });
} }
} else { } else {
instance.confirmButtonLoading = false;
done(); done();
} }
} }
@ -384,9 +344,9 @@ export default {
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
.draft { .draft {
width: 400px; width: 400px;
text-align: center; text-align: center;
margin: 20px auto; margin: 20px auto;
} }
</style> </style>

View File

@ -0,0 +1,342 @@
<template>
<div style="height: 100%; overflow-y: auto;">
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" style="width: 98%;margin-left:1%;margin-top:20px;" />
<!-- <training-draft
ref="draftTrain"
:map-id-list="mapIdList"
:training-type-list="trainingTypeList"
:training-operate-type-map="trainingOperateTypeMap"
@refresh="reloadTable"
/> -->
<div class="draft">
<el-button-group>
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
</el-button-group>
</div>
</div>
</template>
<script>
import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie';
import { pageQueryTraining, pageQueryTrainingNew, createAllTrainingList } from '@/api/jmap/training';
import { trainingNotify, trainingNotifyNew } from '@/api/simulation';
import { launchFullscreen } from '@/utils/screen';
import { getPublishMapListOnline } from '@/api/jmap/map';
import { getOperateTrainingList } from '@/api/management/operation';
import { UrlConfig } from '@/scripts/ConstDic';
// import TrainingDraft from './draft';
import localStore from 'storejs';
export default {
name: 'TrainingGeneration',
components: {
// TrainingDraft
},
data() {
return {
mapIdList: [],
trainingTypeList: [],
trainingOperateTypeMap: {},
trainingTypeMap: {},
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
queryObject: {
prdType: {
type: 'select',
label: this.$t('lesson.prdType'),
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: []
}
},
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.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'; }
},
{
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: ''
}
/* {
name: this.$t('lesson.trainingRecord'),
handleClick: this.trainingRecord,
type: ''
}*/
]
}
],
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'}
]
},
currentModel: {}
};
},
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 }; });
},
drawWay() {
return this.$route.query.drawWay + '';
}
},
async created() {
const json = localStore.get(this.$route.path);
await this.loadInitData(json);
this.typeChoose(json);
},
methods: {
async loadInitData(queryData) {
this.mapIdList = [];
this.queryForm.queryObject.prdType.config.data = [];
getPublishMapListOnline().then(response => {
this.mapIdList = response.data;
});
this.queryForm.queryObject.prdType.config.data = this.prdTypeList;
//
this.trainingTypeList = [];
this.$Dictionary.trainingType().then(list => {
this.trainingTypeList = list;
});
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; //
await this.prdChoose(queryData);
this.reloadTable();
},
async prdChoose(queryData) {
this.trainingTypeMap = {};
const mapId = this.$route.query.mapId;
const res = await getOperateTrainingList({ mapId: mapId, productType: queryData.prdType });
if (res && res.code == 200) {
const trainingTypeLists = res.data;
this.trainingTypeList.forEach(elem => {
trainingTypeLists.forEach(item => {
if (item.id == elem.code) {
item.label = elem.name;
item.value = elem.code;
}
if (this.trainingOperateTypeMap[item.id].length) {
this.trainingOperateTypeMap[item.id].forEach(i => {
item.children.forEach(v => {
if (i.code == v.id) {
v.name = i.name;
v.code = i.code;
}
});
});
}
});
});
trainingTypeLists.forEach(item => {
item.children.forEach(v => {
if (!this.trainingTypeMap[item.id]) {
this.trainingTypeMap[item.id] = [];
}
this.trainingTypeMap[item.id].push({
label: v.name,
value: v.code
});
});
});
this.queryForm.queryObject.type.config.data = trainingTypeLists;
}
},
typeChoose(form) {
this.queryForm.queryObject.operateType.config.data = [];
form.operateType = '';
if (form && form.type && this.trainingTypeMap[form.type]) {
this.trainingTypeMap[form.type].forEach(elem => {
this.queryForm.queryObject.operateType.config.data.push({ value: elem.value, label: elem.label });
});
}
},
autoMaticTrainging() {
this.$confirm('您确定是否生成所有实训,此操作会删除之前已生成好的实训!', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning',
beforeClose: async (action, instance, done) => {
if (action === 'confirm') {
instance.confirmButtonLoading = true;
instance.confirmButtonText = '生成中...';
try {
await createAllTrainingList(this.$route.query.mapId);
this.$message.success('生成实训成功');
done();
} catch (error) {
this.$message.error(`生成实训失败: ${error.message}`);
}
} else {
done();
}
}
}
).then(async (action) => {
// done();
});
// 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') });
// },
demoDisplay(index, node) {
if (this.drawWay === 'true') {
trainingNotifyNew({ trainingId: node.id }).then(resp => {
/** 区分演示和正式需要在演示时设置lessonId为0*/
const query = { group: resp.data, trainingId: node.id, lessonId: 0, mapId: this.$route.query.mapId, lineCode: this.$route.query.lineCode };
this.$router.push({ path: `${UrlConfig.displayNew}/manage`, query: query });
launchFullscreen();
}).catch(error => {
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
});
} else {
trainingNotify({ trainingId: node.id }).then(resp => {
/** 区分演示和正式需要在演示时设置lessonId为0*/
const query = { group: resp.data, trainingId: node.id, lessonId: 0, mapId: this.$route.query.mapId };
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) {
if (this.drawWay === 'true') {
trainingNotifyNew({ 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}`);
});
} else {
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;
if (this.drawWay === 'true') {
return pageQueryTrainingNew(params);
} else {
return pageQueryTraining(params);
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.draft {
width: 400px;
text-align: center;
margin: 20px auto;
}
</style>

View File

@ -77,7 +77,7 @@ export default {
device = this.$store.getters['map/getDeviceByCode'](section.relSwitchCode); device = this.$store.getters['map/getDeviceByCode'](section.relSwitchCode);
} }
} }
if (device._type == 'Section' && device.type == '03') { // model if (device._type == 'Section' && (device.type == '03' || device.type == '04')) { // model
device = device.switch; device = device.switch;
} }

View File

@ -196,7 +196,7 @@ export default {
name: this.$t('map.mapData'), name: this.$t('map.mapData'),
item: [ item: [
{ prop: 'stationCode', label: this.$t('map.equipmentStation') + ':', type: 'select', mode: true, optionLabel: 'name&&code', optionValue: 'code', disabled: this.isStationCodeDisabled, options: this.centralizedStationList, isHidden: this.isLSectionOffsetShow}, { prop: 'stationCode', label: this.$t('map.equipmentStation') + ':', type: 'select', mode: true, optionLabel: 'name&&code', optionValue: 'code', disabled: this.isStationCodeDisabled, options: this.centralizedStationList, isHidden: this.isLSectionOffsetShow},
{ prop: 'lengthFact', label: this.$t('map.actualLength') + ':', type: 'number', min: 0, placeholder: this.$t('map.meter') }, { prop: 'lengthFact', label: this.$t('map.actualLength') + ':', type: 'number', min: 0, placeholder: this.$t('map.meter'), isHidden: this.isLengthFactShow },
{ prop: 'leftStopPointOffset', label: this.$t('map.leftStopPointOffset'), type: 'number', min: 0, disabled: true, isHidden: !this.isStopPointOffset }, { prop: 'leftStopPointOffset', label: this.$t('map.leftStopPointOffset'), type: 'number', min: 0, disabled: true, isHidden: !this.isStopPointOffset },
{ prop: 'rightStopPointOffset', label: this.$t('map.rightStopPointOffset'), type: 'number', min: 0, disabled: true, isHidden: !this.isStopPointOffset }, { prop: 'rightStopPointOffset', label: this.$t('map.rightStopPointOffset'), type: 'number', min: 0, disabled: true, isHidden: !this.isStopPointOffset },
{ prop: 'region', label: this.$t('map.sectionColon'), type: 'select', optionLabel: 'label', optionValue: 'value', options: this.regionList, isHidden: !this.sectionColonShow }, { prop: 'region', label: this.$t('map.sectionColon'), type: 'select', optionLabel: 'label', optionValue: 'value', options: this.regionList, isHidden: !this.sectionColonShow },
@ -362,6 +362,9 @@ export default {
isLSectionOffsetShow() { isLSectionOffsetShow() {
return this.editModel.type === '02'; return this.editModel.type === '02';
}, },
isLengthFactShow() {
return this.editModel.type === '02' || this.editModel.type === '04';
},
centralizedStationList() { centralizedStationList() {
let list = []; let list = [];
list = this.stationList.filter(station=>{ list = this.stationList.filter(station=>{
@ -414,10 +417,11 @@ export default {
this.editModel = deepAssign(this.editModel, selected); this.editModel = deepAssign(this.editModel, selected);
this.editModel.logicSectionNum = selected.type === '01' ? selected.logicSectionNum : [0]; this.editModel.logicSectionNum = selected.type === '01' ? selected.logicSectionNum : [0];
this.editModel.points = JSON.parse(JSON.stringify(selected.points)); this.editModel.points = JSON.parse(JSON.stringify(selected.points));
console.log(selected, selected.lengthFact, '实际长度');
this.editModel.lengthFact = selected.lengthFact || 0;
this.oldPoint = JSON.parse(JSON.stringify(selected.points)); this.oldPoint = JSON.parse(JSON.stringify(selected.points));
this.oldLeftSectionCode = selected.leftSectionCode; this.oldLeftSectionCode = selected.leftSectionCode;
this.oldRightSectionCode = selected.rightSectionCode; this.oldRightSectionCode = selected.rightSectionCode;
this.editModel.lengthFact = selected.lengthFact || 0;
this.$refs.logicBlock.computedLogicSectionNumList(this.editModel.logicSectionNum); this.$refs.logicBlock.computedLogicSectionNumList(this.editModel.logicSectionNum);
if (this.field.toUpperCase() === 'splitSection'.toUpperCase()) { if (this.field.toUpperCase() === 'splitSection'.toUpperCase()) {
this.$refs.splitOrMerge.addModel.splitOffsetMax = Math.sqrt(new JTriangle(selected.points[0], selected.points[selected.points.length - 1]).abspowz); this.$refs.splitOrMerge.addModel.splitOffsetMax = Math.sqrt(new JTriangle(selected.points[0], selected.points[selected.points.length - 1]).abspowz);