窗口间通信

This commit is contained in:
dong 2022-09-20 17:25:21 +08:00
parent a49f1b2c7a
commit 8fb99c668d
6 changed files with 69 additions and 14 deletions

View File

@ -88,6 +88,16 @@ export default {
await this.$store.dispatch('preLogout');
}
});
window.addEventListener('storage', e => {
if (e.key == 'setTrainingOperate') {
const operate = JSON.parse(e.newValue);
this.$store.dispatch('trainingNew/setTrainingOperate', operate);
}
if (e.key == 'setSceneOperate') {
const operate = JSON.parse(e.newValue);
this.$store.dispatch('trainingNew/setSceneOperate', operate);
}
});
this.$nextTick(() => {
openIndexedDB();
});

View File

@ -811,6 +811,11 @@ export const menuOperate = {
operation: OperationEvent.CTCCommand.modifyStationTrack.menu.operation,
cmdType: CMD.CTC.CTC_STATION_DETAIL_EDIT
},
// 编辑股道信息
editStationTrack:{
operation: OperationEvent.CTCCommand.modifyStationTrack.edit.operation,
cmdType: CMD.CTC.CTC_STATION_DETAIL_EDIT
},
// 股道发布生效区
releaseStationTrack:{
operation: OperationEvent.CTCCommand.releaseStationTrack.menu.operation,
@ -917,6 +922,7 @@ export const menuOperate = {
export function commitOperate(operate, paramList, over, fillStep = {}) {
const step = {
start: true,
userOperationType: operate.userOperationType || 'leftClick',
operation: operate.operation,
param:{}
};

View File

@ -265,6 +265,11 @@ export default {
},
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel)) {
const operate = {
userOperationType: 'rightClick',
operation: this.Command.commandRight.right.operation
};
this.$store.dispatch('training/nextNew', operate);
this.$refs && this.$refs.popMenu && this.$refs.popMenu.resetShowPosition(this.$store.state.menuOperation.menuPosition);
} else {
this.$refs && this.$refs.popMenu && this.$refs.popMenu.close();
@ -322,12 +327,14 @@ export default {
if (data.nextCmdType) {
operate = {
over: true,
userOperationType: 'leftClick',
operation: data.operation,
cmdType: data.nextCmdType,
param: data.param
};
} else {
operate = {
userOperationType: 'leftClick',
operationPre: data.operation,
operation: data.operateNext
};
@ -368,6 +375,7 @@ export default {
// S
guideLockLeftButtonDown() {
const operate = {
userOperationType: 'leftClick',
operation: this.Switch.guideLock.leftButton.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
@ -384,6 +392,7 @@ export default {
// X
guideLockRightButtonDown() {
const operate = {
userOperationType: 'leftClick',
operation: this.Switch.guideLock.rightButton.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
@ -403,6 +412,7 @@ export default {
this.clearOperate();
if (operation != this.Command.cancel.clearMbm.operation) {
const operate = {
userOperationType: 'leftClick',
operation: operation
};
// 684
@ -430,6 +440,7 @@ export default {
//
const operate = {
start: true,
userOperationType: 'leftClick',
operation: operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
@ -467,6 +478,7 @@ export default {
handelReopenSignal(device) {
const operate = {
operation: this.Signal.reopenSignal.button.operation,
userOperationType: 'leftClick',
code: device.code,
param: { signalCode: device.code }
};
@ -475,7 +487,7 @@ export default {
},
//
arrangementRouteOperation(deviceList) {
const operate = { operation: this.Signal.arrangementRoute.button.operation };
const operate = { userOperationType: 'leftClick', operation: this.Signal.arrangementRoute.button.operation };
if (!this.routeDataMap) { this.handleRouteDataMap(); }
if (!this.checkHaveRoute(deviceList)) { // deviceList
// this.$message.error('');
@ -543,6 +555,7 @@ export default {
const operate = {
code: model.code,
operation: this.$store.state.menuOperation.buttonOperation,
userOperationType: 'leftClick',
param: {
signalCode: model._type === 'Signal' ? model.code : model.signalCode
}
@ -557,6 +570,7 @@ export default {
const operate = {
code: model.code,
operation: this.Signal.guide.button.operation,
userOperationType: 'leftClick',
param: {signalCode: model.signalCode}
};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
@ -570,6 +584,7 @@ export default {
const operate = {
code: model.code,
operation: this.$store.state.menuOperation.buttonOperation,
userOperationType: 'leftClick',
val: model.code,
param: { signalCode: model.code }
};
@ -582,6 +597,7 @@ export default {
const operate = {
code: model.code,
operation: this.$store.state.menuOperation.buttonOperation,
userOperationType: 'leftClick',
param: { switchCode: model.code}
};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
@ -641,6 +657,7 @@ export default {
const operate = {
code: model.code,
operation: this.Signal.guide.button.operation,
userOperationType: 'leftClick',
param: {signalCode: model.signalCode}
};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
@ -747,7 +764,7 @@ export default {
this.$store.dispatch('menuOperation/setButtonOperation', this.operation);
},
routeCommit(trainCode, duration) {
const operate = {over: true, cmdType: CMD.CTC.CTC_SET_ROUTE, param:{ tripNumber: trainCode || '', duration: duration >= 0 ? duration : null, force: false }};
const operate = {userOperationType: 'leftClick', over: true, cmdType: CMD.CTC.CTC_SET_ROUTE, param:{ tripNumber: trainCode || '', duration: duration >= 0 ? duration : null, force: false }};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
this.clearOperate();
}).catch((e) => {
@ -766,7 +783,7 @@ export default {
this.routeCommit();
}
} else if (this.operation === OperationEvent.MixinCommand.totalCancel.button.operation) {
const operate = {over: true, cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE};
const operate = {userOperationType: 'leftClick', over: true, cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
this.clearOperate();
}).catch((e) => {
@ -774,7 +791,7 @@ export default {
this.clearOperate();
});
} else if (this.operation === OperationEvent.Signal.reopenSignal.button.operation) {
const operate = {over: true, cmdType: CMD.Signal.CMD_SIGNAL_REOPEN_SIGNAL};
const operate = {userOperationType: 'leftClick', over: true, cmdType: CMD.Signal.CMD_SIGNAL_REOPEN_SIGNAL};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
this.clearOperate();
}).catch(() => {
@ -782,7 +799,7 @@ export default {
this.clearOperate();
});
} else if (this.operation === OperationEvent.Signal.guide.button.operation) {
const operate = {over: true, cmdType: CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE};
const operate = {userOperationType: 'leftClick', over: true, cmdType: CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
this.$store.dispatch('training/updateMapState', [{code: this.selected.code, _type: this.selected._type, hasSelected: 0}]);
this.clearOperate();
@ -792,13 +809,13 @@ export default {
this.clearOperate();
});
} else if (this.operation === OperationEvent.Signal.humanTrainRoute.button.operation) {
const operate = {over: true, cmdType: CMD.Signal.CMD_SIGNAL_HUMAN_RELEASE_ROUTE};
const operate = {userOperationType: 'leftClick', over: true, cmdType: CMD.Signal.CMD_SIGNAL_HUMAN_RELEASE_ROUTE};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
}).catch((e) => {
this.$refs.noticeInfo.doShow();
}).finally(() => { this.clearOperate(); });
} else if (this.switchOperation.includes(this.operation)) {
const operate = {over:true, cmdType: this.cmdType};
const operate = {userOperationType: 'leftClick', over:true, cmdType: this.cmdType};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
}).catch(() => {
this.$refs.noticeInfo.doShow();
@ -885,6 +902,7 @@ export default {
const operate = {
over:true,
operation: noPasswordModelTypeMap[model.type].operation,
userOperationType: 'leftClick',
code: model.code,
param: noPasswordModelTypeMap[model.type].param,
cmdType : noPasswordModelTypeMap[model.type].nextCmdType
@ -903,6 +921,7 @@ export default {
} else {
const operate = {
operation: modelTypeMap[model.type].operation,
userOperationType: 'leftClick',
code: model.code,
param: modelTypeMap[model.type].param
};

View File

@ -668,6 +668,12 @@ export const OperationEvent = {
operation: '00c03s',
domId: '_Tips-ningBo-line_remoteResetFunc-sure{TOP}'
}
},
commandRight: {
right: {
operation: '00b',
domId: ''
}
}
},
// 站台概要表
@ -3996,6 +4002,10 @@ export const OperationEvent = {
menu: {
operation: '1154',
domId: '_Tips-CTC-modifyStationTrack-Menu{TOP}'
},
edit: {
operation: '11541',
domId: '_Tips-CTC-modifyStationTrack-edit{TOP}'
}
},
// 出入口发布生效区

View File

@ -94,6 +94,7 @@ const training = {
},
setTrainingOperate: ({commit, state}, trainingOperate) => {
commit('setTrainingOperate', trainingOperate);
window.localStorage.setItem('setTrainingOperate', JSON.stringify(trainingOperate));
},
stepOrderIncrease: ({commit}) => {
commit('stepOrderIncrease');
@ -118,6 +119,7 @@ const training = {
},
setSceneOperate: ({commit}, sceneOperate) => {
commit('setSceneOperate', sceneOperate);
window.localStorage.setItem('setSceneOperate', JSON.stringify(sceneOperate));
},
handleCheckNewTrainingResult:({commit, state}, valid) => {
const stepList = JSON.parse(state.trainingDetail.stepJson);

View File

@ -8,12 +8,12 @@
<div class="stationTrackRMenu">
<div class="stationTrackRMenuL">
<!-- :id="domIdConfirm" :loading="loading" @click="commit"-->
<el-button class="stationTrackButton" size="small" @click="modifySection">修改</el-button>
<el-button :id="OperationEvent.CTCCommand.modifyStationTrack.edit.domId" class="stationTrackButton" size="small" @click="modifySection">修改</el-button>
</div>
<div class="stationTrackRMenuR">
<span class="stationTrackRVer">版本号</span>
<el-button class="stationTrackButton" size="small">备份</el-button>
<el-button class="stationTrackButton" size="small" @click="releaseStationTrack">更新至生效区</el-button>
<el-button :id="OperationEvent.CTCCommand.releaseStationTrack.menu.operation" class="stationTrackButton" size="small" @click="releaseStationTrack">更新至生效区</el-button>
<el-button class="stationTrackButton" size="small">导入</el-button>
<el-button class="stationTrackButton" size="small">比较</el-button>
</div>
@ -153,6 +153,7 @@ import { mapGetters } from 'vuex';
import TerminalStationList from './terminalStationList';
import TrackInformation from './trackInformation';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
export default {
name:'StationTrack',
components: {
@ -213,7 +214,10 @@ export default {
computed:{
...mapGetters('map', [
'sectionList'
])
]),
OperationEvent() {
return OperationEvent;
}
},
methods:{
loadStation() {
@ -252,10 +256,14 @@ export default {
},
modifySection() {
if (this.currentRow) {
this.$refs.trackInformation.doShow({
row:this.currentRow,
filterSectionMap:this.filterSectionMap,
stationCode:this.currentStationCode
commitOperate(menuOperate.CTC.editStationTrack, {}, 0).then(({valid})=>{
if (valid) {
this.$refs.trackInformation.doShow({
row:this.currentRow,
filterSectionMap:this.filterSectionMap,
stationCode:this.currentStationCode
});
}
});
}
},