Merge branch 'dev' of https://git.qcloud.com/joylink/jl-nclient into dev
This commit is contained in:
commit
6102c29116
@ -2,194 +2,194 @@ import request from '@/utils/request';
|
||||
|
||||
/** 清除实训数据*/
|
||||
export function clearTraining(args) {
|
||||
return request({
|
||||
url: `/api/training/${args.id}`,
|
||||
method: 'delete'
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/${args.id}`,
|
||||
method: 'delete'
|
||||
});
|
||||
}
|
||||
|
||||
/** 开始实训*/
|
||||
export function startTraining(args, group) {
|
||||
return request({
|
||||
url: `/api/training/${args.id}/start`,
|
||||
method: 'get',
|
||||
params: {
|
||||
group
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/${args.id}/start`,
|
||||
method: 'get',
|
||||
params: {
|
||||
group
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 实训结束*/
|
||||
export function endTraining(args, group) {
|
||||
return request({
|
||||
url: `/api/training/${args.lessonId}/${args.id}/end`,
|
||||
method: 'get',
|
||||
params: {
|
||||
mode: args.mode,
|
||||
usedTime: args.usedTime,
|
||||
group
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/${args.lessonId}/${args.id}/end`,
|
||||
method: 'get',
|
||||
params: {
|
||||
mode: args.mode,
|
||||
usedTime: args.usedTime,
|
||||
group
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 发送步骤数据*/
|
||||
export function sendTrainingNextStep(data, group) {
|
||||
return request({
|
||||
url: `/api/training/${data.trainingId}/nextStep`,
|
||||
method: 'post',
|
||||
data: data.operate,
|
||||
params: {
|
||||
group
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/${data.trainingId}/nextStep`,
|
||||
method: 'post',
|
||||
data: data.operate,
|
||||
params: {
|
||||
group
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取实训树*/
|
||||
export function getTrainingTree() {
|
||||
return request({
|
||||
url: `/api/training/tree`,
|
||||
method: 'get'
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/tree`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取章节基本信息*/
|
||||
export function getTrainingDetail(trainingId) {
|
||||
return request({
|
||||
url: `/api/training/${trainingId}`,
|
||||
method: 'get'
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/${trainingId}`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/** 添加实训*/
|
||||
export function addTraining(data) {
|
||||
return request({
|
||||
url: '/api/training',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
return request({
|
||||
url: '/api/training',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/** 更新实训*/
|
||||
export function updateTraining(data) {
|
||||
return request({
|
||||
url: `/api/training/${data.id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/${data.id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/** 保存实训初始状态*/
|
||||
export function saveTrainingInitStatus(data, group) {
|
||||
return request({
|
||||
url: `/api/training/${data.id}/detailSave?group=${group}`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/${data.id}/detailSave?group=${group}`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/** 保存实训步骤数据*/
|
||||
export function saveTrainingStepsData(data) {
|
||||
return request({
|
||||
url: `/api/training/${data.id}/stepsSave`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/${data.id}/stepsSave`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取实训步骤数据*/
|
||||
export function getTrainingStepsDetail(trainingId, params) {
|
||||
return request({
|
||||
url: `/api/training/${trainingId}/detail`,
|
||||
method: 'get',
|
||||
params: params
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/${trainingId}/detail`,
|
||||
method: 'get',
|
||||
params: params
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询实训列表*/
|
||||
export function pageQueryTraining(params) {
|
||||
return request({
|
||||
url: `/api/training/pagedQuery`,
|
||||
method: 'get',
|
||||
params: params
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/pagedQuery`,
|
||||
method: 'get',
|
||||
params: params
|
||||
});
|
||||
}
|
||||
|
||||
/** 自动生成实训操作*/
|
||||
export function addAutoTraining(data) {
|
||||
return request({
|
||||
url: `/api/training/generate`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/generate`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/** 修改自动删除实训操作*/
|
||||
export function updateAutoTraining(data) {
|
||||
return request({
|
||||
url: `/api/training/batchUpdateGenerate`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/batchUpdateGenerate`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除自动生成实训*/
|
||||
export function deleteAutoTraining(params) {
|
||||
return request({
|
||||
url: `/api/training/generate`,
|
||||
method: 'delete',
|
||||
params: params
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/generate`,
|
||||
method: 'delete',
|
||||
params: params
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取用户实训列表*/
|
||||
export function getTrainingList(data) {
|
||||
return request({
|
||||
url: `/api/training/list`,
|
||||
method: 'get',
|
||||
params: data
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/list`,
|
||||
method: 'get',
|
||||
params: data
|
||||
});
|
||||
}
|
||||
|
||||
export function sendCommand(group, command) {
|
||||
return request({
|
||||
url: `/api/training/deviceChange?group=${group}`,
|
||||
method: 'put',
|
||||
data: {
|
||||
param: command.val,
|
||||
type: command.type,
|
||||
code: command.code,
|
||||
operation: command.operation
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/deviceChange?group=${group}`,
|
||||
method: 'put',
|
||||
data: {
|
||||
param: command.val,
|
||||
type: command.type,
|
||||
code: command.code,
|
||||
operation: command.operation
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function updateLesson(data) {
|
||||
return request({
|
||||
url: `/api/training/userTraining/${data.id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/userTraining/${data.id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
// 添加用户实训数据
|
||||
export function addUserTraining(data) {
|
||||
return request({
|
||||
url: `/api/training/userTraining`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/userTraining`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
// 更新用户实训数据
|
||||
export function putUserTraining(data) {
|
||||
return request({
|
||||
url: `/api/training/userTraining/${data.id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/userTraining/${data.id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
// 清除实训数据
|
||||
export function deleteUserTraining(statsId) {
|
||||
return request({
|
||||
url: `/api/training/userTraining/${statsId}`,
|
||||
method: 'delete'
|
||||
});
|
||||
return request({
|
||||
url: `/api/training/userTraining/${statsId}`,
|
||||
method: 'delete'
|
||||
});
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -36,6 +36,8 @@ export default {
|
||||
sectionRelSwitchCode: 'sectionRelSwitchCode',
|
||||
|
||||
pleaseSelectSectionName: 'Select the section name',
|
||||
pleaseSelectSection: 'Select the section',
|
||||
pleaseSelectStationCode: 'Select the section station code',
|
||||
pleaseFillOffset: 'Please fill in the offset',
|
||||
pleaseFillValue: 'Please fill in the value',
|
||||
pleaseSelectLeftSectionName: 'Please select the left section name',
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -34,6 +34,8 @@ export default {
|
||||
basisLink: '基础Link:',
|
||||
|
||||
pleaseSelectSectionName: '请选择区段名称',
|
||||
pleaseSelectSection: '请选择区段',
|
||||
pleaseSelectStationCode: '请选择设备集中站',
|
||||
pleaseFillOffset: '请填写偏移量',
|
||||
pleaseFillValue: '请填写数值',
|
||||
pleaseSelectLeftSectionName: '请选择左侧区段名称',
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -260,6 +260,14 @@ class SkinCode extends defaultStyle {
|
||||
},
|
||||
arrow: {
|
||||
show: true // 控制模式箭头显隐
|
||||
},
|
||||
mouseOverStyle: { // 鼠标悬浮样式
|
||||
fontSize: 10,
|
||||
fontFormat: 'consolas',
|
||||
fontColor: '#FFF000',
|
||||
fontWeight: 'normal',
|
||||
textAlign: 'middle',
|
||||
textVerticalAlign: 'top'
|
||||
}
|
||||
};
|
||||
|
||||
@ -319,11 +327,71 @@ class SkinCode extends defaultStyle {
|
||||
lineColor: '#FFFFFF' // 线条颜色
|
||||
};
|
||||
|
||||
this[deviceType.LcControl] = {};
|
||||
this[deviceType.LcControl] = {
|
||||
text: {
|
||||
fontSize: 10, // 灯字体大小
|
||||
fontWeight: 'normal', // 字体粗细
|
||||
distance: 5 // 灯跟文字距离
|
||||
},
|
||||
lamp: {
|
||||
radiusR: 6, // 灯大小
|
||||
controlColor: '#FFFF00' // 灯颜色
|
||||
},
|
||||
mouseOverStyle: {
|
||||
fontSize: 10,
|
||||
fontFormat: 'consolas',
|
||||
fontColor: '#FFF000',
|
||||
fontWeight: 'normal',
|
||||
textAlign: 'middle',
|
||||
textVerticalAlign: 'top',
|
||||
arcColor: '#00FFFF',
|
||||
textColor: '#000000'
|
||||
}
|
||||
};
|
||||
|
||||
this[deviceType.ZcControl] = {};
|
||||
this[deviceType.ZcControl] = {
|
||||
text: {
|
||||
fontSize: 10, // 字体大小
|
||||
fontWeight: 'normal', // 字体粗细
|
||||
distance: 5 // 灯跟文字距离
|
||||
},
|
||||
lamp: {
|
||||
radiusR: 6, // 灯大小
|
||||
controlColor: '#00FF00' // 灯颜色
|
||||
},
|
||||
mouseOverStyle: {
|
||||
fontSize: 10,
|
||||
fontFormat: 'consolas',
|
||||
fontColor: '#FFF000',
|
||||
fontWeight: 'normal',
|
||||
textAlign: 'middle',
|
||||
textVerticalAlign: 'top',
|
||||
arcColor: '#00FFFF',
|
||||
textColor: '#000000'
|
||||
}
|
||||
};
|
||||
|
||||
this[deviceType.LimitControl] = {};
|
||||
this[deviceType.LimitControl] = {
|
||||
text: {
|
||||
fontSize: 10, // 字体大小
|
||||
fontWeight: 'normal', // 字体粗细
|
||||
distance: 5 // 灯跟文字距离
|
||||
},
|
||||
lamp: {
|
||||
radiusR: 6, // 灯大小
|
||||
controlColor: '#ECE9D8' // 灯颜色
|
||||
},
|
||||
mouseOverStyle: {
|
||||
fontSize: 10,
|
||||
fontFormat: 'consolas',
|
||||
fontColor: '#FFF000',
|
||||
fontWeight: 'normal',
|
||||
textAlign: 'middle',
|
||||
textVerticalAlign: 'top',
|
||||
textColor: '#000000',
|
||||
arcColor: '#00FFFF'
|
||||
}
|
||||
};
|
||||
|
||||
this[deviceType.TrainWindow] = {
|
||||
lineColor: '#4DD43F', // 车次窗颜色
|
||||
|
@ -22,386 +22,386 @@ import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
|
||||
import { MenuDisabledState, menuConvert, menuFiltration } from './utils/menuItemStatus';
|
||||
|
||||
export default {
|
||||
name: 'SectionMenu',
|
||||
components: {
|
||||
PopMenu,
|
||||
SectionControl,
|
||||
SectionCmdControl,
|
||||
SpeedCmdControl,
|
||||
TrainCreate,
|
||||
NoticeInfo
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menu: [],
|
||||
menuNormal: {
|
||||
local: [
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionFaultUnlock'),
|
||||
handler: this.fault,
|
||||
disabledCallback: MenuDisabledState.Section.fault,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionResection'),
|
||||
handler: this.split,
|
||||
disabledCallback: MenuDisabledState.Section.split,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionActive'),
|
||||
handler: this.active,
|
||||
disabledCallback: MenuDisabledState.Section.active,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionAxisPreReset'),
|
||||
handler: this.axlePreReset,
|
||||
disabledCallback: MenuDisabledState.Section.axlePreReset,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionBlockade'),
|
||||
handler: this.lock,
|
||||
disabledCallback: MenuDisabledState.Section.lock,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionUnblock'),
|
||||
handler: this.unlock,
|
||||
disabledCallback: MenuDisabledState.Section.unlock,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionSetSpeedLimit'),
|
||||
handler: this.setSpeed,
|
||||
disabledCallback: MenuDisabledState.Section.setSpeed,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionCancelSpeedLimit'),
|
||||
handler: this.cancelSpeed,
|
||||
disabledCallback: MenuDisabledState.Section.cancelSpeed,
|
||||
auth: { station: true, center: false }
|
||||
}
|
||||
],
|
||||
central: [
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionFaultUnlock'),
|
||||
handler: this.fault,
|
||||
disabledCallback: MenuDisabledState.Section.fault,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionResection'),
|
||||
handler: this.split,
|
||||
disabledCallback: MenuDisabledState.Section.split,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionActive'),
|
||||
handler: this.active,
|
||||
disabledCallback: MenuDisabledState.Section.active,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.axisPreReset'),
|
||||
handler: this.axlePreReset,
|
||||
disabledCallback: MenuDisabledState.Section.axlePreReset,
|
||||
auth: { station: false, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionBlockade'),
|
||||
handler: this.lock,
|
||||
disabledCallback: MenuDisabledState.Section.lock,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionUnblock'),
|
||||
handler: this.unlock,
|
||||
disabledCallback: MenuDisabledState.Section.unlock,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionSetSpeedLimit'),
|
||||
handler: this.setSpeed,
|
||||
disabledCallback: MenuDisabledState.Section.setSpeed,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionCancelSpeedLimit'),
|
||||
handler: this.cancelSpeed,
|
||||
disabledCallback: MenuDisabledState.Section.cancelSpeed,
|
||||
auth: { station: false, center: true }
|
||||
}
|
||||
]
|
||||
},
|
||||
menuTrain: [
|
||||
{
|
||||
label: this.$t('menu.menuSection.createTrain'),
|
||||
handler: this.newTrain,
|
||||
disabledCallback: MenuDisabledState.Section.newTrain
|
||||
}
|
||||
],
|
||||
menuForce: [
|
||||
{
|
||||
label: this.$t('menu.menuSection.setFault'),
|
||||
handler: this.setStoppage,
|
||||
disabledCallback: MenuDisabledState.Section.setStoppage
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.cancelFault'),
|
||||
handler: this.cancelStoppage,
|
||||
disabledCallback: MenuDisabledState.Section.cancelStoppage
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('training', [
|
||||
'mode',
|
||||
'operatemode'
|
||||
]),
|
||||
...mapGetters('menuOperation', [
|
||||
'buttonOperation'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
'$store.state.menuOperation.menuCount': function (val) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Section) && !this.buttonOperation) {
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else {
|
||||
this.doClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
window.onclick = function (e) {
|
||||
self.doClose();
|
||||
};
|
||||
},
|
||||
initMenu() {
|
||||
// 编辑模式菜单列表
|
||||
this.menu = menuFiltration(this.menuNormal);
|
||||
if (this.operatemode === OperateMode.ADMIN) {
|
||||
this.menu = [...this.menu, ...this.menuForce, ...this.menuTrain];
|
||||
}
|
||||
name: 'SectionMenu',
|
||||
components: {
|
||||
PopMenu,
|
||||
SectionControl,
|
||||
SectionCmdControl,
|
||||
SpeedCmdControl,
|
||||
TrainCreate,
|
||||
NoticeInfo
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menu: [],
|
||||
menuNormal: {
|
||||
local: [
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionFaultUnlock'),
|
||||
handler: this.fault,
|
||||
disabledCallback: MenuDisabledState.Section.fault,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionResection'),
|
||||
handler: this.split,
|
||||
disabledCallback: MenuDisabledState.Section.split,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionActive'),
|
||||
handler: this.active,
|
||||
disabledCallback: MenuDisabledState.Section.active,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionAxisPreReset'),
|
||||
handler: this.axlePreReset,
|
||||
disabledCallback: MenuDisabledState.Section.axlePreReset,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionBlockade'),
|
||||
handler: this.lock,
|
||||
disabledCallback: MenuDisabledState.Section.lock,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionUnblock'),
|
||||
handler: this.unlock,
|
||||
disabledCallback: MenuDisabledState.Section.unlock,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionSetSpeedLimit'),
|
||||
handler: this.setSpeed,
|
||||
disabledCallback: MenuDisabledState.Section.setSpeed,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionCancelSpeedLimit'),
|
||||
handler: this.cancelSpeed,
|
||||
disabledCallback: MenuDisabledState.Section.cancelSpeed,
|
||||
auth: { station: true, center: false }
|
||||
}
|
||||
],
|
||||
central: [
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionFaultUnlock'),
|
||||
handler: this.fault,
|
||||
disabledCallback: MenuDisabledState.Section.fault,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionResection'),
|
||||
handler: this.split,
|
||||
disabledCallback: MenuDisabledState.Section.split,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionActive'),
|
||||
handler: this.active,
|
||||
disabledCallback: MenuDisabledState.Section.active,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.axisPreReset'),
|
||||
handler: this.axlePreReset,
|
||||
disabledCallback: MenuDisabledState.Section.axlePreReset,
|
||||
auth: { station: false, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionBlockade'),
|
||||
handler: this.lock,
|
||||
disabledCallback: MenuDisabledState.Section.lock,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionUnblock'),
|
||||
handler: this.unlock,
|
||||
disabledCallback: MenuDisabledState.Section.unlock,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionSetSpeedLimit'),
|
||||
handler: this.setSpeed,
|
||||
disabledCallback: MenuDisabledState.Section.setSpeed,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.sectionCancelSpeedLimit'),
|
||||
handler: this.cancelSpeed,
|
||||
disabledCallback: MenuDisabledState.Section.cancelSpeed,
|
||||
auth: { station: false, center: true }
|
||||
}
|
||||
]
|
||||
},
|
||||
menuTrain: [
|
||||
{
|
||||
label: this.$t('menu.menuSection.createTrain'),
|
||||
handler: this.newTrain,
|
||||
disabledCallback: MenuDisabledState.Section.newTrain
|
||||
}
|
||||
],
|
||||
menuForce: [
|
||||
{
|
||||
label: this.$t('menu.menuSection.setFault'),
|
||||
handler: this.setStoppage,
|
||||
disabledCallback: MenuDisabledState.Section.setStoppage
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuSection.cancelFault'),
|
||||
handler: this.cancelStoppage,
|
||||
disabledCallback: MenuDisabledState.Section.cancelStoppage
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('training', [
|
||||
'mode',
|
||||
'operatemode'
|
||||
]),
|
||||
...mapGetters('menuOperation', [
|
||||
'buttonOperation'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
'$store.state.menuOperation.menuCount': function (val) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Section) && !this.buttonOperation) {
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else {
|
||||
this.doClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
window.onclick = function (e) {
|
||||
self.doClose();
|
||||
};
|
||||
},
|
||||
initMenu() {
|
||||
// 编辑模式菜单列表
|
||||
this.menu = menuFiltration(this.menuNormal);
|
||||
if (this.operatemode === OperateMode.ADMIN) {
|
||||
this.menu = [...this.menu, ...this.menuForce, ...this.menuTrain];
|
||||
}
|
||||
|
||||
// 故障模式菜单列表
|
||||
if (this.operatemode === OperateMode.FAULT) {
|
||||
this.menu = this.menuForce;
|
||||
}
|
||||
// 故障模式菜单列表
|
||||
if (this.operatemode === OperateMode.FAULT) {
|
||||
this.menu = this.menuForce;
|
||||
}
|
||||
|
||||
this.menu = menuConvert(this.menu);
|
||||
},
|
||||
doShow(point) {
|
||||
this.clickEvent();
|
||||
this.initMenu();
|
||||
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
|
||||
this.$refs.popMenu.resetShowPosition(point);
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
if (this.$refs && this.$refs.popMenu) {
|
||||
this.$refs.popMenu.close();
|
||||
}
|
||||
},
|
||||
// 设置故障
|
||||
setStoppage() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.stoppage.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
} else {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
},
|
||||
// 取消故障
|
||||
cancelStoppage() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.cancelStoppage.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
} else {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
},
|
||||
// 故障解锁
|
||||
fault() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.fault.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.sectionCmdControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 切除
|
||||
split() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.split.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.sectionControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 激活
|
||||
active() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.active.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.sectionControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 区段计轴预复位
|
||||
axlePreReset() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.axlePreReset.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.sectionCmdControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 区段解锁
|
||||
lock() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.lock.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.sectionControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 区段封锁
|
||||
unlock() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.unlock.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.sectionCmdControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 设置速度
|
||||
setSpeed() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.setSpeed.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.speedCmdControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 取消速度
|
||||
cancelSpeed() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.cancelSpeed.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
|
||||
if (valid) {
|
||||
const tempData = response.data;
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.speedCmdControl.doShow(operate, this.selected, tempData);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 新建列车
|
||||
newTrain() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.newtrain.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.trainCreate.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
this.menu = menuConvert(this.menu);
|
||||
},
|
||||
doShow(point) {
|
||||
this.clickEvent();
|
||||
this.initMenu();
|
||||
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
|
||||
this.$refs.popMenu.resetShowPosition(point);
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
if (this.$refs && this.$refs.popMenu) {
|
||||
this.$refs.popMenu.close();
|
||||
}
|
||||
},
|
||||
// 设置故障
|
||||
setStoppage() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.stoppage.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
} else {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
},
|
||||
// 取消故障
|
||||
cancelStoppage() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.cancelStoppage.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
} else {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
},
|
||||
// 故障解锁
|
||||
fault() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.fault.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.sectionCmdControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 切除
|
||||
split() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.split.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.sectionControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 激活
|
||||
active() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.active.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.sectionControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 区段计轴预复位
|
||||
axlePreReset() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.axlePreReset.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.sectionCmdControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 区段解锁
|
||||
lock() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.lock.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.sectionControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 区段封锁
|
||||
unlock() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.unlock.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.sectionCmdControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 设置速度
|
||||
setSpeed() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.setSpeed.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.speedCmdControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 取消速度
|
||||
cancelSpeed() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.cancelSpeed.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
|
||||
if (valid) {
|
||||
const tempData = response.data;
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.speedCmdControl.doShow(operate, this.selected, tempData);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 新建列车
|
||||
newTrain() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.Section.type,
|
||||
label: MapDeviceType.Section.label,
|
||||
operation: OperationEvent.Section.newtrain.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.trainCreate.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -26,463 +26,463 @@ import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
|
||||
import { MenuDisabledState, menuConvert, menuFiltration } from './utils/menuItemStatus';
|
||||
|
||||
export default {
|
||||
name: 'StationStandMenu',
|
||||
components: {
|
||||
PopMenu,
|
||||
StandControl,
|
||||
StandDetail,
|
||||
StandRunLevel,
|
||||
NoticeInfo,
|
||||
StandBackStrategy,
|
||||
StandStopTime,
|
||||
StandDetainTrainAll
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menu: [],
|
||||
menuNormal: {
|
||||
local: [
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.detainTrain'),
|
||||
handler: this.setDetainTrain,
|
||||
disabledCallback: MenuDisabledState.StationStand.setDetainTrain,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelDetainTrain'),
|
||||
handler: this.cancelDetainTrain,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrain,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelDetainTrainForce'),
|
||||
handler: this.cancelDetainTrainForce,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrainForce,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.jumpStop'),
|
||||
handler: this.setJumpStop,
|
||||
disabledCallback: MenuDisabledState.StationStand.setJumpStop,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelJumpStop'),
|
||||
handler: this.cancelJumpStop,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelJumpStop,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setRunLevel'),
|
||||
handler: this.setRunLevel,
|
||||
disabledCallback: MenuDisabledState.StationStand.setRunLevel,
|
||||
auth: { station: false, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setEarlyDeparture'),
|
||||
handler: this.earlyDeparture,
|
||||
disabledCallback: MenuDisabledState.StationStand.earlyDeparture,
|
||||
auth: { station: false, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setBackStrategy'),
|
||||
handler: this.setBackStrategy,
|
||||
disabledCallback: MenuDisabledState.StationStand.setBackStrategy,
|
||||
auth: { station: false, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.getStationStandStatus'),
|
||||
handler: this.detail,
|
||||
disabledCallback: MenuDisabledState.StationStand.detail,
|
||||
auth: { station: true, center: false }
|
||||
}
|
||||
],
|
||||
central: [
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.detainTrain'),
|
||||
handler: this.setDetainTrain,
|
||||
disabledCallback: MenuDisabledState.StationStand.setDetainTrain,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelDetainTrain'),
|
||||
handler: this.cancelDetainTrain,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrain,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelDetainTrainForce'),
|
||||
handler: this.cancelDetainTrainForce,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrainForce,
|
||||
auth: { station: false, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelDetainTrainAll'),
|
||||
handler: this.cancelDetainTrainAll,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrainAll,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.jumpStop'),
|
||||
handler: this.setJumpStop,
|
||||
disabledCallback: MenuDisabledState.StationStand.setJumpStop,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelJumpStop'),
|
||||
handler: this.cancelJumpStop,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelJumpStop,
|
||||
auth: { station: true, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setStopTime'),
|
||||
handler: this.setStopTime,
|
||||
disabledCallback: MenuDisabledState.StationStand.setStopTime,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setRunLevel'),
|
||||
handler: this.setRunLevel,
|
||||
disabledCallback: MenuDisabledState.StationStand.setRunLevel,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setEarlyDeparture'),
|
||||
handler: this.earlyDeparture,
|
||||
disabledCallback: MenuDisabledState.StationStand.earlyDeparture,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setBackStrategy'),
|
||||
handler: this.setBackStrategy,
|
||||
disabledCallback: MenuDisabledState.StationStand.setBackStrategy,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.getStationStandStatus'),
|
||||
handler: this.detail,
|
||||
disabledCallback: MenuDisabledState.StationStand.detail,
|
||||
auth: { station: true, center: true }
|
||||
}
|
||||
]
|
||||
},
|
||||
menuForce: [
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setFault'),
|
||||
handler: this.setStoppage,
|
||||
disabledCallback: MenuDisabledState.StationStand.setStoppage
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelFault'),
|
||||
handler: this.cancelStoppage,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelStoppage
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('training', [
|
||||
'mode',
|
||||
'operatemode'
|
||||
]),
|
||||
...mapGetters('menuOperation', [
|
||||
'buttonOperation'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
'$store.state.menuOperation.menuCount': function (val) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.StationStand) && !this.buttonOperation) {
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else {
|
||||
this.doClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
window.onclick = function (e) {
|
||||
self.doClose();
|
||||
};
|
||||
},
|
||||
initMenu() {
|
||||
// 编辑模式菜单列表
|
||||
this.menu = menuFiltration(this.menuNormal);
|
||||
if (this.operatemode === OperateMode.ADMIN) {
|
||||
this.menu = [...this.menu, ...this.menuForce];
|
||||
}
|
||||
name: 'StationStandMenu',
|
||||
components: {
|
||||
PopMenu,
|
||||
StandControl,
|
||||
StandDetail,
|
||||
StandRunLevel,
|
||||
NoticeInfo,
|
||||
StandBackStrategy,
|
||||
StandStopTime,
|
||||
StandDetainTrainAll
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menu: [],
|
||||
menuNormal: {
|
||||
local: [
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.detainTrain'),
|
||||
handler: this.setDetainTrain,
|
||||
disabledCallback: MenuDisabledState.StationStand.setDetainTrain,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelDetainTrain'),
|
||||
handler: this.cancelDetainTrain,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrain,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelDetainTrainForce'),
|
||||
handler: this.cancelDetainTrainForce,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrainForce,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.jumpStop'),
|
||||
handler: this.setJumpStop,
|
||||
disabledCallback: MenuDisabledState.StationStand.setJumpStop,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelJumpStop'),
|
||||
handler: this.cancelJumpStop,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelJumpStop,
|
||||
auth: { station: true, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setRunLevel'),
|
||||
handler: this.setRunLevel,
|
||||
disabledCallback: MenuDisabledState.StationStand.setRunLevel,
|
||||
auth: { station: false, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setEarlyDeparture'),
|
||||
handler: this.earlyDeparture,
|
||||
disabledCallback: MenuDisabledState.StationStand.earlyDeparture,
|
||||
auth: { station: false, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setBackStrategy'),
|
||||
handler: this.setBackStrategy,
|
||||
disabledCallback: MenuDisabledState.StationStand.setBackStrategy,
|
||||
auth: { station: false, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.getStationStandStatus'),
|
||||
handler: this.detail,
|
||||
disabledCallback: MenuDisabledState.StationStand.detail,
|
||||
auth: { station: true, center: false }
|
||||
}
|
||||
],
|
||||
central: [
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.detainTrain'),
|
||||
handler: this.setDetainTrain,
|
||||
disabledCallback: MenuDisabledState.StationStand.setDetainTrain,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelDetainTrain'),
|
||||
handler: this.cancelDetainTrain,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrain,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelDetainTrainForce'),
|
||||
handler: this.cancelDetainTrainForce,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrainForce,
|
||||
auth: { station: false, center: false }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelDetainTrainAll'),
|
||||
handler: this.cancelDetainTrainAll,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrainAll,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.jumpStop'),
|
||||
handler: this.setJumpStop,
|
||||
disabledCallback: MenuDisabledState.StationStand.setJumpStop,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelJumpStop'),
|
||||
handler: this.cancelJumpStop,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelJumpStop,
|
||||
auth: { station: true, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setStopTime'),
|
||||
handler: this.setStopTime,
|
||||
disabledCallback: MenuDisabledState.StationStand.setStopTime,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setRunLevel'),
|
||||
handler: this.setRunLevel,
|
||||
disabledCallback: MenuDisabledState.StationStand.setRunLevel,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setEarlyDeparture'),
|
||||
handler: this.earlyDeparture,
|
||||
disabledCallback: MenuDisabledState.StationStand.earlyDeparture,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setBackStrategy'),
|
||||
handler: this.setBackStrategy,
|
||||
disabledCallback: MenuDisabledState.StationStand.setBackStrategy,
|
||||
auth: { station: false, center: true }
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.getStationStandStatus'),
|
||||
handler: this.detail,
|
||||
disabledCallback: MenuDisabledState.StationStand.detail,
|
||||
auth: { station: true, center: true }
|
||||
}
|
||||
]
|
||||
},
|
||||
menuForce: [
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.setFault'),
|
||||
handler: this.setStoppage,
|
||||
disabledCallback: MenuDisabledState.StationStand.setStoppage
|
||||
},
|
||||
{
|
||||
label: this.$t('menu.menuStationStand.cancelFault'),
|
||||
handler: this.cancelStoppage,
|
||||
disabledCallback: MenuDisabledState.StationStand.cancelStoppage
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('training', [
|
||||
'mode',
|
||||
'operatemode'
|
||||
]),
|
||||
...mapGetters('menuOperation', [
|
||||
'buttonOperation'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
'$store.state.menuOperation.menuCount': function (val) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.StationStand) && !this.buttonOperation) {
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else {
|
||||
this.doClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
window.onclick = function (e) {
|
||||
self.doClose();
|
||||
};
|
||||
},
|
||||
initMenu() {
|
||||
// 编辑模式菜单列表
|
||||
this.menu = menuFiltration(this.menuNormal);
|
||||
if (this.operatemode === OperateMode.ADMIN) {
|
||||
this.menu = [...this.menu, ...this.menuForce];
|
||||
}
|
||||
|
||||
// 故障模式菜单列表
|
||||
if (this.operatemode === OperateMode.FAULT) {
|
||||
this.menu = this.menuForce;
|
||||
}
|
||||
// 故障模式菜单列表
|
||||
if (this.operatemode === OperateMode.FAULT) {
|
||||
this.menu = this.menuForce;
|
||||
}
|
||||
|
||||
this.menu = menuConvert(this.menu);
|
||||
},
|
||||
doShow(point) {
|
||||
this.clickEvent();
|
||||
this.initMenu();
|
||||
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
|
||||
this.$refs.popMenu.resetShowPosition(point);
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
if (this.$refs && this.$refs.popMenu) {
|
||||
this.$refs.popMenu.close();
|
||||
}
|
||||
},
|
||||
// 设置故障
|
||||
setStoppage() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.stoppage.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
} else {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
},
|
||||
// 取消故障
|
||||
cancelStoppage() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.cancelStoppage.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
} else {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
},
|
||||
// 设置扣车
|
||||
setDetainTrain() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.setDetainTrain.menu.operation
|
||||
};
|
||||
this.menu = menuConvert(this.menu);
|
||||
},
|
||||
doShow(point) {
|
||||
this.clickEvent();
|
||||
this.initMenu();
|
||||
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
|
||||
this.$refs.popMenu.resetShowPosition(point);
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
if (this.$refs && this.$refs.popMenu) {
|
||||
this.$refs.popMenu.close();
|
||||
}
|
||||
},
|
||||
// 设置故障
|
||||
setStoppage() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.stoppage.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
} else {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
},
|
||||
// 取消故障
|
||||
cancelStoppage() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.cancelStoppage.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
} else {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
},
|
||||
// 设置扣车
|
||||
setDetainTrain() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.setDetainTrain.menu.operation
|
||||
};
|
||||
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 取消扣车
|
||||
cancelDetainTrain() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.cancelDetainTrain.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 强制取消扣车
|
||||
cancelDetainTrainForce() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.cancelDetainTrainForce.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 全线取消扣车
|
||||
cancelDetainTrainAll() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.cancelDetainTrainAll.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standDetainTrainAll.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 设置跳停
|
||||
setJumpStop() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.setJumpStop.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 取消跳停
|
||||
cancelJumpStop() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.cancelJumpStop.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 设置停站时间
|
||||
setStopTime() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.setStopTime.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
|
||||
if (valid) {
|
||||
let tempDate = null;
|
||||
if (response) {
|
||||
tempDate = response.data;
|
||||
}
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standStopTime.doShow(operate, this.selected, tempDate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
},
|
||||
// 设置运行等级
|
||||
setRunLevel() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.setRunLevel.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
|
||||
if (valid) {
|
||||
let tempDate = null;
|
||||
if (response) {
|
||||
tempDate = response.data;
|
||||
}
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standRunLevel.doShow(operate, this.selected, tempDate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
},
|
||||
// 设置提前发车
|
||||
earlyDeparture() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
operation: OperationEvent.StationStand.earlyDeparture.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 设置折返策略
|
||||
setBackStrategy() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
operation: OperationEvent.StationStand.setBackStrategy.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 取消扣车
|
||||
cancelDetainTrain() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.cancelDetainTrain.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 强制取消扣车
|
||||
cancelDetainTrainForce() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.cancelDetainTrainForce.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 全线取消扣车
|
||||
cancelDetainTrainAll() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.cancelDetainTrainAll.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standDetainTrainAll.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 设置跳停
|
||||
setJumpStop() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.setJumpStop.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 取消跳停
|
||||
cancelJumpStop() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.cancelJumpStop.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 设置停站时间
|
||||
setStopTime() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.setStopTime.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
|
||||
if (valid) {
|
||||
let tempDate = null;
|
||||
if (response) {
|
||||
tempDate = response.data;
|
||||
}
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standStopTime.doShow(operate, this.selected, tempDate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
},
|
||||
// 设置运行等级
|
||||
setRunLevel() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.setRunLevel.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
|
||||
if (valid) {
|
||||
let tempDate = null;
|
||||
if (response) {
|
||||
tempDate = response.data;
|
||||
}
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standRunLevel.doShow(operate, this.selected, tempDate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
},
|
||||
// 设置提前发车
|
||||
earlyDeparture() {
|
||||
const operate = {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
operation: OperationEvent.StationStand.earlyDeparture.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standControl.doShow(operate, this.selected);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 设置折返策略
|
||||
setBackStrategy() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
operation: OperationEvent.StationStand.setBackStrategy.menu.operation
|
||||
};
|
||||
|
||||
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
|
||||
if (valid) {
|
||||
let tempDate = null;
|
||||
if (response) {
|
||||
tempDate = response.data;
|
||||
}
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standBackStrategy.doShow(operate, this.selected, tempDate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
},
|
||||
// 查询站台状态
|
||||
detail() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.detail.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
|
||||
if (valid) {
|
||||
let tempDate = null;
|
||||
if (response) {
|
||||
tempDate = response.data;
|
||||
}
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standDetail.doShow(operate, this.selected, tempDate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
}
|
||||
}
|
||||
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
|
||||
if (valid) {
|
||||
let tempDate = null;
|
||||
if (response) {
|
||||
tempDate = response.data;
|
||||
}
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standBackStrategy.doShow(operate, this.selected, tempDate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
},
|
||||
// 查询站台状态
|
||||
detail() {
|
||||
const operate = {
|
||||
start: true,
|
||||
send: true,
|
||||
code: this.selected.code,
|
||||
type: MapDeviceType.StationStand.type,
|
||||
label: MapDeviceType.StationStand.label,
|
||||
operation: OperationEvent.StationStand.detail.menu.operation
|
||||
};
|
||||
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
|
||||
if (valid) {
|
||||
let tempDate = null;
|
||||
if (response) {
|
||||
tempDate = response.data;
|
||||
}
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.standDetail.doShow(operate, this.selected, tempDate);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -8,60 +8,60 @@ import { getConverter } from '@/scripts/plugin/converter/manager';
|
||||
var OperateConverter = function () { };
|
||||
OperateConverter.prototype = {
|
||||
|
||||
/** 转换 操作 为 指令 */
|
||||
convert: function (operate) {
|
||||
if (operate.send) {
|
||||
let command = null;
|
||||
const converter = getConverter(OperateHandler.operates);
|
||||
if (converter) {
|
||||
command = converter.convert(OperateHandler.operates);
|
||||
}
|
||||
/** 转换 操作 为 指令 */
|
||||
convert: function (operate) {
|
||||
if (operate.send) {
|
||||
let command = null;
|
||||
const converter = getConverter(OperateHandler.operates);
|
||||
if (converter) {
|
||||
command = converter.convert(OperateHandler.operates);
|
||||
}
|
||||
|
||||
if (command && command.error) {
|
||||
// 命令错误,可以回退或清空(暂用回退)
|
||||
OperateHandler.operates.pop();
|
||||
store.dispatch('training/setTempStep', null);
|
||||
command = null;
|
||||
} else if (command && command.over) {
|
||||
// 清空操作组
|
||||
OperateHandler.cleanOperates();
|
||||
store.dispatch('menuOperation/setButtonOperation', null);
|
||||
}
|
||||
if (command && command.error) {
|
||||
// 命令错误,可以回退或清空(暂用回退)
|
||||
OperateHandler.operates.pop();
|
||||
store.dispatch('training/setTempStep', null);
|
||||
command = null;
|
||||
} else if (command && command.over) {
|
||||
// 清空操作组
|
||||
OperateHandler.cleanOperates();
|
||||
store.dispatch('menuOperation/setButtonOperation', null);
|
||||
}
|
||||
|
||||
return command;
|
||||
} else if (operate.operation === OperationEvent.Command.cancel.menu.operation || operate.over) {
|
||||
// 取消操作,清空操作组
|
||||
OperateHandler.cleanOperates();
|
||||
}
|
||||
return null;
|
||||
},
|
||||
return command;
|
||||
} else if (operate.operation === OperationEvent.Command.cancel.menu.operation || operate.over) {
|
||||
// 取消操作,清空操作组
|
||||
OperateHandler.cleanOperates();
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
sendToServer: function (command) {
|
||||
const group = router.currentRoute.query.group;
|
||||
return new Promise((resolve, reject) => {
|
||||
sendCommand(group, command).then((response) => {
|
||||
resolve(response);
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
sendToServer: function (command) {
|
||||
const group = router.currentRoute.query.group;
|
||||
return new Promise((resolve, reject) => {
|
||||
sendCommand(group, command).then((response) => {
|
||||
resolve(response);
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/** 转换操作 为 指令并发送 */
|
||||
convertAndSend: function (operate) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const command = this.convert(operate);
|
||||
if (command) {
|
||||
this.sendToServer(command).then(response => {
|
||||
resolve(response);
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
/** 转换操作 为 指令并发送 */
|
||||
convertAndSend: function (operate) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const command = this.convert(operate);
|
||||
if (command) {
|
||||
this.sendToServer(command).then(response => {
|
||||
resolve(response);
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default new OperateConverter();
|
||||
|
@ -11,138 +11,137 @@ var OperateHandler = function () {
|
||||
};
|
||||
|
||||
OperateHandler.prototype = {
|
||||
/** 操作组 */
|
||||
operates: [],
|
||||
/** 操作组 */
|
||||
operates: [],
|
||||
|
||||
backStep: function(num) {
|
||||
this.operates = this.operates.slice(0, num);
|
||||
},
|
||||
backStep: function(num) {
|
||||
this.operates = this.operates.slice(0, num);
|
||||
},
|
||||
|
||||
/** 清空操作组 */
|
||||
cleanOperates: function () {
|
||||
this.operates.splice(0, this.operates.length);
|
||||
},
|
||||
/** 清空操作组 */
|
||||
cleanOperates: function () {
|
||||
this.operates.splice(0, this.operates.length);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 判断操作步骤是否正确
|
||||
*/
|
||||
judge: function (operate) {
|
||||
let valid = false;
|
||||
const steps = this.getSteps();
|
||||
const order = this.getOrder();
|
||||
if (order >= steps) {
|
||||
return valid;
|
||||
}
|
||||
// debugger;
|
||||
const standard = steps[order];
|
||||
if (operate && standard && operate.code == standard.code && operate.type == standard.type &&
|
||||
judge: function (operate) {
|
||||
let valid = false;
|
||||
const steps = this.getSteps();
|
||||
const order = this.getOrder();
|
||||
if (order >= steps) {
|
||||
return valid;
|
||||
}
|
||||
// debugger;
|
||||
const standard = steps[order];
|
||||
if (operate && standard && operate.code == standard.code && operate.type == standard.type &&
|
||||
operate.operation == standard.operation &&
|
||||
operate.val == standard.val) {
|
||||
valid = true;
|
||||
}
|
||||
return valid;
|
||||
},
|
||||
valid = true;
|
||||
}
|
||||
return valid;
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 根据模式验证操作步骤
|
||||
*/
|
||||
validate: function (operate) {
|
||||
// 按钮操作之后,第二步错误操作菜单的情况,需要直接返回
|
||||
if ((this.operates.length && operate.start === true) &&
|
||||
(this.operates[0].type === 'mbm')) {
|
||||
return false;
|
||||
}
|
||||
validate: function (operate) {
|
||||
// 按钮操作之后,第二步错误操作菜单的情况,需要直接返回
|
||||
if ((this.operates.length && operate.start === true) && (this.operates[0].type === 'mbm')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 如果是正常的第一步操作,需要清空operates数组
|
||||
if (operate.type === 'mbm' || operate.type === 'bar' || operate.start === true) {
|
||||
this.cleanOperates();
|
||||
}
|
||||
// 如果是正常的第一步操作,需要清空operates数组
|
||||
if (operate.type === 'mbm' || operate.type === 'bar' || operate.start === true) {
|
||||
this.cleanOperates();
|
||||
}
|
||||
|
||||
this.operates.push(operate);
|
||||
this.operates.push(operate);
|
||||
|
||||
// 预处理
|
||||
const converter = getConverter(this.operates);
|
||||
if (converter && converter.preHandle instanceof Function) {
|
||||
operate = converter.preHandle(this.operates);
|
||||
}
|
||||
// 预处理
|
||||
const converter = getConverter(this.operates);
|
||||
if (converter && converter.preHandle instanceof Function) {
|
||||
operate = converter.preHandle(this.operates);
|
||||
}
|
||||
|
||||
let valid = true;
|
||||
const mode = this.getTrainingMode();
|
||||
if (TrainingMode.EDIT === mode) {
|
||||
// 编辑制作模式
|
||||
if (this.getOperateBreakStatus()) {
|
||||
valid = false;
|
||||
const tip = LangStorage.getLang() == 'en' ? 'Please enter a hint and click next' : '请输入提示并点击下一步';
|
||||
Message.error(tip);
|
||||
this.operates.pop();
|
||||
return valid;
|
||||
}
|
||||
if (this.getTrainingStart()) {
|
||||
store.dispatch('training/setTempStep', operate);
|
||||
}
|
||||
} else if (TrainingMode.TEACH === mode || TrainingMode.PRACTICE === mode) {
|
||||
// 教学模式/练习模式
|
||||
if (this.getTrainingStart()) {
|
||||
valid = this.judge(operate);
|
||||
} else {
|
||||
this.cleanOperates();
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
let valid = true;
|
||||
const mode = this.getTrainingMode();
|
||||
if (TrainingMode.EDIT === mode) {
|
||||
// 编辑制作模式
|
||||
if (this.getOperateBreakStatus()) {
|
||||
valid = false;
|
||||
const tip = LangStorage.getLang() == 'en' ? 'Please enter a hint and click next' : '请输入提示并点击下一步';
|
||||
Message.error(tip);
|
||||
this.operates.pop();
|
||||
return valid;
|
||||
}
|
||||
if (this.getTrainingStart()) {
|
||||
store.dispatch('training/setTempStep', operate);
|
||||
}
|
||||
} else if (TrainingMode.TEACH === mode || TrainingMode.PRACTICE === mode) {
|
||||
// 教学模式/练习模式
|
||||
if (this.getTrainingStart()) {
|
||||
valid = this.judge(operate);
|
||||
} else {
|
||||
this.cleanOperates();
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 发送每一步的步骤数据;
|
||||
const basicInfo = store.getters['training/basicInfo'];
|
||||
if (basicInfo.id && valid) {
|
||||
const group = router.currentRoute.query.group;
|
||||
sendTrainingNextStep({ trainingId: basicInfo.id, operate: operate }, group);
|
||||
}
|
||||
// 发送每一步的步骤数据;
|
||||
const basicInfo = store.getters['training/basicInfo'];
|
||||
if (basicInfo.id && valid) {
|
||||
const group = router.currentRoute.query.group;
|
||||
sendTrainingNextStep({ trainingId: basicInfo.id, operate: operate }, group);
|
||||
}
|
||||
|
||||
if (!valid) {
|
||||
// 如果操作校验不正确,回退
|
||||
this.operates.pop();
|
||||
} else {
|
||||
if (operate.cancel === true) {
|
||||
this.cleanOperates();
|
||||
}
|
||||
}
|
||||
if (!valid) {
|
||||
// 如果操作校验不正确,回退
|
||||
this.operates.pop();
|
||||
} else {
|
||||
if (operate.cancel === true) {
|
||||
this.cleanOperates();
|
||||
}
|
||||
}
|
||||
|
||||
return valid;
|
||||
},
|
||||
handle: function (operate) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const rtn = { valid: false, response: null };
|
||||
const valid = this.validate(operate);
|
||||
return valid;
|
||||
},
|
||||
handle: function (operate) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const rtn = { valid: false, response: null };
|
||||
const valid = this.validate(operate);
|
||||
|
||||
rtn.valid = valid;
|
||||
rtn.valid = valid;
|
||||
|
||||
if (valid) {
|
||||
// 改变状态开始请求
|
||||
OperateConverter.convertAndSend(operate).then(response => {
|
||||
rtn.response = response;
|
||||
resolve(rtn);
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
resolve(rtn);
|
||||
}
|
||||
});
|
||||
},
|
||||
getTrainingMode: function () {
|
||||
return store.state.training.mode;
|
||||
},
|
||||
getSteps: function () {
|
||||
return store.state.training.steps;
|
||||
},
|
||||
getOrder: function () {
|
||||
return store.state.training.order;
|
||||
},
|
||||
getTrainingStart: function () {
|
||||
return store.state.training.started;
|
||||
},
|
||||
getOperateBreakStatus: function () {
|
||||
return store.state.menuOperation.break;
|
||||
}
|
||||
if (valid) {
|
||||
// 改变状态开始请求
|
||||
OperateConverter.convertAndSend(operate).then(response => {
|
||||
rtn.response = response;
|
||||
resolve(rtn);
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
resolve(rtn);
|
||||
}
|
||||
});
|
||||
},
|
||||
getTrainingMode: function () {
|
||||
return store.state.training.mode;
|
||||
},
|
||||
getSteps: function () {
|
||||
return store.state.training.steps;
|
||||
},
|
||||
getOrder: function () {
|
||||
return store.state.training.order;
|
||||
},
|
||||
getTrainingStart: function () {
|
||||
return store.state.training.started;
|
||||
},
|
||||
getOperateBreakStatus: function () {
|
||||
return store.state.menuOperation.break;
|
||||
}
|
||||
};
|
||||
|
||||
export default new OperateHandler();
|
||||
|
@ -2,7 +2,7 @@ import deviceType from '@/jmap/constant/deviceType';
|
||||
import { parser, updateMapData } from '@/jmap/utils/parser';
|
||||
import Vue from 'vue';
|
||||
import { deepAssign } from '@/utils/index';
|
||||
// import { deepClone } from '@/utils/index';
|
||||
|
||||
/**
|
||||
* 查询向上受影响的Devices
|
||||
* @param {Object} map
|
||||
@ -240,7 +240,7 @@ function revocation(state, models) {
|
||||
break;
|
||||
}
|
||||
case 'edit': {
|
||||
list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code])});
|
||||
list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code] || item.data)});
|
||||
stepList.push({...item.data, _dispose: false});
|
||||
break;
|
||||
}
|
||||
@ -268,7 +268,7 @@ function recover(state, models) {
|
||||
break;
|
||||
}
|
||||
case 'edit': {
|
||||
list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code])});
|
||||
list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code] || item.data)});
|
||||
stepList.push({...item.data, _dispose: false});
|
||||
break;
|
||||
}
|
||||
|
@ -8,552 +8,552 @@ import LangStorage from '@/utils/lang';
|
||||
* 实训状态数据
|
||||
*/
|
||||
const training = {
|
||||
namespaced: true,
|
||||
namespaced: true,
|
||||
|
||||
state: {
|
||||
mode: null, // 模式
|
||||
operatemode: null, // 操作模式 管理员/普通
|
||||
started: false, // 是否开始
|
||||
switchcount: 0, // 开关标识
|
||||
basicInfo: {}, // 实训基本信息数据
|
||||
offsetStationCode: '', // 偏移到车站
|
||||
rezoomCount: 0, // 车站变更标识
|
||||
steps: [], // 实训步骤数据
|
||||
tempStep: {}, // 临时步骤数据(编辑模式)
|
||||
order: -1, // 实训进行到第几步
|
||||
orderCount: 0, // 步骤变更标识
|
||||
operateErrMsg: '', // 操作错误提示信息
|
||||
subscribeCount: 0, // 仿真订阅完成标识
|
||||
score: 0, // 实训得分
|
||||
usedTime: 0, // 实训所需时间
|
||||
timeInterval: null, // 计时器
|
||||
tipEvent: 0, // 提示刷新检测
|
||||
operate: {}, // 操作model,
|
||||
initTime: 0, // 当前系统时间
|
||||
prdType: '', // 产品类型
|
||||
roles: '', // 角色权限类型
|
||||
group: '' // 设置全局 group
|
||||
},
|
||||
state: {
|
||||
mode: null, // 模式
|
||||
operatemode: null, // 操作模式 管理员/普通
|
||||
started: false, // 是否开始
|
||||
switchcount: 0, // 开关标识
|
||||
basicInfo: {}, // 实训基本信息数据
|
||||
offsetStationCode: '', // 偏移到车站
|
||||
rezoomCount: 0, // 车站变更标识
|
||||
steps: [], // 实训步骤数据
|
||||
tempStep: {}, // 临时步骤数据(编辑模式)
|
||||
order: -1, // 实训进行到第几步
|
||||
orderCount: 0, // 步骤变更标识
|
||||
operateErrMsg: '', // 操作错误提示信息
|
||||
subscribeCount: 0, // 仿真订阅完成标识
|
||||
score: 0, // 实训得分
|
||||
usedTime: 0, // 实训所需时间
|
||||
timeInterval: null, // 计时器
|
||||
tipEvent: 0, // 提示刷新检测
|
||||
operate: {}, // 操作model,
|
||||
initTime: 0, // 当前系统时间
|
||||
prdType: '', // 产品类型
|
||||
roles: '', // 角色权限类型
|
||||
group: '' // 设置全局 group
|
||||
},
|
||||
|
||||
getters: {
|
||||
tempStep: (state) => {
|
||||
return state.tempStep;
|
||||
},
|
||||
steps: (state) => {
|
||||
return state.steps;
|
||||
},
|
||||
order: (state) => {
|
||||
return state.order;
|
||||
},
|
||||
offsetStationCode: (state) => {
|
||||
return state.offsetStationCode;
|
||||
},
|
||||
basicInfo: (state) => {
|
||||
return state.basicInfo;
|
||||
},
|
||||
mode: (state) => {
|
||||
return state.mode;
|
||||
},
|
||||
operatemode: (state) => {
|
||||
return state.operatemode;
|
||||
},
|
||||
started: (state) => {
|
||||
return state.started;
|
||||
},
|
||||
score: (state) => {
|
||||
return state.score;
|
||||
},
|
||||
usedTime: (state) => {
|
||||
return state.usedTime;
|
||||
},
|
||||
tipEvent: (state) => {
|
||||
return state.tipEvent;
|
||||
},
|
||||
initTime: (state) => {
|
||||
return state.initTime;
|
||||
},
|
||||
prdType: (state) => {
|
||||
return state.prdType;
|
||||
},
|
||||
roles: (state) => {
|
||||
return state.roles;
|
||||
},
|
||||
// 视图中的列车列表
|
||||
viewTrainList: (state) => () =>{
|
||||
const trainList = [];
|
||||
const mapDevice = Vue.prototype.$jlmap.mapDevice;
|
||||
Object.values(mapDevice).forEach(device => {
|
||||
if (device && device._type === deviceType.Train) {
|
||||
trainList.push(device);
|
||||
}
|
||||
});
|
||||
getters: {
|
||||
tempStep: (state) => {
|
||||
return state.tempStep;
|
||||
},
|
||||
steps: (state) => {
|
||||
return state.steps;
|
||||
},
|
||||
order: (state) => {
|
||||
return state.order;
|
||||
},
|
||||
offsetStationCode: (state) => {
|
||||
return state.offsetStationCode;
|
||||
},
|
||||
basicInfo: (state) => {
|
||||
return state.basicInfo;
|
||||
},
|
||||
mode: (state) => {
|
||||
return state.mode;
|
||||
},
|
||||
operatemode: (state) => {
|
||||
return state.operatemode;
|
||||
},
|
||||
started: (state) => {
|
||||
return state.started;
|
||||
},
|
||||
score: (state) => {
|
||||
return state.score;
|
||||
},
|
||||
usedTime: (state) => {
|
||||
return state.usedTime;
|
||||
},
|
||||
tipEvent: (state) => {
|
||||
return state.tipEvent;
|
||||
},
|
||||
initTime: (state) => {
|
||||
return state.initTime;
|
||||
},
|
||||
prdType: (state) => {
|
||||
return state.prdType;
|
||||
},
|
||||
roles: (state) => {
|
||||
return state.roles;
|
||||
},
|
||||
// 视图中的列车列表
|
||||
viewTrainList: (state) => () =>{
|
||||
const trainList = [];
|
||||
const mapDevice = Vue.prototype.$jlmap.mapDevice;
|
||||
Object.values(mapDevice).forEach(device => {
|
||||
if (device && device._type === deviceType.Train) {
|
||||
trainList.push(device);
|
||||
}
|
||||
});
|
||||
|
||||
return trainList;
|
||||
}
|
||||
},
|
||||
return trainList;
|
||||
}
|
||||
},
|
||||
|
||||
mutations: {
|
||||
changeMode: (state, mode) => {
|
||||
state.mode = mode;
|
||||
},
|
||||
changeOperateMode: (state, mode) => {
|
||||
state.operatemode = mode;
|
||||
},
|
||||
start: (state) => {
|
||||
state.started = true;
|
||||
state.switchcount += 1;
|
||||
},
|
||||
over: (state) => {
|
||||
state.started = false;
|
||||
state.switchcount += 1;
|
||||
},
|
||||
updateMapState: (state, deviceStatus) => {
|
||||
Vue.prototype.$jlmap && Vue.prototype.$jlmap.update(deviceStatus);
|
||||
},
|
||||
setMapDefaultState: (state) =>{
|
||||
Vue.prototype.$jlmap && Vue.prototype.$jlmap.setDefaultState();
|
||||
},
|
||||
setBasicInfo: (state, basicInfo) => {
|
||||
state.basicInfo = basicInfo;
|
||||
},
|
||||
setOffsetStationCode: (state, offsetStationCode) => {
|
||||
state.offsetStationCode = offsetStationCode || null;
|
||||
if (state % 100 === 0) {
|
||||
state.rezoomCount = 0;
|
||||
} else {
|
||||
state.rezoomCount += 1;
|
||||
}
|
||||
},
|
||||
setSteps: (state, steps) => {
|
||||
state.steps = steps;
|
||||
},
|
||||
addStep: (state, step) => {
|
||||
state.steps.push(step);
|
||||
},
|
||||
next: (state) => {
|
||||
state.order += 1;
|
||||
state.orderCount += 1;
|
||||
},
|
||||
orderCountIncrement: (state) => {
|
||||
state.orderCount += 1;
|
||||
},
|
||||
resetOrder: (state) => {
|
||||
state.order = -1;
|
||||
},
|
||||
backOrder: (state, stepNum) => {
|
||||
if (state.order > stepNum) {
|
||||
state.order -= stepNum;
|
||||
state.orderCount += 1;
|
||||
}
|
||||
},
|
||||
setTempStep: (state, step) => {
|
||||
state.tempStep = step;
|
||||
},
|
||||
mutations: {
|
||||
changeMode: (state, mode) => {
|
||||
state.mode = mode;
|
||||
},
|
||||
changeOperateMode: (state, mode) => {
|
||||
state.operatemode = mode;
|
||||
},
|
||||
start: (state) => {
|
||||
state.started = true;
|
||||
state.switchcount += 1;
|
||||
},
|
||||
over: (state) => {
|
||||
state.started = false;
|
||||
state.switchcount += 1;
|
||||
},
|
||||
updateMapState: (state, deviceStatus) => {
|
||||
Vue.prototype.$jlmap && Vue.prototype.$jlmap.update(deviceStatus);
|
||||
},
|
||||
setMapDefaultState: (state) =>{
|
||||
Vue.prototype.$jlmap && Vue.prototype.$jlmap.setDefaultState();
|
||||
},
|
||||
setBasicInfo: (state, basicInfo) => {
|
||||
state.basicInfo = basicInfo;
|
||||
},
|
||||
setOffsetStationCode: (state, offsetStationCode) => {
|
||||
state.offsetStationCode = offsetStationCode || null;
|
||||
if (state % 100 === 0) {
|
||||
state.rezoomCount = 0;
|
||||
} else {
|
||||
state.rezoomCount += 1;
|
||||
}
|
||||
},
|
||||
setSteps: (state, steps) => {
|
||||
state.steps = steps;
|
||||
},
|
||||
addStep: (state, step) => {
|
||||
state.steps.push(step);
|
||||
},
|
||||
next: (state) => {
|
||||
state.order += 1;
|
||||
state.orderCount += 1;
|
||||
},
|
||||
orderCountIncrement: (state) => {
|
||||
state.orderCount += 1;
|
||||
},
|
||||
resetOrder: (state) => {
|
||||
state.order = -1;
|
||||
},
|
||||
backOrder: (state, stepNum) => {
|
||||
if (state.order > stepNum) {
|
||||
state.order -= stepNum;
|
||||
state.orderCount += 1;
|
||||
}
|
||||
},
|
||||
setTempStep: (state, step) => {
|
||||
state.tempStep = step;
|
||||
},
|
||||
|
||||
setOperateErrMsg: (state, errMsg) => {
|
||||
state.operateErrMsg = errMsg;
|
||||
},
|
||||
setOperateErrMsg: (state, errMsg) => {
|
||||
state.operateErrMsg = errMsg;
|
||||
},
|
||||
|
||||
setHasSubscribed: (state) => {
|
||||
state.subscribeCount++;
|
||||
},
|
||||
setHasSubscribed: (state) => {
|
||||
state.subscribeCount++;
|
||||
},
|
||||
|
||||
setScore: (state, score) => {
|
||||
state.score = score;
|
||||
},
|
||||
resetScore: (state) => {
|
||||
state.score = '';
|
||||
},
|
||||
tipEventIncrement: (state) => {
|
||||
state.tipEvent++;
|
||||
},
|
||||
resetUsedTime: (state) => {
|
||||
state.usedTime = 0;
|
||||
},
|
||||
countUsedTime: (state) => {
|
||||
if (state.timeInterval) {
|
||||
clearInterval(state.timeInterval);
|
||||
state.timeInterval = null;
|
||||
}
|
||||
state.timeInterval = setInterval(() => {
|
||||
state.usedTime++;
|
||||
state.initTime += 1000;
|
||||
}, 1000);
|
||||
},
|
||||
stopCountTime: (state) => {
|
||||
if (state.timeInterval) {
|
||||
clearInterval(state.timeInterval);
|
||||
state.timeInterval = null;
|
||||
}
|
||||
},
|
||||
setOperate: (state, operate) => {
|
||||
state.operate = operate;
|
||||
},
|
||||
setInitTime: (state, operate) => {
|
||||
state.initTime = operate;
|
||||
},
|
||||
setPrdType: (state, prdType) => {
|
||||
state.prdType = prdType;
|
||||
},
|
||||
setRoles: (state, roles) => {
|
||||
state.roles = roles;
|
||||
},
|
||||
setGroup: (state, group) => {
|
||||
state.group = group;
|
||||
}
|
||||
},
|
||||
setScore: (state, score) => {
|
||||
state.score = score;
|
||||
},
|
||||
resetScore: (state) => {
|
||||
state.score = '';
|
||||
},
|
||||
tipEventIncrement: (state) => {
|
||||
state.tipEvent++;
|
||||
},
|
||||
resetUsedTime: (state) => {
|
||||
state.usedTime = 0;
|
||||
},
|
||||
countUsedTime: (state) => {
|
||||
if (state.timeInterval) {
|
||||
clearInterval(state.timeInterval);
|
||||
state.timeInterval = null;
|
||||
}
|
||||
state.timeInterval = setInterval(() => {
|
||||
state.usedTime++;
|
||||
state.initTime += 1000;
|
||||
}, 1000);
|
||||
},
|
||||
stopCountTime: (state) => {
|
||||
if (state.timeInterval) {
|
||||
clearInterval(state.timeInterval);
|
||||
state.timeInterval = null;
|
||||
}
|
||||
},
|
||||
setOperate: (state, operate) => {
|
||||
state.operate = operate;
|
||||
},
|
||||
setInitTime: (state, operate) => {
|
||||
state.initTime = operate;
|
||||
},
|
||||
setPrdType: (state, prdType) => {
|
||||
state.prdType = prdType;
|
||||
},
|
||||
setRoles: (state, roles) => {
|
||||
state.roles = roles;
|
||||
},
|
||||
setGroup: (state, group) => {
|
||||
state.group = group;
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
/**
|
||||
actions: {
|
||||
/**
|
||||
* 清除仿真所在组
|
||||
*/
|
||||
clearSimulationGroup: ({ commit }, type) => {
|
||||
commit('clearSimulationGroup', type);
|
||||
},
|
||||
/**
|
||||
clearSimulationGroup: ({ commit }, type) => {
|
||||
commit('clearSimulationGroup', type);
|
||||
},
|
||||
/**
|
||||
* 设置socke已经连接
|
||||
*/
|
||||
setHasSubscribed: ({ commit }) => {
|
||||
commit('setHasSubscribed');
|
||||
},
|
||||
/**
|
||||
setHasSubscribed: ({ commit }) => {
|
||||
commit('setHasSubscribed');
|
||||
},
|
||||
/**
|
||||
* 模式变更
|
||||
*/
|
||||
changeMode: ({ commit }, opts) => {
|
||||
commit('changeMode', opts.mode);
|
||||
},
|
||||
changeMode: ({ commit }, opts) => {
|
||||
commit('changeMode', opts.mode);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 操作模式变更
|
||||
*/
|
||||
changeOperateMode: ({ commit }, opts) => {
|
||||
commit('changeOperateMode', opts.mode);
|
||||
},
|
||||
changeOperateMode: ({ commit }, opts) => {
|
||||
commit('changeOperateMode', opts.mode);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 重置实训状态
|
||||
*/
|
||||
reset: ({ commit }) => {
|
||||
commit('over');
|
||||
commit('resetOrder');
|
||||
commit('stopCountTime');
|
||||
reset: ({ commit }) => {
|
||||
commit('over');
|
||||
commit('resetOrder');
|
||||
commit('stopCountTime');
|
||||
|
||||
// 清空计时器以及得分
|
||||
commit('resetUsedTime');
|
||||
commit('resetScore');
|
||||
// 设置其他属性状态
|
||||
commit('setOffsetStationCode', null);
|
||||
},
|
||||
// 清空计时器以及得分
|
||||
commit('resetUsedTime');
|
||||
commit('resetScore');
|
||||
// 设置其他属性状态
|
||||
commit('setOffsetStationCode', null);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 开始
|
||||
*/
|
||||
start: ({ commit }) => {
|
||||
// 清空操作组
|
||||
OperateHandler.cleanOperates();
|
||||
// 清空计时器以及得分
|
||||
commit('stopCountTime');
|
||||
commit('resetUsedTime');
|
||||
commit('resetScore');
|
||||
commit('start');
|
||||
},
|
||||
start: ({ commit }) => {
|
||||
// 清空操作组
|
||||
OperateHandler.cleanOperates();
|
||||
// 清空计时器以及得分
|
||||
commit('stopCountTime');
|
||||
commit('resetUsedTime');
|
||||
commit('resetScore');
|
||||
commit('start');
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 结束
|
||||
*/
|
||||
over: ({ commit }) => {
|
||||
commit('over');
|
||||
commit('resetOrder');
|
||||
commit('stopCountTime');
|
||||
},
|
||||
over: ({ commit }) => {
|
||||
commit('over');
|
||||
commit('resetOrder');
|
||||
commit('stopCountTime');
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* step步骤是否结束
|
||||
*/
|
||||
isStepOver: ({ state }) => {
|
||||
if (state.order >= state.steps.length) {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
isStepOver: ({ state }) => {
|
||||
if (state.order >= state.steps.length) {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 停止计时
|
||||
*/
|
||||
setStopCountTime: ({ commit }) => {
|
||||
commit('stopCountTime');
|
||||
},
|
||||
setStopCountTime: ({ commit }) => {
|
||||
commit('stopCountTime');
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 主动判断是否结束
|
||||
*/
|
||||
judgeFinish: ({ dispatch, commit, state }, rtn) => {
|
||||
if (state.started) {
|
||||
if (state.order >= state.steps.length) {
|
||||
if (rtn && rtn.valid) {
|
||||
commit('next');
|
||||
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'Correct operation! Training is over!' : '操作正确!实训结束!', color: 'green' });
|
||||
} else {
|
||||
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'Operation error! Training is over!' : '操作错误!实训结束!', color: 'red' });
|
||||
}
|
||||
dispatch('over');
|
||||
dispatch('changeMode', { mode: null });
|
||||
if (rtn.hasOwnProperty('score')) {
|
||||
commit('setScore', rtn.score || 0);
|
||||
}
|
||||
} else {
|
||||
rtn && rtn.valid && commit('next');
|
||||
}
|
||||
}
|
||||
},
|
||||
judgeFinish: ({ dispatch, commit, state }, rtn) => {
|
||||
if (state.started) {
|
||||
if (state.order >= state.steps.length) {
|
||||
if (rtn && rtn.valid) {
|
||||
commit('next');
|
||||
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'Correct operation! Training is over!' : '操作正确!实训结束!', color: 'green' });
|
||||
} else {
|
||||
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'Operation error! Training is over!' : '操作错误!实训结束!', color: 'red' });
|
||||
}
|
||||
dispatch('over');
|
||||
dispatch('changeMode', { mode: null });
|
||||
if (rtn.hasOwnProperty('score')) {
|
||||
commit('setScore', rtn.score || 0);
|
||||
}
|
||||
} else {
|
||||
rtn && rtn.valid && commit('next');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 开始实训(模式变更和开始的混合操作)
|
||||
*/
|
||||
startTraining: ({ commit }, opts) => {
|
||||
commit('resetOrder');
|
||||
commit('changeMode', opts.mode);
|
||||
if (opts.start) {
|
||||
// 清空计时器以及得分
|
||||
commit('stopCountTime');
|
||||
commit('resetUsedTime');
|
||||
commit('resetScore');
|
||||
// 开始实训
|
||||
commit('start');
|
||||
commit('next');
|
||||
// 开始计时
|
||||
commit('countUsedTime');
|
||||
}
|
||||
},
|
||||
startTraining: ({ commit }, opts) => {
|
||||
commit('resetOrder');
|
||||
commit('changeMode', opts.mode);
|
||||
if (opts.start) {
|
||||
// 清空计时器以及得分
|
||||
commit('stopCountTime');
|
||||
commit('resetUsedTime');
|
||||
commit('resetScore');
|
||||
// 开始实训
|
||||
commit('start');
|
||||
commit('next');
|
||||
// 开始计时
|
||||
commit('countUsedTime');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 开始实训(模式变更和开始的混合操作)
|
||||
*/
|
||||
backSteps: ({ commit }, stepNum) => {
|
||||
if (Number.isInteger) {
|
||||
commit('backOrder', stepNum);
|
||||
}
|
||||
},
|
||||
backSteps: ({ commit }, stepNum) => {
|
||||
if (Number.isInteger) {
|
||||
commit('backOrder', stepNum);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 下一步
|
||||
*/
|
||||
next: ({ commit, state }, operate) => {
|
||||
commit('setOperate', operate);
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!state.started && !state.mode) {
|
||||
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'Please click start, start training!' : '请点击开始,开始实训!', color: 'red' });
|
||||
return;
|
||||
}
|
||||
next: ({ commit, state }, operate) => {
|
||||
commit('setOperate', operate);
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!state.started && !state.mode) {
|
||||
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'Please click start, start training!' : '请点击开始,开始实训!', color: 'red' });
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理operation
|
||||
OperateHandler.handle(operate).then(rtn => {
|
||||
if (state.started) {
|
||||
// 教学和联系模式需要给出过程步骤提示
|
||||
if (TrainingMode.TEACH === state.mode || TrainingMode.PRACTICE === state.mode) {
|
||||
if (rtn && rtn.valid) {
|
||||
commit('next');
|
||||
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? "Correct operation! That's great!" : '操作正确!真棒!', color: 'green' });
|
||||
commit('tipEventIncrement');
|
||||
} else {
|
||||
if (!operate.repeat) {
|
||||
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'operation mistake!' : '操作错误!', color: 'red' });
|
||||
}
|
||||
}
|
||||
} else if (TrainingMode.EXAM === state.mode || TrainingMode.TEST === state.mode) {
|
||||
// 测试和考试不给提示
|
||||
rtn && rtn.valid && commit('next');
|
||||
}
|
||||
}
|
||||
resolve(rtn);
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
// 处理operation
|
||||
OperateHandler.handle(operate).then(rtn => {
|
||||
if (state.started) {
|
||||
// 教学和联系模式需要给出过程步骤提示
|
||||
if (TrainingMode.TEACH === state.mode || TrainingMode.PRACTICE === state.mode) {
|
||||
if (rtn && rtn.valid) {
|
||||
commit('next');
|
||||
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? "Correct operation! That's great!" : '操作正确!真棒!', color: 'green' });
|
||||
commit('tipEventIncrement');
|
||||
} else {
|
||||
if (!operate.repeat) {
|
||||
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'operation mistake!' : '操作错误!', color: 'red' });
|
||||
}
|
||||
}
|
||||
} else if (TrainingMode.EXAM === state.mode || TrainingMode.TEST === state.mode) {
|
||||
// 测试和考试不给提示
|
||||
rtn && rtn.valid && commit('next');
|
||||
}
|
||||
}
|
||||
resolve(rtn);
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 提示消息重新加载
|
||||
*/
|
||||
tipReload: ({ commit }) => {
|
||||
commit('orderCountIncrement');
|
||||
},
|
||||
tipReload: ({ commit }) => {
|
||||
commit('orderCountIncrement');
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 更新偏移位置车站
|
||||
*/
|
||||
updateOffsetStationCode: ({ commit }, payLoad) => {
|
||||
commit('setOffsetStationCode', payLoad.offsetStationCode);
|
||||
},
|
||||
updateOffsetStationCode: ({ commit }, payLoad) => {
|
||||
commit('setOffsetStationCode', payLoad.offsetStationCode);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 设置实训数据
|
||||
*/
|
||||
setTrainingData: ({ commit }, trainingData) => {
|
||||
const basicInfo = {
|
||||
id: trainingData.id,
|
||||
name: trainingData.name,
|
||||
remarks: trainingData.remarks,
|
||||
prdType: trainingData.prdType,
|
||||
minDuration: trainingData.minDuration,
|
||||
maxDuration: trainingData.maxDuration
|
||||
};
|
||||
commit('setBasicInfo', basicInfo);
|
||||
const steps = trainingData.steps;
|
||||
commit('setSteps', steps);
|
||||
const offsetStationCode = trainingData.locateDeviceCode;
|
||||
commit('setOffsetStationCode', offsetStationCode);
|
||||
commit('setMapDefaultState');
|
||||
},
|
||||
setTrainingData: ({ commit }, trainingData) => {
|
||||
const basicInfo = {
|
||||
id: trainingData.id,
|
||||
name: trainingData.name,
|
||||
remarks: trainingData.remarks,
|
||||
prdType: trainingData.prdType,
|
||||
minDuration: trainingData.minDuration,
|
||||
maxDuration: trainingData.maxDuration
|
||||
};
|
||||
commit('setBasicInfo', basicInfo);
|
||||
const steps = trainingData.steps;
|
||||
commit('setSteps', steps);
|
||||
const offsetStationCode = trainingData.locateDeviceCode;
|
||||
commit('setOffsetStationCode', offsetStationCode);
|
||||
commit('setMapDefaultState');
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 设置步骤数据
|
||||
*/
|
||||
setSteps: ({ commit }, steps) => {
|
||||
commit('setSteps', steps);
|
||||
},
|
||||
setSteps: ({ commit }, steps) => {
|
||||
commit('setSteps', steps);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 添加步骤数据
|
||||
*/
|
||||
addStep: ({ state, commit }, step) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
var valid = true;
|
||||
const steps = state.steps;
|
||||
if (steps && steps.length > 0) {
|
||||
const last = steps.length - 1;
|
||||
if (steps[last].type === step.type &&
|
||||
addStep: ({ state, commit }, step) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
var valid = true;
|
||||
const steps = state.steps;
|
||||
if (steps && steps.length > 0) {
|
||||
const last = steps.length - 1;
|
||||
if (steps[last].type === step.type &&
|
||||
steps[last].code === step.code &&
|
||||
steps[last].operation === step.operation) {
|
||||
steps.splice(last, 1);
|
||||
step.order = step.order - 1;
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
commit('addStep', step);
|
||||
resolve(valid);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
steps.splice(last, 1);
|
||||
step.order = step.order - 1;
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
commit('addStep', step);
|
||||
resolve(valid);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 设置地图默认状态
|
||||
*/
|
||||
setMapDefaultState: ({ commit }) => {
|
||||
commit('setMapDefaultState');
|
||||
},
|
||||
setMapDefaultState: ({ commit }) => {
|
||||
commit('setMapDefaultState');
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 更新地图设备状态数据
|
||||
*/
|
||||
updateMapState: ({ commit }, deviceStatus) => {
|
||||
commit('updateMapState', deviceStatus);
|
||||
},
|
||||
updateMapState: ({ commit }, deviceStatus) => {
|
||||
commit('updateMapState', deviceStatus);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 设置临时步骤数据
|
||||
*/
|
||||
setTempStep: ({ commit }, step) => {
|
||||
commit('setTempStep', step);
|
||||
},
|
||||
setTempStep: ({ commit }, step) => {
|
||||
commit('setTempStep', step);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 开始教学模式
|
||||
*/
|
||||
teachModeStart: ({ dispatch }, mode) => {
|
||||
const payLoad = { start: true, mode: mode };
|
||||
dispatch('startTraining', payLoad);
|
||||
},
|
||||
teachModeStart: ({ dispatch }, mode) => {
|
||||
const payLoad = { start: true, mode: mode };
|
||||
dispatch('startTraining', payLoad);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 开始考试模式
|
||||
*/
|
||||
examModeStart: ({ dispatch }) => {
|
||||
const payLoad = { start: true, mode: TrainingMode.EXAM };
|
||||
dispatch('startTraining', payLoad);
|
||||
},
|
||||
examModeStart: ({ dispatch }) => {
|
||||
const payLoad = { start: true, mode: TrainingMode.EXAM };
|
||||
dispatch('startTraining', payLoad);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 仿真和大屏和计划模式
|
||||
*/
|
||||
simulationStart: ({ dispatch }) => {
|
||||
const payLoad = { start: true, mode: TrainingMode.NORMAL };
|
||||
dispatch('startTraining', payLoad);
|
||||
},
|
||||
simulationStart: ({ dispatch }) => {
|
||||
const payLoad = { start: true, mode: TrainingMode.NORMAL };
|
||||
dispatch('startTraining', payLoad);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 结束模式
|
||||
*/
|
||||
end: ({ commit }, mode) => {
|
||||
commit('over');
|
||||
commit('resetOrder');
|
||||
commit('stopCountTime');
|
||||
commit('changeMode', mode);
|
||||
},
|
||||
end: ({ commit }, mode) => {
|
||||
commit('over');
|
||||
commit('resetOrder');
|
||||
commit('stopCountTime');
|
||||
commit('changeMode', mode);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 是否教学模式
|
||||
*/
|
||||
isTeachMode: ({ state }) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (state.mode === TrainingMode.TEACH) {
|
||||
resolve();
|
||||
} else {
|
||||
reject(new Error('not teach mode'));
|
||||
}
|
||||
});
|
||||
},
|
||||
isTeachMode: ({ state }) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (state.mode === TrainingMode.TEACH) {
|
||||
resolve();
|
||||
} else {
|
||||
reject(new Error('not teach mode'));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 设置用户得分
|
||||
*/
|
||||
setScore: ({ commit }, score) => {
|
||||
commit('setScore', score);
|
||||
},
|
||||
setScore: ({ commit }, score) => {
|
||||
commit('setScore', score);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 设置tip变化事件
|
||||
*/
|
||||
emitTipFresh: ({ commit }) => {
|
||||
commit('tipEventIncrement');
|
||||
},
|
||||
emitTipFresh: ({ commit }) => {
|
||||
commit('tipEventIncrement');
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 设置WebSocket链接状态
|
||||
*/
|
||||
setConnected: ({ commit }, isConnected) => {
|
||||
commit('setConnected', isConnected);
|
||||
},
|
||||
setConnected: ({ commit }, isConnected) => {
|
||||
commit('setConnected', isConnected);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 设置系统时间
|
||||
*/
|
||||
setInitTime: ({ commit }, initTime) => {
|
||||
commit('setInitTime', initTime);
|
||||
},
|
||||
setInitTime: ({ commit }, initTime) => {
|
||||
commit('setInitTime', initTime);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 设置产品类型
|
||||
*/
|
||||
setPrdType: ({ commit }, prdType) => {
|
||||
commit('setPrdType', prdType);
|
||||
},
|
||||
setPrdType: ({ commit }, prdType) => {
|
||||
commit('setPrdType', prdType);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 设置角色列表
|
||||
*/
|
||||
setRoles: ({ commit }, roles) => {
|
||||
commit('setRoles', roles);
|
||||
},
|
||||
setRoles: ({ commit }, roles) => {
|
||||
commit('setRoles', roles);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* 设置仿真组
|
||||
*/
|
||||
setGroup: ({ commit }, group) => {
|
||||
commit('setGroup', group);
|
||||
}
|
||||
}
|
||||
setGroup: ({ commit }, group) => {
|
||||
commit('setGroup', group);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default training;
|
||||
|
@ -158,7 +158,6 @@ export default {
|
||||
save() {
|
||||
this.loading = true;
|
||||
if (this.basicInfo) {
|
||||
// this.editModel.id = this.$route.params.mapId;
|
||||
this.$refs['edit'].validate((valid) => {
|
||||
if (valid) {
|
||||
updateMap(this.editModel).then(response => {
|
||||
|
@ -17,6 +17,7 @@ import MapEdit from './edit';
|
||||
import MapSaveAs from './saveAs';
|
||||
import MapPublish from './publish';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { saveMap } from '@/api/jmap/mapdraft';
|
||||
|
||||
export default {
|
||||
name: 'MapOperateMenu',
|
||||
@ -47,10 +48,10 @@ export default {
|
||||
label: this.$t('map.updateObj'),
|
||||
handler: this.updateObj
|
||||
},
|
||||
// {
|
||||
// label: this.$t('map.updateObjAxis'),
|
||||
// handler: this.updateObjAxis
|
||||
// },
|
||||
{
|
||||
label: this.$t('map.updateObjAxis'),
|
||||
handler: this.updateObjAxis
|
||||
},
|
||||
{
|
||||
label: this.$t('map.saveAs'),
|
||||
handler: this.saveAs
|
||||
@ -69,7 +70,15 @@ export default {
|
||||
handler: this.publish
|
||||
},
|
||||
menuNormal: [],
|
||||
menu: []
|
||||
menu: [],
|
||||
updtModel: {
|
||||
code: '',
|
||||
scaling: '',
|
||||
origin: {
|
||||
x: '',
|
||||
y: ''
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -124,12 +133,45 @@ export default {
|
||||
this.$refs.edit.show('editCode');
|
||||
}
|
||||
},
|
||||
// updateObjAxis() {
|
||||
// this.doClose();
|
||||
// if (this.$refs && this.$refs.axisEdit) {
|
||||
// this.$refs.axisEdit.show('editPoint');
|
||||
// }
|
||||
// },
|
||||
updateObjAxis() {
|
||||
this.doClose();
|
||||
this.getMapOrigin();
|
||||
this.$confirm('您确认按当前绘图位置更新坐标及缩放比例?', this.$t('tip.hint'), {
|
||||
confirmButtonText: this.$t('tip.confirm'),
|
||||
cancelButtonText: this.$t('tip.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const map = this.$store.state.map.map;
|
||||
this.$store.dispatch('map/saveMapDeviceDefaultRelations').then(() => {
|
||||
const param = {
|
||||
mapId: this.$route.params.mapId,
|
||||
skinVO: {
|
||||
code: this.$store.state.map.map.skinVO.code,
|
||||
name: this.$store.state.map.map.skinVO.name,
|
||||
origin: {
|
||||
x: this.updtModel.origin.x,
|
||||
y: this.updtModel.origin.y
|
||||
},
|
||||
scaling: this.updtModel.scaling
|
||||
}
|
||||
};
|
||||
saveMap(Object.assign(map, param)).then(response => {
|
||||
this.$message.success(this.$t('map.updateSuccessfully'));
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('map.updateFailed'));
|
||||
});
|
||||
});
|
||||
}).catch(() => { });
|
||||
|
||||
},
|
||||
getMapOrigin() {
|
||||
const dataZoom = this.$store.state.map.dataZoom;
|
||||
if (dataZoom && dataZoom.offsetX) {
|
||||
this.updtModel.origin.x = Number.parseInt(dataZoom.offsetX);
|
||||
this.updtModel.origin.y = Number.parseInt(dataZoom.offsetY);
|
||||
this.updtModel.scaling = dataZoom.scaleRate;
|
||||
}
|
||||
},
|
||||
saveAs() {
|
||||
this.doClose();
|
||||
if (this.$refs && this.$refs.saveAs) {
|
||||
|
@ -20,9 +20,7 @@
|
||||
<div style="height: calc(100% - 46px);">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
<el-card v-if="questionList.length" class="box-card">
|
||||
<div v-for="(item, index) in questionList" :key="index" class="text item">
|
||||
{{ item }}
|
||||
</div>
|
||||
<div v-for="(item, index) in questionList" :key="index" class="text item">{{ item }}</div>
|
||||
</el-card>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
@ -134,21 +132,56 @@
|
||||
</el-button-group>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane class="view-control" label="批量删除" name="five">
|
||||
<div class="link_box_select">
|
||||
<span style="margin-right: 12px;">选择link:</span>
|
||||
<el-select v-model="linkCode" filterable multiple size="mini">
|
||||
<el-option
|
||||
v-for="item in linkList"
|
||||
:key="item.code"
|
||||
:label="item.name + ' (' + item.code + ')'"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="flex_box">
|
||||
<el-button type="primary" @click="delRelevanceSection">删除link相关元素</el-button>
|
||||
</div>
|
||||
<el-tab-pane class="view-control" label="批量操作" name="five">
|
||||
<el-form ref="oprt" label-width="130px" size="mini">
|
||||
<el-form-item label="选择link:">
|
||||
<el-select v-model="linkCode" filterable multiple size="mini">
|
||||
<el-option
|
||||
v-for="item in linkList"
|
||||
:key="item.code"
|
||||
:label="item.name + ' (' + item.code + ')'"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="delRelevanceSection">删除link相关元素</el-button>
|
||||
</el-button-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form ref="operationModel" :model="operationModel" label-width="130px" size="mini" :rules="operationRules">
|
||||
<el-form-item :label="$t('map.sectionData') + ':'" prop="sectionList">
|
||||
<el-select v-model="operationModel.sectionList" filterable multiple>
|
||||
<el-option
|
||||
v-for="item in PhysicalSectionList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
:type="field === 'handleSection' ? 'danger' : 'primary'"
|
||||
size="small"
|
||||
@click="hover('handleSection')"
|
||||
>{{ $t('map.activate') }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.equipmentStation')" prop="stationCode">
|
||||
<el-select v-model="operationModel.stationCode" filterable>
|
||||
<el-option
|
||||
v-for="item in stationList"
|
||||
:key="item.code"
|
||||
:label="item.name + item.code"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="handleScetionStationCode">{{ $t('map.setStationCode') }}</el-button>
|
||||
</el-button-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</template>
|
||||
@ -233,6 +266,10 @@ export default {
|
||||
trainPosType: '', // 列车所在方向
|
||||
splitOffsetMax: 15
|
||||
},
|
||||
operationModel: { // 区段集中站列表
|
||||
sectionList: [],
|
||||
stationCode: ''
|
||||
},
|
||||
mergeModel: {
|
||||
lsectioncode: '',
|
||||
rsectioncode: ''
|
||||
@ -264,6 +301,14 @@ export default {
|
||||
pointY: [
|
||||
{ required: true, message: this.$t('rules.pleaseEnterYValue'), trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
operationRules: {
|
||||
sectionList: [
|
||||
{ required: true, message: this.$t('rules.pleaseSelectSection'), trigger: 'change' }
|
||||
],
|
||||
stationCode: [
|
||||
{ required: true, message: this.$t('rules.pleaseSelectStationCode'), trigger: 'change' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
@ -586,6 +631,11 @@ export default {
|
||||
this.activeName = 'three';
|
||||
this.field = '';
|
||||
this.$emit('fieldSelect', '');
|
||||
} else if (this.field.toUpperCase() === 'handleSection'.toUpperCase()) {
|
||||
this.operationModel.sectionList.push(selected.code);
|
||||
this.activeName = 'five';
|
||||
// this.field = '';
|
||||
// this.$emit('fieldSelect', '');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -607,7 +657,7 @@ export default {
|
||||
handleDelete(index, row) {
|
||||
row.num = 0;
|
||||
},
|
||||
// 模型
|
||||
// 逻辑区段模型
|
||||
addLogicalSection(model, points, index, middleOffset) {
|
||||
const data = {
|
||||
_type: 'Section',
|
||||
@ -660,7 +710,7 @@ export default {
|
||||
};
|
||||
return data;
|
||||
},
|
||||
// 创建物理区段
|
||||
// 创建逻辑区段
|
||||
createLogicalSections(num, beg, end, model, counts) {
|
||||
const models = [];
|
||||
const triangle = new JTriangle(beg, end);
|
||||
@ -678,7 +728,6 @@ export default {
|
||||
// 生成逻辑区段
|
||||
editSectionNum() {
|
||||
let models = [];
|
||||
// const remove = [];
|
||||
let counts = 0;
|
||||
const logicSectionNumList = [];
|
||||
const sectionPoints = [...this.editModel.points]; // 获取区段点
|
||||
@ -687,9 +736,8 @@ export default {
|
||||
logicSectionNumList.push(Number(ele.num));
|
||||
counts += parseInt(ele.num);
|
||||
});
|
||||
this.sectionList.forEach(section => {
|
||||
this.sectionList.forEach(section => { // 删除之前的逻辑区段
|
||||
if (section.type === '02' && section.parentCode == this.editModel.code) {
|
||||
// remove.push(section);
|
||||
models.push(deepAssign(section, {_dispose: true}));
|
||||
}
|
||||
});
|
||||
@ -697,8 +745,6 @@ export default {
|
||||
this.editModel.logicSectionNum = [...logicSectionNumList];
|
||||
models.push(this.editModel);
|
||||
this.activeName = 'first';
|
||||
// this.$emit('addOrUpdateMapModel', models);
|
||||
// this.$emit('delMapModel', remove);
|
||||
this.$emit('updateMapModel', models);
|
||||
},
|
||||
addPoint(index) {
|
||||
@ -710,9 +756,6 @@ export default {
|
||||
this.editModel.points.splice(index, 1);
|
||||
this.logicSectionNums.splice(index, 1);
|
||||
},
|
||||
filterLinks(query, item) {
|
||||
return item.pinyin.indexOf(query) > -1;
|
||||
},
|
||||
// 一键创建区段 检测link是否规范
|
||||
checkLinkList() {
|
||||
this.questionList = [];
|
||||
@ -720,7 +763,7 @@ export default {
|
||||
if (item.leftFdCode) {
|
||||
if (item.leftSdCode) {
|
||||
item.create = true;
|
||||
} else if (!item.leftSdCode) {
|
||||
} else {
|
||||
const selected = this.$store.getters['map/getDeviceByCode'](item.leftFdCode);
|
||||
if (selected.rightFdCode && selected.rightSdCode) {
|
||||
item.create = true;
|
||||
@ -732,7 +775,7 @@ export default {
|
||||
} else if (item.rightFdCode) {
|
||||
if (item.rightSdCode) {
|
||||
item.create = true;
|
||||
} else if (!item.rightSdCode) {
|
||||
} else {
|
||||
const selected = this.$store.getters['map/getDeviceByCode'](item.rightFdCode);
|
||||
if (selected.leftFdCode && selected.leftSdCode) {
|
||||
item.create = true;
|
||||
@ -748,7 +791,6 @@ export default {
|
||||
// 一键生成区段
|
||||
create() {
|
||||
const models = [];
|
||||
// const remove = [];
|
||||
if (this.checkLinkList()) {
|
||||
this.linkList.forEach(link => {
|
||||
let count = 0;
|
||||
@ -832,10 +874,8 @@ export default {
|
||||
const sectionList = this.findSectionListDataByLinkCode(link.code);
|
||||
if (sectionList) {
|
||||
sectionList.forEach(section => {
|
||||
// remove.push({ _dispose: true, _type: 'Section', code: section.code });
|
||||
models.push(deepAssign({ _type: 'Section', code: section.code }, { _dispose: true }));
|
||||
if (section.type === '02' && section.parentCode) {
|
||||
// remove.push(section);
|
||||
models.push(deepAssign(section, { _dispose: true }));
|
||||
}
|
||||
});
|
||||
@ -849,7 +889,6 @@ export default {
|
||||
cancelButtonText: this.$t('tip.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
// _that.$emit('updateMapModel', remove);
|
||||
if (models.length) {
|
||||
_that.$emit('updateMapModel', models);
|
||||
} else {
|
||||
@ -905,7 +944,13 @@ export default {
|
||||
},
|
||||
// 删除对象
|
||||
deleteObj() {
|
||||
const models = [];
|
||||
const switchList = [];
|
||||
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);
|
||||
this.switchList.forEach(switchEle => {
|
||||
selected.relSwitchCode == switchEle.code && switchList.push(this.$store.getters['map/getDeviceByCode'](switchEle.code));
|
||||
});
|
||||
this.delSectionSwitch(switchList, models);
|
||||
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
|
||||
const _that = this;
|
||||
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
|
||||
@ -913,10 +958,9 @@ export default {
|
||||
cancelButtonText: this.$t('tip.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const models = [];
|
||||
if (selected.type == '01') {
|
||||
this.sectionList.forEach(section => {
|
||||
if (section.parentCode == selected.code) {
|
||||
if (section.parentCode == selected.code) { // 删除所属逻辑区段
|
||||
models.push(deepAssign(section, { _dispose: true }));
|
||||
}
|
||||
});
|
||||
@ -1130,13 +1174,9 @@ export default {
|
||||
this.sectionList.forEach(section => {
|
||||
if (section.linkCode == linkCode) {
|
||||
const selectedSection = this.$store.getters['map/getDeviceByCode'](section.code);
|
||||
// models.push(selectedSection);
|
||||
models.push(deepAssign(selectedSection, { _dispose: true }));
|
||||
this.switchList.forEach(switchEle => {
|
||||
if (section.relSwitchCode == switchEle.code) {
|
||||
const selectedSwitch = this.$store.getters['map/getDeviceByCode'](switchEle.code);
|
||||
switchList.push(selectedSwitch);
|
||||
}
|
||||
section.relSwitchCode == switchEle.code && switchList.push(this.$store.getters['map/getDeviceByCode'](switchEle.code));
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -1146,27 +1186,45 @@ export default {
|
||||
cancelButtonText: this.$t('tip.cancel'),
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
switchList.forEach((switchs) => {
|
||||
// 删除道岔/ 关联的道岔区段以及 道岔绑定关系
|
||||
this.sectionList.forEach(elem => {
|
||||
if (elem.type == '03' && elem.relSwitchCode == switchs.code) {
|
||||
models.push(deepAssign(this.$store.getters['map/getDeviceByCode'](elem.code), { _dispose: true }));
|
||||
}
|
||||
if (elem.relSwitchCode == switchs.code && elem.type != '03') {
|
||||
const copyModel = deepAssign({}, elem);
|
||||
copyModel.relSwitchCode = '';
|
||||
copyModel.isSwitchSection = false;
|
||||
models.push(copyModel);
|
||||
}
|
||||
});
|
||||
models.push(deepAssign(switchs, { _dispose: true }));
|
||||
});
|
||||
await this.$emit('updateMapModel', models);
|
||||
this.delSectionSwitch(switchList, models);
|
||||
this.$emit('updateMapModel', models);
|
||||
this.deviceSelect();
|
||||
this.linkCode = '';
|
||||
}).catch(() => {
|
||||
this.$message.info(this.$t('tip.cancelledDelete'));
|
||||
});
|
||||
},
|
||||
// 删除道岔/ 关联的道岔区段以及 道岔绑定关系
|
||||
delSectionSwitch(switchList, models) {
|
||||
switchList.forEach((switchs) => {
|
||||
this.sectionList.forEach(elem => {
|
||||
if (elem.type == '03' && elem.relSwitchCode == switchs.code) {
|
||||
models.push(deepAssign(this.$store.getters['map/getDeviceByCode'](elem.code), { _dispose: true }));
|
||||
}
|
||||
if (elem.relSwitchCode == switchs.code && elem.type != '03') {
|
||||
const copyModel = deepAssign({}, elem);
|
||||
copyModel.relSwitchCode = '';
|
||||
copyModel.isSwitchSection = false;
|
||||
models.push(copyModel);
|
||||
}
|
||||
});
|
||||
models.push(deepAssign(switchs, { _dispose: true }));
|
||||
});
|
||||
},
|
||||
// 多选区段设置集中站
|
||||
handleScetionStationCode() {
|
||||
this.$refs['operationModel'].validate((valid) => {
|
||||
if (valid) {
|
||||
const models = [];
|
||||
this.operationModel.sectionList.forEach(sectionCode => {
|
||||
const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](sectionCode));
|
||||
section.stationCode = this.operationModel.stationCode;
|
||||
models.push(section);
|
||||
});
|
||||
this.$emit('updateMapModel', models);
|
||||
this.$refs['operationModel'].resetFields();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -1200,6 +1258,16 @@ export default {
|
||||
}
|
||||
.link_box_select{
|
||||
padding: 10px 20px;
|
||||
.title{
|
||||
width: 100px;
|
||||
display: block;
|
||||
float: left;
|
||||
text-align: right;
|
||||
line-height: 28px;
|
||||
font-weight: 700;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
@ -21,9 +21,7 @@
|
||||
<div style="height: calc(100% - 46px);">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
<el-card v-if="questionList.length" class="box-card">
|
||||
<div v-for="(item, index) in questionList" :key="index" class="text item">
|
||||
{{ item }}
|
||||
</div>
|
||||
<div v-for="(item, index) in questionList" :key="index" class="text item">{{ item }}</div>
|
||||
</el-card>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
@ -149,8 +147,6 @@ export default {
|
||||
this.deviceSelect(val);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
filterSections(query, item) {
|
||||
return item.pinyin.indexOf(query) > -1;
|
||||
|
Loading…
Reference in New Issue
Block a user