Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
7d68f74b8c
@ -82,7 +82,9 @@ export default {
|
||||
},
|
||||
subscribeMessage(res) {
|
||||
if (this.$refs.deomonTopic && !window.location.href.includes('trainroom')) {
|
||||
this.$refs.deomonTopic.doShow(res);
|
||||
if (getSessionStorage('project') != 'refereeJsxt') {
|
||||
this.$refs.deomonTopic.doShow(res);
|
||||
}
|
||||
this.$store.dispatch('socket/setRoomInvite');
|
||||
}
|
||||
},
|
||||
|
@ -49,7 +49,7 @@ export function getQuestionListByMapId(params) {
|
||||
// 加载实操及内容
|
||||
export function loadQuestionList(competitionId, data) {
|
||||
return request({
|
||||
url: `/api/v1/competitionPractical/${competitionId}/distribute`,
|
||||
url: `api/v1/competitionPractical/competition/${competitionId}/distribute`,
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
|
File diff suppressed because one or more lines are too long
@ -22,7 +22,7 @@ var Staticmodel = {
|
||||
deviceType: "stationstand",
|
||||
type: "low",
|
||||
picUrl: "",
|
||||
assetUrl: "../../static/model/device/stationstand/stationstandhrb.FBX"
|
||||
assetUrl: "../../static/model/device/stationstand/stationstand.FBX"
|
||||
//https://joylink.club/oss/wx/stationstand/stationstand.FBX
|
||||
//../../static/model/device/stationstand.FBX
|
||||
|
||||
|
@ -4,14 +4,18 @@ import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
|
||||
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
|
||||
|
||||
import { ModelManager } from '@/jlmap3d/jl3ddevice/loader.js';
|
||||
import { Standtextureload } from '@/jlmap3d/jl3ddevice/standtextureload.js';
|
||||
import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js';
|
||||
import { Moveanimate } from '@/jlmap3d/jl3ddevice/component/moveanimate.js';
|
||||
import { Textconfig } from '@/jlmap3d/jl3ddevice/component/textconfig.js';
|
||||
|
||||
import { getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
|
||||
|
||||
|
||||
import StompClient from '@/utils/sock';
|
||||
|
||||
var clock = new THREE.Clock();
|
||||
export function Jl3ddeviceNew(dom,group,token) {
|
||||
export function Jl3ddeviceNew(dom,group,token,skinCode) {
|
||||
var scope = this;
|
||||
|
||||
this.dom = dom;
|
||||
@ -24,6 +28,8 @@ export function Jl3ddeviceNew(dom,group,token) {
|
||||
|
||||
let helpbox,textplane;
|
||||
let daochamodel;
|
||||
|
||||
let psdtexturemap = [];
|
||||
//点击事件状态
|
||||
this.raycasterstatus = false;
|
||||
//动画状态
|
||||
@ -33,6 +39,7 @@ export function Jl3ddeviceNew(dom,group,token) {
|
||||
//当前动画播放模型
|
||||
this.animationmodel = null;
|
||||
|
||||
this.stationtexture = [];
|
||||
this.devicetext = new Textconfig();
|
||||
|
||||
this.windowstatus = '0';
|
||||
@ -90,6 +97,7 @@ export function Jl3ddeviceNew(dom,group,token) {
|
||||
this.controls.update();
|
||||
|
||||
|
||||
|
||||
document.addEventListener( "mousedown", onselect, false );
|
||||
|
||||
let teststomp = new StompClient();
|
||||
@ -134,11 +142,31 @@ export function Jl3ddeviceNew(dom,group,token) {
|
||||
this.anime = null;
|
||||
|
||||
this.modelmanager = new ModelManager();
|
||||
this.modelmanager.loadpromise(Staticmodel, scope.mixers).then(function (data) {
|
||||
moveanima.initlistnew(scope.modelmanager.switchmodel.mesh);
|
||||
daochamodel = scope.modelmanager.switchmodel.mesh.getObjectByName("DAOCHA");
|
||||
animate();
|
||||
})
|
||||
getPublish3dMapDetail(skinCode).then(netdata => {
|
||||
console.log(JSON.parse(netdata.data.stands));
|
||||
setpsdstationmap(JSON.parse(netdata.data.stands));
|
||||
Standtextureload(scope,JSON.parse(netdata.data.assets));
|
||||
console.log(scope.stationtexture);
|
||||
scope.modelmanager.loadpromise(Staticmodel, scope.mixers).then(function (data) {
|
||||
moveanima.initlistnew(scope.modelmanager.switchmodel.mesh);
|
||||
daochamodel = scope.modelmanager.switchmodel.mesh.getObjectByName("DAOCHA");
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("zhantailiebiao").material.map =scope.stationtexture["stationlist"];
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("zhantailiebiao").material.map.needsUpdate = true;
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("pingbimen1").material.map =scope.stationtexture["pingbimen"];
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("pingbimen1").material.map.needsUpdate = true;
|
||||
|
||||
console.log(scope.modelmanager);
|
||||
// scope.stationtexture
|
||||
animate();
|
||||
})
|
||||
});
|
||||
|
||||
function setpsdstationmap(stationlist){
|
||||
for(let i=0,leni=stationlist.length;i<leni;i++){
|
||||
psdtexturemap[stationlist[i].direction1.code] = stationlist[i].code;
|
||||
psdtexturemap[stationlist[i].direction2.code] = stationlist[i].code;
|
||||
}
|
||||
}
|
||||
|
||||
//循环渲染函数
|
||||
function animate() {
|
||||
@ -199,10 +227,14 @@ export function Jl3ddeviceNew(dom,group,token) {
|
||||
}
|
||||
|
||||
if (data._type == "Psd") {
|
||||
|
||||
console.log(data);
|
||||
scope.modelmanager.standmodel.code = data.code;
|
||||
scope.showmodel = scope.modelmanager.standmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map =scope.stationtexture[psdtexturemap[data.standCode]];
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
if(scope.showmodel){
|
||||
scope.resetmodel();
|
||||
@ -245,6 +277,9 @@ export function Jl3ddeviceNew(dom,group,token) {
|
||||
if (data._type == "Psd") {;
|
||||
scope.showmodel = scope.modelmanager.standmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map =scope.stationtexture[psdtexturemap[data.standCode]];
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
initstatus(data);
|
||||
}
|
||||
|
114
src/jlmap3d/jl3ddevice/standtextureload.js
Normal file
114
src/jlmap3d/jl3ddevice/standtextureload.js
Normal file
@ -0,0 +1,114 @@
|
||||
export function Standtextureload(jlmap3dedit,assettype){
|
||||
if(assettype.stationtexture == "xian3"){
|
||||
if(jlmap3dedit.stationtexture){
|
||||
setstationtexture(jlmap3dedit.stationtexture,"stationlist",'../../static/texture/xian3/devicelist.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"pingbimen",'../../static/texture/xian3/pingbimen.png');
|
||||
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station18000",'../../static/texture/xian3/Station18000.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station61238",'../../static/texture/xian3/Station61238.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station41790",'../../static/texture/xian3/Station41790.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station67945",'../../static/texture/xian3/Station67945.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station85598",'../../static/texture/xian3/Station85598.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station4324",'../../static/texture/xian3/Station4324.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station55755",'../../static/texture/xian3/Station55755.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station53597",'../../static/texture/xian3/Station53597.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station68029",'../../static/texture/xian3/Station68029.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station17596",'../../static/texture/xian3/Station17596.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station66742",'../../static/texture/xian3/Station66742.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station90701",'../../static/texture/xian3/Station90701.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station90652",'../../static/texture/xian3/Station90652.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station54200",'../../static/texture/xian3/Station54200.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station19253",'../../static/texture/xian3/Station19253.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station37821",'../../static/texture/xian3/Station37821.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station47557",'../../static/texture/xian3/Station47557.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station78551",'../../static/texture/xian3/Station78551.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station64474",'../../static/texture/xian3/Station64474.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station21203",'../../static/texture/xian3/Station21203.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station34499",'../../static/texture/xian3/Station34499.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station571",'../../static/texture/xian3/Station571.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station99903",'../../static/texture/xian3/Station99903.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station43447",'../../static/texture/xian3/Station43447.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station67917",'../../static/texture/xian3/Station67917.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station60649",'../../static/texture/xian3/Station60649.jpg');
|
||||
}
|
||||
}
|
||||
if(assettype.stationtexture == "haerbin1"){
|
||||
if(jlmap3dedit.stationtexture){
|
||||
setstationtexture(jlmap3dedit.stationtexture,"stationlist",'../../static/texture/xian3/devicelist.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"pingbimen",'../../static/texture/xian3/pingbimen.jpg');
|
||||
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station5361",'../../static/texture/heb/Station5361.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station11094",'../../static/texture/heb/Station11094.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station11136",'../../static/texture/heb/Station11136.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station17293",'../../static/texture/heb/Station17293.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station18398",'../../static/texture/heb/Station18398.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station22163",'../../static/texture/heb/Station22163.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station25464",'../../static/texture/heb/Station25464.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station28090",'../../static/texture/heb/Station28090.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station41999",'../../static/texture/heb/Station41999.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station44338",'../../static/texture/heb/Station44338.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station46464",'../../static/texture/heb/Station46464.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station50565",'../../static/texture/heb/Station50565.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station60068",'../../static/texture/heb/Station60068.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station62429",'../../static/texture/heb/Station62429.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station64444",'../../static/texture/heb/Station64444.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station71700",'../../static/texture/heb/Station71700.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station72132",'../../static/texture/heb/Station72132.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station78164",'../../static/texture/heb/Station78164.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station79537",'../../static/texture/heb/Station79537.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station82618",'../../static/texture/heb/Station82618.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station85520",'../../static/texture/heb/Station85520.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station89483",'../../static/texture/heb/Station89483.jpg');
|
||||
setstationtexture(jlmap3dedit.stationtexture,"Station96090",'../../static/texture/heb/Station96090.jpg');
|
||||
}
|
||||
}
|
||||
|
||||
//console.log(jlmap3dedit.materiallist);
|
||||
}
|
||||
|
||||
function settexture(materiallist,name,textureurl){
|
||||
var loader = new THREE.TextureLoader();
|
||||
|
||||
// 加载一个资源
|
||||
loader.load(
|
||||
// 资源URL
|
||||
textureurl,
|
||||
|
||||
// onLoad回调
|
||||
function ( texture ) {
|
||||
texture.name = name;
|
||||
materiallist.push(texture);
|
||||
},
|
||||
|
||||
// 目前暂不支持onProgress的回调
|
||||
undefined,
|
||||
|
||||
// onError回调
|
||||
function ( err ) {
|
||||
console.error( 'An error happened.' );
|
||||
}
|
||||
);
|
||||
}
|
||||
function setstationtexture(stationtexture,name,textureurl){
|
||||
var loader = new THREE.TextureLoader();
|
||||
|
||||
// 加载一个资源
|
||||
loader.load(
|
||||
// 资源URL
|
||||
textureurl,
|
||||
|
||||
// onLoad回调
|
||||
function ( texture ) {
|
||||
texture.name = name;
|
||||
stationtexture[name] = texture;
|
||||
},
|
||||
|
||||
// 目前暂不支持onProgress的回调
|
||||
undefined,
|
||||
|
||||
// onError回调
|
||||
function ( err ) {
|
||||
console.error( 'An error happened.' );
|
||||
}
|
||||
);
|
||||
}
|
@ -409,8 +409,6 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
|
||||
}
|
||||
|
||||
if(scope.raycasterswitch == "section"){
|
||||
console.log(sectionlist);
|
||||
console.log(linklist);
|
||||
//console.log(sectionlist.sections.modellist);
|
||||
let intersects = raycaster.intersectObjects( linklist.linksgroup.children,true);
|
||||
if(intersects[0]){
|
||||
|
@ -114,8 +114,10 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
|
||||
let stationname = stationstandlist.group.children[mm].name;
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantailiebiao").material.map =scope.stationtexture["stationlist"];
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantailiebiao").material.map.needsUpdate = true;
|
||||
|
||||
let newmaterial = stationstandlist.group.children[mm].getObjectByName("zhantaiming").material.clone();
|
||||
newmaterial.map =scope.stationtexture[stationname];
|
||||
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantaiming").material = newmaterial;
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
|
||||
|
@ -164,10 +164,11 @@ class SkinCode extends defaultStyle {
|
||||
route: {
|
||||
direction: false, // 自动进路方向
|
||||
offset: { x: -4, y: 0 }, // 自动进路偏移量
|
||||
routeColor: '#00FF00' // 自动进路
|
||||
routeColor: '#00FF00', // 自动进路
|
||||
radiusR: 6
|
||||
},
|
||||
auto: {
|
||||
signalFrontTriangle: false, // 信号灯前三角展示
|
||||
signalFrontTriangle: true, // 信号灯前三角展示
|
||||
direction: false, // 自动通过方向
|
||||
offset: { x: -4, y: 0}, // 自动通过偏移量
|
||||
width: 5, // 自动宽度
|
||||
|
@ -370,7 +370,7 @@ class Signal extends Group {
|
||||
this.cbtcStatus = '';
|
||||
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
|
||||
this.lamps[1] && this.lamps[1].setColor(this.style.backgroundColor); // 设置黑色
|
||||
this.virtualSignal && this.virtualSignal.setColor(this.style.Signal.lamp.greenColor);
|
||||
this.virtualSignal && this.virtualSignal.setColor(this.style.Signal.lamp.blueColor);
|
||||
if (this.style.Signal.lamp.guidName === 'doubleAndBase') { // 设置底座颜色
|
||||
this.sigPost.setColor('#00FF00');
|
||||
if (this.model.logicLight) {
|
||||
@ -393,6 +393,7 @@ class Signal extends Group {
|
||||
this.cbtcStatus = '';
|
||||
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.yellowColor);
|
||||
this.lamps[1] && this.lamps[1].setColor(this.style.backgroundColor);
|
||||
this.virtualSignal && this.virtualSignal.setColor(this.style.Signal.lamp.redColor);
|
||||
if (this.style.Signal.lamp.guidName === 'doubleAndBase') { // 设置底座颜色
|
||||
this.sigPost.setColor('#00FF00');
|
||||
if (this.model.logicLight) { // 设置哈尔滨逻辑点灯 颜色
|
||||
|
@ -114,6 +114,17 @@ export default {
|
||||
'buttonOperation'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push({
|
||||
label: '新建计划车',
|
||||
handler: this.addPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
@ -123,15 +134,6 @@ export default {
|
||||
},
|
||||
initMenu() {
|
||||
// 编辑模式菜单列表
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push({
|
||||
label: '新建计划车',
|
||||
handler: this.addPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
this.menu = MenuContextHandler.covert(this.menuNormal);
|
||||
|
||||
// 故障模式菜单列表
|
||||
|
@ -100,6 +100,17 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push( {
|
||||
label: '新建计划列车',
|
||||
handler: this.createPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
@ -109,15 +120,6 @@ export default {
|
||||
},
|
||||
initMenu() {
|
||||
// 编辑模式菜单列表
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push( {
|
||||
label: '新建计划列车',
|
||||
handler: this.createPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
this.menu = MenuContextHandler.covert(this.menuNormal);
|
||||
|
||||
// 故障模式菜单列表
|
||||
|
@ -104,6 +104,17 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push( {
|
||||
label: '新建计划列车',
|
||||
handler: this.createPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
@ -113,15 +124,6 @@ export default {
|
||||
},
|
||||
initMenu() {
|
||||
// 编辑模式菜单列表
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push( {
|
||||
label: '新建计划列车',
|
||||
handler: this.createPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
this.menu = MenuContextHandler.covert(this.menuNormal);
|
||||
|
||||
// 故障模式菜单列表
|
||||
|
@ -42,6 +42,7 @@ import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
|
||||
import NoticeInfo from './childDialog/childDialog/noticeInfo';
|
||||
import CMD from '@/scripts/cmdPlugin/CommandEnum';
|
||||
import { deepAssign } from '@/utils/index';
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'RouteSelection',
|
||||
@ -64,6 +65,9 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'overlapData'
|
||||
]),
|
||||
show() {
|
||||
return this.dialogShow && !this.$store.state.menuOperation.break;
|
||||
},
|
||||
@ -156,7 +160,25 @@ export default {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.overlapData[row.overlapCode] && this.overlapData[row.overlapCode].pathList && this.overlapData[row.overlapCode].pathList.length) {
|
||||
this.overlapData[row.overlapCode].pathList.forEach(item => {
|
||||
if (item.sectionList && item.sectionList.length) {
|
||||
item.sectionList.forEach(elem => {
|
||||
const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem));
|
||||
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
|
||||
section.logicSectionCodeList.forEach(logicSectionCode => {
|
||||
const sec = deepAssign({}, this.$store.getters['map/getDeviceByCode'](logicSectionCode));
|
||||
sec.cutOff = true;
|
||||
containSectionList.push(sec);
|
||||
});
|
||||
} else {
|
||||
section.cutOff = true;
|
||||
containSectionList.push(section);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
this.$store.dispatch('training/updateMapState', [...containSectionList]);
|
||||
this.beforeSectionList = containSectionList || [];
|
||||
|
||||
|
@ -115,6 +115,17 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push({
|
||||
label: '新建计划车',
|
||||
handler: this.addPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
@ -124,15 +135,6 @@ export default {
|
||||
},
|
||||
initMenu() {
|
||||
// 编辑模式菜单列表
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push({
|
||||
label: '新建计划车',
|
||||
handler: this.addPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
this.menu = MenuContextHandler.covert(this.menuNormal);
|
||||
// 故障模式菜单列表
|
||||
if (this.operatemode === OperateMode.FAULT) {
|
||||
|
@ -49,6 +49,8 @@
|
||||
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
|
||||
import ConfirmControl from './childDialog/confirmControl';
|
||||
import NoticeInfo from './childDialog/childDialog/noticeInfo';
|
||||
import { deepAssign } from '@/utils/index';
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'RouteSelection',
|
||||
@ -70,6 +72,9 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'overlapData'
|
||||
]),
|
||||
show() {
|
||||
return this.dialogShow && !this.$store.state.menuOperation.break;
|
||||
},
|
||||
@ -161,30 +166,56 @@ export default {
|
||||
this.row = row;
|
||||
if (row) {
|
||||
// 恢复进路区段的切除状态
|
||||
this.row.canSetting = true;
|
||||
this.restoreBeforeDevices();
|
||||
|
||||
const containSectionList = [];
|
||||
if (row.canSetting) {
|
||||
// 设置选中区段为切除状态
|
||||
if (row.containSectionList && row.containSectionList.length) {
|
||||
if (row.routeSectionList && row.routeSectionList.length) {
|
||||
// 设置新选的进路区段为切除状态
|
||||
row.containSectionList.forEach(elem => {
|
||||
elem.cutOff = true;
|
||||
row.routeSectionList.forEach(elem => {
|
||||
const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem));
|
||||
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
|
||||
section.logicSectionCodeList.forEach(item => {
|
||||
const sec = deepAssign({}, this.$store.getters['map/getDeviceByCode'](item));
|
||||
sec.cutOff = true;
|
||||
containSectionList.push(sec);
|
||||
});
|
||||
} else {
|
||||
section.cutOff = true;
|
||||
containSectionList.push(section);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.$store.dispatch('training/updateMapState', [...row.containSectionList]);
|
||||
this.beforeSectionList = row.containSectionList || [];
|
||||
if (this.overlapData[row.overlapCode] && this.overlapData[row.overlapCode].pathList && this.overlapData[row.overlapCode].pathList.length) {
|
||||
this.overlapData[row.overlapCode].pathList.forEach(item => {
|
||||
if (item.sectionList && item.sectionList.length) {
|
||||
item.sectionList.forEach(elem => {
|
||||
const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem));
|
||||
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
|
||||
section.logicSectionCodeList.forEach(logicSectionCode => {
|
||||
const sec = deepAssign({}, this.$store.getters['map/getDeviceByCode'](logicSectionCode));
|
||||
sec.cutOff = true;
|
||||
containSectionList.push(sec);
|
||||
});
|
||||
} else {
|
||||
section.cutOff = true;
|
||||
containSectionList.push(section);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
this.$store.dispatch('training/updateMapState', [...containSectionList]);
|
||||
this.beforeSectionList = containSectionList || [];
|
||||
|
||||
// 设置选中指令
|
||||
const operate = {
|
||||
operation: OperationEvent.Signal.arrangementRoute.choose.operation,
|
||||
val: row.code,
|
||||
param: {
|
||||
Route_Code: row.code
|
||||
}
|
||||
val: row.code
|
||||
};
|
||||
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
}
|
||||
|
@ -162,6 +162,17 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push({
|
||||
label: '新建计划车',
|
||||
handler: this.addPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
@ -171,15 +182,6 @@ export default {
|
||||
},
|
||||
initMenu() {
|
||||
// 编辑模式菜单列表
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push({
|
||||
label: '新建计划车',
|
||||
handler: this.addPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
this.menu = MenuContextHandler.covert(this.menuNormal);
|
||||
|
||||
// 故障模式菜单列表
|
||||
|
@ -109,6 +109,17 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push({
|
||||
label: '新建计划车',
|
||||
handler: this.createPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
@ -118,15 +129,6 @@ export default {
|
||||
},
|
||||
initMenu() {
|
||||
// 编辑模式菜单列表
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push({
|
||||
label: '新建计划车',
|
||||
handler: this.createPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
this.menu = MenuContextHandler.covert(this.menuNormal);
|
||||
|
||||
// 故障模式菜单列表
|
||||
|
@ -38,6 +38,7 @@ import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
|
||||
import NoticeInfo from './childDialog/childDialog/noticeInfo';
|
||||
import {menuOperate, commitOperate} from '../utils/menuOperate';
|
||||
import { deepAssign } from '@/utils/index';
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'RouteSelection',
|
||||
@ -62,6 +63,9 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'overlapData'
|
||||
]),
|
||||
show() {
|
||||
return this.dialogShow && !this.$store.state.menuOperation.break;
|
||||
},
|
||||
@ -166,7 +170,25 @@ export default {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.overlapData[row.overlapCode] && this.overlapData[row.overlapCode].pathList && this.overlapData[row.overlapCode].pathList.length) {
|
||||
this.overlapData[row.overlapCode].pathList.forEach(item => {
|
||||
if (item.sectionList && item.sectionList.length) {
|
||||
item.sectionList.forEach(elem => {
|
||||
const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem));
|
||||
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
|
||||
section.logicSectionCodeList.forEach(logicSectionCode => {
|
||||
const sec = deepAssign({}, this.$store.getters['map/getDeviceByCode'](logicSectionCode));
|
||||
sec.cutOff = true;
|
||||
containSectionList.push(sec);
|
||||
});
|
||||
} else {
|
||||
section.cutOff = true;
|
||||
containSectionList.push(section);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
this.$store.dispatch('training/updateMapState', [...containSectionList]);
|
||||
this.beforeSectionList = containSectionList || [];
|
||||
|
||||
|
@ -133,6 +133,17 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push({
|
||||
label: '新建计划车',
|
||||
handler: this.addPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
@ -142,15 +153,6 @@ export default {
|
||||
},
|
||||
initMenu() {
|
||||
// 编辑模式菜单列表
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push({
|
||||
label: '新建计划车',
|
||||
handler: this.addPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
this.menu = MenuContextHandler.covert(this.menuNormal);
|
||||
// 故障模式菜单列表
|
||||
if (this.operatemode === OperateMode.FAULT) {
|
||||
|
@ -51,6 +51,7 @@ import ConfirmControl from './childDialog/confirmControl';
|
||||
import NoticeInfo from './childDialog/childDialog/noticeInfo';
|
||||
import { deepAssign } from '@/utils/index';
|
||||
import { menuOperate, commitOperate } from '../utils/menuOperate';
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'RouteSelection',
|
||||
@ -72,6 +73,9 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'overlapData'
|
||||
]),
|
||||
show() {
|
||||
return this.dialogShow && !this.$store.state.menuOperation.break;
|
||||
},
|
||||
@ -184,7 +188,25 @@ export default {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.overlapData[row.overlapCode] && this.overlapData[row.overlapCode].pathList && this.overlapData[row.overlapCode].pathList.length) {
|
||||
this.overlapData[row.overlapCode].pathList.forEach(item => {
|
||||
if (item.sectionList && item.sectionList.length) {
|
||||
item.sectionList.forEach(elem => {
|
||||
const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem));
|
||||
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
|
||||
section.logicSectionCodeList.forEach(logicSectionCode => {
|
||||
const sec = deepAssign({}, this.$store.getters['map/getDeviceByCode'](logicSectionCode));
|
||||
sec.cutOff = true;
|
||||
containSectionList.push(sec);
|
||||
});
|
||||
} else {
|
||||
section.cutOff = true;
|
||||
containSectionList.push(section);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
this.$store.dispatch('training/updateMapState', [...containSectionList]);
|
||||
this.beforeSectionList = containSectionList || [];
|
||||
|
||||
|
@ -146,6 +146,17 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push({
|
||||
label: '新建计划车',
|
||||
handler: this.addPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
@ -155,15 +166,7 @@ export default {
|
||||
},
|
||||
initMenu() {
|
||||
// 编辑模式菜单列表
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push({
|
||||
label: '新建计划车',
|
||||
handler: this.addPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
|
||||
this.menu = MenuContextHandler.covert(this.menuNormal);
|
||||
|
||||
// 故障模式菜单列表
|
||||
|
@ -152,6 +152,17 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push({
|
||||
label: '新建计划车',
|
||||
handler: this.addPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
@ -161,15 +172,6 @@ export default {
|
||||
},
|
||||
initMenu() {
|
||||
// 编辑模式菜单列表
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
if (isDev || isTest) {
|
||||
this.menuNormal.Center.push({
|
||||
label: '新建计划车',
|
||||
handler: this.addPlanTrain,
|
||||
cmdType: CMD.Section.CMD_Train_Init_Plan
|
||||
});
|
||||
}
|
||||
// this.menu = MenuContextHandler.covert(this.menuNormal);
|
||||
this.menu = this.menuNormal.Center;
|
||||
// 故障模式菜单列表
|
||||
|
@ -207,7 +207,9 @@ const map = {
|
||||
trainListUpdate:0, // 列车列表更新标识,
|
||||
runPlanStatus:false, // 是否正处于按计划行车
|
||||
showCentralizedStationCode: '', // 现地分集中站显示(集中站code)
|
||||
showCentralizedStationNum: 0 // 现地分集中站显示判断
|
||||
showCentralizedStationNum: 0, // 现地分集中站显示判断
|
||||
overlapList: [], // 延续保护list
|
||||
overlapData: {} // 延续保护数据
|
||||
},
|
||||
|
||||
getters: {
|
||||
@ -226,6 +228,9 @@ const map = {
|
||||
routeData: (state) => {
|
||||
return state.routeData;
|
||||
},
|
||||
overlapData: (state) => {
|
||||
return state.overlapData;
|
||||
},
|
||||
autoReentryData: (state) => {
|
||||
return state.autoReentryData;
|
||||
},
|
||||
@ -716,6 +721,12 @@ const map = {
|
||||
});
|
||||
state.routeList = routeDataList;
|
||||
},
|
||||
setOverlapData: (state, overlapList) => {
|
||||
overlapList.forEach(data => {
|
||||
state.overlapData[data.code] = data;
|
||||
});
|
||||
state.overlapList = overlapList;
|
||||
},
|
||||
setAutoReentryData: (state, autoReentryList) => {
|
||||
autoReentryList.forEach(data => {
|
||||
state.autoReentryData[data.code] = data;
|
||||
@ -790,6 +801,9 @@ const map = {
|
||||
setRouteData: ({ commit }, routeData) => { // 设置进路数据
|
||||
commit('setRouteData', routeData);
|
||||
},
|
||||
setOverlapData: ({ commit }, overlapData) => {
|
||||
commit('setOverlapData', overlapData);
|
||||
},
|
||||
setAutoReentryData: ({ commit }, autoReentryData) => {
|
||||
commit('setAutoReentryData', autoReentryData);
|
||||
},
|
||||
|
@ -48,9 +48,11 @@ export function loadNewMapDataByGroup(group) {
|
||||
});
|
||||
});
|
||||
const routeData = resp.data.logicDataNew.routeList; // 设置进路数据
|
||||
const overlapData = resp.data.logicDataNew.overlapList;
|
||||
const autoReentryData = resp.data.logicDataNew.autoReentryList; // 自动折返数据
|
||||
const signalApproachSectionData = resp.data.logicDataNew.signalApproachSectionList; // 信号机接近区段数据
|
||||
store.dispatch('map/setRouteData', routeData);
|
||||
store.dispatch('map/setOverlapData', overlapData);
|
||||
store.dispatch('map/setAutoReentryData', autoReentryData);
|
||||
store.dispatch('map/setSignalApproachSectionData', signalApproachSectionData);
|
||||
const mapConfig = resp.data.configVO;
|
||||
|
@ -1,6 +1,8 @@
|
||||
<template>
|
||||
<div>
|
||||
紧急发布一览
|
||||
<div class="emergency_release">
|
||||
<div class="emergency_release_header">
|
||||
<div class="emergency_header_text">中心PIS紧急信息一览</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -8,3 +10,7 @@ export default {
|
||||
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.emergency_release{padding:20px;}
|
||||
.emergency_header_text{margin-top:10px;text-align: center;color: #9af1ec;font-size: 18px;padding-bottom: 10px;}
|
||||
</style>
|
||||
|
@ -77,8 +77,8 @@ export default {
|
||||
/deep/{
|
||||
.time_preview{padding:20px;}
|
||||
.preview_header_text{margin-top:10px;text-align: center;color: #9af1ec;font-size: 18px;padding-bottom: 10px;}
|
||||
.time_preview_content{width:100%;height:500px;border-top: 2px solid #8c8a89;overflow-y: auto;margin-top:10px;display:flex;border-left: 2px solid #8c8a89;border-right: 2px solid #fff;border-bottom: 2px solid #fff;}
|
||||
.time_preview_footer{width:650px;margin-top:20px;border-top: 2px solid #8c8a89;
|
||||
.time_preview_content{width:94%;height:500px;border-top: 2px solid #8c8a89;overflow-y: auto;margin-left:3%;margin-top:10px;display:flex;border-left: 2px solid #8c8a89;border-right: 2px solid #fff;border-bottom: 2px solid #fff;}
|
||||
.time_preview_footer{width:650px;margin-top:20px;border-top: 2px solid #8c8a89;margin-left:3%;
|
||||
border-left: 2px solid #8c8a89;
|
||||
border-right: 2px solid #fff;
|
||||
border-bottom: 2px solid #fff;background:#aabbbb;}
|
||||
|
@ -102,7 +102,10 @@
|
||||
computed: {
|
||||
code() {
|
||||
return this.$route.query.code;
|
||||
}
|
||||
},
|
||||
mapId() {
|
||||
return this.$route.query.mapId;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
window.updatemenulist = this.updatemenulist;
|
||||
@ -133,11 +136,11 @@
|
||||
initolddata: function (group,header) {
|
||||
// let mapdata = this.$store.state.socket.device;
|
||||
let dom = document.getElementById('jl3d');
|
||||
this.jl3d = new Jl3ddevice(dom,group,header);
|
||||
this.jl3d = new Jl3ddevice(dom,group,header,this.mapId);
|
||||
},
|
||||
initnewdata: function (group,header){
|
||||
let dom = document.getElementById('jl3d');
|
||||
this.jl3d = new Jl3ddeviceNew(dom,group,header);
|
||||
this.jl3d = new Jl3ddeviceNew(dom,group,header,this.mapId);
|
||||
},
|
||||
close3ddeviceview: function(){
|
||||
this.$emit('closedevice3dview');
|
||||
|
@ -81,7 +81,7 @@ import axios from 'axios';
|
||||
groupnum:"",
|
||||
userrole:'',
|
||||
drawWay:'',
|
||||
|
||||
nowdrive:null,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -95,29 +95,36 @@ import axios from 'axios';
|
||||
computed: {
|
||||
group() {
|
||||
return this.$route.query.group;
|
||||
}
|
||||
},
|
||||
userId() {
|
||||
return this.$store.state.user ? this.$store.state.user.id : '';
|
||||
},
|
||||
},
|
||||
async mounted() {
|
||||
// this.teststomp = new StompClient();
|
||||
|
||||
this.updatetrainlist();
|
||||
},
|
||||
beforeDestroy() {
|
||||
},
|
||||
methods: {
|
||||
currentsel(selVal){
|
||||
this.selVal = selVal;
|
||||
this.dialogVisible = true;
|
||||
let oldgroupnum = this.groupnum;
|
||||
this.groupnum = selVal;
|
||||
for(let i=0;i<this.trainlist.length;i++){
|
||||
if(this.trainlist[i].groupNumber == this.groupnum){
|
||||
this.$refs.centercontrol.centerstate(this.trainlist[i].gear);
|
||||
}
|
||||
}
|
||||
|
||||
bindSimulationTrain(this.group,this.groupnum).then(netdata => {
|
||||
this.selVal = selVal;
|
||||
this.dialogVisible = true;
|
||||
// this.groupnum = selVal;
|
||||
for(let i=0;i<this.trainlist.length;i++){
|
||||
if(this.trainlist[i].groupNumber == this.groupnum){
|
||||
this.$refs.centercontrol.centerstate(this.trainlist[i].gear);
|
||||
}
|
||||
}
|
||||
this.nowdrive = this.groupnum;
|
||||
}).catch(error => {
|
||||
|
||||
console.log(error);
|
||||
this.groupnum = oldgroupnum;
|
||||
this.selVal = oldgroupnum;
|
||||
this.$emit('warningmsg',error.message);
|
||||
this.value = this.nowdrive;
|
||||
});
|
||||
},
|
||||
clickselect(e){
|
||||
@ -125,26 +132,35 @@ import axios from 'axios';
|
||||
getSimulationMemberNew(this.group).then(netdata => {
|
||||
this.userrole = netdata.data.role;
|
||||
});
|
||||
getSimulationTrainlistNew(this.group).then(netdata => {
|
||||
this.options = [];
|
||||
this.trainlist = netdata.data;
|
||||
for(let i=0;i<netdata.data.length;i++){
|
||||
|
||||
let option= {
|
||||
value: netdata.data[i].groupNumber,
|
||||
label: netdata.data[i].groupNumber
|
||||
}
|
||||
if(netdata.data[i].name){
|
||||
option.label = netdata.data[i].name+"正在驾驶"+netdata.data[i].groupNumber;
|
||||
}
|
||||
|
||||
|
||||
this.options.push(option);
|
||||
}
|
||||
|
||||
});
|
||||
this.updatetrainlist();
|
||||
}
|
||||
},
|
||||
updatetrainlist(){
|
||||
getSimulationTrainlistNew(this.group).then(netdata => {
|
||||
this.options = [];
|
||||
this.trainlist = netdata.data;
|
||||
|
||||
for(let i=0;i<netdata.data.length;i++){
|
||||
let option= {
|
||||
value: netdata.data[i].groupNumber,
|
||||
label: netdata.data[i].groupNumber
|
||||
}
|
||||
if(netdata.data[i].name){
|
||||
option.label = netdata.data[i].name+"正在驾驶"+netdata.data[i].groupNumber;
|
||||
}
|
||||
if(netdata.data[i].driverId){
|
||||
if(netdata.data[i].driverId == this.userId){
|
||||
this.value = netdata.data[i].groupNumber;
|
||||
this.nowdrive = netdata.data[i].groupNumber;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.options.push(option);
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -33,7 +33,7 @@
|
||||
<Drive-Mmi v-if="mmishow" ref="mmiui" />
|
||||
|
||||
<Drive-Tms v-if="mmishow" />
|
||||
<Drive-Control v-if="dcontrolshow" ref="dcontrol"/>
|
||||
<Drive-Control v-if="dcontrolshow" ref="dcontrol" @warningmsg="warningmsg" @warningmsgoff="warningmsgoff" />
|
||||
</div>
|
||||
|
||||
</template>
|
||||
@ -265,6 +265,15 @@ export default {
|
||||
updatestatus(newdata){
|
||||
this.trainnum = newdata.groupNumber;
|
||||
this.$refs.mmiui.updatetrainstatus(newdata);
|
||||
},
|
||||
warningmsg(nowmsg){
|
||||
this.controlmsg = nowmsg;
|
||||
this.msgshow = true;
|
||||
setTimeout(this.warningmsgoff,3000);
|
||||
},
|
||||
warningmsgoff(){
|
||||
this.msgshow = false;
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
@ -377,7 +386,7 @@ export default {
|
||||
position:absolute;
|
||||
}
|
||||
.msgtext{
|
||||
width:400px;
|
||||
width:100%;
|
||||
height:50px;
|
||||
border-radius:5px;
|
||||
background:#C0C0C0;
|
||||
|
@ -8,8 +8,14 @@
|
||||
</div>
|
||||
<el-card class="tableList">
|
||||
<el-table :data="tableData" style="width: 100%" border>
|
||||
<el-table-column prop="roomName" label="房间名">
|
||||
<template slot-scope="scope">{{ scope.row.roomName+'的房间' }}</template>
|
||||
<el-table-column prop="name" label="用户名">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="organization" label="公司" />
|
||||
<el-table-column prop="department" label="部门" />
|
||||
<el-table-column prop="position" label="职位" />
|
||||
<el-table-column prop="score" label="评分">
|
||||
<template slot-scope="scope">{{ scope.row.score?scope.row.score:0 }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
@ -24,7 +30,8 @@
|
||||
|
||||
<script>
|
||||
// import { getPublishMapDetailList } from '@/api/jmap/map';
|
||||
import {refereeGetCompetitionList} from '@/api/competition';
|
||||
import {refereeGetCompetitionList, refereeEnterSimulation} from '@/api/competition';
|
||||
import {getPermissionJointNew} from '@/api/jointTraining';
|
||||
import QuestionList from './questionList';
|
||||
|
||||
export default {
|
||||
@ -34,7 +41,8 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableData: []
|
||||
tableData: [],
|
||||
isLeaving:false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -42,14 +50,31 @@ export default {
|
||||
created() {
|
||||
this.loadInitData();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.isLeaving = true;
|
||||
},
|
||||
methods: {
|
||||
loadInitData() {
|
||||
this.getData();
|
||||
},
|
||||
getData() {
|
||||
refereeGetCompetitionList(1).then(response=>{
|
||||
this.tableData = response.data;
|
||||
setTimeout(() => {
|
||||
if (!this.isLeaving) {
|
||||
this.getData();
|
||||
}
|
||||
}, 2000);
|
||||
});
|
||||
},
|
||||
handleClick(row) {
|
||||
console.log(row);
|
||||
const group = row.room.group;
|
||||
getPermissionJointNew(group).then(resp=>{
|
||||
refereeEnterSimulation(group).then(response=>{
|
||||
const query = { lineCode: '11', mapId: '41', group: row.room.group, roomId: row.room.id };
|
||||
this.$router.push({ path: `/jointTrainingNew`, query: query});
|
||||
});
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.loadInitData();
|
||||
@ -69,9 +94,9 @@ export default {
|
||||
}
|
||||
}
|
||||
.tableList{
|
||||
width: 50%;
|
||||
margin-left: 25%;
|
||||
border-radius:10px;
|
||||
width:94%;
|
||||
margin-left: 3%;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.refresh_box_out{
|
||||
display: inline-block;
|
||||
|
@ -360,7 +360,7 @@ export default {
|
||||
if (this.lineCode) {
|
||||
// 01 现地 02 行调 '' 观众
|
||||
const resp = await this.getUserRole();
|
||||
console.log(resp.data.userRole);
|
||||
console.log('/////////////' + resp.data.userRole);
|
||||
if (resp && resp.code == 200) {
|
||||
// Admin 管理员 Instructor 教员 Dispatcher 行调 STATION_SUPERVISOR 车站 Audience 观众 Driver 司机 MAINTAINER 通号 IBP:IBP盘
|
||||
this.userRole = resp.data.userRole;
|
||||
|
@ -13,7 +13,8 @@
|
||||
<!-- <el-button :disabled="!jsStart" type="success" @click="startCompetition">开始</el-button> -->
|
||||
<el-button type="danger" @click="endCompetition">结束</el-button>
|
||||
</template>
|
||||
<el-button v-if="project!=='jsxt'" type="primary" :loading="backLoading" @click="back">{{ $t('global.back') }}</el-button>
|
||||
<el-button v-if="project==='refereeJsxt'" type="danger" @click="refeeEndCompetition">结束</el-button>
|
||||
<el-button v-if="project!=='jsxt'&&project!=='refereeJsxt'" type="primary" :loading="backLoading" @click="back">{{ $t('global.back') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<qr-code ref="qrCode" />
|
||||
@ -32,7 +33,7 @@ import { putJointTrainingSimulationUserNew} from '@/api/jointTraining';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import { getSessionStorage } from '@/utils/auth';
|
||||
import RealDevice from './menuDraft/realDevice';
|
||||
import { participantCompleteCompetition } from '@/api/competition';
|
||||
import { participantCompleteCompetition, refereeExitSimulation } from '@/api/competition';
|
||||
import { prefixIntrger } from '@/utils/date';
|
||||
|
||||
export default {
|
||||
@ -320,6 +321,13 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
refeeEndCompetition() {
|
||||
refereeExitSimulation(this.group).then(resp => {
|
||||
this.$router.go(-1);
|
||||
}).catch(()=> {
|
||||
this.$message.success('退出系统失败');
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
// this.$store.dispatch('exam/over').then(() => {
|
||||
// this.$store.dispatch('trainingList/clearTrainingList');
|
||||
|
BIN
static/model/device/stationstand/stationstand.FBX
Normal file
BIN
static/model/device/stationstand/stationstand.FBX
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/model/device/stationstand/stationstand1.FBX
Normal file
BIN
static/model/device/stationstand/stationstand1.FBX
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/model/station/station333.FBX
Normal file
BIN
static/model/station/station333.FBX
Normal file
Binary file not shown.
BIN
static/texture/heb/devicelist.jpg
Normal file
BIN
static/texture/heb/devicelist.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 97 KiB |
BIN
static/texture/heb/pingbimen.png
Normal file
BIN
static/texture/heb/pingbimen.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
BIN
static/texture/xian3/devicelist.jpg
Normal file
BIN
static/texture/xian3/devicelist.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 97 KiB |
BIN
static/texture/xian3/pingbimen.png
Normal file
BIN
static/texture/xian3/pingbimen.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 85 KiB |
744
static/workertest/maintainerworker.js
Normal file
744
static/workertest/maintainerworker.js
Normal file
@ -0,0 +1,744 @@
|
||||
importScripts('sockjs.js');
|
||||
// import { getToken } from '@/utils/auth';
|
||||
// import { getBaseUrl } from '@/utils/baseUrl';
|
||||
// import SockJS from 'sockjs-client';
|
||||
|
||||
// const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token=';
|
||||
// const websocketUrl = `http://192.168.3.6:9000/joylink-websocket?token=`;
|
||||
let websocketUrl = null;
|
||||
let token = null;
|
||||
var StompClient = function (headers,token) {
|
||||
let scope = this;
|
||||
this.url = websocketUrl + token;
|
||||
this.headers = headers || {};
|
||||
this.connect();
|
||||
};
|
||||
|
||||
StompClient.prototype = {
|
||||
socket: null,
|
||||
|
||||
clientIns: null,
|
||||
|
||||
subscribeMap: null,
|
||||
|
||||
url: '',
|
||||
|
||||
status: false,
|
||||
|
||||
sockStatus: 0,
|
||||
|
||||
headers: {
|
||||
// 'X-Token': getToken()
|
||||
},
|
||||
|
||||
count: 0,
|
||||
|
||||
topic: '',
|
||||
|
||||
onmessage: null,
|
||||
|
||||
checkTimer: null,
|
||||
|
||||
// 连接服务端
|
||||
connect() {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
// 断开已有连接
|
||||
if (this.clientIns && this.clientIns.connected) {
|
||||
this.clientIns.disconnect();
|
||||
this.clientIns = null;
|
||||
}
|
||||
|
||||
// 建立连接对象(还未发起连接)
|
||||
this.socket = new SockJS(websocketUrl + token);
|
||||
|
||||
// 获取 STOMP 子协议的客户端对象
|
||||
this.clientIns = Stomp.over(this.socket);
|
||||
|
||||
this.closeStompDebug();
|
||||
|
||||
// 向服务器发起websocket连接并发送CONNECT帧
|
||||
this.clientIns.connect({ 'X-Token': token }, () => {
|
||||
console.info('连接成功.');
|
||||
this.count = 0;
|
||||
this.status = true;
|
||||
|
||||
// 恢复订阅
|
||||
if (this.topic && this.onmessage) {
|
||||
this.unsubscribe(this.topic);
|
||||
this.subscribe(this.topic, this.onmessage, this.headers);
|
||||
}
|
||||
|
||||
|
||||
resolve(this);
|
||||
}, () => {
|
||||
if (this.checkTimer) {
|
||||
clearInterval(this.checkTimer);
|
||||
this.checkTimer = null;
|
||||
}
|
||||
|
||||
});
|
||||
} catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
logOut(err) {
|
||||
if (err.code == 50008 || err.code == 50014) {
|
||||
this.url = websocketUrl + token;
|
||||
this.status = false;
|
||||
this.count++;
|
||||
this.reconnect(this.count);
|
||||
}
|
||||
},
|
||||
// 恢复链接
|
||||
reconnect(count) {
|
||||
console.info(`尝试第${count || 1}次连接.`);
|
||||
this.connect().then(() => { }).catch(() => {
|
||||
this.count++;
|
||||
this.reconnect(this.count);
|
||||
});
|
||||
},
|
||||
|
||||
closeStompDebug() {
|
||||
if (this.clientIns) {
|
||||
this.clientIns.debug = undefined;
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
// 订阅指定的topic
|
||||
subscribe(topic, onmessage, headers) {
|
||||
this.topic = topic;
|
||||
this.onmessage = onmessage;
|
||||
this.headers = headers;
|
||||
if (this.status) {
|
||||
if (!this.subscribeMap) {
|
||||
this.subscribeMap = new Map();
|
||||
}
|
||||
|
||||
try {
|
||||
var subscription = this.subscribeMap.get(topic);
|
||||
if (!subscription) {
|
||||
subscription = this.clientIns.subscribe(topic, onmessage, headers); // 接收消息通过 subscribe() 方法实现
|
||||
this.subscribeMap.set(topic, subscription);
|
||||
}
|
||||
} catch (err) {
|
||||
setTimeout(() => {
|
||||
this.subscribe(topic, onmessage, headers);
|
||||
}, 300);
|
||||
}
|
||||
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
this.subscribe(topic, onmessage, headers);
|
||||
}, 300);
|
||||
}
|
||||
},
|
||||
|
||||
unsubscribe(topic) {
|
||||
if (this.subscribeMap) {
|
||||
const subscription = this.subscribeMap.get(topic);
|
||||
if (subscription) {
|
||||
subscription.unsubscribe();
|
||||
this.subscribeMap.delete(topic);
|
||||
console.log('取消订阅');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 发送消息
|
||||
send(url, msg) {
|
||||
if (this.status) {
|
||||
if (msg) {
|
||||
msg = JSON.stringify(msg);
|
||||
}
|
||||
try {
|
||||
this.clientIns.send(url, {}, msg);
|
||||
} catch (err) {
|
||||
this.status = false;
|
||||
this.send(url, msg);
|
||||
}
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
this.send(url, msg);
|
||||
}, 300);
|
||||
}
|
||||
},
|
||||
|
||||
disconnect() {
|
||||
if (this.checkTimer) {
|
||||
clearInterval(this.checkTimer);
|
||||
this.checkTimer = null;
|
||||
}
|
||||
|
||||
if (this.clientIns && this.clientIns.connected) {
|
||||
this.clientIns.disconnect();
|
||||
this.clientIns = null;
|
||||
}
|
||||
this.status = false;
|
||||
console.log('断开连接');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var Byte, Client, Frame, Stomp,
|
||||
__hasProp = {}.hasOwnProperty,
|
||||
__slice = [].slice;
|
||||
|
||||
Byte = {
|
||||
LF: '\x0A',
|
||||
NULL: '\x00'
|
||||
};
|
||||
|
||||
Frame = (function() {
|
||||
var unmarshallSingle;
|
||||
|
||||
function Frame(command, headers, body) {
|
||||
this.command = command;
|
||||
this.headers = headers != null ? headers : {};
|
||||
this.body = body != null ? body : '';
|
||||
}
|
||||
|
||||
Frame.prototype.toString = function() {
|
||||
var lines, name, skipContentLength, value, _ref;
|
||||
lines = [this.command];
|
||||
skipContentLength = this.headers['content-length'] === false ? true : false;
|
||||
if (skipContentLength) {
|
||||
delete this.headers['content-length'];
|
||||
}
|
||||
_ref = this.headers;
|
||||
for (name in _ref) {
|
||||
if (!__hasProp.call(_ref, name)) continue;
|
||||
value = _ref[name];
|
||||
lines.push("" + name + ":" + value);
|
||||
}
|
||||
if (this.body && !skipContentLength) {
|
||||
lines.push("content-length:" + (Frame.sizeOfUTF8(this.body)));
|
||||
}
|
||||
lines.push(Byte.LF + this.body);
|
||||
return lines.join(Byte.LF);
|
||||
};
|
||||
|
||||
Frame.sizeOfUTF8 = function(s) {
|
||||
if (s) {
|
||||
return encodeURI(s).match(/%..|./g).length;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
unmarshallSingle = function(data) {
|
||||
var body, chr, command, divider, headerLines, headers, i, idx, len, line, start, trim, _i, _j, _len, _ref, _ref1;
|
||||
divider = data.search(RegExp("" + Byte.LF + Byte.LF));
|
||||
headerLines = data.substring(0, divider).split(Byte.LF);
|
||||
command = headerLines.shift();
|
||||
headers = {};
|
||||
trim = function(str) {
|
||||
return str.replace(/^\s+|\s+$/g, '');
|
||||
};
|
||||
_ref = headerLines.reverse();
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
line = _ref[_i];
|
||||
idx = line.indexOf(':');
|
||||
headers[trim(line.substring(0, idx))] = trim(line.substring(idx + 1));
|
||||
}
|
||||
body = '';
|
||||
start = divider + 2;
|
||||
if (headers['content-length']) {
|
||||
len = parseInt(headers['content-length']);
|
||||
body = ('' + data).substring(start, start + len);
|
||||
} else {
|
||||
chr = null;
|
||||
for (i = _j = start, _ref1 = data.length; start <= _ref1 ? _j < _ref1 : _j > _ref1; i = start <= _ref1 ? ++_j : --_j) {
|
||||
chr = data.charAt(i);
|
||||
if (chr === Byte.NULL) {
|
||||
break;
|
||||
}
|
||||
body += chr;
|
||||
}
|
||||
}
|
||||
return new Frame(command, headers, body);
|
||||
};
|
||||
|
||||
Frame.unmarshall = function(datas) {
|
||||
var data;
|
||||
return (function() {
|
||||
var _i, _len, _ref, _results;
|
||||
_ref = datas.split(RegExp("" + Byte.NULL + Byte.LF + "*"));
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
data = _ref[_i];
|
||||
if ((data != null ? data.length : void 0) > 0) {
|
||||
_results.push(unmarshallSingle(data));
|
||||
}
|
||||
}
|
||||
return _results;
|
||||
})();
|
||||
};
|
||||
|
||||
Frame.marshall = function(command, headers, body) {
|
||||
var frame;
|
||||
frame = new Frame(command, headers, body);
|
||||
return frame.toString() + Byte.NULL;
|
||||
};
|
||||
|
||||
return Frame;
|
||||
|
||||
})();
|
||||
|
||||
Client = (function() {
|
||||
var now;
|
||||
|
||||
function Client(ws) {
|
||||
this.ws = ws;
|
||||
this.ws.binaryType = "arraybuffer";
|
||||
this.counter = 0;
|
||||
this.connected = false;
|
||||
this.heartbeat = {
|
||||
outgoing: 10000,
|
||||
incoming: 10000
|
||||
};
|
||||
this.maxWebSocketFrameSize = 16 * 1024;
|
||||
this.subscriptions = {};
|
||||
}
|
||||
|
||||
Client.prototype.debug = function(message) {
|
||||
var _ref;
|
||||
return typeof window !== "undefined" && window !== null ? (_ref = window.console) != null ? _ref.log(message) : void 0 : void 0;
|
||||
};
|
||||
|
||||
now = function() {
|
||||
if (Date.now) {
|
||||
return Date.now();
|
||||
} else {
|
||||
return new Date().valueOf;
|
||||
}
|
||||
};
|
||||
|
||||
Client.prototype._transmit = function(command, headers, body) {
|
||||
var out;
|
||||
out = Frame.marshall(command, headers, body);
|
||||
if (typeof this.debug === "function") {
|
||||
this.debug(">>> " + out);
|
||||
}
|
||||
while (true) {
|
||||
if (out.length > this.maxWebSocketFrameSize) {
|
||||
this.ws.send(out.substring(0, this.maxWebSocketFrameSize));
|
||||
out = out.substring(this.maxWebSocketFrameSize);
|
||||
if (typeof this.debug === "function") {
|
||||
this.debug("remaining = " + out.length);
|
||||
}
|
||||
} else {
|
||||
return this.ws.send(out);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Client.prototype._setupHeartbeat = function(headers) {
|
||||
var serverIncoming, serverOutgoing, ttl, v, _ref, _ref1;
|
||||
if ((_ref = headers.version) !== Stomp.VERSIONS.V1_1 && _ref !== Stomp.VERSIONS.V1_2) {
|
||||
return;
|
||||
}
|
||||
_ref1 = (function() {
|
||||
var _i, _len, _ref1, _results;
|
||||
_ref1 = headers['heart-beat'].split(",");
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||
v = _ref1[_i];
|
||||
_results.push(parseInt(v));
|
||||
}
|
||||
return _results;
|
||||
})(), serverOutgoing = _ref1[0], serverIncoming = _ref1[1];
|
||||
if (!(this.heartbeat.outgoing === 0 || serverIncoming === 0)) {
|
||||
ttl = Math.max(this.heartbeat.outgoing, serverIncoming);
|
||||
if (typeof this.debug === "function") {
|
||||
this.debug("send PING every " + ttl + "ms");
|
||||
}
|
||||
this.pinger = Stomp.setInterval(ttl, (function(_this) {
|
||||
return function() {
|
||||
_this.ws.send(Byte.LF);
|
||||
return typeof _this.debug === "function" ? _this.debug(">>> PING") : void 0;
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
if (!(this.heartbeat.incoming === 0 || serverOutgoing === 0)) {
|
||||
ttl = Math.max(this.heartbeat.incoming, serverOutgoing);
|
||||
if (typeof this.debug === "function") {
|
||||
this.debug("check PONG every " + ttl + "ms");
|
||||
}
|
||||
return this.ponger = Stomp.setInterval(ttl, (function(_this) {
|
||||
return function() {
|
||||
var delta;
|
||||
delta = now() - _this.serverActivity;
|
||||
if (delta > ttl * 2) {
|
||||
if (typeof _this.debug === "function") {
|
||||
_this.debug("did not receive server activity for the last " + delta + "ms");
|
||||
}
|
||||
return _this.ws.close();
|
||||
}
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
};
|
||||
|
||||
Client.prototype._parseConnect = function() {
|
||||
var args, connectCallback, errorCallback, headers;
|
||||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
headers = {};
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
headers = args[0], connectCallback = args[1];
|
||||
break;
|
||||
case 3:
|
||||
if (args[1] instanceof Function) {
|
||||
headers = args[0], connectCallback = args[1], errorCallback = args[2];
|
||||
} else {
|
||||
headers.login = args[0], headers.passcode = args[1], connectCallback = args[2];
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
headers.login = args[0], headers.passcode = args[1], connectCallback = args[2], errorCallback = args[3];
|
||||
break;
|
||||
default:
|
||||
headers.login = args[0], headers.passcode = args[1], connectCallback = args[2], errorCallback = args[3], headers.host = args[4];
|
||||
}
|
||||
return [headers, connectCallback, errorCallback];
|
||||
};
|
||||
|
||||
Client.prototype.connect = function() {
|
||||
var args, errorCallback, headers, out;
|
||||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
out = this._parseConnect.apply(this, args);
|
||||
headers = out[0], this.connectCallback = out[1], errorCallback = out[2];
|
||||
if (typeof this.debug === "function") {
|
||||
this.debug("Opening Web Socket...");
|
||||
}
|
||||
this.ws.onmessage = (function(_this) {
|
||||
return function(evt) {
|
||||
var arr, c, client, data, frame, messageID, onreceive, subscription, _i, _len, _ref, _results;
|
||||
data = typeof ArrayBuffer !== 'undefined' && evt.data instanceof ArrayBuffer ? (arr = new Uint8Array(evt.data), typeof _this.debug === "function" ? _this.debug("--- got data length: " + arr.length) : void 0, ((function() {
|
||||
var _i, _len, _results;
|
||||
_results = [];
|
||||
for (_i = 0, _len = arr.length; _i < _len; _i++) {
|
||||
c = arr[_i];
|
||||
_results.push(String.fromCharCode(c));
|
||||
}
|
||||
return _results;
|
||||
})()).join('')) : evt.data;
|
||||
_this.serverActivity = now();
|
||||
if (data === Byte.LF) {
|
||||
if (typeof _this.debug === "function") {
|
||||
_this.debug("<<< PONG");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (typeof _this.debug === "function") {
|
||||
_this.debug("<<< " + data);
|
||||
}
|
||||
_ref = Frame.unmarshall(data);
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
frame = _ref[_i];
|
||||
switch (frame.command) {
|
||||
case "CONNECTED":
|
||||
if (typeof _this.debug === "function") {
|
||||
_this.debug("connected to server " + frame.headers.server);
|
||||
}
|
||||
_this.connected = true;
|
||||
_this._setupHeartbeat(frame.headers);
|
||||
_results.push(typeof _this.connectCallback === "function" ? _this.connectCallback(frame) : void 0);
|
||||
break;
|
||||
case "MESSAGE":
|
||||
subscription = frame.headers.subscription;
|
||||
onreceive = _this.subscriptions[subscription] || _this.onreceive;
|
||||
if (onreceive) {
|
||||
client = _this;
|
||||
messageID = frame.headers["message-id"];
|
||||
frame.ack = function(headers) {
|
||||
if (headers == null) {
|
||||
headers = {};
|
||||
}
|
||||
return client.ack(messageID, subscription, headers);
|
||||
};
|
||||
frame.nack = function(headers) {
|
||||
if (headers == null) {
|
||||
headers = {};
|
||||
}
|
||||
return client.nack(messageID, subscription, headers);
|
||||
};
|
||||
_results.push(onreceive(frame));
|
||||
} else {
|
||||
_results.push(typeof _this.debug === "function" ? _this.debug("Unhandled received MESSAGE: " + frame) : void 0);
|
||||
}
|
||||
break;
|
||||
case "RECEIPT":
|
||||
_results.push(typeof _this.onreceipt === "function" ? _this.onreceipt(frame) : void 0);
|
||||
break;
|
||||
case "ERROR":
|
||||
_results.push(typeof errorCallback === "function" ? errorCallback(frame) : void 0);
|
||||
break;
|
||||
default:
|
||||
_results.push(typeof _this.debug === "function" ? _this.debug("Unhandled frame: " + frame) : void 0);
|
||||
}
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
})(this);
|
||||
this.ws.onclose = (function(_this) {
|
||||
return function() {
|
||||
var msg;
|
||||
msg = "Whoops! Lost connection to " + _this.ws.url;
|
||||
if (typeof _this.debug === "function") {
|
||||
_this.debug(msg);
|
||||
}
|
||||
_this._cleanUp();
|
||||
return typeof errorCallback === "function" ? errorCallback(msg) : void 0;
|
||||
};
|
||||
})(this);
|
||||
return this.ws.onopen = (function(_this) {
|
||||
return function() {
|
||||
if (typeof _this.debug === "function") {
|
||||
_this.debug('Web Socket Opened...');
|
||||
}
|
||||
headers["accept-version"] = Stomp.VERSIONS.supportedVersions();
|
||||
headers["heart-beat"] = [_this.heartbeat.outgoing, _this.heartbeat.incoming].join(',');
|
||||
return _this._transmit("CONNECT", headers);
|
||||
};
|
||||
})(this);
|
||||
};
|
||||
|
||||
Client.prototype.disconnect = function(disconnectCallback, headers) {
|
||||
if (headers == null) {
|
||||
headers = {};
|
||||
}
|
||||
this._transmit("DISCONNECT", headers);
|
||||
this.ws.onclose = null;
|
||||
this.ws.close();
|
||||
this._cleanUp();
|
||||
return typeof disconnectCallback === "function" ? disconnectCallback() : void 0;
|
||||
};
|
||||
|
||||
Client.prototype._cleanUp = function() {
|
||||
this.connected = false;
|
||||
if (this.pinger) {
|
||||
Stomp.clearInterval(this.pinger);
|
||||
}
|
||||
if (this.ponger) {
|
||||
return Stomp.clearInterval(this.ponger);
|
||||
}
|
||||
};
|
||||
|
||||
Client.prototype.send = function(destination, headers, body) {
|
||||
if (headers == null) {
|
||||
headers = {};
|
||||
}
|
||||
if (body == null) {
|
||||
body = '';
|
||||
}
|
||||
headers.destination = destination;
|
||||
return this._transmit("SEND", headers, body);
|
||||
};
|
||||
|
||||
Client.prototype.subscribe = function(destination, callback, headers) {
|
||||
var client;
|
||||
if (headers == null) {
|
||||
headers = {};
|
||||
}
|
||||
if (!headers.id) {
|
||||
headers.id = "sub-" + this.counter++;
|
||||
}
|
||||
headers.destination = destination;
|
||||
this.subscriptions[headers.id] = callback;
|
||||
this._transmit("SUBSCRIBE", headers);
|
||||
client = this;
|
||||
return {
|
||||
id: headers.id,
|
||||
unsubscribe: function() {
|
||||
return client.unsubscribe(headers.id);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Client.prototype.unsubscribe = function(id) {
|
||||
delete this.subscriptions[id];
|
||||
return this._transmit("UNSUBSCRIBE", {
|
||||
id: id
|
||||
});
|
||||
};
|
||||
|
||||
Client.prototype.begin = function(transaction) {
|
||||
var client, txid;
|
||||
txid = transaction || "tx-" + this.counter++;
|
||||
this._transmit("BEGIN", {
|
||||
transaction: txid
|
||||
});
|
||||
client = this;
|
||||
return {
|
||||
id: txid,
|
||||
commit: function() {
|
||||
return client.commit(txid);
|
||||
},
|
||||
abort: function() {
|
||||
return client.abort(txid);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Client.prototype.commit = function(transaction) {
|
||||
return this._transmit("COMMIT", {
|
||||
transaction: transaction
|
||||
});
|
||||
};
|
||||
|
||||
Client.prototype.abort = function(transaction) {
|
||||
return this._transmit("ABORT", {
|
||||
transaction: transaction
|
||||
});
|
||||
};
|
||||
|
||||
Client.prototype.ack = function(messageID, subscription, headers) {
|
||||
if (headers == null) {
|
||||
headers = {};
|
||||
}
|
||||
headers["message-id"] = messageID;
|
||||
headers.subscription = subscription;
|
||||
return this._transmit("ACK", headers);
|
||||
};
|
||||
|
||||
Client.prototype.nack = function(messageID, subscription, headers) {
|
||||
if (headers == null) {
|
||||
headers = {};
|
||||
}
|
||||
headers["message-id"] = messageID;
|
||||
headers.subscription = subscription;
|
||||
return this._transmit("NACK", headers);
|
||||
};
|
||||
|
||||
return Client;
|
||||
|
||||
})();
|
||||
|
||||
Stomp = {
|
||||
VERSIONS: {
|
||||
V1_0: '1.0',
|
||||
V1_1: '1.1',
|
||||
V1_2: '1.2',
|
||||
supportedVersions: function() {
|
||||
return '1.1,1.0';
|
||||
}
|
||||
},
|
||||
client: function(url, protocols) {
|
||||
var klass, ws;
|
||||
if (protocols == null) {
|
||||
protocols = ['v10.stomp', 'v11.stomp'];
|
||||
}
|
||||
klass = Stomp.WebSocketClass || WebSocket;
|
||||
ws = new klass(url, protocols);
|
||||
return new Client(ws);
|
||||
},
|
||||
over: function(ws) {
|
||||
return new Client(ws);
|
||||
},
|
||||
Frame: Frame
|
||||
};
|
||||
|
||||
if (typeof exports !== "undefined" && exports !== null) {
|
||||
exports.Stomp = Stomp;
|
||||
}
|
||||
Stomp.setInterval = function(interval, f) {
|
||||
return setInterval(f, interval);
|
||||
};
|
||||
Stomp.clearInterval = function(id) {
|
||||
return clearInterval(id);
|
||||
};
|
||||
|
||||
|
||||
let data = null;
|
||||
|
||||
let topic = null;
|
||||
let header = null;
|
||||
function timedCount(){
|
||||
|
||||
onmessage = (e) => {
|
||||
|
||||
if(e.data.type == "init"){
|
||||
topic = e.data.topic;
|
||||
header = {'X-Token': e.data.token };
|
||||
token = e.data.token;
|
||||
websocketUrl = e.data.baseurl+'/joylink-websocket?token=';
|
||||
|
||||
}
|
||||
|
||||
if(e.data == "connect"){
|
||||
let teststomp = new StompClient(header,token);
|
||||
teststomp.subscribe(topic, callback, header);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function callback(Response) {
|
||||
|
||||
data = JSON.parse(Response.body);
|
||||
// console.log(data);
|
||||
// if(data.type == 'TrainRun_3D'){
|
||||
// for (let i=0,leni = data.body.length; i<leni; i++) {
|
||||
// data.body[i].type = "TRAIN";
|
||||
// postMessage(data.body[i]);
|
||||
// }
|
||||
// }
|
||||
|
||||
if(data.type == "Device_Fault_Set_3D"){
|
||||
postMessage(data);
|
||||
return;
|
||||
}
|
||||
if(data.type == "Device_Fault_Over_3D"){
|
||||
postMessage(data);
|
||||
return;
|
||||
}
|
||||
if(data.type == "Device_Load_Destroy_3D"){
|
||||
postMessage(data);
|
||||
return;
|
||||
}
|
||||
|
||||
if(data.type == 'TrainRun_3D'){
|
||||
postMessage(data);
|
||||
return;
|
||||
}
|
||||
//data.type == 'Simulation_DeviceStatus' &&
|
||||
|
||||
// if(data.type == 'Simulation_DeviceStatus'){
|
||||
// for (let i= 0,leni = data.body.length; i<leni; i++) {
|
||||
// if(data.body[i].deviceType == "TRAIN"){
|
||||
// postMessage(data.body[i]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if(data.type == "Train_Hmi_3D"){
|
||||
postMessage(data);
|
||||
return;
|
||||
}
|
||||
if(data.type == 'DeviceCtrl_3D'){
|
||||
// console.log(data);
|
||||
postMessage(data.body);
|
||||
return;
|
||||
}
|
||||
if(data.type == 'Simulation_Reset'){
|
||||
postMessage(data);
|
||||
return;
|
||||
}
|
||||
if( data.body.length>300){
|
||||
// console.log(data);
|
||||
postMessage(data);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
timedCount();
|
Loading…
Reference in New Issue
Block a user