窗口间通信

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'); 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(() => { this.$nextTick(() => {
openIndexedDB(); openIndexedDB();
}); });

View File

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

View File

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

View File

@ -668,6 +668,12 @@ export const OperationEvent = {
operation: '00c03s', operation: '00c03s',
domId: '_Tips-ningBo-line_remoteResetFunc-sure{TOP}' domId: '_Tips-ningBo-line_remoteResetFunc-sure{TOP}'
} }
},
commandRight: {
right: {
operation: '00b',
domId: ''
}
} }
}, },
// 站台概要表 // 站台概要表
@ -3996,6 +4002,10 @@ export const OperationEvent = {
menu: { menu: {
operation: '1154', operation: '1154',
domId: '_Tips-CTC-modifyStationTrack-Menu{TOP}' 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) => { setTrainingOperate: ({commit, state}, trainingOperate) => {
commit('setTrainingOperate', trainingOperate); commit('setTrainingOperate', trainingOperate);
window.localStorage.setItem('setTrainingOperate', JSON.stringify(trainingOperate));
}, },
stepOrderIncrease: ({commit}) => { stepOrderIncrease: ({commit}) => {
commit('stepOrderIncrease'); commit('stepOrderIncrease');
@ -118,6 +119,7 @@ const training = {
}, },
setSceneOperate: ({commit}, sceneOperate) => { setSceneOperate: ({commit}, sceneOperate) => {
commit('setSceneOperate', sceneOperate); commit('setSceneOperate', sceneOperate);
window.localStorage.setItem('setSceneOperate', JSON.stringify(sceneOperate));
}, },
handleCheckNewTrainingResult:({commit, state}, valid) => { handleCheckNewTrainingResult:({commit, state}, valid) => {
const stepList = JSON.parse(state.trainingDetail.stepJson); const stepList = JSON.parse(state.trainingDetail.stepJson);

View File

@ -8,12 +8,12 @@
<div class="stationTrackRMenu"> <div class="stationTrackRMenu">
<div class="stationTrackRMenuL"> <div class="stationTrackRMenuL">
<!-- :id="domIdConfirm" :loading="loading" @click="commit"--> <!-- :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>
<div class="stationTrackRMenuR"> <div class="stationTrackRMenuR">
<span class="stationTrackRVer">版本号</span> <span class="stationTrackRVer">版本号</span>
<el-button class="stationTrackButton" size="small">备份</el-button> <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>
<el-button class="stationTrackButton" size="small">比较</el-button> <el-button class="stationTrackButton" size="small">比较</el-button>
</div> </div>
@ -153,6 +153,7 @@ import { mapGetters } from 'vuex';
import TerminalStationList from './terminalStationList'; import TerminalStationList from './terminalStationList';
import TrackInformation from './trackInformation'; import TrackInformation from './trackInformation';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate'; import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
export default { export default {
name:'StationTrack', name:'StationTrack',
components: { components: {
@ -213,7 +214,10 @@ export default {
computed:{ computed:{
...mapGetters('map', [ ...mapGetters('map', [
'sectionList' 'sectionList'
]) ]),
OperationEvent() {
return OperationEvent;
}
}, },
methods:{ methods:{
loadStation() { loadStation() {
@ -252,12 +256,16 @@ export default {
}, },
modifySection() { modifySection() {
if (this.currentRow) { if (this.currentRow) {
commitOperate(menuOperate.CTC.editStationTrack, {}, 0).then(({valid})=>{
if (valid) {
this.$refs.trackInformation.doShow({ this.$refs.trackInformation.doShow({
row:this.currentRow, row:this.currentRow,
filterSectionMap:this.filterSectionMap, filterSectionMap:this.filterSectionMap,
stationCode:this.currentStationCode stationCode:this.currentStationCode
}); });
} }
});
}
}, },
noticeInfo() { noticeInfo() {
this.$emit('noticeInfo'); this.$emit('noticeInfo');