实训问题修复

This commit is contained in:
fan 2023-09-27 15:46:10 +08:00
parent ac096dd663
commit 0598da9a2d
4 changed files with 43 additions and 2 deletions

View File

@ -583,3 +583,10 @@ export function enterSimulationByTeacher(group) {
method: 'post' method: 'post'
}); });
} }
/** 切换角色后触发消息 */
export function getUnreceivedMessages(simulationId, memberId) {
return request({
url: `/simulation/${simulationId}/${memberId}/unreceivedMessages`,
method: 'get'
});
}

View File

@ -163,6 +163,37 @@ export default {
this.updateTableValue(controlTransfer); this.updateTableValue(controlTransfer);
}); });
}, },
'$store.state.socket.controlTransfer': function(val) {
if (this.$store.state.training.domConfig.trainingDesign) {
if (val[0].application === 'LOCAL') {
this.doShow({operation: OperationEvent.StationControl.requestStationControl.mbar.operation});
} else if (val[0].application === 'CENTER') {
this.doShow({operation: OperationEvent.StationControl.requestCentralControl.mbar.operation});
} else if (val[0].application === 'FORCE_LOCAL') {
this.doShow({operation: OperationEvent.StationControl.forcedStationControl.mbar.operation});
}
val.forEach(item => {
let controlMode = '';
if (item.application === 'LOCAL' || item.application === 'FORCE_LOCAL') {
controlMode = 'Local';
} else if (item.application === 'CENTER') {
controlMode = 'Center';
}
// this.updateTableValue( { code: item.stationCode, controlMode: controlMode });
this.tableData.forEach((row, index) => {
if (row.code == item.stationCode) {
row.result = this.$t('menu.menuDialog.controlModeTransfersuccees');
row.control = this.controlProps[controlMode];
this.removeSelection(item.stationCode);
row.disabled = true;
row.check = false;
this.disabledClose = false;
this.disabledSure = false;
}
});
});
}
},
// //
tableData: { tableData: {
handler(val, oldVal) { handler(val, oldVal) {

View File

@ -210,7 +210,7 @@ function handle(data) {
case 'Simulation_Training_Audio_MATCH_RESULT': case 'Simulation_Training_Audio_MATCH_RESULT':
store.dispatch('trainingNew/handleMatchVoice', msg); store.dispatch('trainingNew/handleMatchVoice', msg);
break; break;
case 'Simulation_Control_Transfer_Result': case 'Simulation_Control_Mode_Apply_Result':
store.dispatch('socket/setControlTransfer', msg); store.dispatch('socket/setControlTransfer', msg);
break; break;
case 'Simulation_Training_Prepare_Start': // 仿真预加载 case 'Simulation_Training_Prepare_Start': // 仿真预加载

View File

@ -49,7 +49,7 @@
</template> </template>
<script> <script>
import {getSimulationMemberList, getAllSimulationUser} from '@/api/simulation'; import {getSimulationMemberList, getAllSimulationUser, getUnreceivedMessages} from '@/api/simulation';
import {getToken} from '@/utils/auth'; import {getToken} from '@/utils/auth';
import {creatSubscribe, clearSubscribe, getTopic} from '@/utils/stomp'; import {creatSubscribe, clearSubscribe, getTopic} from '@/utils/stomp';
import { defaultCallback, stateCallback, diagramSimCallback } from '@/utils/subscribeCallback'; import { defaultCallback, stateCallback, diagramSimCallback } from '@/utils/subscribeCallback';
@ -166,6 +166,9 @@ export default {
this.$store.dispatch('training/setMapDefaultState'); this.$store.dispatch('training/setMapDefaultState');
this.isFirst = false; this.isFirst = false;
} }
if (this.$store.state.training.domConfig.trainingDesign) {
getUnreceivedMessages(this.$route.query.group, this.$store.state.training.myMemberId);
}
}, },
'$store.state.socket.memberChangeCount': function () { // 仿 '$store.state.socket.memberChangeCount': function () { // 仿
this.initMemberUserInfo(); this.initMemberUserInfo();