修改宁波三道岔实训问题

This commit is contained in:
dong 2023-01-06 13:42:38 +08:00
parent b604bc55be
commit 973732c80d
4 changed files with 89 additions and 42 deletions

View File

@ -61,7 +61,8 @@ export default {
allChecked: false, allChecked: false,
dialogShow: false, dialogShow: false,
loading: false, loading: false,
isActive: false isActive: false,
changeIgnore: false
}; };
}, },
computed: { computed: {
@ -121,6 +122,7 @@ export default {
this.$nextTick(function () { this.$nextTick(function () {
let index = 0; let index = 0;
const switchEle = this.switchList.find((el, i) => { index = i; return el.code == selected.code; }); const switchEle = this.switchList.find((el, i) => { index = i; return el.code == selected.code; });
this.changeIgnore = !!switchEle;
this.$refs.table.setCurrentRow(switchEle); this.$refs.table.setCurrentRow(switchEle);
setTimeout(()=> { setTimeout(()=> {
this.$refs.table.bodyWrapper.scrollTop = index * 20; this.$refs.table.bodyWrapper.scrollTop = index * 20;
@ -131,6 +133,7 @@ export default {
doClose() { doClose() {
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
this.changeIgnore = false;
this.$refs.table.setCurrentRow(); this.$refs.table.setCurrentRow();
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}, },
@ -154,13 +157,17 @@ export default {
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
if (!val) { return; } if (!val) { return; }
this.$store.dispatch('menuOperation/setSelected', {device: val});
if (this.changeIgnore) {
this.changeIgnore = false;
return;
}
const step = { const step = {
// code: val.code, // code: val.code,
operation: OperationEvent.Command.common.choose.operation, operation: OperationEvent.Command.common.choose.operation,
val: val.code val: val.code
}; };
this.$store.dispatch('menuOperation/setSelected', {device: val});
this.$store.dispatch('trainingNew/next', step).then(({ valid }) => { this.$store.dispatch('trainingNew/next', step).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });

View File

@ -163,8 +163,9 @@ export default {
this.currentSelect = sure ? this.$store.getters['map/getDeviceByCode'](this.initSelect.code) : null; this.currentSelect = sure ? this.$store.getters['map/getDeviceByCode'](this.initSelect.code) : null;
this.dialogShow = true; this.dialogShow = true;
this.$nextTick(function () { this.$nextTick(function () {
this.changeIgnore = sure; const switchEle = sure ? this.tempList.find(el => el.code == this.initSelect.code) : null;
this.$refs.table.setCurrentRow(sure ? this.tempList.find(el => el.code == this.initSelect.code) : null); this.changeIgnore = !!switchEle;
this.$refs.table.setCurrentRow(switchEle);
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}); });
}, },
@ -182,6 +183,7 @@ export default {
this.$nextTick(function () { this.$nextTick(function () {
let index = 0; let index = 0;
const switchEle = this.tempList.find((el, i) => { index = i; return el.code == selected.code; }); const switchEle = this.tempList.find((el, i) => { index = i; return el.code == selected.code; });
this.changeIgnore = !!switchEle;
this.$refs.table.setCurrentRow(switchEle); this.$refs.table.setCurrentRow(switchEle);
setTimeout(()=> { setTimeout(()=> {
this.$refs.table.bodyWrapper.scrollTop = index * 20; this.$refs.table.bodyWrapper.scrollTop = index * 20;
@ -236,8 +238,12 @@ export default {
handleCurrentChange(val) { handleCurrentChange(val) {
if (!val) { return; } if (!val) { return; }
this.currentSelect = this.$store.getters['map/getDeviceByCode'](val.code); this.currentSelect = this.$store.getters['map/getDeviceByCode'](val.code);
this.sure || this.$emit('initSelect', this.currentSelect);
this.$emit('updateDone'); this.$emit('updateDone');
if (this.changeIgnore) { return; } if (this.changeIgnore) {
this.changeIgnore = false;
return;
}
const step = { const step = {
// code: val.code, // code: val.code,
@ -245,11 +251,9 @@ export default {
val: val.code val: val.code
}; };
this.changeIgnore = false;
this.$store.dispatch('trainingNew/next', step).then(({ valid }) => { this.$store.dispatch('trainingNew/next', step).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.sure || this.$emit('initSelect', this.currentSelect);
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(); this.$refs.noticeInfo.doShow();

View File

@ -89,7 +89,8 @@ export default {
selectedSwitch: {}, selectedSwitch: {},
mode: '', mode: '',
position: '', position: '',
reserved: '' reserved: '',
changeIgnore: false
}; };
}, },
@ -177,11 +178,12 @@ export default {
this.$nextTick(function () { this.$nextTick(function () {
let index = 0; let index = 0;
const switchEle = this.switchList.find((el, i) => { index = i; return el.code == selected.code; }); const switchEle = this.switchList.find((el, i) => { index = i; return el.code == selected.code; });
this.changeIgnore = !!switchEle;
this.$refs.table.setCurrentRow(switchEle); this.$refs.table.setCurrentRow(switchEle);
setTimeout(() => { setTimeout(() => {
this.$refs.table.bodyWrapper.scrollTop = index * 20; this.$refs.table.bodyWrapper.scrollTop = index * 20;
}, 200); }, 200);
this.handleCurrentChange(switchEle); // this.handleCurrentChange(switchEle);
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}); });
}, },
@ -190,6 +192,7 @@ export default {
this.dialogShow = false; this.dialogShow = false;
this.mode = ''; this.mode = '';
this.position = ''; this.position = '';
this.changeIgnore = false;
this.$refs.table.setCurrentRow(); this.$refs.table.setCurrentRow();
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}, },
@ -232,19 +235,15 @@ export default {
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
if (!val) { return; } if (!val) { return; }
commitOperate(menuOperate.Switch.turnout, {code:val.code}).then(({valid, operate})=>{ this.position = '';
// if (valid) { const switchModel = this.$store.getters['map/getDeviceByCode'](val.code);
this.position = ''; this.selectedSwitchCode = val.code;
const switchModel = this.$store.getters['map/getDeviceByCode'](val.code); this.selectedSwitch = switchModel;
this.selectedSwitchCode = val.code; if (this.changeIgnore) {
this.selectedSwitch = switchModel; this.changeIgnore = false;
// this.mode = elem.auto ? 'artificial' : 'auto'; return;
// if (!elem.auto) { }
// if (elem.normalPosition) { this.position = 'reverse'; } commitOperate(menuOperate.Switch.turnout, {code:val.code});
// if (elem.reversePosition) { this.position = 'normal'; }
// }
// }
});
}, },
getSwitchPosition(code) { getSwitchPosition(code) {
const elem = this.$store.getters['map/getDeviceByCode'](code); const elem = this.$store.getters['map/getDeviceByCode'](code);

View File

@ -71,6 +71,7 @@ export default {
menuNormal: [ menuNormal: [
{ {
label: '命令', label: '命令',
operate: OperationEvent.Command.commandNingBo3.line_switch_cmd,
handler: this.handlerCommand handler: this.handlerCommand
}, },
@ -79,10 +80,12 @@ export default {
children: [ children: [
{ {
label: '初始化', label: '初始化',
operate: OperationEvent.Command.commandNingBo3.line_switch_block_init,
handler: this.handlerInitBlock handler: this.handlerInitBlock
}, },
{ {
label: '确定/取消', label: '确定/取消',
operate: OperationEvent.Command.commandNingBo3.line_switch_block_sure,
handler: this.handlerBlock handler: this.handlerBlock
} }
] ]
@ -92,10 +95,12 @@ export default {
children: [ children: [
{ {
label: '初始化', label: '初始化',
operate: OperationEvent.Command.commandNingBo3.line_switch_unblock_init,
handler: this.handlerInitUnblock handler: this.handlerInitUnblock
}, },
{ {
label: '确定/取消', label: '确定/取消',
operate: OperationEvent.Command.commandNingBo3.line_switch_unblock_sure,
handler: this.handlerUnblock handler: this.handlerUnblock
} }
] ]
@ -105,17 +110,20 @@ export default {
children: [ children: [
{ {
label: '请求或授权/取消', label: '请求或授权/取消',
operate: OperationEvent.Command.commandNingBo3.line_switch_empower_init,
handler: this.handlerActive handler: this.handlerActive
}, },
{ {
label: '显示', label: '显示',
disabled: true, disabled: true,
operate: OperationEvent.Command.commandNingBo3.line_switch_empower_sure,
handler: this.undeveloped handler: this.undeveloped
} }
] ]
}, },
{ {
label: '显示', label: '显示',
operate: OperationEvent.Command.commandNingBo3.line_switch_detail,
handler: this.handlerDetail handler: this.handlerDetail
} }
], ],
@ -145,12 +153,6 @@ export default {
watch: { watch: {
'$store.state.menuOperation.menuCount': function (val) { '$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Switch) && !this.buttonOperation) { if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Switch) && !this.buttonOperation) {
const operate = {
code: `${this.selected.code}`,
userOperationType: 'rightClick',
operation: OperationEvent.Command.commandRight.right.operation
};
this.$store.dispatch('trainingNew/next', operate);
this.doShow(this.$store.state.menuOperation.menuPosition); this.doShow(this.$store.state.menuOperation.menuPosition);
} else { } else {
this.doClose(); this.doClose();
@ -230,26 +232,61 @@ export default {
hookLock() { hookLock() {
this.$refs.switchHookLock.doShow(this.selected); this.$refs.switchHookLock.doShow(this.selected);
}, },
handlerCommand() { handlerCommand(item) {
this.$refs.switchCommand.rightClickShow('', this.selected); const operate = {
code: this.selected.code,
operation: item.operate.operation
};
this.$store.dispatch('trainingNew/next', operate);
this.$refs.switchCommand.rightClickShow(item.operate, this.selected);
}, },
handlerInitBlock() { handlerInitBlock(item) {
this.$refs.switchBlock.rightClickShow(OperationEvent.Command.commandNingBo3.line_switch_block_init, false, this.selected); const operate = {
code: this.selected.code,
operation: item.operate.operation
};
this.$store.dispatch('trainingNew/next', operate);
this.$refs.switchBlock.rightClickShow(item.operate, false, this.selected);
}, },
handlerBlock() { handlerBlock(item) {
this.$refs.switchBlock.rightClickShow(OperationEvent.Command.commandNingBo3.line_switch_block_sure, true, this.selected); const operate = {
code: this.selected.code,
operation: item.operate.operation
};
this.$store.dispatch('trainingNew/next', operate);
this.$refs.switchBlock.rightClickShow(item.operate, true, this.selected);
}, },
handlerInitUnblock() { handlerInitUnblock(item) {
this.$refs.switchBlock.rightClickShow(OperationEvent.Command.commandNingBo3.line_switch_unblock_init, false, this.selected); const operate = {
code: this.selected.code,
operation: item.operate.operation
};
this.$store.dispatch('trainingNew/next', operate);
this.$refs.switchBlock.rightClickShow(item.operate, false, this.selected);
}, },
handlerUnblock() { handlerUnblock(item) {
this.$refs.switchBlock.rightClickShow(OperationEvent.Command.commandNingBo3.line_switch_unblock_sure, true, this.selected); const operate = {
code: this.selected.code,
operation: item.operate.operation
};
this.$store.dispatch('trainingNew/next', operate);
this.$refs.switchBlock.rightClickShow(item.operate, true, this.selected);
}, },
handlerActive() { handlerActive(item) {
this.$refs.switchActive.rightClickShow('', this.selected); const operate = {
code: this.selected.code,
operation: item.operate.operation
};
this.$store.dispatch('trainingNew/next', operate);
this.$refs.switchActive.rightClickShow(item.operate, this.selected);
}, },
handlerDetail() { handlerDetail(item) {
this.$refs.switchDetail.rightClickShow('', this.selected); const operate = {
code: this.selected.code,
operation: item.operate.operation
};
this.$store.dispatch('trainingNew/next', operate);
this.$refs.switchDetail.rightClickShow(item.operate, this.selected);
} }
} }
}; };