Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
3c016a5c4b
@ -333,19 +333,22 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
|
||||
for(let i=0,leni=stationList.length;i<leni;i++){
|
||||
|
||||
if(stationList[i].code == event.data.stationcode){
|
||||
|
||||
scope.nowstation = stationList[i];
|
||||
let stationworket = {
|
||||
type:'station',
|
||||
station:scope.nowstation
|
||||
};
|
||||
|
||||
let voicetext = scope.nowstation.name.split("(");
|
||||
localVoicePlay("列车即将进站"+voicetext[0]);
|
||||
|
||||
vrwebworker.postMessage(stationworket);
|
||||
vrPlane.updataStationMsg(scope.nowstation);
|
||||
trainControl.toptrain.position.x = 20000;
|
||||
trainControl.downtrain.position.x = 20000;
|
||||
|
||||
let voicetext = scope.nowstation.name.split("(");
|
||||
localVoicePlay("列车即将进站"+voicetext[0]);
|
||||
|
||||
|
||||
|
||||
trainControl.toptrain.status = "0";
|
||||
trainControl.downtrain.status = "0";
|
||||
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("(");
|
||||
localVoicePlay("列车即将进站"+voicetext[0]);
|
||||
|
||||
if(positionStatus == "topfloor"){
|
||||
trainControl.sound.pause();
|
||||
}
|
||||
if(positionStatus == "downfloor"){
|
||||
trainControl.sound.pause();
|
||||
}
|
||||
vrwebworker.postMessage(stationworket);
|
||||
vrPlane.updataStationMsg(scope.nowstation);
|
||||
trainControl.toptrain.position.x = 20000;
|
||||
@ -385,8 +393,7 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
|
||||
}
|
||||
|
||||
if(event.data.type == "topTrain"){
|
||||
console.log(event.data);
|
||||
console.log(trainControl.toptrain.status);
|
||||
|
||||
if(trainControl.toptrain.status != 1){
|
||||
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"){
|
||||
|
||||
console.log(event.data);
|
||||
|
||||
if(event.data.open == "0"){
|
||||
trainControl.closetraindoor(trainControl.toptrain,event.data.doorCode,"top");
|
||||
trainControl.closetraindoor(trainControl.toptrain,event.data.doorCode,positionStatus,"top");
|
||||
// trainLeaveStation("top");
|
||||
}else{
|
||||
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.open == "0"){
|
||||
trainControl.closetraindoor(trainControl.downtrain,event.data.doorCode,"down");
|
||||
trainControl.closetraindoor(trainControl.downtrain,event.data.doorCode,positionStatus,"down");
|
||||
// trainLeaveStation("down");
|
||||
}else{
|
||||
trainControl.opentraindoor(trainControl.downtrain,event.data.doorCode,"down");
|
||||
@ -580,7 +585,7 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
|
||||
floors.push(navmesh.children[0]);
|
||||
|
||||
|
||||
|
||||
let detectedVRDevices;
|
||||
let timer=setInterval(function(){
|
||||
|
||||
if(scope.stationtexture["stationlist"]){
|
||||
@ -597,7 +602,23 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
|
||||
scope.scene.add( vrPlane.group );
|
||||
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();
|
||||
clearInterval(timer);
|
||||
}
|
||||
@ -952,7 +973,7 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
|
||||
|
||||
}
|
||||
var object = intersection.object;
|
||||
console.log(intersection.point);
|
||||
|
||||
|
||||
if(positionStatus == "dm"){
|
||||
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];
|
||||
let stationworket = {
|
||||
type:'station',
|
||||
@ -1347,8 +1368,7 @@ export function Jl3dfaultdeviceVR(dom,group,skinCode) {
|
||||
|
||||
|
||||
function setTextVr(intersects,plane){
|
||||
console.log(intersects);
|
||||
console.log(plane);
|
||||
|
||||
if(intersects.text){
|
||||
let textgeometry = new THREE.PlaneBufferGeometry( 1.2, 0.8, 1 );
|
||||
let textt = new THREE.CanvasTexture(getTextCanvas(intersects));
|
||||
|
@ -56,6 +56,9 @@ let floors = [];
|
||||
window.speechSynthesis.getVoices()
|
||||
let voices = speechSynthesis.getVoices();
|
||||
|
||||
//通号人物
|
||||
let maintainerHuman = null;
|
||||
let maintainerGroup = new THREE.Group();
|
||||
export function Jl3dOtherVR(dom,group,skinCode) {
|
||||
|
||||
var scope = this;
|
||||
@ -178,7 +181,15 @@ export function Jl3dOtherVR(dom,group,skinCode) {
|
||||
otherVrViewWorker.postMessage(connectmsg);
|
||||
|
||||
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"){
|
||||
let newfault = {
|
||||
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.needsUpdate = true;
|
||||
scope.scene.add(scope.modelmanager.otherDevice.mesh);
|
||||
|
||||
maintainerHuman = scope.modelmanager.human.mesh;
|
||||
initHumanAnimation();
|
||||
maintainerGroup.add(maintainerHuman);
|
||||
scope.scene.add(maintainerGroup);
|
||||
otherVrViewWorker.postMessage("connect");
|
||||
animate();
|
||||
clearInterval(timer);
|
||||
@ -547,6 +561,7 @@ export function Jl3dOtherVR(dom,group,skinCode) {
|
||||
|
||||
moveanima.animateupdate();
|
||||
let delta = clock.getDelta();
|
||||
humanMoveUpdate(delta);
|
||||
if (mixers) {
|
||||
for (let i = 0; i < mixers.length; 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){
|
||||
console.log(intersects);
|
||||
|
@ -39,6 +39,7 @@ var VRButton = {
|
||||
|
||||
device.isPresenting ? device.exitPresent() : device.requestPresent( [ { source: renderer.domElement } ] );
|
||||
originPos.position.set( -12.21, 1.38+0.6, 3.49);
|
||||
|
||||
};
|
||||
|
||||
renderer.vr.setDevice( device );
|
||||
|
@ -2,11 +2,21 @@ export function TrainControl(){
|
||||
let scope = this;
|
||||
this.toptrain = 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){
|
||||
let ntracks1,ntracks2,tclip,fclip;
|
||||
console.log(animations);
|
||||
|
||||
ntracks2 = animations.slice(6,14);
|
||||
|
||||
fclip = new THREE.AnimationClip("four",2,ntracks2);
|
||||
@ -39,7 +49,7 @@ export function TrainControl(){
|
||||
scope.downtrain = object.clone(true);
|
||||
scope.downtrain.nowcode = null;
|
||||
scope.downtrain.floor = scope.downtrain.getObjectByName("xunlu6");
|
||||
// console.log();
|
||||
|
||||
scope.downtrain.floor.name = "downfloor";
|
||||
scope.downtrain.status = 0;
|
||||
scope.downtrain.action = {
|
||||
@ -55,9 +65,7 @@ export function TrainControl(){
|
||||
inittrainanimation(scope.toptrain,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.y = -20000;
|
||||
scope.downtrain.rotation.y = Math.PI;
|
||||
@ -78,6 +86,7 @@ export function TrainControl(){
|
||||
// if(doorcode == "2"){
|
||||
// actions = train.action.top;
|
||||
// }
|
||||
|
||||
actions = train.action.down;
|
||||
}else{
|
||||
// if(doorcode == "1"){
|
||||
@ -87,6 +96,7 @@ export function TrainControl(){
|
||||
// if(doorcode == "2"){
|
||||
// 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;
|
||||
|
||||
|
||||
|
||||
if(direct == "top"){
|
||||
// if(doorcode == "1"){
|
||||
// actions = train.action.down;
|
||||
@ -107,8 +120,19 @@ export function TrainControl(){
|
||||
// if(doorcode == "2"){
|
||||
// actions = train.action.top;
|
||||
// }
|
||||
if(positionStatus == "topfloor"){
|
||||
setTimeout(function(){
|
||||
scope.sound.play();
|
||||
}, 3000);
|
||||
}
|
||||
actions = train.action.down;
|
||||
}else{
|
||||
if(positionStatus == "downfloor"){
|
||||
setTimeout(function(){
|
||||
scope.sound.play();
|
||||
}, 3000);
|
||||
|
||||
}
|
||||
// if(doorcode == "1"){
|
||||
// actions = train.action.top;
|
||||
// }
|
||||
@ -127,6 +151,7 @@ export function TrainControl(){
|
||||
scope.trainLeaveStation(direct);
|
||||
}
|
||||
this.trainLeaveStation = function(direction){
|
||||
|
||||
if(direction == "top"){
|
||||
setTimeout(function(){
|
||||
let timer=setInterval(function(){
|
||||
|
@ -37,6 +37,13 @@ export function ModelManagerVR(){
|
||||
url:"../../static/vrtest/vrTrain.FBX"
|
||||
};
|
||||
|
||||
this.human = {
|
||||
code:"human",
|
||||
locateType:"5",
|
||||
mesh:null,
|
||||
url:"../../static/vrtest/vrHuman.FBX"
|
||||
};
|
||||
|
||||
this.loadpromise = function (mixers){
|
||||
let initlist = [];
|
||||
|
||||
@ -45,6 +52,7 @@ export function ModelManagerVR(){
|
||||
initlist.push(fbxpromise(mixers,scope.stationOut));
|
||||
initlist.push(fbxpromise(mixers,scope.otherDevice));
|
||||
initlist.push(fbxpromise(mixers,scope.train));
|
||||
initlist.push(fbxpromise(mixers,scope.human));
|
||||
// initlist.push(fbxpromise(data.Switch,mixers,scope.switchmodel));
|
||||
// initlist.push(fbxpromise(data.Signal,mixers,scope.signalmodel));
|
||||
// initlist.push(fbxpromise(data.stationstand,mixers,scope.standmodel));
|
||||
@ -56,7 +64,7 @@ export function ModelManagerVR(){
|
||||
Promise.all(initlist).then((result) => {
|
||||
resolve("success"); //['成功了', 'success']
|
||||
}).catch((error) => {
|
||||
//console.log(error);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@ -69,8 +77,7 @@ function fbxpromise(mixers,model){
|
||||
var loader = new THREE.FBXLoader();
|
||||
loader.load( model.url, function ( object ) {
|
||||
let mixer = new THREE.AnimationMixer( object );
|
||||
// console.log(model.code);
|
||||
// console.log(object.animations[0]);
|
||||
|
||||
object.animacode = model.code;
|
||||
// model.mesh = object;
|
||||
|
||||
@ -91,7 +98,6 @@ function fbxpromise(mixers,model){
|
||||
realtrain.add(object.getObjectByName("xunlu6"));
|
||||
model.mesh = realtrain;
|
||||
|
||||
// console.log(realtrain);
|
||||
model.animations = object.animations[0].tracks;
|
||||
}else{
|
||||
model.mesh = object;
|
||||
|
@ -169,12 +169,19 @@ class Jlmap {
|
||||
}
|
||||
|
||||
setCenter(deviceCode) {
|
||||
const arr = Object.keys(this.mapDevice);
|
||||
if (arr.length != 0) {
|
||||
const device = this.mapDevice[deviceCode];
|
||||
if (device && device.instance) {
|
||||
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() {
|
||||
this.screenFlag = false;
|
||||
|
@ -3,7 +3,6 @@ class Theme {
|
||||
this._code = '02';
|
||||
this._mapMenu = {
|
||||
'01': 'chengdu_01',
|
||||
// '01': 'ningbo_03',
|
||||
'02': 'fuzhou_01',
|
||||
'03': 'beijing_01',
|
||||
'04': 'chengdu_03',
|
||||
|
@ -14,114 +14,101 @@ export default {
|
||||
ExcelConfig: {
|
||||
beginRow: 1,
|
||||
beginCol: 0,
|
||||
fieldNum: 10,
|
||||
sepField: '行车间隔',
|
||||
trainId: 'TrainID',
|
||||
columns: ['折返线', 'TrainID', '行车间隔']
|
||||
fieldNum: 6,
|
||||
sepField: '车次号',
|
||||
columns: {
|
||||
'停车站名称': { key: 'stationName', formatter: (val) => { return val; } },
|
||||
'到达时间': { key: 'arriveTime', formatter: (val) => { return val; } },
|
||||
'出发时间': { key: 'departureTime', formatter: (val) => { return val; } }
|
||||
}
|
||||
},
|
||||
|
||||
/** 解析exal数据转换为Json后台数据*/
|
||||
importData(Sheet, JsonData) {
|
||||
var dataList = convertSheetToList(Sheet, true);
|
||||
const dataList = convertSheetToList(Sheet, true);
|
||||
const needList = Object.keys(this.ExcelConfig.columns);
|
||||
debugger;
|
||||
|
||||
if (dataList && dataList.length) {
|
||||
if (dataList && dataList.length && dataList[1] && dataList[0]) {
|
||||
// const tIndex = dataList.findIndex(it => { return it[0]; }); // 设置不用过滤行数
|
||||
const tIndex = 9; // 设置不用过滤行数
|
||||
for (let colIndex = this.ExcelConfig.beginCol; colIndex < dataList.length; colIndex += this.ExcelConfig.fieldNum + 1) {
|
||||
let isContinue = true;
|
||||
let tripObj = { code: '', directionCode: '', arrivalList: [] };
|
||||
for (let rowIndex = this.ExcelConfig.beginRow; isContinue; rowIndex += 1) {
|
||||
isContinue = false;
|
||||
|
||||
/** 解析二维数组为json对象*/
|
||||
const reg3 = /^(\d+:\d+:\d+|)/; // 06:12:00
|
||||
dataList.forEach((elem, i) => {
|
||||
var begin = -1;
|
||||
/** 跳过名称所在的行*/
|
||||
if (i != tIndex && elem && elem.length > 0) {
|
||||
let flag = false;
|
||||
let count = 0;
|
||||
let param = { begTime: '', endTime: '' };
|
||||
if (i > tIndex) { elem.reverse(); }
|
||||
elem.forEach((item, j) => {
|
||||
/** 过滤空值*/
|
||||
if (item) {
|
||||
let title = '';
|
||||
var value = `${item}`.trim();
|
||||
if (i > tIndex) { // 上行线
|
||||
title = `${dataList[tIndex][dataList[tIndex].length - j - 1]}`.replace(/\s*/g, '');
|
||||
if (title == 'undefined') {
|
||||
title = `${dataList[tIndex][dataList[tIndex].length - j - 2]}`.replace(/\s*/g, '');
|
||||
const stationObj = {};
|
||||
for (let index = 0; index < this.ExcelConfig.fieldNum; index += 1) {
|
||||
if (dataList[colIndex + index]) {
|
||||
const title = dataList[colIndex + index][0];
|
||||
const value = dataList[colIndex + index][rowIndex];
|
||||
|
||||
if (title && value) {
|
||||
// 数据列解析
|
||||
isContinue = true;
|
||||
const titleStr = `${title}`.trim();
|
||||
let valueStr = `${value}`.trim();
|
||||
|
||||
if (titleStr == this.ExcelConfig.sepField) {
|
||||
valueStr = `${dataList[colIndex + index - 1][rowIndex]}${valueStr}`;
|
||||
if (tripObj.code) {
|
||||
const length = tripObj.arrivalList.length;
|
||||
if (length == 1) {
|
||||
tripObj.arrivalList[0]['flag'] = true;
|
||||
}
|
||||
} else { // 下行线
|
||||
title = `${dataList[tIndex][j]}`.replace(/\s*/g, '');
|
||||
if (title == 'undefined') {
|
||||
title = `${dataList[tIndex][j - 1]}`.replace(/\s*/g, '');
|
||||
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 (begin == -1) {
|
||||
flag = true;
|
||||
begin = value; // 设置初始索引
|
||||
JsonData.push({
|
||||
code: value,
|
||||
destinationCode: '',
|
||||
arrivalList: []
|
||||
});
|
||||
} else if (flag) {
|
||||
begin = -1; // 清空初始索引
|
||||
JsonData[JsonData.length - 1].destinationCode = value;
|
||||
flag = false;
|
||||
// 取需要的字段
|
||||
if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) {
|
||||
stationObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr);
|
||||
if (this.ExcelConfig.columns[titleStr].key == 'arriveTime' || this.ExcelConfig.columns[titleStr].key == 'departureTime') {
|
||||
stationObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(prefixTime(valueStr));
|
||||
}
|
||||
} 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 (Object.keys(stationObj).length) {
|
||||
if (stationObj.arriveTime) {
|
||||
tripObj.arrivalList.push(stationObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (param.begTime && param.endTime) {
|
||||
need = true;
|
||||
// 添加最后那条没有车次的记录
|
||||
if (tripObj.code) {
|
||||
const length = tripObj.arrivalList.length;
|
||||
if (length) {
|
||||
tripObj.arrivalList[length - 1]['flag'] = true;
|
||||
}
|
||||
JsonData.push(tripObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 添加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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return JsonData;
|
||||
},
|
||||
|
||||
/** 将后台数据解析成图表*/
|
||||
convertDataToModels(data, stations, kmRangeCoordMap, lineStyle) {
|
||||
var models = [];
|
||||
|
||||
if (data && data.serviceNumberDataList && data.serviceNumberDataList.length) {
|
||||
/** 按服务遍历数据*/
|
||||
data.serviceNumberDataList.forEach((service) => {
|
||||
/** 按车次遍历数据*/
|
||||
var isBackup = true;
|
||||
var opt = { name: '', markPointData: [], data: [] };
|
||||
if (service.tripNumberDataList && service.tripNumberDataList.length) {
|
||||
service.tripNumberDataList.forEach((train, j) => {
|
||||
@ -134,7 +121,8 @@ export default {
|
||||
/** 如果车次号为空,不显示名称*/
|
||||
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.directionCode = train.directionCode;
|
||||
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 > 0 && index < train.stationTimeList.length - 1) {
|
||||
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];
|
||||
nextPoint = service.tripNumberDataList[j + 1].stationTimeList[1];
|
||||
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 || ''}`]);
|
||||
opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.directionCode, true, num), nextPoint.stationCode, `${service.serviceNumber}${train.tripNumber}${train.destinationCode || ''}`]);
|
||||
const aa = `${train.directionCode}${train.tripNumber}`;
|
||||
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: [] };
|
||||
}
|
||||
}
|
||||
|
||||
isBackup = train.backup;
|
||||
});
|
||||
|
||||
// 不是备用车,按服务添加线
|
||||
if (!service.backup) {
|
||||
if (!isBackup) {
|
||||
/** 创建一条完成的服务数据*/
|
||||
var model = createSeriesModel(opt, Object.assign({ color: hexColor.toCreate() }, lineStyle));
|
||||
if (model) {
|
||||
@ -201,6 +192,7 @@ export default {
|
||||
if (!runPlanData[elem.serviceNumber]) {
|
||||
/** 创建一个新服务号标记*/
|
||||
runPlanData[elem.serviceNumber] = {};
|
||||
|
||||
/** 不存在此服务号,则需要创建一条新的line*/
|
||||
series.push(createSeriesModel({
|
||||
zlevel: 1,
|
||||
@ -229,17 +221,17 @@ export default {
|
||||
serie.markPoint.data.push(createMartPoint({
|
||||
directionCode: elem.directionCode,
|
||||
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'
|
||||
}));
|
||||
}
|
||||
|
||||
/** 计算折返点*/
|
||||
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) {
|
||||
var lastPoint = serie.data[serie.data.length - 1];
|
||||
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([nextPoint[0], this.getYvalueByDirectionCode(nextPoint[1], lastPoint[2], num), lastPoint[2]]);
|
||||
}
|
||||
|
@ -341,6 +341,7 @@ const training = {
|
||||
commit('resetScore');
|
||||
// 设置其他属性状态
|
||||
commit('setOffsetStationCode', null);
|
||||
commit('changeMode', null);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -73,7 +73,8 @@ export default {
|
||||
{
|
||||
name: '发布',
|
||||
handleClick: this.publishScript,
|
||||
type: 'primary'
|
||||
type: 'primary',
|
||||
showControl: (row) => { return !row.publish; }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -17,10 +17,9 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {covertMemberData} from './utils';
|
||||
import ChatBox from '../chatView/chatBox.vue';
|
||||
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 {getAllConversition} from '@/api/chat';
|
||||
export default {
|
||||
@ -71,106 +70,37 @@ export default {
|
||||
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 = [];
|
||||
const driverList = [];
|
||||
this.treeData = [];
|
||||
lastData.forEach((member, index)=>{
|
||||
if (member.type != '观众') {
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
const result = covertMemberData(this.activeTrainList, resp);
|
||||
this.driverList = result.driverList;
|
||||
this.treeData = [{
|
||||
label: '行调',
|
||||
id: 'dispatcher',
|
||||
type: 'role',
|
||||
children: dispatcherList
|
||||
children: result.deviceListData[0]
|
||||
}, {
|
||||
label: '车站值班员',
|
||||
id: 'stationSupervisor',
|
||||
type: 'role',
|
||||
children: stationSupervisorList
|
||||
children: result.deviceListData[2]
|
||||
}, {
|
||||
label: '司机',
|
||||
id: 'driver',
|
||||
type: 'role',
|
||||
children: driverList
|
||||
children: result.deviceListData[3]
|
||||
}, {
|
||||
label: '通号',
|
||||
id: 'maintainer',
|
||||
type: 'role',
|
||||
children: maintainerList
|
||||
children: result.deviceListData[1]
|
||||
}, {
|
||||
label: '车辆段',
|
||||
id: 'depotDispatcher',
|
||||
type: 'role',
|
||||
children: depotDispatcherList
|
||||
children: result.deviceListData[4]
|
||||
}];
|
||||
this.memberData = lastMemberList;
|
||||
this.memberData = result.lastMemberList;
|
||||
}).catch(() => {
|
||||
this.$messageBox('获取仿真成员列表失败!');
|
||||
});
|
||||
|
@ -38,7 +38,7 @@
|
||||
import Jl3dDevice from '@/views/jlmap3d/device/jl3ddevice';
|
||||
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import ChangeMap from './changeMap';
|
||||
import ChangeMap from './dispatherContest/changeMap';
|
||||
import { getSessionStorage } from '@/utils/auth';
|
||||
import Scheduling from '@/views/newMap/displayNew/demon/scheduling';
|
||||
import SchedulingView from '@/views/newMap/displayNew/demon/schedulingView';
|
||||
|
@ -54,9 +54,9 @@
|
||||
|
||||
<!-- 单人仿真 -->
|
||||
<script>
|
||||
import SetTime from './demon/setTime';
|
||||
import DemonMenu from './demonMenu';
|
||||
import DemonChat from './demonChat';
|
||||
import SetTime from '../demon/setTime';
|
||||
import DemonMenu from '../demonMenu';
|
||||
import DemonChat from '../demonChat';
|
||||
import MenuSchema from '@/views/newMap/displayNew/menuSchema';
|
||||
import { getGoodsTryUse } from '@/api/management/goods';
|
||||
import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@/api/simulation';
|
||||
@ -416,7 +416,7 @@ export default {
|
||||
location.reload();
|
||||
});
|
||||
});
|
||||
}).catch(error=> {
|
||||
}).catch(()=> {
|
||||
this.$message.error('结束仿真失败!');
|
||||
});
|
||||
},
|
@ -23,7 +23,6 @@ import { Notification } from 'element-ui';
|
||||
import { startTrainingNew } from '@/api/jmap/training';
|
||||
import { timeFormat } from '@/utils/date';
|
||||
import { refreshExamList, finishOneExamQuestion } from '@/api/management/userexam';
|
||||
import { launchFullscreen } from '@/utils/screen';
|
||||
|
||||
export default {
|
||||
name: 'MenuExam',
|
||||
@ -154,7 +153,6 @@ export default {
|
||||
});
|
||||
},
|
||||
init() {
|
||||
launchFullscreen();
|
||||
// 刷新考试列表
|
||||
refreshExamList(this.$route.query.userExamId).then(response => {
|
||||
this.$store.dispatch('exam/setUsedTime', response.data.usedTime);
|
||||
@ -175,12 +173,9 @@ export default {
|
||||
},
|
||||
// 课程和考试系统
|
||||
async initData() {
|
||||
this.$store.dispatch('training/end', null);
|
||||
if (parseInt(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) {
|
||||
const detail = resp.data;
|
||||
await this.$store.dispatch('training/setPrdType', this.prdTypeMap[detail.prdType]);
|
||||
|
@ -23,7 +23,7 @@
|
||||
highlight-current
|
||||
@node-click="getTrainDetail"
|
||||
>
|
||||
<span slot-scope="{ node, data }">
|
||||
<span slot-scope="{ data }">
|
||||
<span :style="{color: data.usedTime !== undefined ? 'green':''}"> {{ trainingList.indexOf(data)+1 }}.{{
|
||||
data.trainingName }}
|
||||
</span>
|
||||
@ -131,7 +131,7 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$store.state.map.mapViewLoadedCount': function() {
|
||||
'$store.state.map.mapViewLoadedCount': function() { // 地图视图加载完成标识
|
||||
this.$store.dispatch('exam/stopCountTime');
|
||||
this.loadInitData();
|
||||
this.$store.dispatch('exam/countUsedTime');
|
||||
@ -165,7 +165,7 @@ export default {
|
||||
minDuration: res.data.minDuration,
|
||||
updateTime: res.data.updateTime
|
||||
};
|
||||
this.$store.dispatch('exam/setCenter', res.data.locateDeviceCode);
|
||||
// this.$store.dispatch('exam/setCenter', res.data.locateDeviceCode);
|
||||
}).catch(error => {
|
||||
this.$message.error(this.$t('display.exam.getTestInformation') + ':' + error.message);
|
||||
});
|
||||
|
@ -39,12 +39,15 @@ import { timeFormat } from '@/utils/date';
|
||||
import MapSystemDraft from '@/views/newMap/mapsystemNew/index';
|
||||
import StatusIcon from '@/views/components/StatusIcon/statusIcon';
|
||||
import MenuDemon from '@/views/newMap/displayNew/menuDemon';
|
||||
|
||||
import MenuExam from './exam/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 MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
|
||||
import MenuScript from '@/views/newMap/displayNew/menuScript';
|
||||
import MenuDispatherContest from './menuDispatherContest';
|
||||
|
||||
import { clearSimulation, getSimulationInfoNew } from '@/api/simulation';
|
||||
import { loadNewMapDataByGroup } from '@/utils/loaddata';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
@ -124,7 +127,6 @@ export default {
|
||||
},
|
||||
'$store.state.app.windowSizeCount': function() { // 窗口缩放
|
||||
this.setWindowSize();
|
||||
this.setPosition();
|
||||
},
|
||||
'$store.state.training.prdType': function (val) { // 根据权限类型计算高度
|
||||
this.setPosition();
|
||||
@ -172,6 +174,8 @@ export default {
|
||||
await this.$refs.menuDemon.back();
|
||||
} else if (this.isScript) {
|
||||
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/countTime');
|
||||
this.planRunning = resp.data.planRunning;
|
||||
if (!this.planRunning) {
|
||||
this.$store.dispatch('training/over');
|
||||
}
|
||||
|
||||
if (this.isDemon) {
|
||||
this.$refs.menuDemon.initPlannedDriving(this.planRunning); // 是否正在按计划行车
|
||||
} else if (this.isScript) {
|
||||
|
@ -156,7 +156,7 @@ export default {
|
||||
// 清空按钮操作
|
||||
this.$store.dispatch('menuOperation/setButtonOperation', null);
|
||||
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) {
|
||||
startTrainingNew(this.trainingObj, this.group).then(response => {
|
||||
this.isDisable = true;
|
||||
|
@ -6,6 +6,7 @@
|
||||
<span v-if="countTime" class="display-score">{{ $t('display.demon.trialTime') }} {{ countTime }}</span>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<demon-menu
|
||||
ref="demonMenu"
|
||||
:is-all-show="!dataError"
|
||||
@ -42,12 +43,6 @@
|
||||
@selectQuest="selectQuest"
|
||||
/>
|
||||
|
||||
<!-- :station-list="stationListMode"
|
||||
:show-select-station="showSelectStation"
|
||||
@selectQuest="selectQuest"
|
||||
@switchStationMode="switchStationMode"
|
||||
@switchMode="switchMode" -->
|
||||
|
||||
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
|
||||
</div>
|
||||
|
||||
|
@ -21,13 +21,15 @@ export const operateEnum = {
|
||||
code:'routeCodeList',
|
||||
isDevice:true,
|
||||
isList:true,
|
||||
name:'进路列表'
|
||||
name:'进路列表',
|
||||
function:getRouteNameById
|
||||
},
|
||||
Signal_Close_Auto_Setting:{
|
||||
code:'routeCodeList',
|
||||
isDevice:true,
|
||||
isList:true,
|
||||
name:'进路列表'
|
||||
name:'进路列表',
|
||||
function:getRouteNameById
|
||||
}
|
||||
},
|
||||
Switch:{
|
||||
@ -54,6 +56,15 @@ export const operateEnum = {
|
||||
name:'限速值为'
|
||||
}
|
||||
},
|
||||
ControlConvertMenu:{
|
||||
CM_Apply_For_Station_Control:{
|
||||
code:'stationCodes',
|
||||
isList:true,
|
||||
isDevice:true,
|
||||
name:'车站列表',
|
||||
function:getStationNameById
|
||||
}
|
||||
},
|
||||
Stand:{
|
||||
code:'standCode',
|
||||
type:'站台',
|
||||
@ -116,11 +127,17 @@ export function covertOperate(operationType, operationParamMap) {
|
||||
if (operationType == 'Set_Fault' || operationType == 'Cancel_Fault') {
|
||||
// covertOperation(operationType);
|
||||
} 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 deviceInfo = covertOperation(device, operationParamMap, operationType);
|
||||
let tip = '请找到' + deviceInfo.deviceName + ',';
|
||||
tip += ' 执行【' + operateName.label + '】操作';
|
||||
let tip = '请';
|
||||
if (deviceInfo.deviceName) {
|
||||
tip += '找到' + deviceInfo.deviceName + ',';
|
||||
}
|
||||
tip += '执行【' + operateName.label + '】操作';
|
||||
if (deviceInfo.paramName) {
|
||||
tip += ',参数为:' + deviceInfo.paramName;
|
||||
}
|
||||
@ -131,6 +148,7 @@ export function covertOperate(operationType, operationParamMap) {
|
||||
function covertOperation(deviceType, operationParamMap, operationType) {
|
||||
let deviceName = '';
|
||||
let paramName = '';
|
||||
if (operateEnum[deviceType].code) {
|
||||
const device = store.getters['map/getDeviceByCode'](operationParamMap[operateEnum[deviceType].code]);
|
||||
if (device._type == 'StationStand') {
|
||||
const station = store.getters['map/getDeviceByCode'](device.stationCode);
|
||||
@ -144,11 +162,20 @@ function covertOperation(deviceType, operationParamMap, operationType) {
|
||||
} else {
|
||||
deviceName += '【' + operateEnum[deviceType].type + ' ' + device.name + '】';
|
||||
}
|
||||
}
|
||||
const paramInfo = operateEnum[deviceType][operationType];
|
||||
if (paramInfo) {
|
||||
if (paramInfo.isDevice) {
|
||||
if (paramInfo.isList) {
|
||||
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 {
|
||||
paramName += '【' + paramInfo.name + ' ';
|
||||
paramName += getRouteNameById(operationParamMap[paramInfo.code]) + '】';
|
||||
@ -158,7 +185,7 @@ function covertOperation(deviceType, operationParamMap, operationType) {
|
||||
const params = paramInfo.params;
|
||||
if (params && params.length > 0) {
|
||||
paramName += '【';
|
||||
params.forEach(param=>{
|
||||
params.forEach((param, index)=>{
|
||||
paramName += ' ' + param.name;
|
||||
const data = operationParamMap[param.code];
|
||||
param.result.forEach(result=>{
|
||||
@ -182,16 +209,24 @@ function covertOperation(deviceType, operationParamMap, operationType) {
|
||||
}
|
||||
}
|
||||
});
|
||||
if (index != params.length - 1) {
|
||||
paramName += ',';
|
||||
}
|
||||
});
|
||||
paramName += '】';
|
||||
}
|
||||
} else {
|
||||
paramName += '【' + paramInfo.name + operationParamMap[paramInfo.code] + '】';
|
||||
}
|
||||
}
|
||||
}
|
||||
return {deviceName:deviceName, paramName:paramName};
|
||||
}
|
||||
|
||||
function covertFunction(func, device) {
|
||||
return func(device);
|
||||
}
|
||||
|
||||
function getRouteNameById(routeId) {
|
||||
const routeList = store.state.map.routeList;
|
||||
const route = routeList.find(route=>{
|
||||
@ -200,3 +235,8 @@ function getRouteNameById(routeId) {
|
||||
if (route) { return route.name; } else { return ''; }
|
||||
}
|
||||
|
||||
function getStationNameById(stationId) {
|
||||
const station = store.getters['map/getDeviceByCode'](stationId);
|
||||
return station.name;
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,7 @@ export default {
|
||||
dataError: false,
|
||||
faultMode: false,
|
||||
viewDisabled: true,
|
||||
firstLoad:true,
|
||||
isscriptRun:false // 剧本是否正在加载
|
||||
};
|
||||
},
|
||||
@ -104,15 +105,15 @@ export default {
|
||||
this.setWindowSize();
|
||||
},
|
||||
'$store.state.training.switchcount': async function () {
|
||||
if (this.group) {
|
||||
if (this.group && this.firstLoad) {
|
||||
await this.loadRunData();
|
||||
// if (this.$store.state.training.started && !this.firstLoad) {
|
||||
|
||||
// } else if (this.firstLoad) {
|
||||
// await this.loadRunData(this.$route.query);
|
||||
// }
|
||||
// this.firstLoad = false;
|
||||
}
|
||||
this.firstLoad = false;
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
|
@ -37,10 +37,10 @@
|
||||
<script>
|
||||
import { TrainingMode } from '@/scripts/ConstDic';
|
||||
import MenuSchema from '@/views/newMap/displayNew/menuSchema';
|
||||
import DemonMenu from './demonMenu';
|
||||
import DemonMenu from '@/views/newMap/displayNew/demonMenu';
|
||||
import ScriptChat from './scriptChat';
|
||||
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 { ranAsPlan, exitRunPlan } from '@/api/simulation';
|
||||
import { mapGetters } from 'vuex';
|
@ -14,9 +14,8 @@
|
||||
/>
|
||||
</template>
|
||||
<script>
|
||||
import ChatBox from '../chatView/chatBox.vue';
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
import Cookies from 'js-cookie';
|
||||
import ChatBox from '@/views/newMap/chatView/chatBox.vue';
|
||||
import {covertMemberData} from '@/views/newMap/displayNew/utils';
|
||||
import {getAllConversition} from '@/api/chat';
|
||||
import { getSimulationMemberList} from '@/api/simulation';
|
||||
export default {
|
||||
@ -60,105 +59,37 @@ export default {
|
||||
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 = [];
|
||||
const driverList = [];
|
||||
this.treeData = [];
|
||||
lastData.forEach((member, index)=>{
|
||||
if (member.type != '观众') {
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
const result = covertMemberData(this.activeTrainList, resp);
|
||||
this.driverList = result.driverList;
|
||||
this.treeData = [{
|
||||
label: '行调',
|
||||
id: 'dispatcher',
|
||||
type: 'role',
|
||||
children: dispatcherList
|
||||
children: result.deviceListData[0]
|
||||
}, {
|
||||
label: '车站值班员',
|
||||
id: 'stationSupervisor',
|
||||
type: 'role',
|
||||
children: stationSupervisorList
|
||||
children: result.deviceListData[2]
|
||||
}, {
|
||||
label: '司机',
|
||||
id: 'driver',
|
||||
type: 'role',
|
||||
children: driverList
|
||||
children: result.deviceListData[3]
|
||||
}, {
|
||||
label: '通号',
|
||||
id: 'maintainer',
|
||||
type: 'role',
|
||||
children: maintainerList
|
||||
children: result.deviceListData[1]
|
||||
}, {
|
||||
label: '车辆段',
|
||||
id: 'depotDispatcher',
|
||||
type: 'role',
|
||||
children: depotDispatcherList
|
||||
children: result.deviceListData[4]
|
||||
}];
|
||||
this.memberData = lastMemberList;
|
||||
this.memberData = result.lastMemberList;
|
||||
}).catch(() => {
|
||||
this.$messageBox('获取仿真成员列表失败!');
|
||||
});
|
||||
@ -185,6 +116,7 @@ export default {
|
||||
if (this.driverList.length > 0) {
|
||||
const driverList = [];
|
||||
if (activeTrainList && activeTrainList.length) {
|
||||
activeTrainList.sort();
|
||||
activeTrainList.forEach(groupNumber => {
|
||||
const drivers = this.driverList.find(driver=>{
|
||||
return driver.deviceCode == groupNumber;
|
57
src/views/newMap/displayNew/utils.js
Normal file
57
src/views/newMap/displayNew/utils.js
Normal 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};
|
||||
}
|
@ -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) {
|
||||
this.resetSize();
|
||||
@ -352,7 +355,7 @@ export default {
|
||||
async simulationReset() {
|
||||
await this.$store.dispatch('map/clearJlmapTrainView');
|
||||
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/setSimulationStart');
|
||||
await this.$store.dispatch('training/setMapDefaultState');
|
||||
|
@ -38,7 +38,6 @@ export default {
|
||||
methods: {
|
||||
tipInit() {
|
||||
this.$nextTick(() => {
|
||||
console.log('tipInit',);
|
||||
this.$store.dispatch('training/isTeachMode').then(() => {
|
||||
this.tipShow = true;
|
||||
const offset = this.$store.state.config.canvasOffset;
|
||||
|
@ -219,7 +219,6 @@ export default {
|
||||
for (const index in wb.Sheets) {
|
||||
jsonData = that.planConvert.importData(wb.Sheets[index], jsonData);
|
||||
}
|
||||
console.log(jsonData, '解析后数据');
|
||||
|
||||
if (that.$route.query.lineCode == '02' && !jsonData[0].downTrack && !jsonData[0].upTrack) {
|
||||
that.loadingDig.close();
|
||||
|
@ -214,13 +214,11 @@ export default {
|
||||
});
|
||||
}
|
||||
if (wb) {
|
||||
try {
|
||||
let jsonData = [];
|
||||
for (const index in wb.Sheets) {
|
||||
jsonData = that.planConvert.importData(wb.Sheets[index], jsonData);
|
||||
}
|
||||
console.log(jsonData, '解析后数据');
|
||||
|
||||
if (jsonData.length) {
|
||||
if (that.$route.query.lineCode == '02' && !jsonData[0].downTrack && !jsonData[0].upTrack) {
|
||||
that.loadingDig.close();
|
||||
that.$message.warning(`运行图暂无默认上行折返轨或默认下行折返轨,请输入`);
|
||||
@ -237,9 +235,9 @@ export default {
|
||||
that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`);
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
} else {
|
||||
that.loadingDig.close();
|
||||
that.$message.warning(`${that.$t('tip.parseRunGraphFailed')} ${error.message}`);
|
||||
that.$message.warning(that.$t('tip.parseRunGraphFailed'));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -197,7 +197,7 @@ export default {
|
||||
name:this.$store.state.user.nickname
|
||||
}
|
||||
);
|
||||
// this.oldMemberId = role.id;
|
||||
this.oldMemberId = role.id;
|
||||
this.$store.dispatch('training/setPrdType', prdType);
|
||||
ConstConfig.ConstSelect.roleTypeNew.forEach(each=>{
|
||||
if (each.label == role.type) {
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -736,6 +736,11 @@ function timedCount(){
|
||||
// postMessage(data.body[i]);
|
||||
// }
|
||||
// }
|
||||
|
||||
if(data.type == "VR_Sync_3D"){
|
||||
postMessage(data);
|
||||
}
|
||||
|
||||
if(data.type == "Device_Fault_Set_3D"){
|
||||
postMessage(data);
|
||||
return;
|
||||
|
@ -162,8 +162,6 @@ StompClient.prototype = {
|
||||
if (msg) {
|
||||
msg = JSON.stringify(msg);
|
||||
}
|
||||
console.log(url);
|
||||
console.log(msg);
|
||||
try {
|
||||
this.clientIns.send(url, {}, msg);
|
||||
} catch (err) {
|
||||
@ -694,9 +692,7 @@ function timedCount(){
|
||||
}
|
||||
|
||||
if(e.data.type == "station"){
|
||||
// console.log(e.data.station);
|
||||
station = e.data.station;
|
||||
|
||||
}
|
||||
|
||||
if(e.data.type == "takeStation"){
|
||||
@ -707,7 +703,6 @@ function timedCount(){
|
||||
};
|
||||
}
|
||||
if(e.data == "takeTopTrain"){
|
||||
console.log(nowTopTrain);
|
||||
nowTakeTrain = {
|
||||
code:nowTopTrain,
|
||||
type:"takeTopTrain",
|
||||
@ -715,7 +710,6 @@ function timedCount(){
|
||||
};
|
||||
}
|
||||
if(e.data == "takeDownTrain"){
|
||||
// console.log(nowDownTrain);
|
||||
nowTakeTrain = {
|
||||
code:nowDownTrain,
|
||||
type:"takeDownTrain",
|
||||
@ -745,7 +739,7 @@ function timedCount(){
|
||||
// }
|
||||
// }
|
||||
if(data.type == "VR_Sync_3D"){
|
||||
console.log(data);
|
||||
|
||||
}
|
||||
if(data.type == "Device_Fault_Set_3D"){
|
||||
postMessage(data);
|
||||
@ -765,8 +759,7 @@ function timedCount(){
|
||||
// let nowTopTrain = null;
|
||||
// let nowDownTrain = null;
|
||||
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++){
|
||||
if(data.body[i].section == station.topsection){
|
||||
@ -789,13 +782,14 @@ function timedCount(){
|
||||
}
|
||||
if(data.type == 'BeAbout2Arrive_3D'){
|
||||
|
||||
if(data.body.groupNumber == nowTakeTrain.code){
|
||||
if(data.body.groupNumber == nowTakeTrain.code && nowTakeTrain.code != null){
|
||||
// nowTakeTrain.code = null;
|
||||
|
||||
let arriveStation = {
|
||||
stationcode:data.body.stationCode,
|
||||
type:nowTakeTrain.type,
|
||||
};
|
||||
|
||||
postMessage(arriveStation);
|
||||
}
|
||||
}
|
||||
@ -848,7 +842,7 @@ function timedCount(){
|
||||
}
|
||||
if(data.body.type == "SWITCH"){
|
||||
postMessage(data.body);
|
||||
}// console.log(data);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user