剧本代码调整

This commit is contained in:
joylink_cuiweidong 2020-05-15 20:45:59 +08:00
parent b1ca16b62f
commit 8059353f06
8 changed files with 61 additions and 14 deletions

View File

@ -29,6 +29,9 @@ function handle(state, data) {
case 'Simulation_Script_Tip': // 仿真-聊天界面用户进出仿真消息
handleSimulationScriptTipInfo(state, msg); // 用户进出仿真消息
break;
case 'Simulation_Script_Finish': // 剧本执行完成推送消息
state.scriptFinish++; // 剧本执行完成推送消息
break;
case 'Simulation_RunFact': // 仿真-列车实际到发车站消息
// let runFactMsg = msg;
// if (runFactMsg.constructor !== Array ) {
@ -195,6 +198,7 @@ const socket = {
roleList: [], // 设置角色信息
simulationRoleList:[], // 设置仿真的聊天角色信息
simulationScriptTip:{}, // 剧本推送提示信息
scriptFinish:0, // 剧本执行完成提示信息
jointRoomPrepare: false, // 演练房间准备状态
equipmentStatus: [], // 仿真-设备状态消息
trainStationList: [], // 仿真-列车实际到发车站消息

View File

@ -46,6 +46,7 @@
</div>
</template>
<script>
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import ChatSetting from './chatSetting';
import ChatContent from './chatContent';
import ChatMemberList from './chatMemberList';
@ -99,16 +100,26 @@ export default {
if (target && target.length > 0) {
this.scriptTip = '请对' + target[0].memberName + '说:' + val.reply;
}
} else if (val.type == 'Command') {
const device = val.operationType.split('_')[0];
const operate = 'CMD_' + val.operationType.toUpperCase();
this.$messageBox('请执行【' + CMD[device][operate].label + '】操作');
}
}
},
'$store.state.socket.scriptFinish':function(val, old) {
this.$message('剧本执行完成');
}
},
mounted() {
this.initPage();
},
methods:{
async initPage() {
this.cancleRecording();
this.scriptTip = '';
},
handleMinimality(data) {
if (data == 'min') {
@ -138,6 +149,12 @@ export default {
changeCoversition(data) {
this.$refs.chatCoversitionList.changeCoversitionOther(data);
},
clearAllData() {
this.initPage();
this.$refs.chatCoversitionList.initPage(true);
this.$refs.chatMemberList.getSimulationMembers();
this.$refs.chatContent.clearData();
},
//
startRecording() {
this.scriptTip = '';

View File

@ -43,9 +43,11 @@ export default {
if (this.currentCoversition.id == val.id) {
this.chatContentList.push(simulationText);
} else {
this.$emit('changeCoversition', simulationText);
// this.$emit('addCoversition', {data:simulationText, headerTitle:''});
this.chatContentList.push(simulationText);
if (!simulationText.group) {
this.$emit('changeCoversition', simulationText);
// this.$emit('addCoversition', {data:simulationText, headerTitle:''});
this.chatContentList.push(simulationText);
}
}
},
$route() {
@ -83,6 +85,9 @@ export default {
// // console.log('inintData---coversitionList' + JSON.stringify(this.$store.state.socket.coversitionList[this.coversition.id]));
// this.chatContentList = coversitionList;
},
clearData() {
this.chatContentList = [];
},
formatTime(time) {
return /\d{2}:\d{2}:\d{2}/.exec(time)[0] || time;
},

View File

@ -212,7 +212,7 @@ export default {
},
checkDisabled(role) {
if (!this.$route.fullPath.includes('design/display/demon')) {
if (!this.$route.fullPath.includes('design/displayNew/demon')) {
if (this.$route.query.prdType == '01') {
return role !== 'Attendant' && role !== 'no';
} else if (this.$route.query.prdType == '02') {
@ -220,6 +220,15 @@ export default {
} else if (this.$route.query.prdType == '04') {
return role !== 'Driver' && role !== 'no';
}
} else {
const prdType = this.$store.state.training.prdType;
if ( prdType == '01') {
return role !== '行值' && role !== 'no';
} else if (prdType == '02') {
return role !== '行调' && role !== 'no';
} else if (prdType == '04') {
return role !== '司机' && role !== 'no';
}
}
},

View File

@ -187,7 +187,7 @@ export default {
});
await this.setWindowSize();
await this.initLoadData();
this.switchMode('');
this.switchMode('01');
},
async beforeDestroy() {
await this.clearAllTimer();
@ -306,7 +306,7 @@ export default {
async initLoadDemonData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
this.$store.dispatch('training/setPrdType', this.prdTypeMap[this.prdType]);
// this.$store.dispatch('training/setPrdType', this.prdTypeMap[this.prdType]);
if (this.group) {
await this.loadNewMapDataByGroup(this.group);
@ -356,6 +356,7 @@ export default {
}
if (this.drawWay) {
scriptExecuteNew(this.group).then(data=>{
this.$refs.menuDemon.clearAllData();
}).catch(error=>{
console.log(error);
});

View File

@ -1,6 +1,6 @@
<template>
<div>
<chat-box :group="group" />
<chat-box ref="chatbox" :group="group" />
<div class="display-card" :style="{top: offset+'px'}">
<el-row>
<span v-if="countTime" class="display-score">{{ $t('display.demon.trialTime') }} {{ countTime }}</span>
@ -36,7 +36,7 @@ import SetTime from './demon/setTime';
import ChatBox from './chatView/chatBox';
import { Notification } from 'element-ui';
import { getGoodsTryUse } from '@/api/management/goods';
import { ranAsPlan, exitRunPlan, clearSimulation } from '@/api/simulation';
import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@/api/simulation';
import { PermissionType } from '@/scripts/ConstDic';
import { getCountTime } from '@/utils/index';
import { quitScriptNew, scriptRePreview } from '@/api/simulation';
@ -230,8 +230,12 @@ export default {
if (this.$route.fullPath.includes('design/displayNew/demon') ) {
quitScriptNew(this.group).then(resp => {
scriptRePreview(this.group).then(resp=>{
this.$emit('quitQuest');
this.initLoadPage();
getSimulationInfoNew(this.group).then(()=>{
this.$emit('quitQuest');
this.initLoadPage();
}).catch(()=>{
this.$messageBox(this.$t('display.demon.exitTaskFail'));
});
}).catch(()=>{
this.$messageBox(this.$t('display.demon.exitTaskFail'));
});
@ -240,13 +244,20 @@ export default {
});
} else {
quitScriptNew(this.group).then(resp => {
this.$emit('quitQuest');
this.initLoadPage();
getSimulationInfoNew(this.group).then(()=>{
this.$emit('quitQuest');
this.initLoadPage();
}).catch(()=>{
this.$messageBox(this.$t('display.demon.exitTaskFail'));
});
}).catch(() => {
this.$messageBox(this.$t('display.demon.exitTaskFail'));
});
}
},
clearAllData() {
this.$refs.chatbox.clearAllData();
},
async back() {
await clearSimulation(this.group);
this.$store.dispatch('training/over').then(() => {

View File

@ -1,7 +1,7 @@
<template>
<div>
<div class="schema" :style="{top: offset+'px'}">
<el-select v-if="isScript" v-model="swch" size="small" :placeholder="$t('display.schema.selectProduct')" @change="switchMode">
<el-select v-if="isScript || 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" v-model="showStation" style="width: 100px;" size="small" @change="switchStationMode">