调整临时限速配置

This commit is contained in:
zyy 2020-06-18 18:13:28 +08:00
parent 003bf13395
commit 0da6a64af7
6 changed files with 100 additions and 110 deletions

View File

@ -100,7 +100,6 @@
<script>
import { mapGetters } from 'vuex';
import { TrainingMode, OperationEvent } from '@/scripts/ConstDic';
import { menuBarConvert, SystemType } from './utils/menuItemStatus';
import StationControl from './menuDialog/stationControl';
import DetainTrainContorl from './menuDialog/detainTrainContorl';
import DetainTrainContorlUpDown from './menuDialog/detainTrainContorlUpDown';
@ -700,7 +699,6 @@ export default {
return list;
},
initMenu(menu) {
this.menu = menuBarConvert(this.menuNormal[SystemType[this.$store.state.training.prdType]], this.$store.state.training.operatemode);
if (this.menu[2]) {
this.menu[2].children = this.initStationList();
}

View File

@ -9,112 +9,91 @@
import PopMenu from '@/components/PopMenu';
import CancelAllLimit from './dialog/cancelAllLimit';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState } from './utils/menuItemStatus';
import { DeviceMenu } from '@/scripts/ConstDic';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import { menuOperate, commitOperate } from '@/jmapNew/theme/components/utils/menuOperate';
export default {
name: 'MenuLimit',
components: {
PopMenu,
CancelAllLimit
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
menu: [{
label: '取消全线临时限速',
handler: this.cancelSpeed,
disabledCallback: '',
auth: { station: true, center: false }
}],
menuNormal: {
local: [
{
label: '取消全线临时限速',
handler: this.cancelSpeed,
disabledCallback: MenuDisabledState.Section.cancelSpeed,
auth: { station: true, center: false }
}
],
central: [
{
label: '取消全线临时限速',
handler: this.cancelSpeed,
disabledCallback: MenuDisabledState.Section.cancelSpeed,
auth: { station: false, center: true }
}
]
}
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.LimitControl) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...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();
}
},
//
cancelSpeed() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.LimitControl.type,
label: MapDeviceType.LimitControl.label,
operation: OperationEvent.LimitControl.CancelAllLimit.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.cancelAllLimit.doShow(operate, this.selected);
}
});
}
}
name: 'MenuLimit',
components: {
PopMenu,
CancelAllLimit
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
menu: [],
menuNormal: {
Local: [
{
label: '取消全线临时限速',
handler: this.cancelSpeed,
cmdType: CMD.LimitControl.CMD_CANCEL_ALL_LIMIT_SPEED
}
],
Center: [
{
label: '取消全线临时限速',
handler: this.cancelSpeed,
cmdType: CMD.LimitControl.CMD_CANCEL_ALL_LIMIT_SPEED
}
]
}
};
},
computed: {
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.LimitControl) && !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 = MenuContextHandler.covert(this.menuNormal);
},
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();
}
},
//
cancelSpeed() {
commitOperate(menuOperate.LimitControl.cancelSpeed, {}, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.cancelAllLimit.doShow(operate, this.selected);
}
});
}
}
};
</script>

View File

@ -330,6 +330,12 @@ export const menuOperate = {
cmdType: CMD.TrainWindow.CMD_TRAIN_SET_MANUAL
}
},
LimitControl: {
cancelSpeed: {
operation: OperationEvent.LimitControl.CancelAllLimit.menu.operation,
cmdType: CMD.Fault.CMD_CANCEL_ALL_LIMIT_SPEED
}
},
Common: {
setFault: {
operation: OperationEvent.MixinCommand.stoppage.menu.operation,

View File

@ -147,7 +147,8 @@ export default {
{ label: '站台', value: 'Stand' },
{ label: '车站', value: 'Station' },
{ label: '控制模式', value: 'ControlConvertMenu' },
{ label: '车次窗', value: 'TrainWindow' }
{ label: '车次窗', value: 'TrainWindow' },
{ label: '全线限速', value: 'LimitControl' }
],
QuestionTypeList: [
{ label: '选择题', value: 'select' },

View File

@ -255,6 +255,6 @@ export default {
CMD_CANCEL_FAULT: {value: 'Cancel_Fault', label: '取消故障'}
},
LimitControl: {
CMD_CANCEL_ALL_LIMIT_SPEED: {value: 'Cancel_All_Limit_Speed', label: '取消全线临时限速'}
}
};

View File

@ -23,6 +23,8 @@ class MenuContextHandler {
control = store.getters['map/getStationCodeByTrain'](selected);
} else if (selected._type == 'TrainWindow') {
control = store.getters['map/getDeviceTrainWindowCodeByStationCode'](selected.code);
} else if (selected._type == 'LimitControl') {
return true;
} else {
control = store.getters['map/getDeviceStationCodeByStationCode'](selected.stationCode);
}
@ -81,9 +83,13 @@ class MenuContextHandler {
return;
}
const data = CommandHandler.getDefinition(elem.cmdType);
if (data) {
// 判断指令是否显示
if (data.simulationRole.toUpperCase() == type.toUpperCase() && data.controlMode.indexOf(status) > -1) {
if (data.operateObject == 'LimitControl') {
elem.show = true;
elem.disabled = false;
} else if (data.simulationRole.toUpperCase() == type.toUpperCase() && data.controlMode.indexOf(status) > -1) {
elem.show = true;
elem.disabled = this.checkDisabled(data, selected);
} else {