仿真调整

This commit is contained in:
fan 2022-12-01 15:38:18 +08:00
parent a52872de5c
commit b15806dca7
8 changed files with 124 additions and 29 deletions

View File

@ -559,3 +559,11 @@ export function destroySimulationByAdmin(group) {
method: 'post'
});
}
/** 非仿真创建者退出仿真 */
export function exitSimulation(group) {
return request({
url: `/simulation/${group}/exit`,
method: 'put'
});
}

View File

@ -193,7 +193,7 @@ export default {
return OperationEvent.Station;
},
isShowBtn() {
return this.$store.state.training.prdType == '09';
return this.$store.state.training.roles === 'DEPOT_DISPATCHER' || this.$store.state.training.roles === 'SIGNAL_BUILDING';
}
},
watch: {

View File

@ -61,7 +61,13 @@ export default {
label: '故障解锁',
handler: this.fault,
cmdType: CMD.Section.CMD_SECTION_FAULT_UNLOCK,
isDisabled: (section, work) => { if (work === 'localWork') { return this.$store.state.training.roleDeviceCode === section.stationCode; } else { return false; } },
isDisabled: (section, work) => {
if (work === 'localWork') {
return this.$store.state.training.roleDeviceCode === section.stationCode;
} else {
return false;
}
},
isShow: (section, work) => ['01', '02', '03'].includes(section.type)
},
{
@ -94,34 +100,66 @@ export default {
label: '计轴预复位',
handler: this.axlePreReset,
cmdType: CMD.Section.CMD_SECTION_AXIS_PRE_RESET,
isDisabled: (section, work) => {
if (work === 'localWork') {
return this.$store.state.training.roleDeviceCode === section.stationCode;
} else {
return false;
}
},
isShow: (section, work) => ['01', '02', '03'].includes(section.type)
},
{
label: this.$t('menu.menuSection.sectionBlockade'),
handler: this.lock,
cmdType: CMD.Section.CMD_SECTION_BLOCK,
isDisabled: section => section.blockade === 1,
// isDisabled: section => section.blockade === 1,
isDisabled: (section, work) => {
if (work === 'localWork') {
return this.$store.state.training.roleDeviceCode === section.stationCode && section.blockade === 1;
} else {
return section.blockade === 1;
}
},
isShow: (section, work) => ['01', '02', '03'].includes(section.type)
},
{
label: this.$t('menu.menuSection.sectionUnblock'),
handler: this.unlock,
cmdType: CMD.Section.CMD_SECTION_UNBLOCK,
isDisabled: section => section.blockade !== 1,
isDisabled: (section, work) => {
if (work === 'localWork') {
return this.$store.state.training.roleDeviceCode === section.stationCode && section.blockade !== 1;
} else {
return section.blockade !== 1;
}
},
isShow: (section, work) => ['01', '02', '03'].includes(section.type)
},
{
label: '设置限速',
handler: this.setSpeed,
cmdType: CMD.Section.CMD_SECTION_SET_LIMIT_SPEED,
isDisabled: section => section.speedUpLimit !== -1,
isDisabled: (section, work) => {
if (work === 'localWork') {
return this.$store.state.training.roleDeviceCode === section.stationCode && section.speedUpLimit !== -1;
} else {
return section.speedUpLimit !== -1;
}
},
isShow: (section, work) => section.type === '02'
},
{
label: '取消限速',
handler: this.cancelSpeed,
cmdType: CMD.Section.CMD_SECTION_CANCEL_LIMIT_SPEED,
isDisabled: section => section.speedUpLimit === -1,
isDisabled: (section, work) => {
if (work === 'localWork') {
return this.$store.state.training.roleDeviceCode === section.stationCode && section.speedUpLimit === -1;
} else {
return section.speedUpLimit === -1;
}
},
isShow: (section, work) => section.type === '02'
}
],

View File

@ -64,39 +64,80 @@ export default {
{
label: this.$t('menu.menuSignal.routeSelect'),
handler: this.arrangementRoute,
cmdType: CMD.Signal.CMD_SIGNAL_SET_ROUTE
cmdType: CMD.Signal.CMD_SIGNAL_SET_ROUTE,
isDisabled: (signal, work) => {
if (work === 'localWork') {
return this.$store.state.training.roleDeviceCode === signal.stationCode;
} else {
return false;
}
}
},
{
label: this.$t('menu.menuSignal.routeCancel'),
handler: this.cancelTrainRoute,
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE,
isDisabled: (signal, work) => {
if (work === 'localWork') {
return this.$store.state.training.roleDeviceCode === signal.stationCode;
} else {
return false;
}
}
},
{
label: this.$t('menu.menuSignal.signalBlock'),
handler: this.lock,
cmdType: CMD.Signal.CMD_SIGNAL_BLOCK,
isDisabled: signal => signal.blockade === 1
isDisabled: (signal, work) => {
if (work === 'localWork') {
return this.$store.state.training.roleDeviceCode === signal.stationCode && signal.blockade === 1;
} else {
return signal.blockade === 1;
}
}
},
{
label: this.$t('menu.menuSignal.signalDeblock'),
handler: this.unlock,
cmdType: CMD.Signal.CMD_SIGNAL_UNBLOCK,
isDisabled: signal => signal.blockade !== 1
isDisabled: (signal, work) => {
if (work === 'localWork') {
return this.$store.state.training.roleDeviceCode === signal.stationCode && signal.blockade !== 1;
} else {
return signal.blockade !== 1;
}
}
},
{
label: this.$t('menu.menuSignal.signalReopen'),
handler: this.reopenSignal,
cmdType: CMD.Signal.CMD_SIGNAL_REOPEN_SIGNAL
cmdType: CMD.Signal.CMD_SIGNAL_REOPEN_SIGNAL,
isDisabled: (signal, work) => {
if (work === 'localWork') {
return this.$store.state.training.roleDeviceCode === signal.stationCode;
} else {
return false;
}
}
},
{
label: this.$t('menu.menuSignal.signalOff'),
handler: this.signalClose,
cmdType: CMD.Signal.CMD_SIGNAL_CLOSE_SIGNAL
cmdType: CMD.Signal.CMD_SIGNAL_CLOSE_SIGNAL,
isDisabled: (signal, work) => {
if (work === 'localWork') {
return this.$store.state.training.roleDeviceCode === signal.stationCode;
} else {
return false;
}
}
},
{
label: '进路引导',
handler: this.guide,
cmdType: CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE,
isDisabled: (signal, work) => this.$store.state.training.roleDeviceCode === signal.stationCode,
isShow: (signal, work) => work === 'localWork'
},
{
@ -109,28 +150,28 @@ export default {
label: this.$t('menu.menuSignal.setInterlockAutoRoute'),
handler: this.setAutoInterlock,
cmdType: CMD.Signal.CMD_SIGNAL_SET_CI_AUTO,
isDisabled: signal => signal.fleetMode === 1,
isDisabled: (signal, work) => this.$store.state.training.roleDeviceCode === signal.stationCode && signal.fleetMode === 1,
isShow: (signal, work) => work === 'localWork'
},
{
label: this.$t('menu.menuSignal.cancelInterlockAutoRoute'),
handler: this.cancelAutoInterlock,
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO,
isDisabled: signal => signal.fleetMode === 0,
isDisabled: (signal, work) => this.$store.state.training.roleDeviceCode === signal.stationCode && signal.fleetMode === 0,
isShow: (signal, work) => work === 'localWork'
},
{
label: this.$t('menu.menuSignal.setInterlockAutoTrigger'),
handler: this.setAutoTrigger,
cmdType: CMD.Signal.CMD_SIGNAL_SET_CI_AUTO_TRIGGER,
isDisabled: signal => signal.ciControl === 1,
isDisabled: (signal, work) => this.$store.state.training.roleDeviceCode === signal.stationCode && signal.ciControl === 1,
isShow: (signal, work) => work === 'localWork'
},
{
label: this.$t('menu.menuSignal.cancelInterlockAutoTrigger'),
handler: this.cancelAutoTrigger,
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO_TRIGGER,
isDisabled: signal => signal.ciControl !== 1,
isDisabled: (signal, work) => this.$store.state.training.roleDeviceCode === signal.stationCode && signal.ciControl !== 1,
isShow: (signal, work) => work === 'localWork'
},
{
@ -148,6 +189,13 @@ export default {
{
label: '查询进路控制模式',
handler: this.detail,
isDisabled: (signal, work) => {
if (work === 'localWork') {
return this.$store.state.training.roleDeviceCode === signal.stationCode;
} else {
return false;
}
},
cmdType: CMD.Signal.CMD_SIGNAL_DETAIL
}
],
@ -261,7 +309,7 @@ export default {
initMenu() {
this.menu = [];
this.menuNormal.forEach(menuItem => {
menuItem.disabled = menuItem.isDisabled ? menuItem.isDisabled(this.selected) : false;
menuItem.disabled = menuItem.isDisabled ? menuItem.isDisabled(this.selected, this.work) : false;
menuItem.show = menuItem.isShow ? menuItem.isShow(this.selected, this.work) : true;
this.menu.push(menuItem);
});

View File

@ -62,6 +62,7 @@ class Handler {
this.clear();
resolve({ valid, response });
}).catch(error => {
this.clear();
reject(error);
});
}

View File

@ -49,7 +49,8 @@ const training = {
notifySelected: null, // 场景弹窗内容
runPathList:[], // 运行线 (宁波三号线)
domConfig: {}, // 线路功能前端配置项
simulationUserType: '' // 仿真用户角色
simulationUserType: '', // 仿真用户角色
simulationCreator: false
},
getters: {
@ -214,9 +215,11 @@ const training = {
},
setSimulationUserList: (state, simulationUserList) => {
state.simulationUserType = '';
state.simulationCreator = false;
simulationUserList.forEach(item => {
if (item.userId == store.state.user.id ) {
state.simulationUserType = item.userType;
state.simulationCreator = item.creator;
}
});
state.simulationUserList = simulationUserList;

View File

@ -18,7 +18,7 @@ import { getSessionStorage } from '@/utils/auth';
import { mapGetters } from 'vuex';
import TerminalsPicture from './terminals/index';
import SimulationMenu from './simulationMenu/simulationMenu';
import { clearSimulation, getSimulationInfoNew} from '@/api/simulation';
import { getSimulationInfoNew, destroySimulationByAdmin, exitSimulation } from '@/api/simulation';
import { loadMapDataById, loadRunPlanData } from '@/utils/loaddata';
import { getByGroupStationList } from '@/api/jmap/map';
import { EventBus } from '@/scripts/event-bus';
@ -29,7 +29,6 @@ import TrainingMenu from './trainingList/trainingMenu';
import TrainingDesign from './trainingDesign/designPane.vue';
import VoiceChatBox from './voiceChatBox';
import DesignTrainingMenu from './trainingList/designTrainingMenu';
import { SimulationUserType } from '@/scripts/ConstDic';
export default {
name: 'DisplayDraft',
components: {
@ -100,8 +99,10 @@ export default {
this.$store.dispatch('trainingNew/clearStepOverCount');
this.$store.dispatch('trainingNew/trainingEnd');
this.$store.dispatch('trainingNew/changeTeachMode', '');
if (this.$store.state.training.simulationUserType === SimulationUserType.TEACHER) {
clearSimulation(this.group);
if (this.$store.state.training.simulationCreator) {
destroySimulationByAdmin(this.group);
} else {
exitSimulation(this.group);
}
},
methods:{

View File

@ -20,7 +20,6 @@
</div>
</template>
<script>
import { clearSimulation, ranAsPlan } from '@/api/simulation';
import { getSimulationQrcode } from '@/api/jointSimulation';
import { initSimulation } from '@/api/rtSimulation';
import ContectUs from './contectUs';
@ -34,6 +33,7 @@ import getErrorTip from '@/scripts/errorTip';
import DeviceManage from './deviceManage';
import QrCode from '@/components/QrCode';
import { SimulationUserType } from '@/scripts/ConstDic';
import { destroySimulationByAdmin, ranAsPlan} from '@/api/simulation';
export default {
name: 'SimulationMenu',
@ -103,10 +103,6 @@ export default {
},
beforeDestroy() {
window.removeEventListener('click', this.close);
this.$store.dispatch('socket/clearTrainingOverCount');
this.$store.dispatch('trainingNew/clearStepOverCount');
this.$store.dispatch('trainingNew/trainingEnd');
this.$store.dispatch('trainingNew/changeTeachMode', '');
},
methods: {
generateQrCode() {
@ -182,8 +178,8 @@ export default {
});
},
back() {
if (this.projectDevice && this.$route.query.type === 'IM') {
clearSimulation(this.group).then(() => {
if (this.projectDevice && this.$store.state.training.simulationCreator) {
destroySimulationByAdmin(this.group).then(() => {
this.logout();
});
} else if (this.projectDevice) {