剧本预览编制代码调整

This commit is contained in:
joylink_cuiweidong 2020-08-17 13:21:27 +08:00
parent c10588289a
commit 9080e14e2a
15 changed files with 532 additions and 330 deletions

View File

@ -750,10 +750,12 @@ const map = {
setActiveTrainList:(state) => {
state.activeTrainListUpdate++;
},
resetActiveTrainList:(state) => {
resetActiveTrainList:(state, isBack) => {
state.activeTrainList = [];
if (!isBack) {
state.activeTrainListUpdate = 0;
state.activeTrainListChange = 0;
}
},
setDeleteCount: (state) => {
state.deleteCount++;
@ -1047,8 +1049,8 @@ const map = {
setActiveTrainList: ({ commit }) => {
commit('setActiveTrainList');
},
resetActiveTrainList: ({ commit }) => {
commit('resetActiveTrainList');
resetActiveTrainList: ({ commit }, isBack) => {
commit('resetActiveTrainList', isBack);
},
setUpdateCount: ({ commit }) => {
commit('setUpdateCount');

View File

@ -26,8 +26,11 @@ function handle(state, data) {
case 'Simulation_User': // 仿真-进出仿真消息
handleSimulationUserinfo(state, msg); // 用户进出仿真消息
break;
case 'Simulation_Script_Tip': // 仿真-聊天界面用户进出仿真消息
handleSimulationScriptTipInfo(state, msg); // 用户进出仿真消息
case 'Simulation_Script_Action_Tip': // 剧本提示消息
handleSimulationScriptTipInfo(state, msg); // 剧本提示消息
break;
case 'Simulation_Script_Action_Finish':
state.simulationScriptTipFinish++; // 剧本某一部操作完成提示
break;
case 'Simulation_PlayBack_Finish': // 竞赛裁判系统裁判员回放结束推送
state.playBackFinish++; // 竞赛裁判系统裁判员回放结束推送
@ -208,6 +211,7 @@ const socket = {
roleList: [], // 设置角色信息
simulationRoleList:[], // 设置仿真的聊天角色信息
simulationScriptTip:{}, // 剧本推送提示信息
simulationScriptTipFinish:0, // 剧本某一步完成的消息
scriptFinish:0, // 剧本执行完成提示信息
autoFaultTrigger:0, // 自动故障触发操作推送消息
scriptAction:{}, // 剧本编制添加指令的推送消息

View File

@ -50,13 +50,11 @@
<div v-if="isShow">
<div class="userString">{{ userString }}</div>
<el-button :loading="loading" size="mini" type="primary" class="chat-box-create-coversite" @click="doCreate">创建会话</el-button>
<div v-if="scriptTip" class="scriptTip">{{ scriptTip }}</div>
</div>
<div v-else>
<div class="chat-box-footer-tool" />
<el-button v-if="isQuitShow" size="mini" type="danger" class="chat-box-footer-quit" :loading="loading" @click="quitConversition()">结束会话</el-button>
<el-button v-if="isStartRecord" class="chat-box-footer-send" size="mini" type="primary" :disabled="recordSending" @click="startRecording()">发送语音</el-button>
<div v-if="scriptTip" class="scriptTip">{{ scriptTip }}</div>
</div>
</div>
</div>
@ -105,10 +103,6 @@ export default {
type:Array,
required: true
},
scriptTip:{
type:String,
required:true
},
isStartRecord:{
type:Boolean,
required:true
@ -185,7 +179,6 @@ export default {
},
//
startRecording() {
this.$emit('setScriptTip', '');
const that = this;
if (!this.recordSending && !this.recorders && !this.microphone) {
this.$refs.chatSetting.doClose();
@ -454,30 +447,6 @@ export default {
cursor: no-drop;
}
.scriptTip{
position: absolute;
width: 260px;
padding: 10px;
background: rgb(250, 246, 3);
right: 7px;
bottom:45px;
border-radius: 5px;
font-size: 14px;
color: #000000;
z-index: 2;
}
.scriptTip::after{
content: '';
position: absolute;
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 8px solid #faf603;
right: 16px;
bottom: -7px;
}
.userString{
height: 50px;
width: 409px;

View File

@ -53,7 +53,7 @@
<script>
import Cookies from 'js-cookie';
import ConstConfig from '@/scripts/ConstConfig';
import {getScriptPageListOnlineNew, getDraftScriptByGroupNew, getScriptByIdNew } from '@/api/script';
import {getScriptPageListOnlineNew, getScriptByIdNew } from '@/api/script';
//
export default {
@ -175,7 +175,7 @@ export default {
},
async handleLoad(index, row) {
this.row = row;
const res = this.$route.fullPath.includes('design/displayNew/demon') ? await getDraftScriptByGroupNew(row.group) : await getScriptByIdNew(row.id);
const res = await getScriptByIdNew(row.id);
let newMemberList = [];
if (res.code == 200) {
if (res.data.memberList && res.data.memberList.length > 0) {

View File

@ -7,18 +7,15 @@
:conversition-id="conversitionId"
:current-member-list="currentMemberList"
:chat-content-list="chatContentList"
:script-tip="scriptTip"
:is-start-record="isStartRecord"
:invite-user-name="inviteUserName"
:is-quit-show="isQuitShow"
@setScriptTip="setScriptTip"
@resetCoversition="resetCoversition"
/>
</template>
<script>
import ChatBox from '../chatView/chatBox.vue';
import ConstConfig from '@/scripts/ConstConfig';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import Cookies from 'js-cookie';
import { getSimulationMemberList} from '@/api/simulation';
import {getAllConversition} from '@/api/chat';
@ -39,7 +36,6 @@ export default {
},
data() {
return {
scriptTip:'',
isHasCoversition:false,
conversitionId:'',
currentMemberList:[],
@ -165,7 +161,6 @@ export default {
},
//
'$store.state.socket.createConversition':function(val) {
this.scriptTip = '';
if (this.memberData.length > 0) {
const member = this.memberData.find(member=>{ return member.id == val.creatorId; });
if (member && member.userId == this.$store.state.user.id) {
@ -231,46 +226,6 @@ export default {
this.currentMemberList = memberList;
}
},
//
'$store.state.socket.simulationScriptTip':function(val, old) {
if (val) {
if (val.type == 'Conversation') {
this.scriptTip = '请说:' + val.content;
} else if (val.type == 'Operation') {
const commandName = val.operationType;
let device = val.operationType.split('_')[0];
if (device == 'CM') {
device = 'ControlConvertMenu';
}
const operateName = Object.values(CMD[device]).find(res=>{ return res.value == commandName; });
this.$messageBox('请执行【' + operateName.label + '】操作');
} else if (val.type == 'Over_Conversation') {
this.scriptTip = '请结束当前会话';
} else if (val.type == 'Start_Conversation' ) {
const inviteMember = [];
this.createCoversition = true;
val.conversationMemberIds.forEach(id=>{
if (val.memberId != id) {
inviteMember.push((this.memberData.find(member=>{ return member.id == id; }) || {label:''}).label );
}
});
this.scriptTip = '请创建会话,选择' + inviteMember.toString();
} else if (val.type == 'Command') {
const targetName = this.memberData.find(member=>{ return member.id == val.commandInitiateVO.targetMemberId; });
const CommandList = {
Drive_Ahead:'确认运行至前方站',
Route_Block_Drive:'进路闭塞法行车',
Drive_Through_The_Guide_Signal:'越引导信号行驶',
Drive_Through_The_Red_Light:'越红灯行驶',
Drive_In_Urm_Mode:'URM模式驾驶',
Set_Speed_Limit:'设置限速',
Open_Or_Close_Door:'开关门',
Switch_Hook_Lock: '道岔钩锁'
};
this.$messageBox('请对【' + targetName.label + '】下达【' + CommandList[val.commandInitiateVO.commandType] + '】指令');
}
}
},
//
'$store.state.socket.conversationInfo':function (val, old) { // 仿
const simulationText = this.$store.state.socket.conversationInfo;
@ -306,7 +261,6 @@ export default {
'$store.state.socket.overConversition': function (val) {
if (val.id === this.conversitionId) {
this.conversitionId = '';
this.scriptTip = '';
this.currentMemberList = [];
this.chatContentList = [];
this.isHasCoversition = false;
@ -330,9 +284,6 @@ export default {
mounted() {
},
methods:{
setScriptTip(scriptTip) {
this.scriptTip = scriptTip;
},
addContent(simulationText) {
const text = {};
const member = this.currentMemberList.find(member=>{
@ -353,7 +304,6 @@ export default {
},
resetCoversition() {
this.conversitionId = '';
this.scriptTip = '';
this.isHasCoversition = false;
this.currentMemberList = [];
this.chatContentList = [];

View File

@ -5,48 +5,57 @@
<map-system-draft ref="mapCanvas" @back="back" />
</transition>
<script-preview-chat ref="chatbox" :group="group" :user-role="userRole" :member-data="memberData" :tree-data="treeData" />
<script-preview-chat ref="chatbox" :group="group" :user-role="userRole" :member-data="memberData" :tree-data="treeData" :offset="offset" />
<div class="display-draft">
<el-button v-if="isscriptRun&&!dataError" type="danger" @click="handleQuitQuest">{{ $t('display.demon.exitScript') }}</el-button>
<el-button type="primary" @click="back">{{ $t('display.demon.back') }}</el-button>
</div>
<menu-schema
v-if="isDemon"
ref="menuSchema"
:offset="offset"
:offset-bottom="offsetBottom"
:show-station="showStation"
:station-list="stationListMode"
:show-select-station="showSelectStation"
@switchMode="switchMode"
@selectQuest="selectQuest"
@switchStationMode="switchStationMode"
/>
<div class="schema" :style="{top: offset+'px'}">
<template v-if="!dataError">
<el-button-group>
<el-button size="small" :disabled="viewDisabled || isscriptRun" type="success" @click="viewScriptRoles">{{ $t('display.schema.selectRoles') }}</el-button>
<!-- 运行图加载 -->
<el-button v-if="running" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('display.schema.previewRunDiagram') }}</el-button>
<el-button v-if="!running" size="small" type="warning" @click="loadRunPlan">{{ $t('display.schema.loadRunDiagram') }}</el-button>
<el-button v-if="faultMode" size="small" type="danger" @click="setFault">自动故障设置</el-button>
</el-button-group>
<el-button v-if="!isScheduling" size="small" :type="faultMode ? '':'primary' " @click="changeOperateMode()">{{ faultMode?'切换到普通模式':'切换到故障模式' }}</el-button>
</template>
</div>
<menu-system-time ref="menuSystemTime" :offset="offset" :group="group" />
</div>
<!-- <Jl3d-Simulation v-show="simulationShow" ref="Jl3dSimulation" :panel-show="simulationShow" @showpanel="showpanel" /> -->
<!-- <Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" /> -->
<select-role ref="selectRole" :member-list="memberList" @selectRole="selectRole" />
<run-plan-Load ref="runPlanLoad" :group="group" />
<run-plan-view ref="runPlanView" :group="group" />
<fault-choose ref="faultChoose" :group="group" :offset="offset" />
</div>
</template>
<script>
// 稿
import SelectRole from './selectRole';
import { getToken } from '@/utils/auth';
import RunPlanLoad from './demon/runPlanLoad';
import RunPlanView from './demon/runPlanView';
import ScriptPreviewChat from './scriptPreviewChat.vue';
import MapSystemDraft from '@/views/newMap/mapsystemNew/index';
import { quitScriptNew, scriptRePreview } from '@/api/simulation';
import MenuSchema from '@/views/newMap/displayNew/menuSchema';
import FaultChoose from './demon/faultChoose';
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
import { mapGetters } from 'vuex';
import { clearSimulation, getSimulationInfoNew } from '@/api/simulation';
import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
import { OperateMode } from '@/scripts/ConstDic';
import { loadNewMapDataByGroup } from '@/utils/loaddata';
import { EventBus } from '@/scripts/event-bus';
import { Notification } from 'element-ui';
import { getByGroupStationList } from '@/api/jmap/map';
import { getEveryDayRunPlanNew } from '@/api/simulation';
import {loadDraftScript, loadDraftScriptNew} from '@/api/designPlatform';
import {getDraftScriptByGroupNew } from '@/api/script';
import Vue from 'vue';
import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie';
@ -54,7 +63,6 @@ import Cookies from 'js-cookie';
// import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation';
// import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
import { timeFormat } from '@/utils/date';
export default {
name: 'DisplayDraft',
components: {
@ -62,8 +70,9 @@ export default {
RunPlanView,
ScriptPreviewChat,
MapSystemDraft,
MenuSchema,
MenuSystemTime
FaultChoose,
MenuSystemTime,
SelectRole
// Jl3dDrive
},
data() {
@ -76,6 +85,10 @@ export default {
dataError: false,
panelShow: true,
memberData:[],
faultMode: false,
viewDisabled: true,
mapLocation:{},
firstLoad: true,
// simulationShow: false,
// drivingShow: false,
isscriptRun:false, //
@ -91,7 +104,8 @@ export default {
},
userRole:'',
isDrive: this.prdType == '04',
treeData:[]
treeData:[],
memberList:[]
};
},
computed: {
@ -119,7 +133,6 @@ export default {
return this.$route.query.mapId;
},
prdType() {
// return this.$route.query.prdType;
return this.$store.state.training.prdType;
},
isDemon() {
@ -128,6 +141,12 @@ export default {
drawWay() {
const drawWay = this.$route.query.drawWay;
return drawWay && JSON.parse(drawWay);
},
running() {
return this.$store.state.training.started;
},
isScheduling() {
return this.$store.state.training.prdType === '05';
}
// isDrive() {
// return this.prdType == '04';
@ -149,12 +168,6 @@ export default {
this.setPosition();
this.setMode();
},
// '$store.state.training.prdType': function(val) {
// debugger;
// // this.prdType=val;
// this.isDrive = (val == '04');
// this.isShowScheduling = (val == '05');
// },
'$store.state.app.windowSizeCount': function() {
this.setWindowSize();
},
@ -165,6 +178,16 @@ export default {
// this.$nextTick(() => {
this.initLoadData();
// });
},
'$store.state.training.switchcount': async function () {
if (this.group) {
if (this.$store.state.training.started && !this.firstLoad) {
await this.loadRunData();
} else if (this.firstLoad) {
await this.loadRunData(this.$route.query);
}
this.firstLoad = false;
}
}
},
created() {
@ -181,6 +204,79 @@ export default {
this.$store.dispatch('scriptRecord/updateSimulationPause', false);
},
methods: {
viewScriptRoles() {
this.$refs.selectRole.doShow();
},
async selectRole(role) {
try {
const res = this.drawWay ? await loadDraftScriptNew(role.id, this.group) : await loadDraftScript(this.$route.query.scriptId, role.id, this.group);
if (res && res.code == 200) {
if (this.querymapLocation) {
const newMapLocation = {'offsetX': this.mapLocation.x, 'offsetY': this.mapLocation.y, 'scaleRate': this.mapLocation.scale};
Vue.prototype.$jlmap.setOptions(newMapLocation);
}
}
this.$store.dispatch('scriptRecord/updateBgSet', true);
this.isscriptRun = true;
if (role.type) {
const typeList = ConstConfig.ConstSelect.roleTypeNew;
typeList.forEach(type=>{
if (role.type == type.label) {
this.userRole = type.value;
}
});
let prdType;
if (this.userRole == '行值') {
prdType = '01';
this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR');
this.$store.dispatch('training/setRoleDeviceCode', role.deviceCode);
} else if (this.userRole == '行调') {
prdType = '02';
this.$store.dispatch('training/setRoles', 'DISPATCHER');
} else if (this.userRole == '司机') {
prdType = '04';
} else if (this.userRole == '通号') {
prdType = '';
const routeData = this.$router.resolve({
path:'/jlmap3d/maintainer',
query:{
mapid:this.$route.query.mapId,
group:this.group,
token:getToken(),
project: this.project,
noPreLogout: true
}
});
this.openWindow = window.open(routeData.href);
} else {
prdType = '';
}
this.switchMode(prdType);
this.memberData.map(member=>{
if (member.id == role.id) {
member.userId = this.$store.state.user.id;
member.name = this.$store.state.user.nickname;
member.disabled = true;
}
});
} else {
this.userRole = 'AUDIENCE';
this.switchMode('');
}
} catch (error) {
this.$messageBox(error.message);
}
},
changeOperateMode() {
this.faultMode = !this.faultMode;
let mode = OperateMode.NORMAL;
if (this.faultMode) {
mode = OperateMode.FAULT;
}
this.$store.dispatch('training/changeOperateMode', { mode: mode });
},
//
async initLoadData() {
this.setWindowSize();
@ -208,6 +304,11 @@ export default {
const resp = await getSimulationInfoNew(this.group);
if (resp && resp.code == 200 && resp.data && !resp.data.dataError) {
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause);
if (resp.data.planRunning) {
this.$store.dispatch('training/start');// 仿
} else {
this.$store.dispatch('training/over');// 仿
}
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
} else if (resp && resp.code == 200 && resp.data && resp.data.dataError) {
this.dataError = true;
@ -217,71 +318,28 @@ export default {
// 仿
async initLoadDemonData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL);
// this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
if (this.group) {
await this.loadNewMapDataByGroup(this.group);
await this.getDraftScriptByGroupNew(this.group);
this.switchMode('02');
} else {
this.endViewLoading();
}
},
// id
async loadNewMapDataByGroup(group) {
try {
await loadNewMapDataByGroup(group);
await this.$store.dispatch('training/setMapDefaultState');
} catch (error) {
this.$messageBox(`获取地图数据失败: ${error.message}`);
this.endViewLoading();
}
},
//
endViewLoading() {
this.$store.dispatch('map/mapClear');
this.$nextTick(() => {
EventBus.$emit('viewLoading', false);
});
},
setPosition() {
this.$nextTick(() => {
const menuBar = document.getElementById('menuBar');
const menuTool = document.getElementById('menuTool');
const menuBottom = document.getElementById('menuButton');
this.offset = 15 + (menuBar ? menuBar.offsetHeight || 0 : 0) + (menuTool ? menuTool.offsetHeight || 0 : 0);
this.offsetBottom = 15 + (menuBottom ? menuBottom.offsetHeight || 0 : 0);
});
},
async back() {
await clearSimulation(this.group);
this.$store.dispatch('training/over').then(() => {
history.go(-1);
Notification.closeAll();
});
},
//
async selectQuest(data) {
this.isscriptRun = true;
if (data.roleName) {
const typeList = ConstConfig.ConstSelect.roleTypeNew;
typeList.forEach(type=>{
if (data.roleName == type.label) {
this.userRole = type.value;
}
});
} else {
this.userRole = 'AUDIENCE';
}
async getDraftScriptByGroupNew(group) {
const resp = await getDraftScriptByGroupNew(group);
if (resp.code == 200) {
if (resp.data.memberList && resp.data.memberList.length > 0) {
this.$store.dispatch('training/setMemberList', {memberList:resp.data.memberList, userId:this.$store.state.user.id});
//
const memberList = this.$store.state.training.memberData;
if (data.id) {
memberList[data.id].userId = this.$store.state.user.id;
memberList[data.id].name = this.$store.state.user.nickname;
memberList[data.id].disabled = true;
}
// if (data.id) {
// memberList[data.id].userId = this.$store.state.user.id;
// memberList[data.id].name = this.$store.state.user.nickname;
// memberList[data.id].disabled = true;
// }
let lastData = JSON.stringify(memberList);
const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
roleTypeList.forEach(function(element) {
@ -356,7 +414,116 @@ export default {
children: maintainerList
}];
this.memberData = lastMemberList;
//
}
let newMemberList = [];
const activeMemberList = [];
resp.data.actionList.forEach((activeMember)=>{
if (!(activeMemberList.length > 0 && activeMemberList.includes(activeMember.memberId))) {
activeMemberList.push(activeMember.memberId);
}
});
const playerList = resp.data.memberList.filter(member=>{
return activeMemberList.includes(member.id);
});
playerList.map(member=>{
if (!member.deviceName && member.deviceCode) {
const device = this.$store.getters['map/getDeviceByCode'](member.deviceCode);
if (device.name) {
member.deviceName = device.name;
} else {
member.deviceName = member.deviceCode;
}
}
});
const lastData = JSON.stringify(playerList);
newMemberList = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew);
if (resp.data.mapLocation) {
this.mapLocation = resp.data.mapLocation;
}
this.memberList = newMemberList || [];
this.memberList.unshift({ id: '', label: this.$t('display.script.none'), role: 'no', disabled:false });
}
},
covert(data, roleTypeList) {
let lastData = data;
roleTypeList.forEach(function(element) {
const rolename = element.value;
if (Cookies.get('user_lang') == 'en') {
lastData = lastData.replace(new RegExp(rolename, 'g'), element.enLabel);
} else {
lastData = lastData.replace(new RegExp(rolename, 'g'), element.label);
}
});
lastData = JSON.parse(lastData);
lastData.forEach(each=>{
const name = each.name == undefined ? '' : '-' + each.name;
const deviceName = each.deviceName == undefined ? '' : '-' + each.deviceName;
each.label = each.type + deviceName + name;
each.disabled = false;
});
return lastData;
},
// id
async loadNewMapDataByGroup(group) {
try {
await loadNewMapDataByGroup(group);
await this.$store.dispatch('training/setMapDefaultState');
} catch (error) {
this.$messageBox(`获取地图数据失败: ${error.message}`);
this.endViewLoading();
}
},
loadRunData() {
this.$store.dispatch('runPlan/clear').then(() => {
if (this.group) {
this.viewDisabled = true;
//
getByGroupStationList(this.group).then(response => {
this.$store.dispatch('runPlan/setStations', response.data).then(() => {
getEveryDayRunPlanNew(this.group).then(resp => { // 仿
this.$store.dispatch('runPlan/setPlanData', resp.data);
this.$store.dispatch('runPlan/setInitialPlanData', resp.data);
this.viewDisabled = false;
}).catch(error => {
this.$store.dispatch('runPlan/setPlanData', []);
if (error.code == 30001) {
this.$messageBox(this.$t('display.schema.todayRunDiagramNoLoad'));
} else {
!this.dataError && this.$messageBox(this.$t('display.schema.getRunDiagramFail'));
}
});
});
}).catch(() => {
this.$messageBox(this.$t('display.schema.getStationListFail'));
});
}
});
},
//
endViewLoading() {
this.$store.dispatch('map/mapClear');
this.$nextTick(() => {
EventBus.$emit('viewLoading', false);
});
},
setPosition() {
this.$nextTick(() => {
const menuBar = document.getElementById('menuBar');
const menuTool = document.getElementById('menuTool');
const menuBottom = document.getElementById('menuButton');
this.offset = 15 + (menuBar ? menuBar.offsetHeight || 0 : 0) + (menuTool ? menuTool.offsetHeight || 0 : 0);
this.offsetBottom = 15 + (menuBottom ? menuBottom.offsetHeight || 0 : 0);
});
},
async back() {
await clearSimulation(this.group);
this.$store.dispatch('training/over').then(() => {
history.go(-1);
Notification.closeAll();
});
},
// 退
handleQuitQuest() {
@ -368,6 +535,11 @@ export default {
this.$store.dispatch('scriptRecord/updateBgSet', false);
this.userRole = '';
this.$refs.chatbox.clearAllData();
// if (resp.data.planRunning) {
// this.$store.dispatch('training/start');// 仿
// } else {
// this.$store.dispatch('training/over');// 仿
// }
}).catch(()=>{
this.$messageBox(this.$t('display.demon.exitTaskFail'));
});
@ -408,12 +580,15 @@ export default {
// this.panelShow = true;
// this.drivingShow = false;
// },
runPlanViewShow() {
viewRunPlan() {
this.$refs.runPlanView.doShow();
},
runPlanLoadShow() {
loadRunPlan() {
this.$refs.runPlanLoad.doShow();
},
setFault() {
this.$refs.faultChoose.doShow();
},
switchStationMode(val) {
if (val == null && this.stationListMode.length > 0) {
this.showStation = this.stationListMode[0].value;
@ -458,4 +633,15 @@ export default {
right: 20px;
bottom: 15px;
}
.schema {
z-index: 36;
display: inline;
position: absolute;
right: 5px;
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
/deep/ .el-button+.el-button {
margin-left: 0px;
}
</style>

View File

@ -180,6 +180,7 @@ export default {
clearTimeout(this.time);
}
this.$store.dispatch('scriptRecord/updateSimulationPause', false);
this.$store.dispatch('map/resetActiveTrainList', true);
},
mounted() {
this.$nextTick(() => {
@ -277,7 +278,7 @@ export default {
exitRunPlan(this.group).then(() => {
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => {
this.$store.dispatch('map/resetActiveTrainList');
this.$store.dispatch('map/resetActiveTrainList', false);
this.$store.dispatch('map/clearJlmapTrainView');
this.$store.dispatch('map/setTrainWindowShow', false);
});

View File

@ -1,17 +1,13 @@
<template>
<div>
<div class="schema" :style="{top: offset+'px'}">
<el-select v-if="isDesignPlatform" v-model="swch" size="small" :placeholder="$t('display.schema.selectProduct')" @change="switchMode">
<el-option v-for="item in swchList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
<el-select v-if="showSelectStation && isLocalStation && !isScript" v-model="showStationContent" style="width: 100px;" size="small" @change="switchStationModeInfo">
<el-option v-for="item in stationList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
<template v-if="!dataError">
<el-button-group>
<el-button v-if="isDemon && isDesignPlatform" size="small" :disabled="viewDisabled" type="success" @click="viewScriptRoles">{{ $t('display.schema.selectRoles') }}</el-button>
<!-- 加载剧本 -->
<el-button v-if="isDemon && !isDesignPlatform && !isScheduling" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">{{ $t('display.schema.loadScript') }}</el-button>
<el-button v-if="isDemon && !isScheduling" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">{{ $t('display.schema.loadScript') }}</el-button>
<!-- 运行图加载 -->
<el-button v-if="notScript && running" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('display.schema.previewRunDiagram') }}</el-button>
<el-button v-if="notScript && !running" size="small" type="warning" @click="loadRunPlan">{{ $t('display.schema.loadRunDiagram') }}</el-button>
@ -35,7 +31,6 @@ import FaultChoose from './demon/faultChoose';
import AddQuest from './demon/addQuest';
import { OperateMode } from '@/scripts/ConstDic';
import { getByGroupStationList } from '@/api/jmap/map';
import {loadDraftScript, loadDraftScriptNew} from '@/api/designPlatform';
import { getEveryDayRunPlanNew, loadScriptNew } from '@/api/simulation';
import Vue from 'vue';
@ -87,10 +82,6 @@ export default {
showStationContent:'',
isScriptCommand:false,
faultMode: false,
swchList: [
{ value: '01', name: '现地' },
{ value: '02', name: '行调' }
],
firstLoad: true
};
},
@ -107,9 +98,6 @@ export default {
isDemon() {
return this.$route.params.mode === 'demon';
},
isDesignPlatform() { //
return this.$route.fullPath.includes('design/displayNew/demon');
},
isScheduling() {
return this.$route.query.prdType === '05';
},
@ -206,18 +194,9 @@ export default {
viewRunQuest() {
this.$refs.addQuest.doShow();
},
viewScriptRoles() {
const row = {id: this.$route.query.scriptId, group:this.$route.query.group, drawWay:this.$route.query.drawWay};
this.$refs.addQuest.handleLoad(1, row);
},
async selectQuest(row, id, mapLocation, roleName) {
try {
let res;
if (this.isDesignPlatform) {
res = this.drawWay ? await loadDraftScriptNew(id, this.group) : await loadDraftScript(row.id, id, this.group);
} else {
res = await loadScriptNew(row.id, id, this.group);
}
const res = await loadScriptNew(row.id, id, this.group);
if (res && res.code == 200) {
this.questId = parseInt(row.id);
if (mapLocation) {
@ -231,10 +210,6 @@ export default {
this.$messageBox(error.message);
}
},
switchMode(swch) {
this.$emit('switchMode', swch);
this.switchModeInner(swch);
},
switchModeInner(swch) {
let showMode = '03';
if (swch == '01') {

View File

@ -1,7 +1,6 @@
<template>
<div>
<div class="display-draft">
<!-- :style="{bottom: offsetBottom + 'px'}" -->
<el-button-group>
<el-button v-if="!isScriptCommand" type="success" :disabled="isDisable || dataError" @click="selectBeginTime">{{ $t('scriptRecord.drivingByPlan') }}</el-button>
<el-button v-if="!isScriptCommand" type="danger" :disabled="dataError" @click="end">初始化</el-button>
@ -41,7 +40,7 @@ import { ranAsPlan, exitRunPlan } from '@/api/simulation';
import { mapGetters } from 'vuex';
export default {
name: 'MenuTask',
name: 'MenuScript',
components: {
SetTime,
ScriptChat,
@ -185,7 +184,7 @@ export default {
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => {
this.$store.dispatch('map/clearJlmapTrainView');
this.$store.dispatch('map/resetActiveTrainList');
this.$store.dispatch('map/resetActiveTrainList', false);
this.$store.dispatch('map/setTrainWindowShow', false);
});
});
@ -196,7 +195,6 @@ export default {
},
back() {
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('map/resetActiveTrainList');
history.go(-1);
Notification.closeAll();
});

View File

@ -7,11 +7,9 @@
:conversition-id="conversitionId"
:current-member-list="currentMemberList"
:chat-content-list="chatContentList"
:script-tip="scriptTip"
:is-start-record="isStartRecord"
:invite-user-name="inviteUserName"
:is-quit-show="isQuitShow"
@setScriptTip="setScriptTip"
@resetCoversition="resetCoversition"
/>
</template>
@ -38,7 +36,6 @@ export default {
},
data() {
return {
scriptTip:'',
isHasCoversition:false,
conversitionId:'',
currentMemberList:[],
@ -249,9 +246,6 @@ export default {
}
},
methods:{
setScriptTip(scriptTip) {
this.scriptTip = scriptTip;
},
addContent(simulationText) {
const text = {};
const member = this.currentMemberList.find(member=>{
@ -268,7 +262,6 @@ export default {
},
resetCoversition() {
this.conversitionId = '';
this.scriptTip = '';
this.isHasCoversition = false;
this.currentMemberList = [];
this.chatContentList = [];

View File

@ -1,4 +1,5 @@
<template>
<div>
<chat-box
ref="chatbox"
:group="group"
@ -7,21 +8,22 @@
:conversition-id="conversitionId"
:current-member-list="currentMemberList"
:chat-content-list="chatContentList"
:script-tip="scriptTip"
:is-start-record="isStartRecord"
:invite-user-name="inviteUserName"
:is-quit-show="isQuitShow"
@setScriptTip="setScriptTip"
@resetCoversition="resetCoversition"
/>
<script-tip ref="scriptTip" :offset="offset" :member-data="memberData" @allowCreatCoversition="allowCreatCoversition" />
</div>
</template>
<script>
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import ChatBox from '../chatView/chatBox.vue';
import ScriptTip from './scriptTip';
export default {
name:'ScriptPreviewChat',
components:{
ChatBox
ChatBox,
ScriptTip
},
props: {
group: {
@ -39,11 +41,14 @@ export default {
treeData:{
type: Array,
required: true
},
offset: {
type: Number,
required: true
}
},
data() {
return {
scriptTip:'',
isHasCoversition:false,
conversitionId:'',
currentMemberList:[],
@ -65,7 +70,7 @@ export default {
watch:{
//
'$store.state.socket.createConversition':function(val) {
this.scriptTip = '';
debugger;
if (this.memberData.length > 0) {
const member = this.memberData.find(member=>{ return member.id == val.creatorId; });
if (member && member.userId == this.$store.state.user.id) {
@ -125,46 +130,6 @@ export default {
this.currentMemberList = memberList;
}
},
//
'$store.state.socket.simulationScriptTip':function(val, old) {
if (val) {
if (val.type == 'Conversation') {
this.scriptTip = '请说:' + val.content;
} else if (val.type == 'Operation') {
const commandName = val.operationType;
let device = val.operationType.split('_')[0];
if (device == 'CM') {
device = 'ControlConvertMenu';
}
const operateName = Object.values(CMD[device]).find(res=>{ return res.value == commandName; });
this.$messageBox('请执行【' + operateName.label + '】操作');
} else if (val.type == 'Over_Conversation') {
this.scriptTip = '请结束当前会话';
} else if (val.type == 'Start_Conversation' ) {
const inviteMember = [];
this.createCoversition = true;
val.conversationMemberIds.forEach(id=>{
if (val.memberId != id) {
inviteMember.push((this.memberData.find(member=>{ return member.id == id; }) || {label:''}).label );
}
});
this.scriptTip = '请创建会话,选择' + inviteMember.toString();
} else if (val.type == 'Command') {
const targetName = this.memberData.find(member=>{ return member.id == val.commandInitiateVO.targetMemberId; });
const CommandList = {
Drive_Ahead:'确认运行至前方站',
Route_Block_Drive:'进路闭塞法行车',
Drive_Through_The_Guide_Signal:'越引导信号行驶',
Drive_Through_The_Red_Light:'越红灯行驶',
Drive_In_Urm_Mode:'URM模式驾驶',
Set_Speed_Limit:'设置限速',
Open_Or_Close_Door:'开关门',
Switch_Hook_Lock: '道岔钩锁'
};
this.$messageBox('请对【' + targetName.label + '】下达【' + CommandList[val.commandInitiateVO.commandType] + '】指令');
}
}
},
//
'$store.state.socket.conversationInfo':function (val, old) { // 仿
const simulationText = this.$store.state.socket.conversationInfo;
@ -175,12 +140,12 @@ export default {
//
'$store.state.socket.scriptFinish':function(val, old) {
this.$message('剧本执行完成');
this.$refs.scriptTip.resetScriptTip();
},
// 退
'$store.state.socket.overConversition': function (val) {
if (val.id === this.conversitionId) {
this.conversitionId = '';
this.scriptTip = '';
this.currentMemberList = [];
this.chatContentList = [];
this.isHasCoversition = false;
@ -201,9 +166,6 @@ export default {
}
},
methods:{
setScriptTip(scriptTip) {
this.scriptTip = scriptTip;
},
addContent(simulationText) {
const text = {};
const member = this.currentMemberList.find(member=>{
@ -224,7 +186,6 @@ export default {
},
resetCoversition() {
this.conversitionId = '';
this.scriptTip = '';
this.isHasCoversition = false;
this.currentMemberList = [];
this.chatContentList = [];
@ -232,6 +193,9 @@ export default {
this.inviteUserName = '';
this.inviteUser = {};
this.isQuitShow = false;
},
allowCreatCoversition() {
this.createCoversition = true;
}
}

View File

@ -0,0 +1,92 @@
<template>
<div v-if="scriptTipMessage!=''" class="scriptTipMessage" :style="{top:offset+'px'}">{{ scriptTipMessage }}</div>
</template>
<script>
import CMD from '@/scripts/cmdPlugin/CommandEnum';
export default {
name:'ScriptTip',
props: {
offset: {
type: Number,
required: true
},
memberData:{
type: Array,
required: true
}
},
data() {
return {
scriptTipMessage:''
};
},
watch:{
//
'$store.state.socket.simulationScriptTip':function(val, old) {
if (val) {
if (val.type == 'Conversation') {
this.scriptTipMessage = '请说:' + val.content;
} else if (val.type == 'Operation') {
const commandName = val.operationType;
let device = val.operationType.split('_')[0];
if (device == 'CM') {
device = 'ControlConvertMenu';
}
const operateName = Object.values(CMD[device]).find(res=>{ return res.value == commandName; });
this.scriptTipMessage = '请执行【' + operateName.label + '】操作';
} else if (val.type == 'Over_Conversation') {
this.scriptTipMessage = '请结束当前会话';
} else if (val.type == 'Start_Conversation' ) {
const inviteMember = [];
this.$emit('allowCreatCoversition');
val.conversationMemberIds.forEach(id=>{
if (val.memberId != id) {
inviteMember.push((this.memberData.find(member=>{ return member.id == id; }) || {label:''}).label );
}
});
this.scriptTipMessage = '请创建会话,选择' + inviteMember.toString();
} else if (val.type == 'Command') {
const targetName = this.memberData.find(member=>{ return member.id == val.commandInitiateVO.targetMemberId; });
const CommandList = {
Drive_Ahead:'确认运行至前方站',
Route_Block_Drive:'进路闭塞法行车',
Drive_Through_The_Guide_Signal:'越引导信号行驶',
Drive_Through_The_Red_Light:'越红灯行驶',
Drive_In_Urm_Mode:'URM模式驾驶',
Set_Speed_Limit:'设置限速',
Open_Or_Close_Door:'开关门',
Switch_Hook_Lock: '道岔钩锁'
};
this.scriptTipMessage = '请对【' + targetName.label + '】下达【' + CommandList[val.commandInitiateVO.commandType] + '】指令';
}
}
},
'$store.state.socket.simulationScriptTipFinish':function(val, old) {
//
this.scriptTipMessage = '';
}
},
methods:{
resetScriptTip() {
this.scriptTipMessage = '';
}
}
};
</script>
<style lang="scss" scoped>
.scriptTipMessage{
position: absolute;
width: 400px;
padding: 15px 15px 20px 15px;
background: rgba(255,255,255,0.97);
top: 100px;
left: 50%;
border-radius: 8px;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
color: #000;
line-height: 180%;
z-index: 10;
font-size: 14px;
}
</style>

View File

@ -0,0 +1,68 @@
<template>
<el-dialog
v-dialogDrag
:title="$t('display.script.roleSelect')"
:visible.sync="roleShow"
top="50px"
width="350px"
:before-do-close="roleDoClose"
:close-on-click-modal="false"
:z-index="5000"
>
<div>
<el-form ref="ruleForm" :model="form" label-width="50px">
<el-form-item :label="$t('display.script.role')" prop="role">
<el-select v-model="form.type" :placeholder="$t('display.script.pleaseSelect')">
<el-option
v-for="item in memberList"
:key="item.id"
:label="item.label"
:value="item.id"
:disabled="item.disabled"
/>
</el-select>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="roleDoClose">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" @click="confirm">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
name:'SelectRole',
props:{
memberList:{
type: Array,
default() {
return [];
}
}
},
data() {
return {
roleShow:false,
form: {
type: ''
}
};
},
methods:{
roleDoClose() {
this.$refs['ruleForm'].resetFields();
this.roleShow = false;
},
doShow() {
this.roleShow = true;
},
confirm() {
const role = this.memberList.find(elem=>{ return elem.id == this.form.type; });
this.$emit('selectRole', role);
this.roleDoClose();
}
}
};
</script>

View File

@ -215,7 +215,7 @@ export default {
this.$store.dispatch('training/setSimulationUserList', []);
this.$store.dispatch('training/over').then(() => {
this.backLoading = true;
this.$store.dispatch('map/resetActiveTrainList');
this.$store.dispatch('map/resetActiveTrainList', true);
if (this.$route.query.projectDevice) {
this.$store.dispatch('LogOut').then(() => {
location.reload();
@ -323,11 +323,11 @@ export default {
this.isDisable = false;
exitRunPlan(this.group).then(()=>{
this.$store.dispatch('map/setTrainWindowShow', false);
this.$store.dispatch('map/resetActiveTrainList');
this.$store.dispatch('map/resetActiveTrainList', false);
}).catch(() => {
this.$store.dispatch('training/over').then(() => {
this.isDisable = true;
this.$store.dispatch('map/resetActiveTrainList');
this.$store.dispatch('map/resetActiveTrainList', false);
this.$messageBox(this.$t('error.endSimulationFailed'));
});
});
@ -344,7 +344,7 @@ export default {
this.$store.dispatch('training/setSimulationUserList', []);
this.$store.dispatch('training/over').then(() => {
this.backLoading = true;
this.$store.dispatch('map/resetActiveTrainList');
this.$store.dispatch('map/resetActiveTrainList', true);
if (this.$route.query.projectDevice) {
this.$store.dispatch('LogOut').then(() => {
location.reload();

View File

@ -107,7 +107,7 @@ export default {
beforeDestroy() {
// this.clearAutoSave();
this.$store.dispatch('training/setMemberList', {memberList:[], userId:this.$store.state.user.id});
this.$store.dispatch('map/resetActiveTrainList');
this.$store.dispatch('map/resetActiveTrainList', true);
this.$store.dispatch('scriptRecord/updateBgSet', false);
this.$store.dispatch('scriptRecord/updateRole', null);
},