Merge branch 'test_dispaly' of https://git.code.tencent.com/lian-cbtc/jl-client into test_dispaly

This commit is contained in:
joylink_cuiweidong 2023-02-07 18:19:22 +08:00
commit 5fbf197be4
7 changed files with 184 additions and 36 deletions

View File

@ -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) {

View File

@ -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}]);
}
});

View File

@ -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按钮抬起'}
}
};

View File

@ -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: {

View File

@ -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';

View File

@ -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); });
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();
handleIbpPress(this.$route.query.group, this.stationCode, this.preResetBtn._code).catch(error => { this.$message.error(error.message); });
}).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); });
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();
handleIbpRelease(this.$route.query.group, this.stationCode, this.preResetBtn._code).catch(error => { this.$message.error(error.message); });
}).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); });
}
},
//

View File

@ -3,7 +3,7 @@
<div style="width: 50%;position: relative;left: 25%;">
<div class="psl-title">
<div>PSL</div>
<el-select v-model="standCode" style="margin-left: 10px;">
<el-select :id="psl.standChange.change.domId" v-model="standCode" style="margin-left: 10px;" @change="standCodeChange">
<el-option
v-for="item in standList"
:key="item.code"
@ -40,7 +40,7 @@
</div>
</div>
<div class="content-row">
<div class="cell btn">
<div :id="psl.pslOperation.turn.domId" class="cell btn">
<div class="btn-text">禁止</div>
<img
:src="getIcon('key')"
@ -49,7 +49,7 @@
>
<div class="btn-text-opt">允许</div>
</div>
<div class="cell btn">
<div :id="psl.hsjcOperation.turn.domId" class="cell btn">
<div class="btn-text">禁止</div>
<img
:src="getIcon('key')"
@ -60,17 +60,17 @@
</div>
</div>
<div class="content-row">
<div class="cell btn">
<div :id="psl.openDoor.button.domId" class="cell btn">
<div class="btn-text">开门按钮</div>
<img :src="getIcon('red', 'btn')" @click="btnClickHandler('KM')">
</div>
<div class="cell btn">
<div :id="psl.closeDoor.button.domId" class="cell btn">
<div class="btn-text">关门按钮</div>
<img :src="getIcon('green', 'btn')" @click="btnClickHandler('GM')">
</div>
</div>
<div class="content-row">
<div class="cell btn">
<div :id="psl.testLamp.button.domId" class="cell btn">
<div class="btn-text">试灯按钮</div>
<img
class="btn-sd btn-img"
@ -87,8 +87,10 @@
<script>
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);
}
}
};