This commit is contained in:
fan 2020-08-27 17:21:13 +08:00
commit 3c016a5c4b
34 changed files with 430 additions and 359 deletions

View File

@ -333,19 +333,22 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
for(let i=0,leni=stationList.length;i<leni;i++){ for(let i=0,leni=stationList.length;i<leni;i++){
if(stationList[i].code == event.data.stationcode){ if(stationList[i].code == event.data.stationcode){
scope.nowstation = stationList[i]; scope.nowstation = stationList[i];
let stationworket = { let stationworket = {
type:'station', type:'station',
station:scope.nowstation station:scope.nowstation
}; };
let voicetext = scope.nowstation.name.split("");
localVoicePlay("列车即将进站"+voicetext[0]);
vrwebworker.postMessage(stationworket); vrwebworker.postMessage(stationworket);
vrPlane.updataStationMsg(scope.nowstation); vrPlane.updataStationMsg(scope.nowstation);
trainControl.toptrain.position.x = 20000; trainControl.toptrain.position.x = 20000;
trainControl.downtrain.position.x = 20000; trainControl.downtrain.position.x = 20000;
let voicetext = scope.nowstation.name.split("");
localVoicePlay("列车即将进站"+voicetext[0]);
trainControl.toptrain.status = "0"; trainControl.toptrain.status = "0";
trainControl.downtrain.status = "0"; trainControl.downtrain.status = "0";
scope.nowStationModel.getObjectByName("zhantaiming").material.map = scope.stationtexture[scope.nowstation.code]; scope.nowStationModel.getObjectByName("zhantaiming").material.map = scope.stationtexture[scope.nowstation.code];
@ -370,7 +373,12 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
let voicetext = scope.nowstation.name.split(""); let voicetext = scope.nowstation.name.split("");
localVoicePlay("列车即将进站"+voicetext[0]); localVoicePlay("列车即将进站"+voicetext[0]);
if(positionStatus == "topfloor"){
trainControl.sound.pause();
}
if(positionStatus == "downfloor"){
trainControl.sound.pause();
}
vrwebworker.postMessage(stationworket); vrwebworker.postMessage(stationworket);
vrPlane.updataStationMsg(scope.nowstation); vrPlane.updataStationMsg(scope.nowstation);
trainControl.toptrain.position.x = 20000; trainControl.toptrain.position.x = 20000;
@ -385,8 +393,7 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
} }
if(event.data.type == "topTrain"){ if(event.data.type == "topTrain"){
console.log(event.data);
console.log(trainControl.toptrain.status);
if(trainControl.toptrain.status != 1){ if(trainControl.toptrain.status != 1){
trainControl.toptrain.position.copy(trainControl.toptrain.curve.getPointAt(event.data.offset)); trainControl.toptrain.position.copy(trainControl.toptrain.curve.getPointAt(event.data.offset));
} }
@ -401,10 +408,8 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
if(event.data.type == "topTrainDoor"){ if(event.data.type == "topTrainDoor"){
console.log(event.data);
if(event.data.open == "0"){ if(event.data.open == "0"){
trainControl.closetraindoor(trainControl.toptrain,event.data.doorCode,"top"); trainControl.closetraindoor(trainControl.toptrain,event.data.doorCode,positionStatus,"top");
// trainLeaveStation("top"); // trainLeaveStation("top");
}else{ }else{
trainControl.opentraindoor(trainControl.toptrain,event.data.doorCode,"top"); trainControl.opentraindoor(trainControl.toptrain,event.data.doorCode,"top");
@ -414,7 +419,7 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
} }
if(event.data.type == "downTrainDoor"){ if(event.data.type == "downTrainDoor"){
if(event.data.open == "0"){ if(event.data.open == "0"){
trainControl.closetraindoor(trainControl.downtrain,event.data.doorCode,"down"); trainControl.closetraindoor(trainControl.downtrain,event.data.doorCode,positionStatus,"down");
// trainLeaveStation("down"); // trainLeaveStation("down");
}else{ }else{
trainControl.opentraindoor(trainControl.downtrain,event.data.doorCode,"down"); trainControl.opentraindoor(trainControl.downtrain,event.data.doorCode,"down");
@ -580,7 +585,7 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
floors.push(navmesh.children[0]); floors.push(navmesh.children[0]);
let detectedVRDevices;
let timer=setInterval(function(){ let timer=setInterval(function(){
if(scope.stationtexture["stationlist"]){ if(scope.stationtexture["stationlist"]){
@ -597,7 +602,23 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
scope.scene.add( vrPlane.group ); scope.scene.add( vrPlane.group );
vrwebworker.postMessage("connect"); vrwebworker.postMessage("connect");
setInterval(function(){
let cameraVr = scope.renderer.vr.getCamera(scope.camera);
let postData = {
type:"syn",
url:"/app/simulation/"+group+"/vr",
dataObject:{
type:"pos",
pos:human.position,
camerapos:cameraVr.position,
camerarot:cameraVr.rotation._y,
}
};
vrwebworker.postMessage(postData);
},1000);
animate(); animate();
clearInterval(timer); clearInterval(timer);
} }
@ -952,7 +973,7 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
} }
var object = intersection.object; var object = intersection.object;
console.log(intersection.point);
if(positionStatus == "dm"){ if(positionStatus == "dm"){
human.position.set( intersection.point.x, intersection.point.y+0.6, intersection.point.z ); human.position.set( intersection.point.x, intersection.point.y+0.6, intersection.point.z );
@ -1275,7 +1296,7 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
} }
} }
console.log(stationList);
scope.nowstation = stationList[0]; scope.nowstation = stationList[0];
let stationworket = { let stationworket = {
type:'station', type:'station',
@ -1347,8 +1368,7 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
function setTextVr(intersects,plane){ function setTextVr(intersects,plane){
console.log(intersects);
console.log(plane);
if(intersects.text){ if(intersects.text){
let textgeometry = new THREE.PlaneBufferGeometry( 1.2, 0.8, 1 ); let textgeometry = new THREE.PlaneBufferGeometry( 1.2, 0.8, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(intersects)); let textt = new THREE.CanvasTexture(getTextCanvas(intersects));

View File

@ -56,6 +56,9 @@ let floors = [];
window.speechSynthesis.getVoices() window.speechSynthesis.getVoices()
let voices = speechSynthesis.getVoices(); let voices = speechSynthesis.getVoices();
//通号人物
let maintainerHuman = null;
let maintainerGroup = new THREE.Group();
export function Jl3dOtherVR(dom,group,skinCode) { export function Jl3dOtherVR(dom,group,skinCode) {
var scope = this; var scope = this;
@ -178,7 +181,15 @@ export function Jl3dOtherVR(dom,group,skinCode) {
otherVrViewWorker.postMessage(connectmsg); otherVrViewWorker.postMessage(connectmsg);
otherVrViewWorker.onmessage = function (event) { otherVrViewWorker.onmessage = function (event) {
// maintainerHuman
console.log(event.data);
if(event.data.type == "VR_Sync_3D"){
console.log(event.data);
humanMove(event.data);
}
if(event.data.type == "Device_Fault_Set_3D"){ if(event.data.type == "Device_Fault_Set_3D"){
let newfault = { let newfault = {
code:event.data.body.code, code:event.data.body.code,
@ -488,7 +499,10 @@ export function Jl3dOtherVR(dom,group,skinCode) {
scope.nowStationModel.getObjectByName("zhantaiming").material.map = scope.stationtexture[scope.nowstation.code]; scope.nowStationModel.getObjectByName("zhantaiming").material.map = scope.stationtexture[scope.nowstation.code];
scope.nowStationModel.getObjectByName("zhantaiming").material.map.needsUpdate = true; scope.nowStationModel.getObjectByName("zhantaiming").material.map.needsUpdate = true;
scope.scene.add(scope.modelmanager.otherDevice.mesh); scope.scene.add(scope.modelmanager.otherDevice.mesh);
maintainerHuman = scope.modelmanager.human.mesh;
initHumanAnimation();
maintainerGroup.add(maintainerHuman);
scope.scene.add(maintainerGroup);
otherVrViewWorker.postMessage("connect"); otherVrViewWorker.postMessage("connect");
animate(); animate();
clearInterval(timer); clearInterval(timer);
@ -547,6 +561,7 @@ export function Jl3dOtherVR(dom,group,skinCode) {
moveanima.animateupdate(); moveanima.animateupdate();
let delta = clock.getDelta(); let delta = clock.getDelta();
humanMoveUpdate(delta);
if (mixers) { if (mixers) {
for (let i = 0; i < mixers.length; i++) { for (let i = 0; i < mixers.length; i++) {
if (mixers[i]) { if (mixers[i]) {
@ -717,6 +732,60 @@ export function Jl3dOtherVR(dom,group,skinCode) {
} }
let moveTargetPosition = maintainerGroup.position;
let moveCurve = null;
let moveProgress = 1;
let moveSpeed = 0;
let humanAction = null;
let humanMixer = null;
function initHumanAnimation(){
humanMixer = new THREE.AnimationMixer( maintainerHuman );
humanAction = humanMixer.clipAction( maintainerHuman.animations[0])
// action.play();
// action.setLoop(THREE.LoopOnce);
// action.clampWhenFinished = true;
}
function humanMove(movedata){
console.log(maintainerHuman);
let distance = Math.sqrt(Math.pow(movedata.body.pos.x - maintainerGroup.position.x, 2) + Math.pow(movedata.body.pos.y - maintainerGroup.position.y, 2) + Math.pow(movedata.body.pos.z - maintainerGroup.position.z, 2));
if(distance <5){
if(movedata.body.pos.x != moveTargetPosition.x || movedata.body.pos.z != moveTargetPosition.z){
moveTargetPosition = movedata.body.pos;
moveCurve = new THREE.CatmullRomCurve3( [
new THREE.Vector3( maintainerGroup.position.x,maintainerGroup.position.y,maintainerGroup.position.z ),
new THREE.Vector3( moveTargetPosition.x,moveTargetPosition.y,moveTargetPosition.z ),
] );
moveSpeed = 0.02;
moveProgress = 0;
humanAction.play();
}
}else{
moveProgress = 2;
moveSpeed = 0;
moveTargetPosition = movedata.body.pos;
maintainerGroup.position.set(movedata.body.pos.x,movedata.body.pos.y,movedata.body.pos.z);
// maintainerHuman.position.set(event.data.body.camerapos.x,event.data.body.camerapos.y,event.data.body.camerapos.z);
// maintainerGroup.rotation.y = movedata.body.camerarot;
}
}
function humanMoveUpdate(delta){
if(moveProgress<1){
humanMixer.update(delta)
let pos = moveCurve.getPointAt(moveProgress);
maintainerGroup.position.set(pos.x,pos.y,pos.z);
let direct = moveCurve.getPointAt(moveProgress+0.001);
maintainerGroup.lookAt(direct);
moveProgress += moveSpeed;
}else{
humanAction.stop();
}
}
function setTextVr(intersects,plane){ function setTextVr(intersects,plane){
console.log(intersects); console.log(intersects);

View File

@ -39,6 +39,7 @@ var VRButton = {
device.isPresenting ? device.exitPresent() : device.requestPresent( [ { source: renderer.domElement } ] ); device.isPresenting ? device.exitPresent() : device.requestPresent( [ { source: renderer.domElement } ] );
originPos.position.set( -12.21, 1.38+0.6, 3.49); originPos.position.set( -12.21, 1.38+0.6, 3.49);
}; };
renderer.vr.setDevice( device ); renderer.vr.setDevice( device );

View File

@ -2,11 +2,21 @@ export function TrainControl(){
let scope = this; let scope = this;
this.toptrain = null; this.toptrain = null;
this.downtrain = null; this.downtrain = null;
let listener = new THREE.AudioListener();
this.sound = new THREE.Audio( listener );
// load a sound and set it as the Audio object's buffer
let audioLoader = new THREE.AudioLoader();
audioLoader.load( '../../static/audio/trainmove.ogg', function( buffer ) {
scope.sound.setBuffer( buffer );
scope.sound.setLoop( true );
scope.sound.setVolume( 3 );
scope.sound.volswitch = false;
});
this.inittrain = function(scene,object,animations,mixers){ this.inittrain = function(scene,object,animations,mixers){
let ntracks1,ntracks2,tclip,fclip; let ntracks1,ntracks2,tclip,fclip;
console.log(animations);
ntracks2 = animations.slice(6,14); ntracks2 = animations.slice(6,14);
fclip = new THREE.AnimationClip("four",2,ntracks2); fclip = new THREE.AnimationClip("four",2,ntracks2);
@ -39,7 +49,7 @@ export function TrainControl(){
scope.downtrain = object.clone(true); scope.downtrain = object.clone(true);
scope.downtrain.nowcode = null; scope.downtrain.nowcode = null;
scope.downtrain.floor = scope.downtrain.getObjectByName("xunlu6"); scope.downtrain.floor = scope.downtrain.getObjectByName("xunlu6");
// console.log();
scope.downtrain.floor.name = "downfloor"; scope.downtrain.floor.name = "downfloor";
scope.downtrain.status = 0; scope.downtrain.status = 0;
scope.downtrain.action = { scope.downtrain.action = {
@ -55,9 +65,7 @@ export function TrainControl(){
inittrainanimation(scope.toptrain,tclip,fclip,mixers); inittrainanimation(scope.toptrain,tclip,fclip,mixers);
inittrainanimation(scope.downtrain,tclip,fclip,mixers); inittrainanimation(scope.downtrain,tclip,fclip,mixers);
// console.log("train");
// console.log(scope.toptrain);
// console.log(scope.downtrain);
scope.toptrain.position.z = -8.3; scope.toptrain.position.z = -8.3;
scope.toptrain.position.y = -20000; scope.toptrain.position.y = -20000;
scope.downtrain.rotation.y = Math.PI; scope.downtrain.rotation.y = Math.PI;
@ -78,6 +86,7 @@ export function TrainControl(){
// if(doorcode == "2"){ // if(doorcode == "2"){
// actions = train.action.top; // actions = train.action.top;
// } // }
actions = train.action.down; actions = train.action.down;
}else{ }else{
// if(doorcode == "1"){ // if(doorcode == "1"){
@ -87,6 +96,7 @@ export function TrainControl(){
// if(doorcode == "2"){ // if(doorcode == "2"){
// actions = train.action.down; // actions = train.action.down;
// } // }
actions = train.action.down; actions = train.action.down;
} }
@ -98,8 +108,11 @@ export function TrainControl(){
} }
} }
this.closetraindoor = function(train,doorcode,direct){ this.closetraindoor = function(train,doorcode,positionStatus,direct){
let actions = null; let actions = null;
if(direct == "top"){ if(direct == "top"){
// if(doorcode == "1"){ // if(doorcode == "1"){
// actions = train.action.down; // actions = train.action.down;
@ -107,8 +120,19 @@ export function TrainControl(){
// if(doorcode == "2"){ // if(doorcode == "2"){
// actions = train.action.top; // actions = train.action.top;
// } // }
if(positionStatus == "topfloor"){
setTimeout(function(){
scope.sound.play();
}, 3000);
}
actions = train.action.down; actions = train.action.down;
}else{ }else{
if(positionStatus == "downfloor"){
setTimeout(function(){
scope.sound.play();
}, 3000);
}
// if(doorcode == "1"){ // if(doorcode == "1"){
// actions = train.action.top; // actions = train.action.top;
// } // }
@ -127,6 +151,7 @@ export function TrainControl(){
scope.trainLeaveStation(direct); scope.trainLeaveStation(direct);
} }
this.trainLeaveStation = function(direction){ this.trainLeaveStation = function(direction){
if(direction == "top"){ if(direction == "top"){
setTimeout(function(){ setTimeout(function(){
let timer=setInterval(function(){ let timer=setInterval(function(){

View File

@ -37,6 +37,13 @@ export function ModelManagerVR(){
url:"../../static/vrtest/vrTrain.FBX" url:"../../static/vrtest/vrTrain.FBX"
}; };
this.human = {
code:"human",
locateType:"5",
mesh:null,
url:"../../static/vrtest/vrHuman.FBX"
};
this.loadpromise = function (mixers){ this.loadpromise = function (mixers){
let initlist = []; let initlist = [];
@ -45,6 +52,7 @@ export function ModelManagerVR(){
initlist.push(fbxpromise(mixers,scope.stationOut)); initlist.push(fbxpromise(mixers,scope.stationOut));
initlist.push(fbxpromise(mixers,scope.otherDevice)); initlist.push(fbxpromise(mixers,scope.otherDevice));
initlist.push(fbxpromise(mixers,scope.train)); initlist.push(fbxpromise(mixers,scope.train));
initlist.push(fbxpromise(mixers,scope.human));
// initlist.push(fbxpromise(data.Switch,mixers,scope.switchmodel)); // initlist.push(fbxpromise(data.Switch,mixers,scope.switchmodel));
// initlist.push(fbxpromise(data.Signal,mixers,scope.signalmodel)); // initlist.push(fbxpromise(data.Signal,mixers,scope.signalmodel));
// initlist.push(fbxpromise(data.stationstand,mixers,scope.standmodel)); // initlist.push(fbxpromise(data.stationstand,mixers,scope.standmodel));
@ -56,7 +64,7 @@ export function ModelManagerVR(){
Promise.all(initlist).then((result) => { Promise.all(initlist).then((result) => {
resolve("success"); //['成功了', 'success'] resolve("success"); //['成功了', 'success']
}).catch((error) => { }).catch((error) => {
//console.log(error);
}); });
}); });
@ -69,8 +77,7 @@ function fbxpromise(mixers,model){
var loader = new THREE.FBXLoader(); var loader = new THREE.FBXLoader();
loader.load( model.url, function ( object ) { loader.load( model.url, function ( object ) {
let mixer = new THREE.AnimationMixer( object ); let mixer = new THREE.AnimationMixer( object );
// console.log(model.code);
// console.log(object.animations[0]);
object.animacode = model.code; object.animacode = model.code;
// model.mesh = object; // model.mesh = object;
@ -91,7 +98,6 @@ function fbxpromise(mixers,model){
realtrain.add(object.getObjectByName("xunlu6")); realtrain.add(object.getObjectByName("xunlu6"));
model.mesh = realtrain; model.mesh = realtrain;
// console.log(realtrain);
model.animations = object.animations[0].tracks; model.animations = object.animations[0].tracks;
}else{ }else{
model.mesh = object; model.mesh = object;

View File

@ -169,11 +169,18 @@ class Jlmap {
} }
setCenter(deviceCode) { setCenter(deviceCode) {
const device = this.mapDevice[deviceCode]; const arr = Object.keys(this.mapDevice);
if (device && device.instance) { if (arr.length != 0) {
var rect = createBoundingRect(device.instance); const device = this.mapDevice[deviceCode];
var dcenter = calculateDCenter(rect, { width: this.$zr.getWidth(), height: this.$zr.getHeight() }); if (device && device.instance) {
this.setOptions(dcenter); var rect = createBoundingRect(device.instance);
var dcenter = calculateDCenter(rect, { width: this.$zr.getWidth(), height: this.$zr.getHeight() });
this.setOptions(dcenter);
}
} else {
setTimeout(() => {
this.setCenter(deviceCode);
}, 60);
} }
} }
setRevoverBigScreen() { setRevoverBigScreen() {

View File

@ -3,7 +3,6 @@ class Theme {
this._code = '02'; this._code = '02';
this._mapMenu = { this._mapMenu = {
'01': 'chengdu_01', '01': 'chengdu_01',
// '01': 'ningbo_03',
'02': 'fuzhou_01', '02': 'fuzhou_01',
'03': 'beijing_01', '03': 'beijing_01',
'04': 'chengdu_03', '04': 'chengdu_03',

View File

@ -14,114 +14,101 @@ export default {
ExcelConfig: { ExcelConfig: {
beginRow: 1, beginRow: 1,
beginCol: 0, beginCol: 0,
fieldNum: 10, fieldNum: 6,
sepField: '行车间隔', sepField: '车次号',
trainId: 'TrainID', columns: {
columns: ['折返线', 'TrainID', '行车间隔'] '停车站名称': { key: 'stationName', formatter: (val) => { return val; } },
'到达时间': { key: 'arriveTime', formatter: (val) => { return val; } },
'出发时间': { key: 'departureTime', formatter: (val) => { return val; } }
}
}, },
/** 解析exal数据转换为Json后台数据*/ /** 解析exal数据转换为Json后台数据*/
importData(Sheet, JsonData) { importData(Sheet, JsonData) {
var dataList = convertSheetToList(Sheet, true); const dataList = convertSheetToList(Sheet, true);
if (dataList && dataList.length) { const needList = Object.keys(this.ExcelConfig.columns);
if (dataList && dataList.length && dataList[1] && dataList[0]) { debugger;
// const tIndex = dataList.findIndex(it => { return it[0]; }); // 设置不用过滤行数
const tIndex = 9; // 设置不用过滤行数
/** 解析二维数组为json对象*/ if (dataList && dataList.length) {
const reg3 = /^(\d+:\d+:\d+|)/; // 06:12:00 for (let colIndex = this.ExcelConfig.beginCol; colIndex < dataList.length; colIndex += this.ExcelConfig.fieldNum + 1) {
dataList.forEach((elem, i) => { let isContinue = true;
var begin = -1; let tripObj = { code: '', directionCode: '', arrivalList: [] };
/** 跳过名称所在的行*/ for (let rowIndex = this.ExcelConfig.beginRow; isContinue; rowIndex += 1) {
if (i != tIndex && elem && elem.length > 0) { isContinue = false;
let flag = false;
let count = 0; const stationObj = {};
let param = { begTime: '', endTime: '' }; for (let index = 0; index < this.ExcelConfig.fieldNum; index += 1) {
if (i > tIndex) { elem.reverse(); } if (dataList[colIndex + index]) {
elem.forEach((item, j) => { const title = dataList[colIndex + index][0];
/** 过滤空值*/ const value = dataList[colIndex + index][rowIndex];
if (item) {
let title = ''; if (title && value) {
var value = `${item}`.trim(); // 数据列解析
if (i > tIndex) { // 上行线 isContinue = true;
title = `${dataList[tIndex][dataList[tIndex].length - j - 1]}`.replace(/\s*/g, ''); const titleStr = `${title}`.trim();
if (title == 'undefined') { let valueStr = `${value}`.trim();
title = `${dataList[tIndex][dataList[tIndex].length - j - 2]}`.replace(/\s*/g, '');
} if (titleStr == this.ExcelConfig.sepField) {
} else { // 下行线 valueStr = `${dataList[colIndex + index - 1][rowIndex]}${valueStr}`;
title = `${dataList[tIndex][j]}`.replace(/\s*/g, ''); if (tripObj.code) {
if (title == 'undefined') { const length = tripObj.arrivalList.length;
title = `${dataList[tIndex][j - 1]}`.replace(/\s*/g, ''); if (length == 1) {
tripObj.arrivalList[0]['flag'] = true;
}
if (valueStr != tripObj.code) {
JsonData.push(tripObj);
const strVal = `${value}`.trim();
tripObj = { code: valueStr, directionCode: strVal[0], arrivalList: [] };
}
} else {
const strVal = `${value}`.trim();
tripObj.code = valueStr;
tripObj.directionCode = strVal[0];
} }
} }
/** 匹配到开始位置或者结束位置*/ // 取需要的字段
if (title == this.ExcelConfig.trainId) { if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) {
if (begin == -1) { stationObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr);
flag = true; if (this.ExcelConfig.columns[titleStr].key == 'arriveTime' || this.ExcelConfig.columns[titleStr].key == 'departureTime') {
begin = value; // 设置初始索引 stationObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(prefixTime(valueStr));
JsonData.push({
code: value,
destinationCode: '',
arrivalList: []
});
} else if (flag) {
begin = -1; // 清空初始索引
JsonData[JsonData.length - 1].destinationCode = value;
flag = false;
}
} else if (begin !== -1) {
/** 匹配到中间位置*/
var stationName = title.replace(/\s/, '');
if (this.ExcelConfig.columns.indexOf(stationName) == -1 && reg3.test(value)) {
let need = false;
if (value.split(':')[0] == '24') { // 24:XX:XX 类似这种数据 变24为00
const arr = value.split(':');
arr[0] = '00';
value = arr.join(':');
}
if (count == 1) {
count = 0;
param.endTime = value;
}
if (count == 0) {
count = 1;
param.begTime = param.begTime || value;
}
if (param.begTime && param.endTime) {
need = true;
}
/** 添加json数据*/
if (need) { // 储存非空 数据
var stationObj = {
stationName: stationName
};
stationObj['arriveTime'] = prefixTime(param.begTime);
stationObj['departureTime'] = prefixTime(param.endTime);
JsonData[JsonData.length - 1].arrivalList.push(stationObj);
param = { begTime: '', endTime: '' };
count = 0;
}
} }
} }
} }
}); }
} }
});
// 添加字段值
if (Object.keys(stationObj).length) {
if (stationObj.arriveTime) {
tripObj.arrivalList.push(stationObj);
}
}
}
// 添加最后那条没有车次的记录
if (tripObj.code) {
const length = tripObj.arrivalList.length;
if (length) {
tripObj.arrivalList[length - 1]['flag'] = true;
}
JsonData.push(tripObj);
}
} }
} }
return JsonData; return JsonData;
}, },
/** 将后台数据解析成图表*/ /** 将后台数据解析成图表*/
convertDataToModels(data, stations, kmRangeCoordMap, lineStyle) { convertDataToModels(data, stations, kmRangeCoordMap, lineStyle) {
var models = []; var models = [];
if (data && data.serviceNumberDataList && data.serviceNumberDataList.length) { if (data && data.serviceNumberDataList && data.serviceNumberDataList.length) {
/** 按服务遍历数据*/ /** 按服务遍历数据*/
data.serviceNumberDataList.forEach((service) => { data.serviceNumberDataList.forEach((service) => {
/** 按车次遍历数据*/ /** 按车次遍历数据*/
var isBackup = true;
var opt = { name: '', markPointData: [], data: [] }; var opt = { name: '', markPointData: [], data: [] };
if (service.tripNumberDataList && service.tripNumberDataList.length) { if (service.tripNumberDataList && service.tripNumberDataList.length) {
service.tripNumberDataList.forEach((train, j) => { service.tripNumberDataList.forEach((train, j) => {
@ -134,7 +121,8 @@ export default {
/** 如果车次号为空,不显示名称*/ /** 如果车次号为空,不显示名称*/
if (train.tripNumber) { if (train.tripNumber) {
/** 创建标记点名称和坐标*/ /** 创建标记点名称和坐标*/
pointdata.name = `${service.serviceNumber}${train.tripNumber}${train.destinationCode || ''}`; // pointdata.name = `${service.serviceNumber}${train.directionCode}${train.tripNumber}`;
pointdata.name = `${service.serviceNumber}${train.tripNumber}`;
pointdata.color = '#000' || lineStyle.color; pointdata.color = '#000' || lineStyle.color;
pointdata.directionCode = train.directionCode; pointdata.directionCode = train.directionCode;
pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, train.stationTimeList[1], train.directionCode, false)]; pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, train.stationTimeList[1], train.directionCode, false)];
@ -152,7 +140,7 @@ export default {
index == train.stationTimeList.length - 2 && train.stationTimeList[index].secondTime != train.stationTimeList[index + 1].secondTime || index == train.stationTimeList.length - 2 && train.stationTimeList[index].secondTime != train.stationTimeList[index + 1].secondTime ||
index > 0 && index < train.stationTimeList.length - 1) { index > 0 && index < train.stationTimeList.length - 1) {
const aa = `${train.directionCode}${train.tripNumber}`; const aa = `${train.directionCode}${train.tripNumber}`;
opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode, aa, `${service.serviceNumber}${train.tripNumber}${train.destinationCode || ''}`]); opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode, aa]);
} }
}); });
@ -161,8 +149,9 @@ export default {
lastPoint = train.stationTimeList[idx - 1]; lastPoint = train.stationTimeList[idx - 1];
nextPoint = service.tripNumberDataList[j + 1].stationTimeList[1]; nextPoint = service.tripNumberDataList[j + 1].stationTimeList[1];
num = this.computedReentryNumber(train.tripNumber); num = this.computedReentryNumber(train.tripNumber);
opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true, num), lastPoint.stationCode, `${service.serviceNumber}${train.tripNumber}${train.destinationCode || ''}`]); const aa = `${train.directionCode}${train.tripNumber}`;
opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.directionCode, true, num), nextPoint.stationCode, `${service.serviceNumber}${train.tripNumber}${train.destinationCode || ''}`]); opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true, num), lastPoint.stationCode, aa]);
opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.directionCode, true, num), nextPoint.stationCode, aa]);
} }
/** 如果是备用车,按车次添加线*/ /** 如果是备用车,按车次添加线*/
@ -175,10 +164,12 @@ export default {
opt = { name: '', markPointData: [], data: [] }; opt = { name: '', markPointData: [], data: [] };
} }
} }
isBackup = train.backup;
}); });
// 不是备用车,按服务添加线 // 不是备用车,按服务添加线
if (!service.backup) { if (!isBackup) {
/** 创建一条完成的服务数据*/ /** 创建一条完成的服务数据*/
var model = createSeriesModel(opt, Object.assign({ color: hexColor.toCreate() }, lineStyle)); var model = createSeriesModel(opt, Object.assign({ color: hexColor.toCreate() }, lineStyle));
if (model) { if (model) {
@ -201,6 +192,7 @@ export default {
if (!runPlanData[elem.serviceNumber]) { if (!runPlanData[elem.serviceNumber]) {
/** 创建一个新服务号标记*/ /** 创建一个新服务号标记*/
runPlanData[elem.serviceNumber] = {}; runPlanData[elem.serviceNumber] = {};
/** 不存在此服务号则需要创建一条新的line*/ /** 不存在此服务号则需要创建一条新的line*/
series.push(createSeriesModel({ series.push(createSeriesModel({
zlevel: 1, zlevel: 1,
@ -229,17 +221,17 @@ export default {
serie.markPoint.data.push(createMartPoint({ serie.markPoint.data.push(createMartPoint({
directionCode: elem.directionCode, directionCode: elem.directionCode,
coord: [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false)], coord: [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false)],
name: `(${elem.groupNumber})${elem.serviceNumber}${elem.tripNumber}${elem.destinationCode || ''}`, name: `(${elem.groupNumber})${elem.serviceNumber}${elem.tripNumber}`,
color: lineStyle.color || '#000' color: lineStyle.color || '#000'
})); }));
} }
/** 计算折返点*/ /** 计算折返点*/
var nextPoint = [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false), elem.directionCode]; var num = this.computedReentryNumber(elem.tripNumber);
var nextPoint = [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false, num), elem.directionCode];
if (serie.data.length > 0) { if (serie.data.length > 0) {
var lastPoint = serie.data[serie.data.length - 1]; var lastPoint = serie.data[serie.data.length - 1];
if (lastPoint[2] !== nextPoint[2]) { if (lastPoint[2] !== nextPoint[2]) {
var num = this.computedReentryNumber(elem.tripNumber);
serie.data.push([lastPoint[0], this.getYvalueByDirectionCode(lastPoint[1], lastPoint[2], num), lastPoint[2]]); serie.data.push([lastPoint[0], this.getYvalueByDirectionCode(lastPoint[1], lastPoint[2], num), lastPoint[2]]);
serie.data.push([nextPoint[0], this.getYvalueByDirectionCode(nextPoint[1], lastPoint[2], num), lastPoint[2]]); serie.data.push([nextPoint[0], this.getYvalueByDirectionCode(nextPoint[1], lastPoint[2], num), lastPoint[2]]);
} }

View File

@ -341,6 +341,7 @@ const training = {
commit('resetScore'); commit('resetScore');
// 设置其他属性状态 // 设置其他属性状态
commit('setOffsetStationCode', null); commit('setOffsetStationCode', null);
commit('changeMode', null);
}, },
/** /**

View File

@ -73,7 +73,8 @@ export default {
{ {
name: '发布', name: '发布',
handleClick: this.publishScript, handleClick: this.publishScript,
type: 'primary' type: 'primary',
showControl: (row) => { return !row.publish; }
} }
] ]
} }

View File

@ -17,10 +17,9 @@
</div> </div>
</template> </template>
<script> <script>
import {covertMemberData} from './utils';
import ChatBox from '../chatView/chatBox.vue'; import ChatBox from '../chatView/chatBox.vue';
import ScriptTip from '@/views/newMap/displayNew/scriptDisplay/component/scriptTip'; import ScriptTip from '@/views/newMap/displayNew/scriptDisplay/component/scriptTip';
import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie';
import { getSimulationMemberList} from '@/api/simulation'; import { getSimulationMemberList} from '@/api/simulation';
import {getAllConversition} from '@/api/chat'; import {getAllConversition} from '@/api/chat';
export default { export default {
@ -71,106 +70,37 @@ export default {
watch:{ watch:{
'$store.state.map.mapViewLoadedCount': function (val) { // 仿 '$store.state.map.mapViewLoadedCount': function (val) { // 仿
getSimulationMemberList(this.group).then(resp => { 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 = []; this.driverList = [];
const maintainerList = [];
const driverList = [];
this.treeData = []; this.treeData = [];
lastData.forEach((member, index)=>{ const result = covertMemberData(this.activeTrainList, resp);
if (member.type != '观众') { this.driverList = result.driverList;
if (!member.userId) {
member.userId = '';
member.disabled = false;
} else {
member.disabled = true;
member.userName = this.$store.state.user.nickname;
this.$store.dispatch('training/setOrignalUserRoleId', member.id);
}
const userName = member.userName ? '-' + member.userName : '';
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.deviceName = device.groupNumber;
member.label = member.type + device.groupNumber + name + userName;
lastMemberList.push(member);
if (this.activeTrainList.length > 0) {
if (this.activeTrainList.includes(member.deviceCode)) {
driverList.push(member);
}
} else {
this.driverList.push(member);
}
} else {
member.deviceName = device.name;
member.label = member.type + device.name + name + userName;
lastMemberList.push(member);
if (device._type == 'Station') {
stationSupervisorList.push(member);
}
}
} else {
member.deviceName = member.deviceCode;
member.label = member.type + member.deviceCode + name + userName;
lastMemberList.push(member);
}
} else {
member.label = member.type + name + userName;
member.deviceName = '';
if (member.type == '行调') {
dispatcherList.push(member);
} else if (member.type == '通号') {
maintainerList.push(member);
} else if (member.type == '车辆段调度') {
depotDispatcherList.push(member);
}
lastMemberList.push(member);
}
}
});
this.treeData = [{ this.treeData = [{
label: '行调', label: '行调',
id: 'dispatcher', id: 'dispatcher',
type: 'role', type: 'role',
children: dispatcherList children: result.deviceListData[0]
}, { }, {
label: '车站值班员', label: '车站值班员',
id: 'stationSupervisor', id: 'stationSupervisor',
type: 'role', type: 'role',
children: stationSupervisorList children: result.deviceListData[2]
}, { }, {
label: '司机', label: '司机',
id: 'driver', id: 'driver',
type: 'role', type: 'role',
children: driverList children: result.deviceListData[3]
}, { }, {
label: '通号', label: '通号',
id: 'maintainer', id: 'maintainer',
type: 'role', type: 'role',
children: maintainerList children: result.deviceListData[1]
}, { }, {
label: '车辆段', label: '车辆段',
id: 'depotDispatcher', id: 'depotDispatcher',
type: 'role', type: 'role',
children: depotDispatcherList children: result.deviceListData[4]
}]; }];
this.memberData = lastMemberList; this.memberData = result.lastMemberList;
}).catch(() => { }).catch(() => {
this.$messageBox('获取仿真成员列表失败!'); this.$messageBox('获取仿真成员列表失败!');
}); });

View File

@ -38,7 +38,7 @@
import Jl3dDevice from '@/views/jlmap3d/device/jl3ddevice'; import Jl3dDevice from '@/views/jlmap3d/device/jl3ddevice';
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive'; import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import ChangeMap from './changeMap'; import ChangeMap from './dispatherContest/changeMap';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import Scheduling from '@/views/newMap/displayNew/demon/scheduling'; import Scheduling from '@/views/newMap/displayNew/demon/scheduling';
import SchedulingView from '@/views/newMap/displayNew/demon/schedulingView'; import SchedulingView from '@/views/newMap/displayNew/demon/schedulingView';

View File

@ -54,9 +54,9 @@
<!-- 单人仿真 --> <!-- 单人仿真 -->
<script> <script>
import SetTime from './demon/setTime'; import SetTime from '../demon/setTime';
import DemonMenu from './demonMenu'; import DemonMenu from '../demonMenu';
import DemonChat from './demonChat'; import DemonChat from '../demonChat';
import MenuSchema from '@/views/newMap/displayNew/menuSchema'; import MenuSchema from '@/views/newMap/displayNew/menuSchema';
import { getGoodsTryUse } from '@/api/management/goods'; import { getGoodsTryUse } from '@/api/management/goods';
import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@/api/simulation'; import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@/api/simulation';
@ -416,7 +416,7 @@ export default {
location.reload(); location.reload();
}); });
}); });
}).catch(error=> { }).catch(()=> {
this.$message.error('结束仿真失败!'); this.$message.error('结束仿真失败!');
}); });
}, },

View File

@ -23,7 +23,6 @@ import { Notification } from 'element-ui';
import { startTrainingNew } from '@/api/jmap/training'; import { startTrainingNew } from '@/api/jmap/training';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
import { refreshExamList, finishOneExamQuestion } from '@/api/management/userexam'; import { refreshExamList, finishOneExamQuestion } from '@/api/management/userexam';
import { launchFullscreen } from '@/utils/screen';
export default { export default {
name: 'MenuExam', name: 'MenuExam',
@ -154,7 +153,6 @@ export default {
}); });
}, },
init() { init() {
launchFullscreen();
// //
refreshExamList(this.$route.query.userExamId).then(response => { refreshExamList(this.$route.query.userExamId).then(response => {
this.$store.dispatch('exam/setUsedTime', response.data.usedTime); this.$store.dispatch('exam/setUsedTime', response.data.usedTime);
@ -175,12 +173,9 @@ export default {
}, },
// //
async initData() { async initData() {
this.$store.dispatch('training/end', null);
if (parseInt(this.$route.query.trainingId)) { if (parseInt(this.$route.query.trainingId)) {
//
//
const resp = await getTrainingDetailNew(this.$route.query.trainingId); const resp = await getTrainingDetailNew(this.$route.query.trainingId);
this.$store.dispatch('exam/setCenter', resp.data.locateDeviceCode); this.$store.dispatch('exam/setCenter', resp.data.locateDeviceCode); //
if (resp && resp.code == 200) { if (resp && resp.code == 200) {
const detail = resp.data; const detail = resp.data;
await this.$store.dispatch('training/setPrdType', this.prdTypeMap[detail.prdType]); await this.$store.dispatch('training/setPrdType', this.prdTypeMap[detail.prdType]);

View File

@ -23,7 +23,7 @@
highlight-current highlight-current
@node-click="getTrainDetail" @node-click="getTrainDetail"
> >
<span slot-scope="{ node, data }"> <span slot-scope="{ data }">
<span :style="{color: data.usedTime !== undefined ? 'green':''}">&nbsp;{{ trainingList.indexOf(data)+1 }}.{{ <span :style="{color: data.usedTime !== undefined ? 'green':''}">&nbsp;{{ trainingList.indexOf(data)+1 }}.{{
data.trainingName }} data.trainingName }}
</span> </span>
@ -131,7 +131,7 @@ export default {
} }
}, },
watch: { watch: {
'$store.state.map.mapViewLoadedCount': function() { '$store.state.map.mapViewLoadedCount': function() { //
this.$store.dispatch('exam/stopCountTime'); this.$store.dispatch('exam/stopCountTime');
this.loadInitData(); this.loadInitData();
this.$store.dispatch('exam/countUsedTime'); this.$store.dispatch('exam/countUsedTime');
@ -165,7 +165,7 @@ export default {
minDuration: res.data.minDuration, minDuration: res.data.minDuration,
updateTime: res.data.updateTime updateTime: res.data.updateTime
}; };
this.$store.dispatch('exam/setCenter', res.data.locateDeviceCode); // this.$store.dispatch('exam/setCenter', res.data.locateDeviceCode);
}).catch(error => { }).catch(error => {
this.$message.error(this.$t('display.exam.getTestInformation') + ':' + error.message); this.$message.error(this.$t('display.exam.getTestInformation') + ':' + error.message);
}); });

View File

@ -39,12 +39,15 @@ import { timeFormat } from '@/utils/date';
import MapSystemDraft from '@/views/newMap/mapsystemNew/index'; import MapSystemDraft from '@/views/newMap/mapsystemNew/index';
import StatusIcon from '@/views/components/StatusIcon/statusIcon'; import StatusIcon from '@/views/components/StatusIcon/statusIcon';
import MenuDemon from '@/views/newMap/displayNew/menuDemon'; import MenuDemon from '@/views/newMap/displayNew/menuDemon';
import MenuExam from './exam/index'; import MenuExam from './exam/index';
import MenuLesson from './lesson/index'; import MenuLesson from './lesson/index';
import MenuScript from './scriptDisplay/scriptRecord/index';
import MenuDispatherContest from './dispatherContest/index';
import MenuTrainList from '@/views/newMap/displayNew/menuTrainList'; import MenuTrainList from '@/views/newMap/displayNew/menuTrainList';
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime'; import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
import MenuScript from '@/views/newMap/displayNew/menuScript';
import MenuDispatherContest from './menuDispatherContest';
import { clearSimulation, getSimulationInfoNew } from '@/api/simulation'; import { clearSimulation, getSimulationInfoNew } from '@/api/simulation';
import { loadNewMapDataByGroup } from '@/utils/loaddata'; import { loadNewMapDataByGroup } from '@/utils/loaddata';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
@ -124,7 +127,6 @@ export default {
}, },
'$store.state.app.windowSizeCount': function() { // '$store.state.app.windowSizeCount': function() { //
this.setWindowSize(); this.setWindowSize();
this.setPosition();
}, },
'$store.state.training.prdType': function (val) { // '$store.state.training.prdType': function (val) { //
this.setPosition(); this.setPosition();
@ -172,6 +174,8 @@ export default {
await this.$refs.menuDemon.back(); await this.$refs.menuDemon.back();
} else if (this.isScript) { } else if (this.isScript) {
await this.$refs.menuScript.back(); await this.$refs.menuScript.back();
} else if (this.isContest) {
await this.$refs.menuDispatherContest.back();
} }
}, },
// //
@ -230,9 +234,7 @@ export default {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`)); this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
this.$store.dispatch('training/countTime'); this.$store.dispatch('training/countTime');
this.planRunning = resp.data.planRunning; this.planRunning = resp.data.planRunning;
if (!this.planRunning) {
this.$store.dispatch('training/over');
}
if (this.isDemon) { if (this.isDemon) {
this.$refs.menuDemon.initPlannedDriving(this.planRunning); // this.$refs.menuDemon.initPlannedDriving(this.planRunning); //
} else if (this.isScript) { } else if (this.isScript) {

View File

@ -156,7 +156,7 @@ export default {
// //
this.$store.dispatch('menuOperation/setButtonOperation', null); this.$store.dispatch('menuOperation/setButtonOperation', null);
this.startLoading = true; this.startLoading = true;
console.log(2222222222222, this.startLoading, this.started, this.trainingObj); // console.log(2222222222222, this.startLoading, this.started, this.trainingObj);
if (this.trainingObj && this.trainingObj.id) { if (this.trainingObj && this.trainingObj.id) {
startTrainingNew(this.trainingObj, this.group).then(response => { startTrainingNew(this.trainingObj, this.group).then(response => {
this.isDisable = true; this.isDisable = true;

View File

@ -6,6 +6,7 @@
<span v-if="countTime" class="display-score">{{ $t('display.demon.trialTime') }} {{ countTime }}</span> <span v-if="countTime" class="display-score">{{ $t('display.demon.trialTime') }} {{ countTime }}</span>
</el-row> </el-row>
</div> </div>
<demon-menu <demon-menu
ref="demonMenu" ref="demonMenu"
:is-all-show="!dataError" :is-all-show="!dataError"
@ -42,12 +43,6 @@
@selectQuest="selectQuest" @selectQuest="selectQuest"
/> />
<!-- :station-list="stationListMode"
:show-select-station="showSelectStation"
@selectQuest="selectQuest"
@switchStationMode="switchStationMode"
@switchMode="switchMode" -->
<set-time ref="setTime" @ConfirmSelectBeginTime="start" /> <set-time ref="setTime" @ConfirmSelectBeginTime="start" />
</div> </div>

View File

@ -21,13 +21,15 @@ export const operateEnum = {
code:'routeCodeList', code:'routeCodeList',
isDevice:true, isDevice:true,
isList:true, isList:true,
name:'进路列表' name:'进路列表',
function:getRouteNameById
}, },
Signal_Close_Auto_Setting:{ Signal_Close_Auto_Setting:{
code:'routeCodeList', code:'routeCodeList',
isDevice:true, isDevice:true,
isList:true, isList:true,
name:'进路列表' name:'进路列表',
function:getRouteNameById
} }
}, },
Switch:{ Switch:{
@ -54,6 +56,15 @@ export const operateEnum = {
name:'限速值为' name:'限速值为'
} }
}, },
ControlConvertMenu:{
CM_Apply_For_Station_Control:{
code:'stationCodes',
isList:true,
isDevice:true,
name:'车站列表',
function:getStationNameById
}
},
Stand:{ Stand:{
code:'standCode', code:'standCode',
type:'站台', type:'站台',
@ -116,11 +127,17 @@ export function covertOperate(operationType, operationParamMap) {
if (operationType == 'Set_Fault' || operationType == 'Cancel_Fault') { if (operationType == 'Set_Fault' || operationType == 'Cancel_Fault') {
// covertOperation(operationType); // covertOperation(operationType);
} else { } else {
const device = operationType.split('_')[0]; let device = operationType.split('_')[0];
if (device == 'CM') {
device = 'ControlConvertMenu';
}
const operateName = Object.values(CMD[device]).find(res=>{ return res.value == operationType; }); const operateName = Object.values(CMD[device]).find(res=>{ return res.value == operationType; });
const deviceInfo = covertOperation(device, operationParamMap, operationType); const deviceInfo = covertOperation(device, operationParamMap, operationType);
let tip = '请找到' + deviceInfo.deviceName + ''; let tip = '请';
tip += ' 执行【' + operateName.label + '】操作'; if (deviceInfo.deviceName) {
tip += '找到' + deviceInfo.deviceName + '';
}
tip += '执行【' + operateName.label + '】操作';
if (deviceInfo.paramName) { if (deviceInfo.paramName) {
tip += ',参数为:' + deviceInfo.paramName; tip += ',参数为:' + deviceInfo.paramName;
} }
@ -131,24 +148,34 @@ export function covertOperate(operationType, operationParamMap) {
function covertOperation(deviceType, operationParamMap, operationType) { function covertOperation(deviceType, operationParamMap, operationType) {
let deviceName = ''; let deviceName = '';
let paramName = ''; let paramName = '';
const device = store.getters['map/getDeviceByCode'](operationParamMap[operateEnum[deviceType].code]); if (operateEnum[deviceType].code) {
if (device._type == 'StationStand') { const device = store.getters['map/getDeviceByCode'](operationParamMap[operateEnum[deviceType].code]);
const station = store.getters['map/getDeviceByCode'](device.stationCode); if (device._type == 'StationStand') {
deviceName += '【车站-' + station.name + '】/'; const station = store.getters['map/getDeviceByCode'](device.stationCode);
} deviceName += '【车站-' + station.name + '】/';
if (device._type == 'Section') { }
if (device.parentCode) { if (device._type == 'Section') {
const parentSection = store.getters['map/getDeviceByCode'](device.parentCode); if (device.parentCode) {
deviceName += '【' + operateEnum[deviceType].type + ' ' + parentSection.name + '-' + device.name + '】'; const parentSection = store.getters['map/getDeviceByCode'](device.parentCode);
deviceName += '【' + operateEnum[deviceType].type + ' ' + parentSection.name + '-' + device.name + '】';
}
} else {
deviceName += '【' + operateEnum[deviceType].type + ' ' + device.name + '】';
} }
} else {
deviceName += '【' + operateEnum[deviceType].type + ' ' + device.name + '】';
} }
const paramInfo = operateEnum[deviceType][operationType]; const paramInfo = operateEnum[deviceType][operationType];
if (paramInfo) { if (paramInfo) {
if (paramInfo.isDevice) { if (paramInfo.isDevice) {
if (paramInfo.isList) { if (paramInfo.isList) {
paramName += '【' + paramInfo.name + ' '; paramName += '【' + paramInfo.name + ' ';
const deviceList = operationParamMap[paramInfo.code];
deviceList.forEach((device, index)=>{
paramName += covertFunction(paramInfo.function, device);
if (index != deviceList.length - 1) {
paramName += '';
}
});
paramName += '】';
} else { } else {
paramName += '【' + paramInfo.name + ' '; paramName += '【' + paramInfo.name + ' ';
paramName += getRouteNameById(operationParamMap[paramInfo.code]) + '】'; paramName += getRouteNameById(operationParamMap[paramInfo.code]) + '】';
@ -158,7 +185,7 @@ function covertOperation(deviceType, operationParamMap, operationType) {
const params = paramInfo.params; const params = paramInfo.params;
if (params && params.length > 0) { if (params && params.length > 0) {
paramName += '【'; paramName += '【';
params.forEach(param=>{ params.forEach((param, index)=>{
paramName += ' ' + param.name; paramName += ' ' + param.name;
const data = operationParamMap[param.code]; const data = operationParamMap[param.code];
param.result.forEach(result=>{ param.result.forEach(result=>{
@ -182,16 +209,24 @@ function covertOperation(deviceType, operationParamMap, operationType) {
} }
} }
}); });
paramName += ','; if (index != params.length - 1) {
paramName += ',';
}
}); });
paramName += '】'; paramName += '】';
} }
} else {
paramName += '【' + paramInfo.name + operationParamMap[paramInfo.code] + '】';
} }
} }
} }
return {deviceName:deviceName, paramName:paramName}; return {deviceName:deviceName, paramName:paramName};
} }
function covertFunction(func, device) {
return func(device);
}
function getRouteNameById(routeId) { function getRouteNameById(routeId) {
const routeList = store.state.map.routeList; const routeList = store.state.map.routeList;
const route = routeList.find(route=>{ const route = routeList.find(route=>{
@ -200,3 +235,8 @@ function getRouteNameById(routeId) {
if (route) { return route.name; } else { return ''; } if (route) { return route.name; } else { return ''; }
} }
function getStationNameById(stationId) {
const station = store.getters['map/getDeviceByCode'](stationId);
return station.name;
}

View File

@ -73,6 +73,7 @@ export default {
dataError: false, dataError: false,
faultMode: false, faultMode: false,
viewDisabled: true, viewDisabled: true,
firstLoad:true,
isscriptRun:false // isscriptRun:false //
}; };
}, },
@ -104,15 +105,15 @@ export default {
this.setWindowSize(); this.setWindowSize();
}, },
'$store.state.training.switchcount': async function () { '$store.state.training.switchcount': async function () {
if (this.group) { if (this.group && this.firstLoad) {
await this.loadRunData(); await this.loadRunData();
// if (this.$store.state.training.started && !this.firstLoad) { // if (this.$store.state.training.started && !this.firstLoad) {
// } else if (this.firstLoad) { // } else if (this.firstLoad) {
// await this.loadRunData(this.$route.query); // await this.loadRunData(this.$route.query);
// } // }
// this.firstLoad = false;
} }
this.firstLoad = false;
} }
}, },
async mounted() { async mounted() {

View File

@ -37,10 +37,10 @@
<script> <script>
import { TrainingMode } from '@/scripts/ConstDic'; import { TrainingMode } from '@/scripts/ConstDic';
import MenuSchema from '@/views/newMap/displayNew/menuSchema'; import MenuSchema from '@/views/newMap/displayNew/menuSchema';
import DemonMenu from './demonMenu'; import DemonMenu from '@/views/newMap/displayNew/demonMenu';
import ScriptChat from './scriptChat'; import ScriptChat from './scriptChat';
import TipScriptRecordNew from '@/views/scriptManage/tipScriptRecord'; import TipScriptRecordNew from '@/views/scriptManage/tipScriptRecord';
import SetTime from './demon/setTime'; import SetTime from '@/views/newMap/displayNew/demon/setTime';
import { Notification } from 'element-ui'; import { Notification } from 'element-ui';
import { ranAsPlan, exitRunPlan } from '@/api/simulation'; import { ranAsPlan, exitRunPlan } from '@/api/simulation';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';

View File

@ -14,9 +14,8 @@
/> />
</template> </template>
<script> <script>
import ChatBox from '../chatView/chatBox.vue'; import ChatBox from '@/views/newMap/chatView/chatBox.vue';
import ConstConfig from '@/scripts/ConstConfig'; import {covertMemberData} from '@/views/newMap/displayNew/utils';
import Cookies from 'js-cookie';
import {getAllConversition} from '@/api/chat'; import {getAllConversition} from '@/api/chat';
import { getSimulationMemberList} from '@/api/simulation'; import { getSimulationMemberList} from '@/api/simulation';
export default { export default {
@ -60,105 +59,37 @@ export default {
watch:{ watch:{
'$store.state.map.mapViewLoadedCount': function (val) { // 仿 '$store.state.map.mapViewLoadedCount': function (val) { // 仿
getSimulationMemberList(this.group).then(resp => { 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 = []; this.driverList = [];
const maintainerList = [];
const driverList = [];
this.treeData = []; this.treeData = [];
lastData.forEach((member, index)=>{ const result = covertMemberData(this.activeTrainList, resp);
if (member.type != '观众') { this.driverList = result.driverList;
if (!member.userId) {
member.userId = '';
member.disabled = false;
} else {
member.disabled = true;
member.userName = this.$store.state.user.nickname;
}
const userName = member.userName ? '-' + member.userName : '';
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.deviceName = device.groupNumber;
member.label = member.type + device.groupNumber + name + userName;
lastMemberList.push(member);
if (this.activeTrainList.length > 0) {
if (this.activeTrainList.includes(member.deviceCode)) {
driverList.push(member);
}
} else {
this.driverList.push(member);
}
} else {
member.deviceName = device.name;
member.label = member.type + device.name + name + userName;
lastMemberList.push(member);
if (device._type == 'Station') {
stationSupervisorList.push(member);
}
}
} else {
member.deviceName = member.deviceCode;
member.label = member.type + member.deviceCode + name + userName;
lastMemberList.push(member);
}
} else {
member.label = member.type + name + userName;
member.deviceName = '';
if (member.type == '行调') {
dispatcherList.push(member);
} else if (member.type == '通号') {
maintainerList.push(member);
} else if (member.type == '车辆段调度') {
depotDispatcherList.push(member);
}
lastMemberList.push(member);
}
}
});
this.treeData = [{ this.treeData = [{
label: '行调', label: '行调',
id: 'dispatcher', id: 'dispatcher',
type: 'role', type: 'role',
children: dispatcherList children: result.deviceListData[0]
}, { }, {
label: '车站值班员', label: '车站值班员',
id: 'stationSupervisor', id: 'stationSupervisor',
type: 'role', type: 'role',
children: stationSupervisorList children: result.deviceListData[2]
}, { }, {
label: '司机', label: '司机',
id: 'driver', id: 'driver',
type: 'role', type: 'role',
children: driverList children: result.deviceListData[3]
}, { }, {
label: '通号', label: '通号',
id: 'maintainer', id: 'maintainer',
type: 'role', type: 'role',
children: maintainerList children: result.deviceListData[1]
}, { }, {
label: '车辆段', label: '车辆段',
id: 'depotDispatcher', id: 'depotDispatcher',
type: 'role', type: 'role',
children: depotDispatcherList children: result.deviceListData[4]
}]; }];
this.memberData = lastMemberList; this.memberData = result.lastMemberList;
}).catch(() => { }).catch(() => {
this.$messageBox('获取仿真成员列表失败!'); this.$messageBox('获取仿真成员列表失败!');
}); });
@ -185,6 +116,7 @@ export default {
if (this.driverList.length > 0) { if (this.driverList.length > 0) {
const driverList = []; const driverList = [];
if (activeTrainList && activeTrainList.length) { if (activeTrainList && activeTrainList.length) {
activeTrainList.sort();
activeTrainList.forEach(groupNumber => { activeTrainList.forEach(groupNumber => {
const drivers = this.driverList.find(driver=>{ const drivers = this.driverList.find(driver=>{
return driver.deviceCode == groupNumber; return driver.deviceCode == groupNumber;

View File

@ -0,0 +1,57 @@
import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie';
import store from '@/store/index_APP_TARGET';
export function covertMemberData (activeTrainList, 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 electricDispatcherList = [];
const deviceListData = [[], [], [], [], []];
const driverList = [];
lastData.forEach((member, index)=>{
if (!member.userId) {
member.disabled = false;
} else {
member.disabled = true;
member.userName = store.state.user.nickname;
store.dispatch('training/setOrignalUserRoleId', member.id);
}
const userName = member.userName ? '-' + member.userName : '';
const name = member.name ? '-' + member.name : '';
if (member.deviceCode) {
const device = store.getters['map/getDeviceByCode'](member.deviceCode);
const deviceName = device.name || device.groupNumber;
member.deviceName = deviceName;
member.label = member.type + deviceName + name + userName;
} else {
member.deviceName = '';
member.label = member.type + name + userName;
}
lastMemberList.push(member);
const deviceType = ['行调', '通号', '行值', '司机', '车辆段调度'];
const deviceTypeIndex = deviceType.indexOf(member.type);
if (deviceTypeIndex >= 0) {
if (deviceTypeIndex == 3) {
if (activeTrainList.length > 0) {
if (activeTrainList.includes(member.deviceCode)) {
deviceListData[deviceTypeIndex].push(member);
}
} else {
driverList.push(member);
}
} else {
deviceListData[deviceTypeIndex].push(member);
}
}
});
return {lastMemberList:lastMemberList, deviceListData:deviceListData, driverList:driverList};
}

View File

@ -139,7 +139,10 @@ export default {
}); });
} }
} }
this.setCenter(code); code && this.setCenter(code);
},
'$store.state.map.mapViewLoadedCount': function (val) { //
this.$store.state.exam.deviceCode && this.setCenter(this.$store.state.exam.deviceCode);
}, },
'$store.state.config.canvasSizeCount': function (val) { '$store.state.config.canvasSizeCount': function (val) {
this.resetSize(); this.resetSize();
@ -352,7 +355,7 @@ export default {
async simulationReset() { async simulationReset() {
await this.$store.dispatch('map/clearJlmapTrainView'); await this.$store.dispatch('map/clearJlmapTrainView');
await this.$store.dispatch('map/setTrainWindowShow', false); await this.$store.dispatch('map/setTrainWindowShow', false);
await this.$store.dispatch('training/over'); // await this.$store.dispatch('training/over');
await this.$store.dispatch('socket/setSimulationReset'); // await this.$store.dispatch('socket/setSimulationReset'); //
await this.$store.dispatch('socket/setSimulationStart'); await this.$store.dispatch('socket/setSimulationStart');
await this.$store.dispatch('training/setMapDefaultState'); await this.$store.dispatch('training/setMapDefaultState');

View File

@ -38,7 +38,6 @@ export default {
methods: { methods: {
tipInit() { tipInit() {
this.$nextTick(() => { this.$nextTick(() => {
console.log('tipInit',);
this.$store.dispatch('training/isTeachMode').then(() => { this.$store.dispatch('training/isTeachMode').then(() => {
this.tipShow = true; this.tipShow = true;
const offset = this.$store.state.config.canvasOffset; const offset = this.$store.state.config.canvasOffset;

View File

@ -219,7 +219,6 @@ export default {
for (const index in wb.Sheets) { for (const index in wb.Sheets) {
jsonData = that.planConvert.importData(wb.Sheets[index], jsonData); jsonData = that.planConvert.importData(wb.Sheets[index], jsonData);
} }
console.log(jsonData, '解析后数据');
if (that.$route.query.lineCode == '02' && !jsonData[0].downTrack && !jsonData[0].upTrack) { if (that.$route.query.lineCode == '02' && !jsonData[0].downTrack && !jsonData[0].upTrack) {
that.loadingDig.close(); that.loadingDig.close();

View File

@ -214,13 +214,11 @@ export default {
}); });
} }
if (wb) { if (wb) {
try { let jsonData = [];
let jsonData = []; for (const index in wb.Sheets) {
for (const index in wb.Sheets) { jsonData = that.planConvert.importData(wb.Sheets[index], jsonData);
jsonData = that.planConvert.importData(wb.Sheets[index], jsonData); }
} if (jsonData.length) {
console.log(jsonData, '解析后数据');
if (that.$route.query.lineCode == '02' && !jsonData[0].downTrack && !jsonData[0].upTrack) { if (that.$route.query.lineCode == '02' && !jsonData[0].downTrack && !jsonData[0].upTrack) {
that.loadingDig.close(); that.loadingDig.close();
that.$message.warning(`运行图暂无默认上行折返轨或默认下行折返轨,请输入`); that.$message.warning(`运行图暂无默认上行折返轨或默认下行折返轨,请输入`);
@ -237,9 +235,9 @@ export default {
that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`); that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`);
}); });
} }
} catch (error) { } else {
that.loadingDig.close(); that.loadingDig.close();
that.$message.warning(`${that.$t('tip.parseRunGraphFailed')} ${error.message}`); that.$message.warning(that.$t('tip.parseRunGraphFailed'));
} }
} }
}; };

View File

@ -197,7 +197,7 @@ export default {
name:this.$store.state.user.nickname name:this.$store.state.user.nickname
} }
); );
// this.oldMemberId = role.id; this.oldMemberId = role.id;
this.$store.dispatch('training/setPrdType', prdType); this.$store.dispatch('training/setPrdType', prdType);
ConstConfig.ConstSelect.roleTypeNew.forEach(each=>{ ConstConfig.ConstSelect.roleTypeNew.forEach(each=>{
if (each.label == role.type) { if (each.label == role.type) {

Binary file not shown.

Binary file not shown.

View File

@ -736,6 +736,11 @@ function timedCount(){
// postMessage(data.body[i]); // postMessage(data.body[i]);
// } // }
// } // }
if(data.type == "VR_Sync_3D"){
postMessage(data);
}
if(data.type == "Device_Fault_Set_3D"){ if(data.type == "Device_Fault_Set_3D"){
postMessage(data); postMessage(data);
return; return;

View File

@ -162,8 +162,6 @@ StompClient.prototype = {
if (msg) { if (msg) {
msg = JSON.stringify(msg); msg = JSON.stringify(msg);
} }
console.log(url);
console.log(msg);
try { try {
this.clientIns.send(url, {}, msg); this.clientIns.send(url, {}, msg);
} catch (err) { } catch (err) {
@ -694,9 +692,7 @@ function timedCount(){
} }
if(e.data.type == "station"){ if(e.data.type == "station"){
// console.log(e.data.station);
station = e.data.station; station = e.data.station;
} }
if(e.data.type == "takeStation"){ if(e.data.type == "takeStation"){
@ -707,7 +703,6 @@ function timedCount(){
}; };
} }
if(e.data == "takeTopTrain"){ if(e.data == "takeTopTrain"){
console.log(nowTopTrain);
nowTakeTrain = { nowTakeTrain = {
code:nowTopTrain, code:nowTopTrain,
type:"takeTopTrain", type:"takeTopTrain",
@ -715,7 +710,6 @@ function timedCount(){
}; };
} }
if(e.data == "takeDownTrain"){ if(e.data == "takeDownTrain"){
// console.log(nowDownTrain);
nowTakeTrain = { nowTakeTrain = {
code:nowDownTrain, code:nowDownTrain,
type:"takeDownTrain", type:"takeDownTrain",
@ -745,7 +739,7 @@ function timedCount(){
// } // }
// } // }
if(data.type == "VR_Sync_3D"){ if(data.type == "VR_Sync_3D"){
console.log(data);
} }
if(data.type == "Device_Fault_Set_3D"){ if(data.type == "Device_Fault_Set_3D"){
postMessage(data); postMessage(data);
@ -765,8 +759,7 @@ function timedCount(){
// let nowTopTrain = null; // let nowTopTrain = null;
// let nowDownTrain = null; // let nowDownTrain = null;
if(data.type == 'TrainRun_3D'){ if(data.type == 'TrainRun_3D'){
// console.log(data); if(nowTakeTrain.status == "trainStop" ){
if(nowTakeTrain.status == "trainStop"){
for(let i=0,leni = data.body.length;i<leni;i++){ for(let i=0,leni = data.body.length;i<leni;i++){
if(data.body[i].section == station.topsection){ if(data.body[i].section == station.topsection){
@ -789,13 +782,14 @@ function timedCount(){
} }
if(data.type == 'BeAbout2Arrive_3D'){ if(data.type == 'BeAbout2Arrive_3D'){
if(data.body.groupNumber == nowTakeTrain.code){ if(data.body.groupNumber == nowTakeTrain.code && nowTakeTrain.code != null){
// nowTakeTrain.code = null; // nowTakeTrain.code = null;
let arriveStation = { let arriveStation = {
stationcode:data.body.stationCode, stationcode:data.body.stationCode,
type:nowTakeTrain.type, type:nowTakeTrain.type,
}; };
postMessage(arriveStation); postMessage(arriveStation);
} }
} }
@ -848,7 +842,7 @@ function timedCount(){
} }
if(data.body.type == "SWITCH"){ if(data.body.type == "SWITCH"){
postMessage(data.body); postMessage(data.body);
}// console.log(data); }
return; return;
} }