# Conflicts:
#	src/views/newMap/displayNew/index.vue
This commit is contained in:
zyy 2020-07-23 18:07:46 +08:00
commit e7ee0344b0
11 changed files with 379 additions and 52 deletions

View File

@ -196,6 +196,9 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
}
}
if(data.type == "Simulation_Reset"){
scope.deviceReset();
}
if(data.type == 'Simulation_Over'){
store.dispatch('LogOut').then(() => {
@ -595,14 +598,14 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
}
this.deviceFaultOver = function (data) {
if (data.type == "SIGNAL") {//从上往下红绿黄
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"];
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["yellow"];
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["green"];
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
}
// if (data.type == "SIGNAL") {//从上往下红绿黄
// scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"];
// scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
// scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["yellow"];
// scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
// scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["green"];
// scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
// }
if (data.type == "PSD" || data.type == "STAND") {
scope.modelmanager.standmodel.screenDoorOpenStatus = "1";
scope.modelmanager.standmodel.action.reset();
@ -612,6 +615,14 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
}
}
this.deviceReset = function () {
scope.modelmanager.standmodel.screenDoorOpenStatus = "1";
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration;
scope.modelmanager.standmodel.action.timeScale = -1;
scope.modelmanager.standmodel.action.play();
}
this.updateselect = function(updata){
if(helpbox){
scope.scene.remove( helpbox );

View File

@ -69,7 +69,6 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
let signaldata = JSON.parse(netdata.signals);
let standsdata = JSON.parse(netdata.stands);
let psddata = data.psdList;
assetloader.setModelListOver(JSON.parse(netdata.assets).sceneAssetList);
assetloader.assetPromiseOver(sceneload)

View File

@ -24,7 +24,6 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
//console.log(mapdata);
//console.log(data);
console.log(data);
let sceneload = scene;
let backdata = scope;
let jlmap3ddata = mapdata;
@ -70,6 +69,8 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
let signaldata = JSON.parse(netdata.signals);
let standsdata = JSON.parse(netdata.stands);
let psddata = data.psdList;
console.log(standsdata);
assetloader.setModelListOver(JSON.parse(netdata.assets).sceneAssetList);
// assetloader.setmodellistnew(netdata.assets);

View File

@ -170,8 +170,8 @@ class ESafeDoor extends Group {
}
hide() {
this.stand1 && this.stand1.setStyle('fill', style.transparentColor);
this.stand2 && this.stand2.setStyle('fill', style.transparentColor);
this.stand1 && this.stand1.hide();
this.stand2 && this.stand2.hide();
this.safeL && this.safeL.hide();
this.safeC && this.safeC.hide();
this.safeR && this.safeR.hide();
@ -179,8 +179,8 @@ class ESafeDoor extends Group {
this.safeB && this.safeB.hide();
}
show() {
this.stand1 && this.stand1.setStyle('fill', style.StationStand.safetyDoor.defaultColor);
this.stand2 && this.stand2.setStyle('fill', style.StationStand.safetyDoor.defaultColor);
this.stand1 && this.stand1.show();
this.stand2 && this.stand2.show();
this.safeL && this.safeL.show();
this.safeC && this.safeC.show();
this.safeR && this.safeR.show();

View File

@ -229,7 +229,7 @@ const training = {
state.simulationUserList = simulationUserList;
},
updateMemberTrust:(state, {deviceCode, trust}) => {
for(let k in state.memberData){
for (const k in state.memberData) {
if (state.memberData[k].deviceCode == deviceCode) {
state.memberData[k].trust = trust;
break;

View File

@ -0,0 +1,335 @@
<template>
<chat-box
ref="chatbox"
:group="group"
:is-show="isShow"
:tree-data="treeData"
:offset-bottom="offsetBottom"
: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';
// getAllSimulationUser
import { getSimulationMemberList} from '@/api/simulation';
export default {
name:'DemonChat',
components:{
ChatBox
},
props: {
group: {
type: String,
required: true
},
userRole: {
type: String,
required: true
},
offsetBottom:{
type: Number,
required: true
}
},
data() {
return {
scriptTip:'',
isHasCoversition:false,
conversitionId:'',
currentMemberList:[],
memberData:{},
chatContentList:[],
isStartRecord:false,
inviteUserName:'',
createCoversition:true,
inviteUser:{},
isQuitShow:false,
treeData:[],
driverList:[]
};
},
computed:{
isShow() {
return this.userRole != '' &&
this.userRole != 'ADMIN' && this.userRole != 'AUDIENCE' &&
!this.isHasCoversition && this.createCoversition;
}
},
watch:{
'$store.state.map.mapViewLoadedCount': function (val) { //
getSimulationMemberList(this.group).then(resp => {
let lastData = JSON.stringify(resp.data);
const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
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);
const lastMemberList = [];
const dispatcherList = [];
const electricDispatcherList = [];
const depotDispatcherList = [];
const stationSupervisorList = [];
this.driverList = [];
const maintainerList = [];
this.treeData = [];
lastData.forEach((member, index)=>{
if (member.type != '观众') {
if (!member.userId) {
member.userId = '';
member.disabled = false;
} else {
member.disabled = true;
}
const name = member.name == undefined ? '' : '-' + member.name;
if (member.deviceCode) {
const device = this.$store.getters['map/getDeviceByCode'](member.deviceCode);
if (device) {
if (device._type == 'Train') {
member.memberName = member.type + device.groupNumber + name;
lastMemberList.push(member);
member.label = member.memberName;
this.driverList.push(member);
} else {
member.memberName = member.type + device.name + name;
lastMemberList.push(member);
if (device._type == 'Station') {
member.label = member.memberName;
stationSupervisorList.push(member);
}
}
} else {
member.memberName = member.type + member.deviceCode + name;
lastMemberList.push(member);
}
} else {
member.memberName = member.type + name;
member.label = member.memberName;
if (member.type == '行调') {
dispatcherList.push(member);
} else if (member.type == '通号') {
maintainerList.push(member);
}
lastMemberList.push(member);
}
}
});
this.treeData = [{
label: '行调',
id: 'dispatcher',
type: 'role',
children: dispatcherList
}, {
label: '车站值班员',
id: 'stationSupervisor',
type: 'role',
children: stationSupervisorList
}, {
label: '司机',
id: 'driver',
type: 'role',
children: []
}, {
label: '通号',
id: 'maintainer',
type: 'role',
children: maintainerList
}];
this.memberData = lastMemberList;
}).catch(() => {
this.$messageBox('获取仿真成员列表失败!');
});
},
//
'$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) {
//
this.isHasCoversition = true;
this.isStartRecord = true;
this.isQuitShow = true;
this.conversitionId = val.id;
const memberList = [];
val.memberIds.forEach(id=>{
if (val.creatorId == id) {
member.connect = true;
memberList.push(member);
} else {
const member = this.memberData.find(member=>{ return member.id == id; });
member.connect = false;
member && memberList.push(member);
}
});
this.currentMemberList = memberList;
} else {
//
if (this.userRole == 'AUDIENCE') {
this.isHasCoversition = true;
this.currentMemberList = this.memberData;
}
}
}
},
//
'$store.state.socket.acceptConversionInvite':function(val) {
if (this.conversitionId) {
let result = false;
//
const memberList = this.currentMemberList.map(member => {
if (member.id == val.memberId) {
member.connect = true;
result = true;
}
return member;
});
//
if (!result && this.conversitionId) {
const member = this.memberData.find(member=>{ return member.id == val.memberId; });
if (member) {
member.connect = true;
memberList.push(member);
//
if (member.userId == this.$store.state.user.id) {
memberList.push(this.inviteUser);
this.inviteUser = {};
this.isStartRecord = true;
this.isQuitShow = true;
}
}
}
this.currentMemberList = memberList;
}
},
//
'$store.state.socket.simulationScriptTip':function(val, old) {
if (val) {
if (val.type == 'Conversation') {
this.scriptTip = '请说:' + val.content;
} else if (val.type == 'Command') {
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();
}
}
},
//
'$store.state.socket.conversationInfo':function (val, old) { // 仿
const simulationText = this.$store.state.socket.conversationInfo;
if (val.messageType == 'MESSAGE' && (this.conversitionId == val.id || this.userRole == 'AUDIENCE')) {
this.chatContentList.push(this.addContent(simulationText.message));
}
},
// ()
'$store.state.map.activeTrainListChange': function (val) {
const activeTrainList = this.$store.state.map.activeTrainList;
const driverList = [];
if (activeTrainList && activeTrainList.length) {
activeTrainList.forEach(groupNumber => {
const drivers = this.driverList.find(driver=>{
return driver.deviceCode == groupNumber;
});
if (drivers) {
driverList.push(drivers);
}
});
}
this.treeData[2].children = driverList;
},
//
'$store.state.socket.scriptFinish':function(val, old) {
this.$message('剧本执行完成');
},
// 退
'$store.state.socket.overConversition': function (val) {
if (val.id === this.conversitionId) {
this.conversitionId = '';
this.scriptTip = '';
this.currentMemberList = [];
this.chatContentList = [];
this.isHasCoversition = false;
this.isStartRecord = false;
}
},
//
'$store.state.socket.inviteSimulationConversition':function(val) {
const member = this.memberData.find(member=>{ return member.id == val.creatorId; });
if (member) {
this.inviteUserName = member.label;
this.conversitionId = val.id;
member.connect = true;
this.inviteUser = member;
this.$refs.chatbox.inviteMember();
}
}
},
mounted() {
},
methods:{
setScriptTip(scriptTip) {
this.scriptTip = scriptTip;
},
addContent(simulationText) {
const text = {};
const member = this.currentMemberList.find(member=>{
return member.id == simulationText.memberId;
});
if (member) {
text.self = (this.$store.state.user.id == member.userId);
text.member = member;
text.chatTime = simulationText.time;
text.src = simulationText.audioPath;
text.message = simulationText.content;
}
return text;
},
clearAllData() {
this.resetCoversition();
},
resetCoversition() {
this.conversitionId = '';
this.scriptTip = '';
this.isHasCoversition = false;
this.currentMemberList = [];
this.chatContentList = [];
this.isStartRecord = false;
this.inviteUserName = '';
this.createCoversition = true;
this.inviteUser = {};
this.isQuitShow = false;
}
}
};
</script>

View File

@ -286,6 +286,7 @@ export default {
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;
}
let lastData = JSON.stringify(memberList);

View File

@ -107,7 +107,7 @@ import MenuPractice from '@/views/newMap/displayNew/menuPractice';
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
import Jl3dDevice from '@/views/jlmap3d/device/jl3ddevice';
import Scheduling from './demon/scheduling';
import { clearSimulation, getSimulationInfoNew, getSimulationMemberList, getAllSimulationUser} from '@/api/simulation';
import { clearSimulation, getSimulationInfoNew} from '@/api/simulation';
import { getTrainingDetailNew } from '@/api/jmap/training';
// loadScriptNew, , scriptExecuteNew
import { mapGetters } from 'vuex';
@ -281,7 +281,6 @@ export default {
} else {
await this.initLoadLessonOrExamData();
}
this.initMemberUserInfo();
} catch (error) {
this.$messageBox(`初始化失败: ${error.message}`);
this.endViewLoading();
@ -349,18 +348,6 @@ export default {
this.endViewLoading();
}
},
initMemberUserInfo() {
getSimulationMemberList(this.$route.query.group).then(resp => {
this.$store.dispatch('training/setMemberList', {memberList:resp.data, userId: this.$store.state.user.id});
}).catch(() => {
this.$messageBox('获取仿真成员列表失败!');
});
getAllSimulationUser(this.$route.query.group).then(resp => {
this.$store.dispatch('training/setSimulationUserList', resp.data);
}).catch(() => {
this.$messageBox('获取所有仿真用户失败!');
});
},
//
async initPracticeData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL);

View File

@ -1,6 +1,6 @@
<template>
<div>
<chat-box ref="chatbox" :group="group" :user-role="userRole" />
<demon-chat ref="chatbox" :group="group" :user-role="userRole" :offset-bottom="offsetBottom" />
<div class="display-card" :style="{top: offset+'px'}">
<el-row>
<span v-if="countTime" class="display-score">{{ $t('display.demon.trialTime') }} {{ countTime }}</span>
@ -24,7 +24,6 @@
<el-button type="primary" @click="back">{{ projectDevice?'退出':$t('display.demon.back') }}</el-button>
</el-button-group>
</div>
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
</div>
@ -33,7 +32,7 @@
<!-- 单人仿真 -->
<script>
import SetTime from './demon/setTime';
import ChatBox from '../jointTrainingNew/chatView/chatBox';
import DemonChat from './demonChat';
import { Notification } from 'element-ui';
import { getGoodsTryUse } from '@/api/management/goods';
import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@/api/simulation';
@ -46,7 +45,7 @@ export default {
name: 'MenuDemon',
components: {
SetTime,
ChatBox
DemonChat
},
props: {
offset: {

View File

@ -1,11 +1,6 @@
<template>
<div>
<div class="display-draft" :style="{bottom: offsetBottom + 'px'}">
<!-- <el-button-group>
<el-button type="primary" @click="saveScenesStage" v-if="isSaveStage">保存背景</el-button>
<el-button type="success" @click="saveScenesData" v-else>保存数据</el-button>
<el-button type="danger" @click="dumpScenesData">重置剧本</el-button>
</el-button-group> -->
<el-button-group>
<el-button type="jumpjlmap3d" @click="jumpjlmap3d">{{ $t('joinTraining.driverPerspective') }}</el-button>
<el-button v-if="!isScriptCommand" type="success" :disabled="isDisable || dataError" @click="selectBeginTime">{{ $t('scriptRecord.drivingByPlan') }}</el-button>

View File

@ -239,7 +239,6 @@ export default {
} else if (val.type == 'Over_Conversation') {
this.scriptTip = '请结束当前会话';
} else if (val.type == 'Start_Conversation' ) {
debugger;
const inviteMember = [];
val.conversationMemberIds.forEach(id=>{
if (val.memberId != id) {