diff --git a/src/api/simulation.js b/src/api/simulation.js index 913f081fa..53780883c 100644 --- a/src/api/simulation.js +++ b/src/api/simulation.js @@ -228,22 +228,22 @@ export function handlerIbpEvent(group, button, stationCode, buttonCode) { }); } -/** 处理ibp盘事件(按下) */ - -export function handleIbpPress(group, stationCode, buttonCode) { - return request({ - url: `/simulation/${group}/ibp/press/${stationCode}/${buttonCode}`, - method: 'put' - }); -} -/** 处理ibp盘事件(松开) */ - -export function handleIbpRelease(group, stationCode, buttonCode) { - return request({ - url: `/simulation/${group}/ibp/release/${stationCode}/${buttonCode}`, - method: 'put' - }); -} +// /** 处理ibp盘事件(按下) */ +// +// export function handleIbpPress(group, stationCode, buttonCode) { +// return request({ +// url: `/simulation/${group}/ibp/press/${stationCode}/${buttonCode}`, +// method: 'put' +// }); +// } +// /** 处理ibp盘事件(松开) */ +// +// export function handleIbpRelease(group, stationCode, buttonCode) { +// return request({ +// url: `/simulation/${group}/ibp/release/${stationCode}/${buttonCode}`, +// method: 'put' +// }); +// } /** 预览脚本仿真(新版)*/ export function scriptDraftRecordNotifyNew(scriptId) { diff --git a/src/jmapNew/theme/datie_02/menus/menuButtonCtc.vue b/src/jmapNew/theme/datie_02/menus/menuButtonCtc.vue index 45273612f..a6bd7dd9f 100644 --- a/src/jmapNew/theme/datie_02/menus/menuButtonCtc.vue +++ b/src/jmapNew/theme/datie_02/menus/menuButtonCtc.vue @@ -546,6 +546,7 @@ export default { }; this.$store.dispatch('trainingNew/next', operate).then(({valid}) => { if (valid) { + this.deviceList.push(model); this.$store.dispatch('training/updateMapState', [{code: model.code, _type: model._type, hasSelected: 1}]); } }); diff --git a/src/scripts/cmdPlugin/CommandEnum.js b/src/scripts/cmdPlugin/CommandEnum.js index 6ee2f8853..074f52661 100644 --- a/src/scripts/cmdPlugin/CommandEnum.js +++ b/src/scripts/cmdPlugin/CommandEnum.js @@ -504,5 +504,12 @@ export default { Conversation: { CMD_Conversation_Chat_Text: {value: 'Conversation_Chat_Text', label: '发送文本消息'}, CMD_Conversation_Chat_Audio_Base64: {value: 'Conversation_Chat_Audio_Base64', label: '发送语音消息'} + }, + PSL: { + CMD_PSL_PRESS_BUTTON: {value: 'PSL_PRESS_BUTTON', label: 'PSL按钮操作'} + }, + IBP: { + CMD_IBP_PRESS_BUTTON: {value: 'IBP_PRESS_BUTTON', label: 'IBP按钮按下'}, + CMD_IBP_RELEASE_BUTTON: {value: 'IBP_RELEASE_BUTTON', label: 'IBP按钮抬起'} } }; diff --git a/src/scripts/cmdPlugin/OperationHandler.js b/src/scripts/cmdPlugin/OperationHandler.js index eece0cf2f..c21485623 100644 --- a/src/scripts/cmdPlugin/OperationHandler.js +++ b/src/scripts/cmdPlugin/OperationHandler.js @@ -4655,6 +4655,58 @@ export const OperationEvent = { } } }, + Psl: { + standChange: { + change: { + operation: 'c001', + domId: '_Tips-Psl-standChange-Change' + } + }, + pslOperation: { + turn: { + operation: 'c002', + domId: '_Tips-Psl-pslOperation-Turn' + } + }, + hsjcOperation: { + turn: { + operation: 'c003', + domId: '_Tips-Psl-hsjcOperation-Turn' + } + }, + openDoor: { + button: { + operation: 'c004', + domId: '_Tips-Psl-openDoor-Button' + } + }, + closeDoor: { + button: { + operation: 'c005', + domId: '_Tips-Psl-closeDoor-Button' + } + }, + testLamp: { + button: { + operation: 'c006', + domId: '_Tips-Psl-testLamp-Button' + } + } + }, + Ibp: { + buttonPressed: { + button: { + operation: 'd001', + domId: '_Tips-Ibp-buttonPressed-Button' + } + }, + buttonRelease: { + button: { + operation: 'd002', + domId: '_Tips-Ibp-buttonRelease-Button' + } + } + }, RailCommand: { railFillInTicket: { menu: { diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 17845245e..f84210e59 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -23,7 +23,7 @@ export function handlerUrl() { let OSS_URL; if (process.env.NODE_ENV === 'development') { // 开发分支 - // BASE_API = 'http://192.168.3.233/rtss-server'; + BASE_API = 'http://192.168.3.233/rtss-server'; // BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'http://114.116.51.125/jlcloud'; diff --git a/src/views/ibp/ibpsystem/index.vue b/src/views/ibp/ibpsystem/index.vue index 71e32ab5a..b712a2281 100644 --- a/src/views/ibp/ibpsystem/index.vue +++ b/src/views/ibp/ibpsystem/index.vue @@ -20,7 +20,6 @@ import Vue from 'vue'; import IbpPan from '@/ibp/ibpPan'; import { parser } from '@/ibp/utils/parser'; import { mapGetters } from 'vuex'; -import { handleIbpPress, handleIbpRelease } from '@/api/simulation'; import { IbpOperation } from '@/scripts/ConstDic'; import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp'; import { getToken } from '@/utils/auth'; @@ -29,6 +28,8 @@ import { getSimulationInfoNew, getIbpInitialState } from '@/api/simulation'; import BuzzerAudio from '@/assets/buzzer.mp3'; import { getStationList } from '@/api/runplan'; import { EventBus } from '@/scripts/event-bus'; +import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; +import CMD from '@/scripts/cmdPlugin/CommandEnum'; const pressedKeys = new Set(); export default { @@ -242,24 +243,74 @@ export default { onKeyboardAction(e) { if (this.preResetBtn) { if (e.type === 'keydown' && e.key === 'Control') { - pressedKeys.add(e.key); - this.preResetBtn.press(); - handleIbpPress(this.$route.query.group, this.stationCode, this.preResetBtn._code).catch(error => { this.$message.error(error.message); }); + // pressedKeys.add(e.key); + // this.preResetBtn.press(); + // handleIbpPress(this.$route.query.group, this.stationCode, this.preResetBtn._code).catch(error => { this.$message.error(error.message); }); + const operate = { + start: true, + send: true, + operation: OperationEvent.Ibp.buttonPressed.operation, + cmdType: CMD.IBP.CMD_IBP_PRESS_BUTTON, + param: { + stationCode: this.stationCode, + buttonCode: this.preResetBtn._code + } + }; + this.$store.dispatch('trainingNew/next', operate).then(({valid}) => { + pressedKeys.add(e.key); + this.preResetBtn.press(); + }).catch(error => { this.$message.error(error.message); }); } else if (e.type === 'keyup' && e.key === 'Control') { - pressedKeys.delete(e.key); - this.preResetBtn.release(); - handleIbpRelease(this.$route.query.group, this.stationCode, this.preResetBtn._code).catch(error => { this.$message.error(error.message); }); + // pressedKeys.delete(e.key); + // this.preResetBtn.release(); + // handleIbpRelease(this.$route.query.group, this.stationCode, this.preResetBtn._code).catch(error => { this.$message.error(error.message); }); + const operate = { + start: true, + send: true, + operation: OperationEvent.Ibp.buttonRelease.operation, + cmdType: CMD.IBP.CMD_IBP_RELEASE_BUTTON, + param: { + stationCode: this.stationCode, + buttonCode: this.preResetBtn._code + } + }; + this.$store.dispatch('trainingNew/next', operate).then(({valid}) => { + pressedKeys.delete(e.key); + this.preResetBtn.release(); + }).catch(error => { this.$message.error(error.message); }); } } }, onMouseDown(em) { if (['SquareButton', 'Key'].includes(em.deviceType)) { - handleIbpPress(this.$route.query.group, this.stationCode, em.deviceCode).catch(error => { this.$message.error(error.message); }); + const operate = { + start: true, + send: true, + operation: OperationEvent.Ibp.buttonPressed.operation, + cmdType: CMD.IBP.CMD_IBP_PRESS_BUTTON, + param: { + stationCode: this.stationCode, + buttonCode: em.deviceCode + } + }; + this.$store.dispatch('trainingNew/next', operate).catch(error => { this.$message.error(error.message); }); + // handleIbpPress(this.$route.query.group, this.stationCode, em.deviceCode).catch(error => { this.$message.error(error.message); }); } }, onMouseUp(em) { if (['SquareButton'].includes(em.deviceType)) { - handleIbpRelease(this.$route.query.group, this.stationCode, em.deviceCode).catch(error => { this.$message.error(error.message); }); + const operate = { + start: true, + send: true, + operation: OperationEvent.Ibp.buttonRelease.operation, + cmdType: CMD.IBP.CMD_IBP_RELEASE_BUTTON, + param: { + stationCode: this.stationCode, + buttonCode: em.deviceCode + } + }; + this.$store.dispatch('trainingNew/next', operate).catch(error => { this.$message.error(error.message); }); + // handleIbpRelease(this.$route.query.group, this.stationCode, em.deviceCode).catch(error => { this.$message.error(error.message); }); } }, // 右键点击事件 diff --git a/src/views/newMap/display/terminals/psl.vue b/src/views/newMap/display/terminals/psl.vue index 2a19261ec..ad7611c2f 100644 --- a/src/views/newMap/display/terminals/psl.vue +++ b/src/views/newMap/display/terminals/psl.vue @@ -3,7 +3,7 @@
PSL
- +
-
+
禁止
允许
-
+
禁止
-
+
开门按钮
-
+
关门按钮
-
+
试灯按钮
import icons from '@/assets/psl_images/psl_icons'; -import { getPslStatus, pressPslButton } from '@/api/simulation'; +import { getPslStatus } from '@/api/simulation'; import {mapGetters} from 'vuex'; +import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; +import CMD from '@/scripts/cmdPlugin/CommandEnum'; export default { name: 'PSL', data() { @@ -112,6 +114,9 @@ export default { ]), group() { return this.$route.query.group; + }, + psl() { + return OperationEvent.Psl; } }, watch: { @@ -147,9 +152,23 @@ export default { this.indicators = resp.data; } }) - .catch(err => {}); + .catch(() => {}); + }, + standCodeChange(val) { + const operate = { + start: true, + over: true, + operation: OperationEvent.Psl.standChange.change.operation, + param: { + standCode: val + } + }; + this.$store.dispatch('trainingNew/next', operate).then(({valid}) => { + if (valid) { + this.initData(this.group, this.standCode); + } + }); }, - doClose() { this.loading = false; this.dialogShow = false; @@ -159,7 +178,25 @@ export default { return status !== undefined ? icons[`${type}_${status}`] : icons[type]; }, btnClickHandler(btnType) { - pressPslButton(this.group, this.standCode, btnType); + const operationMap = { + YXJZ: this.psl.pslOperation.turn.operation, + HSJC: this.psl.hsjcOperation.turn.operation, + KM: this.psl.openDoor.button.operation, + GM: this.psl.closeDoor.button.operation, + SD: this.psl.testLamp.button.operation + }; + const operate = { + start: true, + send: true, + operation: operationMap[btnType], + cmdType: CMD.PSL.CMD_PSL_PRESS_BUTTON, + param: { + standCode: this.standCode, + button: btnType + } + }; + this.$store.dispatch('trainingNew/next', operate); + // pressPslButton(this.group, this.standCode, btnType); } } };