This commit is contained in:
joylink_cuiweidong 2020-05-22 16:27:20 +08:00
commit 198b16d926
68 changed files with 2792 additions and 285 deletions

View File

@ -26,6 +26,17 @@ var Staticmodel = {
//https://joylink.club/oss/wx/stationstand/stationstand.FBX //https://joylink.club/oss/wx/stationstand/stationstand.FBX
//../../static/model/device/stationstand.FBX //../../static/model/device/stationstand.FBX
},
section: {
id: "4",
name: "区段",
deviceType: "section",
type: "low",
picUrl: "",
assetUrl: "../../static/model/device/section/section.FBX"
//https://joylink.club/oss/wx/stationstand/stationstand.FBX
//../../static/model/device/stationstand.FBX
} }
} }

View File

@ -26,11 +26,19 @@ export function ModelManager(){
action:null action:null
}; };
this.sectionmodel = {
code:"section",
sectionstatus:"01",
mesh:null,
action:null
};
this.loadpromise = function (data,mixers){ this.loadpromise = function (data,mixers){
let initlist = []; let initlist = [];
initlist.push(fbxpromise(data.Switch,mixers,scope.switchmodel)); initlist.push(fbxpromise(data.Switch,mixers,scope.switchmodel));
initlist.push(fbxpromise(data.Signal,mixers,scope.signalmodel)); initlist.push(fbxpromise(data.Signal,mixers,scope.signalmodel));
initlist.push(fbxpromise(data.stationstand,mixers,scope.standmodel)); initlist.push(fbxpromise(data.stationstand,mixers,scope.standmodel));
initlist.push(fbxpromise(data.section,mixers,scope.sectionmodel));
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){

View File

@ -0,0 +1,681 @@
import { Staticmodel } from '@/jlmap3d/jl3ddevice/config.js';
//loader
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 Jl3dfaultdevice(dom,group,token,skinCode) {
var scope = this;
this.dom = dom;
this.nowcode = null;
this.animateswitch = false;
this.signallights = [];
Signallightload(this.signallights);
this.mixers = [];
this.showmodel = null;
let helpbox,textplane;
let daochamodel;
let psdtexturemap = [];
//点击事件状态
this.raycasterstatus = false;
//动画状态
this.animastats = false;
//当前选中模型
this.nowobject = null;
//当前动画播放模型
this.animationmodel = null;
this.stationtexture = [];
this.devicetext = new Textconfig();
this.windowstatus = '0';
//初始化webgl渲染
this.renderer = new THREE.WebGLRenderer({ antialias: true });
this.renderer.setClearColor(new THREE.Color(0x000000));
this.renderer.setSize(window.innerWidth, window.innerHeight);
this.renderer.shadowMap.enabled = true;
this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
this.dom.appendChild(this.renderer.domElement);
//定义相机
this.camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 200);
this.camera.position.set(0, 20, 30);
this.camera.aspect = window.innerWidth / window.innerHeight;
this.camera.updateProjectionMatrix();
//定义场景(渲染容器)
this.scene = new THREE.Scene();
this.scene.background = new THREE.Color(0xa0a0a0);
var mesh = new THREE.Mesh(new THREE.PlaneBufferGeometry(200, 200), new THREE.MeshPhongMaterial({ color: 0x999999, depthWrite: false }));
mesh.rotation.x = - Math.PI / 2;
mesh.receiveShadow = true;
this.scene.add(mesh);
var grid = new THREE.GridHelper(200, 20, 0x000000, 0x000000);
grid.material.opacity = 0.2;
grid.material.transparent = true;
this.scene.add(grid);
let moveanima = new Moveanimate(scope);
//定义全局光
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
this.scene.add(ambientLight);
var spotLight = new THREE.SpotLight(0xececff);
spotLight.position.set(-50, 80, 0);
spotLight.castShadow = true;
spotLight.shadow.mapSize.width = 2048;
spotLight.shadow.mapSize.height = 2048;
this.scene.add(spotLight);
this.controls = new THREE.OrbitControls(this.camera, dom);
this.controls.maxPolarAngle = Math.PI / 2;
this.controls.minPolarangle = Math.PI / 5;
this.controls.maxDistance = 80;
this.controls.screenSpacePanning = true;
this.controls.update();
document.addEventListener( "mousedown", onselect, false );
let teststomp = new StompClient();
// let topic = '/user/topic/simulation/assistant/'+group;
let topic = '/user/queue/simulation/jl3d/'+group;
let header = {'X-Token': token};
try {
// console.log("teststomp");
teststomp.subscribe(topic, callback, header);
} catch (error) {
console.error('websocket订阅失败');
}
function callback(Response) {
let data = JSON.parse(Response.body);
// if(scope.nowcode != data.body.code){
// scope.nowcode = data.body.code;
// scope.selectmodel(data);
// }else{
if(data.type == "DeviceCtrl_3D"){
// console.log(data.body);
if(data.body.code == scope.nowcode){
scope.updateaction(data.body);
}
}
// }
}
window.onresize = function () {
scope.camera.aspect = window.innerWidth / window.innerHeight;
scope.camera.updateProjectionMatrix();
scope.renderer.setSize(window.innerWidth, window.innerHeight);
}
this.domresize = function(){
scope.camera.aspect = window.innerWidth/ window.innerHeight;
scope.camera.updateProjectionMatrix();
scope.renderer.setSize(window.innerWidth, window.innerHeight);
}
this.anime = null;
this.modelmanager = new ModelManager();
getPublish3dMapDetail(skinCode).then(netdata => {
setpsdstationmap(JSON.parse(netdata.data.stands));
Standtextureload(scope,JSON.parse(netdata.data.assets));
scope.modelmanager.loadpromise(Staticmodel, scope.mixers).then(function (data) {
moveanima.initlistnew(scope.modelmanager.switchmodel.mesh);
daochamodel = scope.modelmanager.switchmodel.mesh.getObjectByName("DAOCHA");
// 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() {
scope.anime = requestAnimationFrame(animate);
scope.renderer.render(scope.scene, scope.camera);
scope.controls.update();
//scope.camera.lookAt(plane);
//
moveanima.animateupdate();
let delta = clock.getDelta();
if (scope.mixers) {
for (let i = 0; i < scope.mixers.length; i++) {
if (scope.mixers[i]) {
scope.mixers[i].update(delta);
}
}
}
}
this.hideswitch = function (nowswitchstatus){
if(nowswitchstatus){
scope.modelmanager.switchmodel.mesh.add(daochamodel);
}else{
scope.modelmanager.switchmodel.mesh.remove(daochamodel);
}
}
this.selectmodel = function (data) {
console.log(data);
if (scope.showmodel) {
if (scope.showmodel.code != data.code) {
scope.scene.remove(scope.showmodel);
scope.showmodel = null
scope.nowcode = data.code;
if (data.type == "SWITCH") {
// scope.modelmanager.switchmodel.locateType = data.body.locateType;
scope.modelmanager.switchmodel.code = data.code;
scope.showmodel = scope.modelmanager.switchmodel.mesh;
scope.scene.add(scope.showmodel);
// scope.devicetext.initdevicetext(scope.modelmanager.switchmodel.mesh);
scope.nowobject = scope.modelmanager.switchmodel.mesh;
// updatemenulist(scope.devicetext.devicelist);
scope.raycasterstatus = true;
}else{
scope.raycasterstatus = false;
scope.nowobject = "";
// updatemenulist();
}
if (data.type == "SIGNAL") {
scope.modelmanager.signalmodel.code = data.code;
scope.showmodel = scope.modelmanager.signalmodel.mesh;
scope.scene.add(scope.showmodel);
}
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.action.reset();
scope.modelmanager.standmodel.action.time = 0;
scope.modelmanager.standmodel.action.timeScale = 1;
scope.modelmanager.standmodel.action.play();
// scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map =scope.stationtexture[psdtexturemap[data.standCode]];
// scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
}
if (data.type == "AXLE_COUNTER") {
// console.log(data);
scope.modelmanager.sectionmodel.code = data.code;
scope.showmodel = scope.modelmanager.sectionmodel.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();
scope.showmodel.code = data.code;
// initstatus(data);
}
}
} else {
scope.nowcode = data.code;
if (data.type == "SWITCH") {
scope.modelmanager.switchmodel.normalPosition = "0";
scope.showmodel = scope.modelmanager.switchmodel.mesh;
scope.scene.add(scope.showmodel);
// if (data.normalPosition == "0") {
// scope.modelmanager.switchmodel.normalPosition = "0";
// if(scope.modelmanager.switchmodel.action){
// scope.modelmanager.switchmodel.action.reset();
// scope.modelmanager.switchmodel.action.time = 0;
// scope.modelmanager.switchmodel.action.timeScale = -1;
// scope.modelmanager.switchmodel.action.play();
// }
// } else if (data.normalPosition == "1") {
// scope.modelmanager.switchmodel.normalPosition = "1";
// if(scope.modelmanager.switchmodel.action){
// scope.modelmanager.switchmodel.action.reset();
// scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration;
// scope.modelmanager.switchmodel.action.timeScale = 1;
// scope.modelmanager.switchmodel.action.play();
// }
// }
}
if (data.type == "SIGNAL") {
scope.showmodel = scope.modelmanager.signalmodel.mesh;
scope.scene.add(scope.showmodel);
}
if (data.type == "PSD") {;
scope.showmodel = scope.modelmanager.standmodel.mesh;
scope.scene.add(scope.showmodel);
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = 0;
scope.modelmanager.standmodel.action.timeScale = 1;
scope.modelmanager.standmodel.action.play();
// scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map =scope.stationtexture[psdtexturemap[data.standCode]];
// scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
}
if (data.type == "AXLE_COUNTER") {
scope.showmodel = scope.modelmanager.sectionmodel.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);
}
}
//设备分解、归位动画按钮
this.disperdevice1 = function(){
if(scope.nowobject.animacode){
if(moveanima.status == true){
if(scope.animastats == false){
scope.animastats = true;
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"on"],true)
} else if(scope.animastats == true){
scope.animastats = false;
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"off"],true);
}
}
}
};
this.disperdevice2 = function(){
if(scope.nowobject.animacode){
if(moveanima.status == true){
if(scope.animastats == false){
scope.animastats = true;
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"chaijie"],true);
} else if(scope.animastats == true){
scope.animastats = false;
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"fuwei"],true);
}
}
}
};
this.resetmodel = function(){
if(scope.nowobject.animacode){
scope.animastats = false;
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"fuwei"],true);
}
};
this.animationmsgshowon = function(nowobject){
scope.animationmodel = nowobject;
if(helpbox){
scope.animationmodel.helpbox = null;
scope.scene.remove( helpbox );
helpbox = undefined;
}
settext(scope.animationmodel,scope.animationmodel.position);
// console.log(scope.animationmodel);
helpbox = new THREE.BoxHelper( scope.animationmodel, 0xff0000 );
moveanima.updatehelpbox(helpbox,textplane);
// settext(intersects[0].object,intersects[0].point);
// getdevicemsg(intersects[0].object.name);
scope.scene.add( helpbox );
getdevicemsg(nowobject.name);
}
this.animationmsgshowoff = function(nowobject){
if(helpbox){
scope.animationmodel.helpbox = null;
scope.scene.remove( helpbox );
helpbox = undefined;
}
if(textplane){
scope.scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
scope.animationmodel = null;
}
this.updateaction = function (data) {
if (data.type == "SWITCH") {
if (data.normal == "0") {
scope.modelmanager.switchmodel.normalPosition = "0";
scope.modelmanager.switchmodel.action.reset();
scope.modelmanager.switchmodel.action.time = 0;
scope.modelmanager.switchmodel.action.timeScale = 1;
scope.modelmanager.switchmodel.action.play();
} else if (data.normal == "1") {
scope.modelmanager.switchmodel.normalPosition = "1";
scope.modelmanager.switchmodel.action.reset();
scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration;
scope.modelmanager.switchmodel.action.timeScale = -1;
scope.modelmanager.switchmodel.action.play();
}
}
if (data.type == "SIGNAL") {//从上往下红绿黄
if(data.red == 1){
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"];
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
}else{
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
}
if(data.yellow == 1){
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["yellow"];
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
}else{
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
}
if(data.green == 1){
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["green"];
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
}else{
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
}
}
if (data.type == "PSD") {
if (data.code == scope.nowcode) {
if (data.open == "1" ) {
scope.modelmanager.standmodel.screenDoorOpenStatus = "0";
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = 0;
scope.modelmanager.standmodel.action.timeScale = 1;
scope.modelmanager.standmodel.action.play();
}
if (data.open == "0" ) {
scope.modelmanager.standmodel.screenDoorOpenStatus = "1";
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration;
scope.modelmanager.standmodel.action.timeScale = -1;
scope.modelmanager.standmodel.action.play();
}
}
}
// scope.showmodel.
}
this.repairpsd = function(){
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration;
scope.modelmanager.standmodel.action.timeScale = -1;
scope.modelmanager.standmodel.action.play();
}
this.updateselect = function(updata){
// console.log(updata);
if(helpbox){
scope.scene.remove( helpbox );
helpbox = null;
}
helpbox = new THREE.BoxHelper( updata.mesh, 0xff0000 );
// console.log(updata.mesh);
let point = {
x:updata.mesh.matrixWorld.elements[12],
y:updata.mesh.matrixWorld.elements[13],
z:updata.mesh.matrixWorld.elements[14]
};
settext(updata.mesh,point)
getdevicemsg(updata.mesh.name);
scope.scene.add( helpbox );
}
function getdevicemsg(selectname){
// console.log(selectname);
for(let i=0,leni=scope.devicetext.devicelist.length;i<leni;i++){
if(selectname == scope.devicetext.devicelist[i].name){
updatemsg(scope.devicetext.devicelist[i].text,scope.devicetext.devicelist[i].msg);
i=leni;
}
}
}
function initstatus(data) {
if (data._type == "Switch") {
if (data.normalPosition == "0") {
scope.modelmanager.switchmodel.normalPosition = "0";
if(scope.modelmanager.switchmodel.action){
scope.modelmanager.switchmodel.action.reset();
scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration;
scope.modelmanager.switchmodel.action.timeScale = 1;
scope.modelmanager.switchmodel.action.play();
}
} else if (data.normalPosition == "1") {
scope.modelmanager.switchmodel.normalPosition = "1";
if(scope.modelmanager.switchmodel.action){
scope.modelmanager.switchmodel.action.reset();
scope.modelmanager.switchmodel.action.time = 0;
scope.modelmanager.switchmodel.action.timeScale = -1;
scope.modelmanager.switchmodel.action.play();
}
}
}
if (data._type == "Signal") {
if(data.logicLight == 0){
if(data.redOpen == 1){
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"];
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
}else{
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
}
if(data.yellowOpen == 1){
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["yellow"];
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
}else{
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
}
if(data.greenOpen == 1){
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["green"];
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
}else{
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
}
}else{
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
}
}
if (data._type == "Psd") {
if (data.screenDoorOpenStatus == "0") {
scope.modelmanager.standmodel.screenDoorOpenStatus = "0";
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration;
scope.modelmanager.standmodel.action.timeScale = 1;
scope.modelmanager.standmodel.action.play();
}
if (data.screenDoorOpenStatus == "1") {
scope.modelmanager.standmodel.screenDoorOpenStatus = "1";
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = 0;
scope.modelmanager.standmodel.action.timeScale = -1;
scope.modelmanager.standmodel.action.play();
}
}
}
this.updatewindowstatus = function(nowwindowstatus){
scope.windowstatus == nowwindowstatus;
}
function onselect(event){
if(event.button == '0'){
if(scope.raycasterstatus){
//定义光线
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
let mouse = new THREE.Vector2();
let getBoundingClientRect = scope.dom.getBoundingClientRect()
if(scope.windowstatus == '0'){
mouse.x = ( (event.clientX - getBoundingClientRect .left) /scope.dom.offsetWidth) * 2-1;
mouse.y = -( (event.clientY - getBoundingClientRect .top) / scope.dom.offsetHeight) * 2 + 1;
}else{
mouse.x = (event.clientX / scope.dom.offsetWidth) * 2 - 1;
mouse.y = -(event.clientY / scope.dom.offsetHeight) * 2 + 1;
}
raycaster.setFromCamera( mouse, scope.camera );
let intersects = raycaster.intersectObjects( scope.modelmanager.switchmodel.mesh.children,true);
if(helpbox){
scope.scene.remove( helpbox );
helpbox = null;
}
if(textplane){
scope.scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
if(intersects[0]){
if(intersects[0].object.raycastoff){
helpbox = new THREE.BoxHelper( intersects[0].object.parent, 0xff0000 );
settext(intersects[0].object.parent,intersects[0].point);
getdevicemsg(intersects[0].object.parent.name);
}else{
helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
settext(intersects[0].object,intersects[0].point);
getdevicemsg(intersects[0].object.name);
}
scope.scene.add( helpbox );
}
}
}
}
function settext(intersects,point){
if(intersects.text){
let textgeometry = new THREE.PlaneBufferGeometry( 18, 12, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(intersects.text));
let textmaterial = new THREE.MeshBasicMaterial( {
side: THREE.DoubleSide,
map:textt ,transparent: true,
alphaTest:0.1
} );
if(textplane){
scope.scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
textplane= new THREE.Mesh( textgeometry, textmaterial );
// textplane.name = data[i].code;
textplane.position.x = point.x;
textplane.position.y = point.y+6;
textplane.position.z = point.z;
// console.log(textplane.position);
// textplane.tcode = data[i].code;
textplane.rotation.y = -Math.PI/2;
textplane.lookAt(scope.camera.position);
// scope.textlist.push(textplane);
// newmesh.children[0].add(textplane);
scope.scene.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
var beauty = new Image();
beauty.src = "../../static/texture/guide.png";
//canvas文字贴图方法
//PS:待提炼 增强功能
function getTextCanvas(text){
var canvas = document.getElementById('canvastexture');
canvas.width = 256;
canvas.height = 128;
var ctx = canvas.getContext('2d');
//var bg = canvas.createPattern(img, "no-repeat");
//ctx.fillStyle = bg;
ctx.fillRect(0, 0,256,128);
ctx.font = "20px Verdana";
ctx.fillStyle = '#FFFFFF';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.clearRect(0,0,256,128);
//console.log(text.groupNumber);
ctx.drawImage(beauty,0,0,256, 128);
ctx.fillText("设备部件:"+text, 90,30);
// ctx.fillText("车组人员:XXX", 40,20);
// ctx.fillText("速度:XXX.XXX", 40,30);
//ctx.fillText(text.trainModel.name, width/2,height*3/4);
let data = ctx.getImageData(0, 0,256, 128);
return data;
}
}

View File

@ -19,12 +19,10 @@ import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
// import { DragControls } from '@/jlmap3d/main/control/DragControls'; // import { DragControls } from '@/jlmap3d/main/control/DragControls';
//加载器 //加载器
import { SimulationLoad } from '@/jlmap3d/main/loaders/SimulationLoad'; import { MaintainerLoad } from '@/jlmap3d/jl3dmaintainer/maintainerload';
import { SimulationLoadNew } from '@/jlmap3d/main/loaders/SimulationLoadNew';
//connect //connect
import {Jlmap3dSubscribe } from '@/jlmap3d/jl3dsimulation/connect/Jlmap3dSubscribe'; import {Maintainerconnect } from '@/jlmap3d/jl3dmaintainer/maintainerconnect';
import {Jlmap3dSubscribeNew } from '@/jlmap3d/jl3dsimulation/connect/Jlmap3dSubscribeNew';
import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata'; import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
@ -97,11 +95,6 @@ export function JLmap3dMaintainer(dom, data,skinCode,storemod,routegroup,project
}; };
//地图模型数据 //地图模型数据
let mapdata = new Jl3ddata(); let mapdata = new Jl3ddata();
//订阅仿真socket
// console.log(routegroup);
// this.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork);
//连接到通信
//console.log(this.Subscribe.config);
this.webwork = new Worker("../../static/workertest/trainworker.js"); this.webwork = new Worker("../../static/workertest/trainworker.js");
//初始化加载数据和模型getPublishMapDetail //初始化加载数据和模型getPublishMapDetail
@ -110,18 +103,13 @@ export function JLmap3dMaintainer(dom, data,skinCode,storemod,routegroup,project
getPublish3dMapDetail(skinCode).then(netdata => { getPublish3dMapDetail(skinCode).then(netdata => {
let assetsdata = JSON.parse(netdata.data.sections); let assetsdata = JSON.parse(netdata.data.sections);
if(assetsdata.link){ if(assetsdata.link){
scope.datatype = "old";
scope.jsonwebwork = new Worker("../../static/workertest/jsonworker.js");
scope.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork);
scope.Subscribe.socketon(scope.Subscribe.topic);
SimulationLoad(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
}else{ }else{
scope.datatype = "new"; scope.datatype = "new";
scope.jsonwebworknew = new Worker("../../static/workertest/jsonworkernew.js"); scope.jsonwebworknew = new Worker("../../static/workertest/maintainerworker.js");
scope.Subscribe = new Jlmap3dSubscribeNew(scope,routegroup,scope.jsonwebworknew); scope.Subscribe = new Maintainerconnect(scope,routegroup,scope.jsonwebworknew);
scope.Subscribe.socketon(scope.Subscribe.topic); scope.Subscribe.socketon(scope.Subscribe.topic);
SimulationLoadNew(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod); MaintainerLoad(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
} }
}); });
@ -304,7 +292,6 @@ export function JLmap3dMaintainer(dom, data,skinCode,storemod,routegroup,project
trainlisttest = loadtrainlisttest; trainlisttest = loadtrainlisttest;
realsectionlist = loadrealsectionlist; realsectionlist = loadrealsectionlist;
rails = loadrails; rails = loadrails;
console.log(stationstandlist);
scope.updatecamera(stationstandlist.group.children[0],"station"); scope.updatecamera(stationstandlist.group.children[0],"station");
} }
@ -412,8 +399,7 @@ export function JLmap3dMaintainer(dom, data,skinCode,storemod,routegroup,project
} }
if(scope.raycasterswitch == "section"){ if(scope.raycasterswitch == "section"){
console.log(sectionlist);
console.log(linklist);
//console.log(sectionlist.sections.modellist); //console.log(sectionlist.sections.modellist);
let intersects = raycaster.intersectObjects( linklist.linksgroup.children,true); let intersects = raycaster.intersectObjects( linklist.linksgroup.children,true);
if(intersects[0]){ if(intersects[0]){
@ -424,7 +410,6 @@ export function JLmap3dMaintainer(dom, data,skinCode,storemod,routegroup,project
} }
if(scope.raycasterswitch == "signal"){ if(scope.raycasterswitch == "signal"){
console.log(signallist);
let intersects = raycaster.intersectObjects( signallist.group.children,true); let intersects = raycaster.intersectObjects( signallist.group.children,true);
if(intersects[0]){ if(intersects[0]){
@ -435,7 +420,6 @@ export function JLmap3dMaintainer(dom, data,skinCode,storemod,routegroup,project
} }
if(scope.raycasterswitch == "switch"){ if(scope.raycasterswitch == "switch"){
console.log(sectionlist);
let intersects = raycaster.intersectObjects( sectionlist.switchs.modellist,true); let intersects = raycaster.intersectObjects( sectionlist.switchs.modellist,true);
if(intersects[0]){ if(intersects[0]){

View File

@ -0,0 +1,828 @@
import StompClient from '@/utils/sock';
// import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
// import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
// 定于仿真socket接口
export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork) {
const scope = this;
this.map = null;
var trainlisttest = null;
var sectionlist = null;
var signallist = null;
var stationstandlist = null;
var sectionlist = null;
var materials = null;
var actions = null;
var rails = null;
var links = null;
var scenes = null;
var code = null;
var drivingcode = null;
var drivingspeed = null;
var drivingaptspeed = null;
let driverswitch = false;
let stoptimer = null;
let num = 30;
let pointstand = null;
let data = null;
// run as plane = 01;
// reset = 02;
var datatype = '00';
this.teststomp = new StompClient();
this.topic = '/user/queue/simulation/jl3d/'+routegroup;
let header = {'X-Token': getToken() };
let connectmsg = {
type:'init',
baseurl:getBaseUrl(),
topic:this.topic,
token:getToken(),
};
jsonwebwork.postMessage(connectmsg);
jsonwebwork.onmessage = function (event) {
// if(event.data.deviceType == "TRAIN"){
// // console.log(event.data);
//
// }
if(event.data.type == "Device_Fault_Set_3D"){
let newfault = {
code:event.data.body.code,
type:event.data.body.type,
text:event.data.body.fault,
fault:event.data.body.fault,
}
if(event.data.body.type == "SIGNAL"){
if(event.data.body.fault == "MAIN_FILAMENT_BROKEN"){
newfault.text = "主灯丝断丝故障";
}
}
if(event.data.body.type == "SWITCH"){
if(event.data.body.fault == "SPLIT"){
newfault.text = "道岔挤岔";
}
}
if(event.data.body.type == "AXLE_COUNTER"){
if(event.data.body.fault == "FAULT"){
newfault.text = "计轴故障";
}
}
if(event.data.body.type == "PSD"){
if(event.data.body.fault == "FAULT"){
newfault.text = "屏蔽门无法关闭故障";
}
}
warningmsg("新的故障设备:"+event.data.body.code);
updatefault(newfault);
return;
}
if(event.data.type == "Device_Fault_Over_3D"){
warningmsg("已修复故障设备:"+event.data.body.code);
deletefault(event.data.body.code);
return;
}
if(event.data.type == "Device_Load_Destroy_3D"){
DeviceDestroy(event.data);
resetfaultlist();
let fault = event.data.body.faultInfoList;
for(let i=0,leni= fault.length;i<leni;i++){
updatefault(fault[i]);
}
return;
}
if(event.data.type == 'TrainRun_3D'){
for(let i=0,leni=event.data.body.length;i<leni;i++){
// console.log(event.data.body[i]);
trainrunnew(event.data.body[i]);
}
return;
}
// if(event.data.type == 'TRAIN'){
// console.log(event.data);
// trainrun(event.data);
// }
if (event.data.type== 'SIGNAL' && signallist) {
signalupdate(event.data);
// console.log(event.data);
return;
}
if (event.data.type== "PSD" && actions) {
standupdate(event.data);
return;
}
if (event.data.type == "SWITCH") {
switchupdate(event.data);
return;
}
if (event.data.type == 'TRAIN_DOOR') {
traindoorupdate(event.data);
return;
}
if(event.data.type == 'Simulation_Reset'){
simulationreset(event.data);
return;
}
if(event.data.type == 'Simulation_DeviceStatus'){
initall(event.data.body);
return;
}
};
this.updatamap = function(newsectionlist,newlinklist,newsignallist,newstationstandlist,newtrainlisttest,newrealsectionlist,newrails, materiallist, nowaction, scene) {
trainlisttest = newtrainlisttest;
sectionlist = newsectionlist;
signallist = newsignallist;
stationstandlist = newstationstandlist;
materials = materiallist;
scenes = scene;
actions = nowaction;
links = newlinklist;
rails = newrails;
};
this.socketon = function(topic) {
try {
// console.log("teststomp");
// scope.teststomp.subscribe(topic, callback, header);
} catch (error) {
console.error('websocket订阅失败');
}
};
this.socketoff = function(topic) {
scope.teststomp.unsubscribe(topic);
for (let i=0; i<trainlisttest.group.children.length; i++) {
if (trainlisttest.group.children[i].dispose == false) {
code = trainlisttest.group.children[i].name;
trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].open = '1';
trainlisttest.list[code].speed = 0;
trainlisttest.group.children[i].dispose = true;
trainlisttest.group.children[i].position.x = -50000;
trainlisttest.group.children[i].position.y = -50000;
trainlisttest.group.remove(trainlisttest.group.children[i]);
i--;
}
}
};
function trainrunnew(data){
let code = data.code;
if(trainlisttest.list[code].right != data.right){
if(data.right == "0"){
trainlisttest.list[code].right = "0";
trainlisttest.list[code].rotation.y = Math.PI;
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
trainlisttest.list[code].position.x = point.x;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = point.z;
}
}else{
trainlisttest.list[code].right = "1";
trainlisttest.list[code].rotation.y = 0;
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
trainlisttest.list[code].position.x = point.x;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = point.z;
}
}
}
// console.log(data);
if(trainlisttest.list[code].dispose == "0"){
if (data.right == '1') { // 向右
trainlisttest.list[code].right = '1';
trainlisttest.list[code].progress = data.offset;
// trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
// if(rails.sectionrail[data.section].standTrack){
// trainlisttest.list[code].statsstop = 0;
// }
let point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress);
trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0;
// for (let tl=0; tl<6; tl++) {
// trainlisttest.list[code].children[tl].position.z = parseFloat(point.z);
// }
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineleft;
// if(data.next){
// trainlisttest.list[code].nextcode = data.next;
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
// }
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
trainlisttest.list[code].status = '1';
if(trainlisttest.list[code].children[0].position.z != point.z){
trainlisttest.list[code].children[0].up = new THREE.Vector3(1,0,0);
let tangent = rails.sectionrail[data.section].lineleft.getTangentAt(data.offset).normalize();
trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize();
let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians);
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
trainlisttest.list[code].children[0].rotation.y = 0;
let rotas = {
posr:point,
rota:trainlisttest.list[code].children[0].rotation.z
}
trainlisttest.list[code].children[1].rotalist.push(rotas);
let offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z);
trainlisttest.list[code].children[0].position.z += offsetz;
}
if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){
//console.log(rs);
if(trainlisttest.list[code].children[rs].rotalist[0]){
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]);
trainlisttest.list[code].children[rs].position.z += offsetz;
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])>=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
// if(trainlisttest.list[code].groupNumber == "005"){
// console.log("rs:"+rs);
// console.log(trainlisttest.list[code].children[rs].matrixWorld.elements[12]);
// console.log(trainlisttest.list[code].children[rs].rotalist[0].posr.x);
// }
if(rs != 5){
let asd = trainlisttest.list[code].children[rs].rotalist[0];
trainlisttest.list[code].children[rs+1].rotalist.push(asd);
}
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rota;
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
xh--;
}else{
xh = trainlisttest.list[code].children[rs].rotalist.length;
}
}
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
}
}
}
} else if (data.right == '0') { // 向左
trainlisttest.list[code].right = '0';
trainlisttest.list[code].progress = 1-data.offset;
// trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
// if(rails.sectionrail[data.section].standTrack){
// trainlisttest.list[code].statsstop = 0;
// }
let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress);
trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0;
// for (let tl=0; tl<6; tl++) {
// trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z);
// }
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineright;
// if(data.next){
// trainlisttest.list[code].nextcode = data.next;
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright;
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
// }
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
trainlisttest.list[code].status = '0';
if(-trainlisttest.list[code].children[0].position.z != point.z){
trainlisttest.list[code].children[0].up = new THREE.Vector3(-1,0,0);
let tangent = rails.sectionrail[data.section].lineright.getTangentAt(data.offset).normalize();
trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize();
let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians);
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
trainlisttest.list[code].children[0].rotation.y = 0;
let rotas = {
posr:point,
rota:trainlisttest.list[code].children[0].rotation.z
}
trainlisttest.list[code].children[1].rotalist.push(rotas);
let offsetz = point.z + trainlisttest.list[code].children[0].position.z;
trainlisttest.list[code].children[0].position.z -= offsetz;
// trainlisttest.list[code].position.z = point.z;
}
if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){
//console.log(rs);
if(trainlisttest.list[code].children[rs].rotalist[0]){
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) + parseFloat(trainlisttest.list[code].children[rs].position.z);
trainlisttest.list[code].children[rs].position.z -= offsetz;
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainlisttest.list[code].children[rs].rotalist[0];
trainlisttest.list[code].children[rs+1].rotalist.push(asd);
}
//let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12];
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rota;
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
xh--;
}else{
xh = trainlisttest.list[code].children[rs].rotalist.length;
}
}
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
}
}
// console.log(trainlisttest.list[code].rotalist);
}
}
}
}
function trainrun(data){
let code = data.code;
// console.log(data);
if(trainlisttest.list[code].dispose == "0"){
if(trainlisttest.list[code].curve == null){
if (data.right == '1') { // 向右
trainlisttest.list[code].right = '1';
trainlisttest.list[code].progress = data.offset;
trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
if(rails.sectionrail[data.section].standTrack){
trainlisttest.list[code].statsstop = 0;
}
let point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress);
trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = parseFloat(point.z);
}
trainlisttest.list[code].curve = rails.sectionrail[data.section].lineleft;
if(data.next){
trainlisttest.list[code].nextcode = data.next;
trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
}
trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
trainlisttest.list[code].status = '1';
} else if (data.right == '0') { // 向左
trainlisttest.list[code].right = '0';
trainlisttest.list[code].progress = 1-data.offset;
trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
if(rails.sectionrail[data.section].standTrack){
trainlisttest.list[code].statsstop = 0;
}
let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress);
trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z);
}
trainlisttest.list[code].curve = rails.sectionrail[data.section].lineright;
if(data.next){
trainlisttest.list[code].nextcode = data.next;
trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright;
trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
}
trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
trainlisttest.list[code].status = '0';
}
}else{
//后端数据驱动车的位置更新与代码驱动车的移动相结合
if(data.code != trainlisttest.list[code].code){
if (data.right == '1') { // 向右
trainlisttest.list[code].right = '1';
trainlisttest.list[code].nowcode = data.code;
trainlisttest.list[code].curve = rails.sectionrail[data.section].lineleft;
trainlisttest.list[code].progress = data.offset;
trainlisttest.list[code].nextcode = data.next;
trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
trainlisttest.list[code].nextissection = rails.sectionrail[data.next].standTrack;
} else if (data.right == '0') { // 向左
trainlisttest.list[code].right = '0';
trainlisttest.list[code].nowcode = data.code;
trainlisttest.list[code].curve = rails.sectionrail[data.section].lineright;
trainlisttest.list[code].progress = 1-data.offset;
trainlisttest.list[code].nextcode = data.next;
trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright;
trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
trainlisttest.list[code].nextissection = rails.sectionrail[data.next].standTrack;
}
}
}
if(data.speed == 0){
trainlisttest.list[code].speeds = 0;
trainlisttest.list[code].statsstop = 0;
}else{
trainlisttest.list[code].speeds = parseFloat(data.speed*10/36/18/trainlisttest.list[code].len);
}
if(data.right != trainlisttest.list[code].status){
trainlisttest.list[code].status = data.right;
trainlisttest.list[code].curve = null;
trainlisttest.list[code].nextcurve = null;
trainlisttest.list[code].nextlen = null;
}
}
}
function initall(data){
for(let i=0,leni=data.length;i<leni;i++){
if(data[i].deviceType == "SWITCH"){
initswitch(data[i]);
}
if(data[i].deviceType == "PSD"){
initstand(data[i]);
}
}
}
function DeviceDestroy(data){
for(let i=0,leni=data.body.length;i<leni;i++){
if(data.body[i].type == "TRAIN"){
code =data.body[i].code;
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == "0") {
if (rails.sectionrail[data.body[i].section]) {
trainlisttest.group.add(trainlisttest.list[code]);
trainlisttest.list[code].position.y = 0;
// trainlisttest.list[code].progress = 0;
trainlisttest.list[code].dispose = "0";
trainlisttest.list[code].nowcode = data.body[i].section;
trainlisttest.list[code].nextcode = null;
trainlisttest.list[code].curve = null;
trainlisttest.list[code].nextcurve = null;
trainlisttest.list[code].pc = 1;
if(trainlisttest.list[code].mixerpush == false){
for(let mi=0,lenmi=trainlisttest.list[code].mixer.length;mi<lenmi;mi++){
jlmap3d.mixers.push(trainlisttest.list[code].mixer[mi]);
}
trainlisttest.list[code].mixerpush = true;
}
}
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == "1") {
trainlisttest.list[code].status = 1;
trainlisttest.group.remove(trainlisttest.list[code]);
trainlisttest.list[code].progress = null;
trainlisttest.list[code].dispose = "1";
code = trainlisttest.group.children[i].name;
trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].open = '1';
trainlisttest.list[code].curve = null;
trainlisttest.list[code].nextcurve = null;
trainlisttest.list[code].speed = 0;
trainlisttest.list[code].position.x = -50000;
trainlisttest.list[code].position.y = -50000;
trainlisttest.list[code].pc = 1;
}
}
if(data.body[i].type == "SIGNAL"){
signalupdate(data.body[i]);
}
if(data.body[i].type == "SWITCH"){
switchupdate(data.body[i]);
}
if(data.body[i].type == "PSD"){
standupdate(data.body[i]);
}
if(data.body[i].type == "TRAIN_DOOR"){
traindoorupdate(data.body[i]);
}
}
}
function traindoorupdate(data){
let code = data.code;
if(trainlisttest.list[code].right == "0"){
if(data.doorCode == "2"){
if(trainlisttest.list[code].open != data.open && data.open == "0"){
trainlisttest.list[code].open = "0";
for(let an=actions[code].top.length-1;an>=0;an--){
actions[code].top[an].reset();
actions[code].top[an].time = actions[code].top[an]._clip.duration;
actions[code].top[an].timeScale = -1;
actions[code].top[an].play();
}
}else if(trainlisttest.list[code].open != data.open && data.open == "1"){
trainlisttest.list[code].open = "1";
for(let an=actions[code].top.length-1;an>=0;an--){
actions[code].top[an].reset();
actions[code].top[an].time = 0;
actions[code].top[an].timeScale = 1;
actions[code].top[an].play();
}
}
}else{
if (trainlisttest.list[code].open != data.open && data.open == '0') {
trainlisttest.list[code].open = '0';
for (let an=actions[code].down.length-1; an>=0; an--) {
actions[code].down[an].reset();
actions[code].down[an].time = actions[code].down[an]._clip.duration;
actions[code].down[an].timeScale = -1;
actions[code].down[an].play();
}
} else if (trainlisttest.list[code].open != data.open && data.open == '1') {
trainlisttest.list[code].open = "1";
for(let an=actions[code].down.length-1;an>=0;an--){
actions[code].down[an].reset();
actions[code].down[an].time = 0;
actions[code].down[an].timeScale = 1;
actions[code].down[an].play();
}
}
}
}else{
if(data.doorCode == "1"){
if(trainlisttest.list[code].open != data.open && data.open == "0"){
trainlisttest.list[code].open = "0";
for(let an=actions[code].top.length-1;an>=0;an--){
actions[code].top[an].reset();
actions[code].top[an].time = actions[code].top[an]._clip.duration;
actions[code].top[an].timeScale = -1;
actions[code].top[an].play();
}
}else if(trainlisttest.list[code].open != data.open && data.open == "1"){
trainlisttest.list[code].open = "1";
for(let an=actions[code].top.length-1;an>=0;an--){
actions[code].top[an].reset();
actions[code].top[an].time = 0;
actions[code].top[an].timeScale = 1;
actions[code].top[an].play();
}
}
}else{
if (trainlisttest.list[code].open != data.open && data.open == '0') {
trainlisttest.list[code].open = '0';
for (let an=actions[code].down.length-1; an>=0; an--) {
actions[code].down[an].reset();
actions[code].down[an].time = actions[code].down[an]._clip.duration;
actions[code].down[an].timeScale = -1;
actions[code].down[an].play();
}
} else if (trainlisttest.list[code].open != data.open && data.open == '1') {
trainlisttest.list[code].open = "1";
for(let an=actions[code].down.length-1;an>=0;an--){
actions[code].down[an].reset();
actions[code].down[an].time = 0;
actions[code].down[an].timeScale = 1;
actions[code].down[an].play();
}
}
}
}
}
function trainstatus(data){
// 遍历列车对象组
if (trainlisttest) {
code = data.code;
// 剔除不显示的车
// 找到对应列车
if ( trainlisttest.list[code]) {
trainlisttest.list[code].driveMode = data.driveMode;
trainlisttest.list[code].status = data.right;
// 车门开关验证
// 遍历获取所在轨道
if (trainlisttest.list[code].dispose != data.dispose && data.dispose == "0") {
if (rails.sectionrail[data.sectionCode]) {
trainlisttest.group.add(trainlisttest.list[code]);
trainlisttest.list[code].position.y = 0;
// trainlisttest.list[code].progress = 0;
trainlisttest.list[code].dispose = "0";
trainlisttest.list[code].nowcode = data.sectionCode;
trainlisttest.list[code].nextcode = null;
trainlisttest.list[code].curve = null;
trainlisttest.list[code].nextcurve = null;
trainlisttest.list[code].pc = 1;
if(trainlisttest.list[code].mixerpush == false){
for(let mi=0,lenmi=trainlisttest.list[code].mixer.length;mi<lenmi;mi++){
jlmap3d.mixers.push(trainlisttest.list[code].mixer[mi]);
}
trainlisttest.list[code].mixerpush = true;
}
}
} else if (trainlisttest.list[code].dispose != data.dispose && data.dispose == "1") {
trainlisttest.list[code].status = 1;
trainlisttest.group.remove(trainlisttest.list[code]);
trainlisttest.list[code].progress = null;
trainlisttest.list[code].dispose = "1";
code = trainlisttest.group.children[i].name;
trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].open = '1';
trainlisttest.list[code].curve = null;
trainlisttest.list[code].nextcurve = null;
trainlisttest.list[code].speed = 0;
trainlisttest.list[code].position.x = -50000;
trainlisttest.list[code].position.y = -50000;
trainlisttest.list[code].pc = 1;
}
}
}
}
function initstand(data) {
code = data.code;
if ( actions[code]) {
if (data.close == '1') {
actions[code].status = '1';
actions[code].action.reset();
actions[code].action.time = 0;
actions[code].action.timeScale = 1;
actions[code].action.play();
}
if (data.close == '0') {
actions[code].status = '0';
actions[code].action.reset();
actions[code].action.time = actions[code].action._clip.duration;
actions[code].action.timeScale = -1;
actions[code].action.play();
}
}
}
function standupdate(data) {
code = data.code;
if ( actions[code]) {
if (data.open == '1') {
actions[code].status = '1';
actions[code].action.reset();
actions[code].action.time = 0;
actions[code].action.timeScale = 1;
actions[code].action.play();
}
if (data.open == '0') {
actions[code].status = '0';
actions[code].action.reset();
actions[code].action.time = actions[code].action._clip.duration;
actions[code].action.timeScale = -1;
actions[code].action.play();
}
}
}
function signalupdate(data) {
code = data.code;
if(data.red == 1){
signallist.list[code].mesh.getObjectByName("red").material.map = materials[0];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
}else{
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
}
if(data.yellow == 1){
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[1];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
}else{
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
}
if(data.green == 1){
signallist.list[code].mesh.getObjectByName("green").material.map = materials[2];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}else{
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
}
function initswitch(data) {
code = data.code;
if (data.routeLock == '0') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = 0;
actions[code].action.timeScale = 1;
actions[code].action.play();
actions[code].normal = "02";
} else if (data.routeLock == '1') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = actions[code].action._clip.duration;
actions[code].action.timeScale = -1;
actions[code].action.play();
actions[code].normal = "01";
}
}
function switchupdate(data) {
code = data.code;
if (actions[code].normal != data.normal) {
if (data.normal == '02') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = 0;
actions[code].action.timeScale = 1;
actions[code].action.play();
actions[code].normal = "02";
} else if (data.normal == '01') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = actions[code].action._clip.duration;
actions[code].action.timeScale = -1;
actions[code].action.play();
actions[code].normal = "01";
}
}
}
function simulationreset(data){
for(let i=0;i<trainlisttest.group.children.length;i++){
trainlisttest.group.children[i].dispose = true;
trainlisttest.group.children[i].stopstation = null;
trainlisttest.group.children[i].pc = null;
trainlisttest.group.children[i].targetpercent = null;
trainlisttest.group.children[i].progress = null;
trainlisttest.group.children[i].linkOffsetPercent = null;
trainlisttest.group.children[i].targetLink = null;
trainlisttest.group.remove(trainlisttest.group.children[i]);
i--;
}
}
}

View File

@ -0,0 +1,213 @@
//componnent
import {SectionList} from '@/jlmap3d/main/model/SectionList.js';
import {SignalList} from '@/jlmap3d/main/model/SignalList.js';
import {StationStandList} from '@/jlmap3d/main/model/StationStandList.js';
import {TrainList} from '@/jlmap3d/main/model/TrainList.js';
import {RealSectionList} from '@/jlmap3d/main/model/RealSectionList.js';
import {LinkList} from '@/jlmap3d/main/model/LinkList.js';
import {RailList} from '@/jlmap3d/main/model/RailList.js';
import {TrainListN} from '@/jlmap3d/main/newmodel/TrainListN.js';
import {SectionListN} from '@/jlmap3d/main/newmodel/SectionListN';
import {SignalListN} from '@/jlmap3d/main/newmodel/SignalListN';
import {StationStandListN} from '@/jlmap3d/main/newmodel/StationStandListN';
import {SwitchListN} from '@/jlmap3d/main/newmodel/SwitchListN';
import {RailListN} from '@/jlmap3d/main/newmodel/RailListN.js';
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
import { Loading } from 'element-ui';
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
export function MaintainerLoad(data,scope,netdata,mapdata,camera,controls,scene){
//console.log(mapdata);
//console.log(data);
//console.log(scope);
let sceneload = scene;
let backdata = scope;
let jlmap3ddata = mapdata;
let assetloader = scope.assetloader;
let mixers = scope.mixers;
let actions = scope.actions;
let linklist,sectionlist,signallist,stationstandlist,trainlisttest,switchlist,realsectionlist,rails;
let loadingInstance = Loading.service({ fullscreen: true });
let isSection = false;
let isNewdata = false;
if(netdata.assets){
initnew3d(data,netdata);
}else{
loadingInstance.close();
alert("没有三维数据");
}
function initnew3d(data,netdata){
Materialload(scope,JSON.parse(netdata.assets));
let mapdata = data;
//初始化轨道和道岔
// lengthfact(data);
// linklist = new LinkList();
sectionlist = new SectionListN();
signallist = new SignalListN();
switchlist = new SwitchListN();
//初始化站台
stationstandlist = new StationStandListN();
//初始化测试列车
trainlisttest = new TrainListN();
// realsectionlist = new RealSectionList();
rails = new RailListN();
let sectiondata = JSON.parse(netdata.sections);
let switchdata = JSON.parse(netdata.switchs);
let signaldata = JSON.parse(netdata.signals);
let standsdata = JSON.parse(netdata.stands);
let psddata = data.psdList;
assetloader.setmodellistnew(netdata.assets);
assetloader.assetpromise(sceneload)
// .then(function(data){
// return linklist.loadpromise(loaderdata.link,sceneload,assetloader);
// })
.then(function(data){
//console.log(data);
//,netdata.stands,mixers,actions,"0"
return stationstandlist.loadpromise(mapdata.stationList,standsdata,psddata,sceneload,assetloader,mixers,actions,"02");
})
.then(function(data){
//console.log(data);
return sectionlist.loadpromise(mapdata.sectionList,sectiondata.section,rails,scene,assetloader);
})
.then(function(data){
//console.log(data);
return signallist.loadpromise(mapdata.signalList,signaldata,sceneload,assetloader);
})
.then(function(data){
return switchlist.loadpromise(mapdata.switchList,switchdata,sceneload,assetloader,mixers,actions);
})
.then(function(data){
//console.log(data);
//console.log(assetloader);
return trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"02");
})
// .then(function(data){
// return new Promise(function(resolve, reject){
// rails.init(sectiondata.section,sectiondata,switchdata,sceneload);
// resolve("loadrail");
//
// });
// })
.then(function(data){
return new Promise(function(resolve, reject){
//
let netasset = JSON.parse(netdata.assets);
if(netasset.istexture){
for(let mm=0;mm< stationstandlist.group.children.length;mm++){
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;
}
}
for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
if(scope.assetloader.modellist[mn].deviceType && scope.assetloader.modellist[mn].deviceType == "suidaobg"){
// scope.assetloader.modellist[mn].mesh.deviceType = "suidaobg";
scene.add(scope.assetloader.modellist[mn].mesh);
}
}
// console.log(stationstandlist.group.children[0].name );
// if(stationstandlist.group.children[0].name == "Station75414"){
// for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
// if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "nbsuidao"){
// scope.assetloader.modellist[mn].mesh.name = "nbsuidao";
// scene.add(scope.assetloader.modellist[mn].mesh);
// }
// }
// }
resolve("mergemodel");
});
})
.then(function(data){
// for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
// if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "suidao"){
// // scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
// // scope.assetloader.modellist[mn].mesh.position.y -=0.1;
// // console.log(scope.assetloader.modellist[mn].mesh);
// scene.add(scope.assetloader.modellist[mn].mesh);
// }
// }
//
// // mapdata = jlmap3ddata;
backdata.loaderdata(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails);
scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,scope.materiallist,scope.actions,scope.sceneload);
scope.webwork.postMessage("on");
scope.jsonwebworknew.postMessage("connect");
loadingInstance.close();
});
}
function onProgress( xhr ) {
if ( xhr.lengthComputable ) {
let percentComplete = xhr.loaded / xhr.total * 100;
//console.log( 'model ' + Math.round( percentComplete, 2 ) + '% downloaded' );
}
}
function onError() {}
}
function lengthfact(data){
let linklist = [];
//console.log(data);
for(let i=0;i<data.linkList.length;i++){
let dx = Math.abs(data.linkList[i].lp.x - data.linkList[i].rp.x);
    let dy = Math.abs(data.linkList[i].lp.y - data.linkList[i].rp.y);
    let distance = Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));
let link = {
code:data.linkList[i].code,
lengthfact:data.linkList[i].lengthFact,
distance:distance
};
linklist.push(link);
}
let sectionlist = [];
for(let i=0;i<data.sectionList.length;i++){
for(let j=0;j<linklist.length;j++){
if(linklist[j].code == data.sectionList[i].linkCode){
let sectionoffset = data.sectionList[i].offsetRight - data.sectionList[i].offsetLeft;
let sectionlengthfact = sectionoffset/linklist[j].distance*linklist[j].lengthfact
let section = {
code:data.sectionList[i].code,
lengthfact:sectionoffset
};
sectionlist.push(section);
j = linklist.length;
}
}
}
//console.log(sectionlist);
}

View File

@ -591,7 +591,13 @@ class SkinCode extends defaultStyle {
tripNumberPrefix: '0000', // 车次号前缀 tripNumberPrefix: '0000', // 车次号前缀
defaultDirectionCode: 'D', // 默认车次号1 defaultDirectionCode: 'D', // 默认车次号1
defaultTripNumber: 'CCC', // 默认车次号2 defaultTripNumber: 'CCC', // 默认车次号2
trainTargetOffset: { x: 42, y: 1}// 列车车次号偏移 trainTargetOffset: { x: 42, y: 1}, // 列车车次号偏移
smallColor: '#70ECEE', // 小交路颜色
bigColor: '#FFFFFF', // 大交路颜色
inboundColor: '#00FF00', // 回库颜色
planTypeColor: '#FFFFFF', // 计划车颜色
manualTypeColor: '#FF0', // 人工车
headTypeColor: '#FF0' // 头码车
}, },
trainTargetNumber: { trainTargetNumber: {
groupNumberPrefix: '000', // 车组号前缀 groupNumberPrefix: '000', // 车组号前缀

View File

@ -307,6 +307,24 @@ export default class TrainBody extends Group {
return new BoundingRect(0, 0, 0, 0); return new BoundingRect(0, 0, 0, 0);
} }
} }
setPlanRoutingTypeColor(planRoutingTypes) {
if (planRoutingTypes === 'BIG') {
this.style.Train.trainTarget.bigColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainTarget.bigColor});
} else if (planRoutingTypes === 'SMALL') {
this.style.Train.trainTarget.smallColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainTarget.smallColor});
} else if (planRoutingTypes === 'INBOUND') {
this.style.Train.trainTarget.inboundColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainTarget.inboundColor});
}
}
setTrainTypeColor(type) {
if (type === 'PLAN') {
this.style.Train.trainTarget.planTypeColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainTarget.planTypeColor});
} else if (type === 'MANUAL') {
this.style.Train.trainTarget.manualTypeColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainTarget.manualTypeColor});
} else if (type === 'HEAD') {
this.style.Train.trainTarget.headTypeColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainTarget.headTypeColor});
}
}
setSoonerOrLater(dt) { setSoonerOrLater(dt) {
if (this.style.Train.soonerOrLater && this.style.Train.soonerOrLater.level === 5) { if (this.style.Train.soonerOrLater && this.style.Train.soonerOrLater.level === 5) {
if (dt > 120) { if (dt > 120) {

View File

@ -408,6 +408,8 @@ export default class Train extends Group {
this.setHoldStatus(model.hold); this.setHoldStatus(model.hold);
this.setJumpStatus(model.jump); this.setJumpStatus(model.jump);
this.setSoonerOrLater(model.dt); this.setSoonerOrLater(model.dt);
this.setPlanRoutingTypeColor(model.planRoutingType);
this.setTrainTypeColor(model.type);
const style = this.style; const style = this.style;
if (style.Section.trainPosition.display) { if (style.Section.trainPosition.display) {
this.updateSection(object); this.updateSection(object);
@ -427,6 +429,12 @@ export default class Train extends Group {
// this.setTrainTypeStatus(model.type); // 根据列车类型设置列车识别号样式 // this.setTrainTypeStatus(model.type); // 根据列车类型设置列车识别号样式
// } // }
} }
setTrainTypeColor(type) {
this.trainB && this.trainB.setTrainTypeColor(type);
}
setPlanRoutingTypeColor(planRoutingType) {
this.trainB && this.trainB.setPlanRoutingTypeColor(planRoutingType);
}
// 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
isChangeTrainWidth(model, style) { isChangeTrainWidth(model, style) {
if (!style.Train.trainBody.changeTrainWidth) { return; } if (!style.Train.trainBody.changeTrainWidth) { return; }

View File

@ -116,8 +116,7 @@ export default {
}, },
mounted() { mounted() {
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const isTest = process.env.NODE_ENV === 'test'; if (isDev) {
if (isDev || isTest) {
this.menuNormal.Center.push({ this.menuNormal.Center.push({
label: '新建计划车', label: '新建计划车',
handler: this.addPlanTrain, handler: this.addPlanTrain,

View File

@ -102,8 +102,7 @@ export default {
}, },
mounted() { mounted() {
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const isTest = process.env.NODE_ENV === 'test'; if (isDev) {
if (isDev || isTest) {
this.menuNormal.Center.push( { this.menuNormal.Center.push( {
label: '新建计划列车', label: '新建计划列车',
handler: this.createPlanTrain, handler: this.createPlanTrain,

View File

@ -106,8 +106,7 @@ export default {
}, },
mounted() { mounted() {
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const isTest = process.env.NODE_ENV === 'test'; if (isDev) {
if (isDev || isTest) {
this.menuNormal.Center.push( { this.menuNormal.Center.push( {
label: '新建计划列车', label: '新建计划列车',
handler: this.createPlanTrain, handler: this.createPlanTrain,

View File

@ -117,8 +117,7 @@ export default {
}, },
mounted() { mounted() {
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const isTest = process.env.NODE_ENV === 'test'; if (isDev) {
if (isDev || isTest) {
this.menuNormal.Center.push({ this.menuNormal.Center.push({
label: '新建计划车', label: '新建计划车',
handler: this.addPlanTrain, handler: this.addPlanTrain,

View File

@ -164,8 +164,7 @@ export default {
}, },
mounted() { mounted() {
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const isTest = process.env.NODE_ENV === 'test'; if (isDev) {
if (isDev || isTest) {
this.menuNormal.Center.push({ this.menuNormal.Center.push({
label: '新建计划车', label: '新建计划车',
handler: this.addPlanTrain, handler: this.addPlanTrain,

View File

@ -111,8 +111,7 @@ export default {
}, },
mounted() { mounted() {
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const isTest = process.env.NODE_ENV === 'test'; if (isDev) {
if (isDev || isTest) {
this.menuNormal.Center.push({ this.menuNormal.Center.push({
label: '新建计划车', label: '新建计划车',
handler: this.createPlanTrain, handler: this.createPlanTrain,

View File

@ -135,8 +135,7 @@ export default {
}, },
mounted() { mounted() {
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const isTest = process.env.NODE_ENV === 'test'; if (isDev) {
if (isDev || isTest) {
this.menuNormal.Center.push({ this.menuNormal.Center.push({
label: '新建计划车', label: '新建计划车',
handler: this.addPlanTrain, handler: this.addPlanTrain,

View File

@ -32,8 +32,7 @@ export default {
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
messages: [this.$t('tip.commandFailed')], messages: [this.$t('tip.commandFailed')]
operate: null
}; };
}, },
computed: { computed: {
@ -53,8 +52,7 @@ export default {
}); });
}, },
methods: { methods: {
doShow(operate, messages) { doShow(messages) {
this.operate = operate || {};
this.dialogShow = true; this.dialogShow = true;
this.messages = [this.$t('tip.commandFailed')]; this.messages = [this.$t('tip.commandFailed')];
if (messages && messages != 'null') { if (messages && messages != 'null') {

View File

@ -170,7 +170,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -187,10 +187,10 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate, [error.message]); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -207,10 +207,10 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate, [error.message]); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -230,7 +230,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -250,7 +250,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
// ATS // ATS
@ -270,7 +270,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -291,7 +291,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -312,7 +312,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -333,7 +333,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
cancel() { cancel() {

View File

@ -152,7 +152,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
cancel() { cancel() {

View File

@ -151,10 +151,10 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow({}, error.message); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -206,7 +206,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -226,7 +226,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -246,7 +246,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -267,7 +267,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -281,7 +281,7 @@ export default {
} }
}).catch(() => { }).catch(() => {
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
} }
} }

View File

@ -143,7 +143,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
cancel() { cancel() {

View File

@ -297,10 +297,10 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow({}, error.message); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -311,10 +311,10 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow({}, error.message); this.$refs.noticeInfo.doShow();
}); });
}, },
cancel() { cancel() {

View File

@ -138,10 +138,10 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow({}, error.message); this.$refs.noticeInfo.doShow();
}); });
}, },
cancel() { cancel() {
@ -154,7 +154,7 @@ export default {
} }
}).catch(() => { }).catch(() => {
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
} }
} }

View File

@ -232,10 +232,10 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow({}, error.message); this.$refs.noticeInfo.doShow();
}); });
} }
}, },

View File

@ -129,10 +129,10 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow({}, error.message); this.$refs.noticeInfo.doShow();
}); });
}, },
cancel() { cancel() {

View File

@ -117,10 +117,10 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow({}, error.message); this.$refs.noticeInfo.doShow();
}); });
}, },

View File

@ -214,7 +214,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
} else { } else {
this.doClose(); this.doClose();

View File

@ -153,10 +153,10 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow({}, error.message); this.$refs.noticeInfo.doShow();
}); });
}, },
cancel() { cancel() {

View File

@ -170,7 +170,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
cancel() { cancel() {

View File

@ -79,6 +79,7 @@
<script> <script>
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { now } from '@/utils/date'; import { now } from '@/utils/date';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
export default { export default {
name: 'StationCmdControl', name: 'StationCmdControl',
@ -311,11 +312,11 @@ export default {
if (this.operation == OperationEvent.Station.powerUnLock.menu.operation) { if (this.operation == OperationEvent.Station.powerUnLock.menu.operation) {
/** 上电解锁*/ /** 上电解锁*/
operate.operation = OperationEvent.Station.powerUnLock.confirm2.operation; operate.operation = OperationEvent.Station.powerUnLock.confirm2.operation;
// operate.cmdType = CMD.Station.powerUnLock; operate.cmdType = CMD.Station.CMD_STATION_POWER_ON_UNLOCK;
} else if (this.operation == OperationEvent.Station.execKeyOperationTest.menu.operation) { } else if (this.operation == OperationEvent.Station.execKeyOperationTest.menu.operation) {
/** 执行关键操作测试*/ /** 执行关键操作测试*/
operate.operation = OperationEvent.Station.execKeyOperationTest.confirm2.operation; operate.operation = OperationEvent.Station.execKeyOperationTest.confirm2.operation;
// operate.cmdType = CMD.Station.execKeyOperationTest; operate.cmdType = CMD.Station.CMD_STATION_KEY_OPERATION_TEST;
} }
this.setMessage(''); this.setMessage('');

View File

@ -95,7 +95,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
cancel() { cancel() {

View File

@ -117,7 +117,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
cancel() { cancel() {

View File

@ -144,10 +144,10 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow({}, error.message); this.$refs.noticeInfo.doShow();
}); });
}, },

View File

@ -186,9 +186,9 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.$refs.noticeInfo.doShow(operate, error.message); this.$refs.noticeInfo.doShow();
this.doClose(); this.doClose();
}); });
} else { } else {

View File

@ -413,7 +413,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
} else { } else {
return false; return false;
@ -444,7 +444,7 @@ export default {
// }).catch(() => { // }).catch(() => {
// this.loading = false; // this.loading = false;
// this.doClose(); // this.doClose();
// this.$refs.noticeInfo.doShow(operate); // this.$refs.noticeInfo.doShow();
// }); // });
const params = { const params = {
groupNumber: this.formModel.groupNumber, groupNumber: this.formModel.groupNumber,
@ -466,10 +466,10 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow({}, error.message); this.$refs.noticeInfo.doShow();
}); });
} else { } else {
return false; return false;

View File

@ -133,7 +133,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
cancel() { cancel() {

View File

@ -143,7 +143,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
} else { } else {
return false; return false;

View File

@ -0,0 +1,180 @@
<template>
<el-dialog v-dialogDrag class="xian-01__systerm train-control" :title="title" :visible.sync="show" width="370px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<el-select
v-model="groupNumber"
filterable
:disabled="true"
>
<el-option
v-for="train in trainList"
:key="train.groupNumber"
:label="train.groupNumber"
:value="train.groupNumber"
/>
</el-select>
<el-table :data="tableData" :show-header="false">
<el-table-column prop="key" label="key" />
<el-table-column prop="value" label="value" />
</el-table>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">{{ $t('global.confirm') }}</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel">{{ $t('global.cancel') }}</el-button>
</el-col>
</el-row>
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import Handler from '@/scripts/cmdPlugin/Handler';
import { menuOperate, commitOperate } from '../utils/menuOperate';
export default {
name: 'TrainControl',
components: {
},
data() {
return {
trainList: [],
tableData: [],
baseInfo: [],
marshallingInfo: [],
planInfo: [],
atcInfo: [],
operation: null,
dialogShow: false,
loading: false,
groupNumber: ''
};
},
computed: {
...mapGetters('map', [
'map'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdConfirm() {
return OperationEvent.Train.trainDetailInfo.confirm.operation;
},
domIdCancel() {
return OperationEvent.Command.cancel.menu.domId;
},
title() {
return '列车详细运行信息';
}
},
watch: {},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
doShow(operate, selected) {
//
if (!this.dialogShow) {
this.operation = operate.operation;
}
const model = this.$store.getters['map/getDeviceByCode'](selected.code);
this.groupNumber = model.groupNumber;
this.baseInfo = [
{key: '车组号', value: model.groupNumber},
{key: '车次号', value: ''},
{key: '表号', value: ''},
{key: '目的地号', value: ''},
{key: '类型', value: ''},
{key: '司机号', value: ''},
{key: '车站', value: ''},
{key: '所处设备', value: ''},
{key: '跟踪模式', value: ''},
{key: 'ATP切除', value: ''},
{key: '停站状态', value: ''}
];
this.marshallingInfo = [
{key: '车组号', value: ''},
{key: '设备ID', value: ''},
{key: '车头号1', value: ''},
{key: '车头号2', value: ''},
{key: '车厢号1', value: ''},
{key: '车厢号2', value: ''},
{key: '车厢号3', value: ''},
{key: '车厢号4', value: ''},
{key: '车厢号5', value: ''},
{key: '车厢号6', value: ''},
{key: '车厢号7', value: ''},
{key: '车厢号8', value: ''}
];
this.planInfo = [
{key: '车组号', value: ''},
{key: '车次号', value: ''},
{key: '表号', value: ''},
{key: '运行等级', value: ''},
{key: '状态', value: ''},
{key: '计划偏离', value: ''},
{key: '停站时间', value: ''},
{key: '计划到站', value: ''},
{key: '计划到点', value: ''},
{key: '计划发点', value: ''},
{key: '终端发车站台', value: ''},
{key: '终端发车时间', value: ''},
{key: '预计离开站台', value: ''},
{key: '预计离开时间', value: ''},
{key: '预计到达站台', value: ''},
{key: '预计到达时间', value: ''},
{key: '区间运行时分', value: ''}
];
this.atcInfo = [
{key: '车组号', value: ''},
{key: '车次号', value: ''},
{key: '表号', value: ''},
{key: '运行方向', value: ''},
{key: '扣车状态', value: ''},
{key: '车门状态', value: ''},
{key: '驾驶模式', value: ''},
{key: '目的地号', value: ''}
];
this.tableData = this.baseInfo;
/** 加载列车数据*/
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false);
},
commit() {
const operate = {
operation: OperationEvent.Train.trainDetailInfo.confirm.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
});
},
cancel() {
const operate = {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
});
}
}
};
</script>

View File

@ -167,7 +167,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
// this.$refs.noticeInfo.doShow(operate); // this.$refs.noticeInfo.doShow();
}); });
} else { } else {
return false; return false;

View File

@ -172,7 +172,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
// this.$refs.noticeInfo.doShow(operate); // this.$refs.noticeInfo.doShow();
}); });
} else { } else {
return false; return false;

View File

@ -66,7 +66,13 @@ export default {
if (station.chargeStationCodeList && station.chargeStationCodeList.length) { if (station.chargeStationCodeList && station.chargeStationCodeList.length) {
const node = { const node = {
label: station.name, label: station.name,
children: [] children: [
{
code: station.code,
label: station.name,
handler: this.mapLocation
}
]
}; };
station.chargeStationCodeList.forEach(item => { station.chargeStationCodeList.forEach(item => {
const next = this.$store.getters['map/getDeviceByCode'](item); const next = this.$store.getters['map/getDeviceByCode'](item);

View File

@ -121,8 +121,8 @@ export default {
this.doClose(); this.doClose();
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} }
}).catch((error) => { }).catch(() => {
this.$refs.noticeInfo.doShow(operate, error.message); this.$refs.noticeInfo.doShow();
}); });
} }
} }

View File

@ -164,7 +164,7 @@ export default {
}); });
}); });
} else { } else {
this.$refs.noticeInfo.doShow(operate, [this.$t('menu.menuDialog.IncorrectPassword')]); this.$refs.noticeInfo.doShow(this.$t('menu.menuDialog.IncorrectPassword'));
} }
}, },

View File

@ -136,12 +136,12 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} else { } else {
// this.$refs.noticeInfo.doShow(operate); // this.$refs.noticeInfo.doShow();
} }
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
// this.$refs.noticeInfo.doShow(operate); // this.$refs.noticeInfo.doShow();
}); });
} else { } else {
return false; return false;

View File

@ -118,12 +118,12 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} else { } else {
// this.$refs.noticeInfo.doShow(operate); // this.$refs.noticeInfo.doShow();
} }
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
// this.$refs.noticeInfo.doShow(operate); // this.$refs.noticeInfo.doShow();
}); });
} else { } else {
return false; return false;

View File

@ -135,12 +135,12 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} else { } else {
// this.$refs.noticeInfo.doShow(operate); // this.$refs.noticeInfo.doShow();
} }
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
// this.$refs.noticeInfo.doShow(operate); // this.$refs.noticeInfo.doShow();
}); });
} else { } else {
return false; return false;

View File

@ -148,8 +148,7 @@ export default {
}, },
mounted() { mounted() {
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const isTest = process.env.NODE_ENV === 'test'; if (isDev) {
if (isDev || isTest) {
this.menuNormal.Center.push({ this.menuNormal.Center.push({
label: '新建计划车', label: '新建计划车',
handler: this.addPlanTrain, handler: this.addPlanTrain,

View File

@ -56,46 +56,30 @@ export default {
// { // {
// label: '', // label: '',
// handler: this.powerUnLock, // handler: this.powerUnLock,
// cmdType: CMD.Station.active, // cmdType: CMD.Station.CMD_STATION_POWER_ON_UNLOCK,
// }, // },
// { // {
// label: '', // label: '',
// handler: this.execKeyOperationTest, // handler: this.execKeyOperationTest,
// cmdType: CMD.Station.active, // cmdType: CMD.Station.CMD_STATION_KEY_OPERATION_TEST,
// } // }
], ],
Center: [ Center: [
{ {
label: '所有进路自排关', label: '所有进路交人工控',
handler: this.humanControlALL, handler: this.humanControlALL,
cmdType: CMD.Station.CMD_STATION_CLOSE_AUTO_SETTING cmdType: CMD.Station.CMD_STATION_CLOSE_AUTO_SETTING
}, },
{ {
label: '所有进路自排开', label: '所有进路交ATS自动控',
handler: this.atsAutoControlALL, handler: this.atsAutoControlALL,
cmdType: CMD.Station.CMD_STATION_OPEN_AUTO_SETTING cmdType: CMD.Station.CMD_STATION_OPEN_AUTO_SETTING
}, },
{ {
label: '上电解锁', label: '执行关键操作测试',
handler: this.powerUnLock, handler: this.execKeyOperationTest,
cmdType: CMD.Station.active cmdType: CMD.Station.CMD_STATION_KEY_OPERATION_TEST
} }
// {
// label: '',
// handler: this.humanControlALL,
// cmdType: ''
// },
// {
// label: 'ATS',
// handler: this.atsAutoControlALL,
// cmdType: ''
// }
// {
// label: '',
// handler: this.execKeyOperationTest,
// cmdType: CMD.Station.active,
// auth: { station: false, center: true }
// }
] ]
}, },
menuForce: [ menuForce: [
@ -140,9 +124,6 @@ export default {
initMenu() { initMenu() {
// //
this.menu = MenuContextHandler.covert(this.menuNormal); this.menu = MenuContextHandler.covert(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce];
}
// //
if (this.operatemode === OperateMode.FAULT) { if (this.operatemode === OperateMode.FAULT) {
@ -174,10 +155,10 @@ export default {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else { } else {
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -193,10 +174,10 @@ export default {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else { } else {
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -212,7 +193,7 @@ export default {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -228,7 +209,7 @@ export default {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -259,7 +240,7 @@ export default {
} }
}); });
}, },
// //
humanControlALL() { humanControlALL() {
const operate = { const operate = {
start: true, start: true,
@ -273,7 +254,7 @@ export default {
} }
}); });
}, },
// // ATS
atsAutoControlALL() { atsAutoControlALL() {
const operate = { const operate = {
start: true, start: true,

View File

@ -52,12 +52,12 @@ export default {
{ {
label: this.$t('menu.menuTrain.addTrainId'), label: this.$t('menu.menuTrain.addTrainId'),
handler: this.addTrainId, handler: this.addTrainId,
cmdType:CMD.Switch.CMD_SWITCH_SINGLE_LOCK cmdType:''
}, },
{ {
label: this.$t('menu.menuTrain.deleteTrainId'), label: this.$t('menu.menuTrain.deleteTrainId'),
handler: this.delTrainId, handler: this.delTrainId,
cmdType:CMD.Switch.CMD_SWITCH_SINGLE_LOCK cmdType:''
}, },
{ {
label: this.$t('menu.menuTrain.editTrainId'), label: this.$t('menu.menuTrain.editTrainId'),
@ -67,17 +67,32 @@ export default {
{ {
label: this.$t('menu.menuTrain.editTrainNo'), label: this.$t('menu.menuTrain.editTrainNo'),
handler: this.editTrainNo, handler: this.editTrainNo,
cmdType:CMD.Switch.CMD_SWITCH_SINGLE_LOCK cmdType:''
}, },
{ {
label: this.$t('menu.menuTrain.moveTrainId'), label: this.$t('menu.menuTrain.moveTrainId'),
handler: this.moveTrainId, handler: this.moveTrainId,
cmdType:CMD.Switch.CMD_SWITCH_SINGLE_LOCK cmdType:''
}, },
{ {
label: this.$t('menu.menuTrain.switchTrainId'), label: this.$t('menu.menuTrain.switchTrainId'),
handler: this.switchTrainId, handler: this.switchTrainId,
cmdType:CMD.Switch.CMD_SWITCH_REMOVE_FAULT cmdType:''
},
{
label: '标记ATP切除',
handler: this.undeveloped(),
cmdType: CMD.TrainWindow.CMD_TRAIN_TAG_ATP_CUT
},
{
label: '标记ATP激活',
handler: this.undeveloped(),
cmdType: CMD.TrainWindow.CMD_TRAIN_TAG_ATP_RECOVER
},
{
label: '查看列车详细运行信息',
handler: this.undeveloped(),
cmdType: CMD.TrainWindow.CMD_TRAIN_INFO
} }
] ]
}, },
@ -139,10 +154,6 @@ export default {
if (this.operatemode === OperateMode.FAULT) { if (this.operatemode === OperateMode.FAULT) {
this.menu = [...this.menuForce, ...this.menuSpeed]; this.menu = [...this.menuForce, ...this.menuSpeed];
} }
// this.menu = this.menuNormal.Center;
// console.log(this.menu, '222222222222222');
// this.menu = MenuContextHandler.covert(this.menu);
}, },
doShow(point) { doShow(point) {
this.clickEvent(); this.clickEvent();
@ -173,10 +184,10 @@ export default {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else { } else {
this.$refs.noticeInfo.doShow(step); this.$refs.noticeInfo.doShow();
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(step); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -194,10 +205,10 @@ export default {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else { } else {
this.$refs.noticeInfo.doShow(step); this.$refs.noticeInfo.doShow();
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(step); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -215,10 +226,10 @@ export default {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else { } else {
this.$refs.noticeInfo.doShow(step); this.$refs.noticeInfo.doShow();
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(step); this.$refs.noticeInfo.doShow();
}); });
}, },
// //
@ -306,6 +317,7 @@ export default {
} }
}); });
}, },
undeveloped() {},
// //
switchTrainId() { switchTrainId() {
const step = { const step = {

View File

@ -268,7 +268,7 @@ export default {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
}, },
refuse() { refuse() {
@ -292,7 +292,7 @@ export default {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow();
}); });
} }
} }

View File

@ -154,8 +154,7 @@ export default {
}, },
mounted() { mounted() {
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const isTest = process.env.NODE_ENV === 'test'; if (isDev) {
if (isDev || isTest) {
this.menuNormal.Center.push({ this.menuNormal.Center.push({
label: '新建计划车', label: '新建计划车',
handler: this.addPlanTrain, handler: this.addPlanTrain,

View File

@ -223,8 +223,6 @@ export const constantRoutes = [
{ // 竞赛系统报名 { // 竞赛系统报名
path: '/jsxtApply', path: '/jsxtApply',
component: JsxtApply, component: JsxtApply,
meta: {
},
hidden: true hidden: true
}, },
{ {
@ -967,40 +965,31 @@ export const JSXT = [
redirect: '/jsxt/home', redirect: '/jsxt/home',
component: Layout, component: Layout,
meta: { meta: {
i18n: 'router.competitionManage',
roles: [user, admin, userTrainingPlatform] roles: [user, admin, userTrainingPlatform]
}, },
hidden: getSessionStorage('project') ? !getSessionStorage('project').endsWith('jsxt') && !window.document.location.pathname.includes('jsxt') : !window.document.location.pathname.includes('jsxt'), hidden: true,
children: [ children: [
{ {
path: '', path: '',
redirect: '/jsxt/home', redirect: '/jsxt/home',
component: CompetitionManage, component: CompetitionManage,
meta: { meta: {
i18n: 'router.competitionManage',
icon: 'design'
}, },
children: [ children: [
{ {
path: 'home', path: 'home',
component: CompetitionHome, component: CompetitionHome,
meta: { hidden: true
hidden: true
}
}, },
// { // {
// path: 'theory/:id', // path: 'theory/:id',
// component: theoryManage, // component: theoryManage,
// meta: { // hidden: true
// hidden: true
// }
// }, // },
{ {
path: 'examDetail', path: 'examDetail',
component: CompetitionDetail, component: CompetitionDetail,
meta: { hidden: true
hidden: true
}
}, },
{ // 考试结果 { // 考试结果
path: 'result', path: 'result',
@ -1014,9 +1003,7 @@ export const JSXT = [
{ {
path: '/jsxt/theory/detail/:id', path: '/jsxt/theory/detail/:id',
component: Refereedetail, component: Refereedetail,
meta: { hidden: true
hidden: true
}
}, },
// 裁判系统 // 裁判系统
{ {

View File

@ -198,7 +198,11 @@ export default {
/** 取消引导总锁 */ /** 取消引导总锁 */
CMD_STATION_CANCEL_MASTER_GUIDE_LOCK: {value: 'Station_Cancel_Master_Guide_Lock', label: '取消引导总锁'}, CMD_STATION_CANCEL_MASTER_GUIDE_LOCK: {value: 'Station_Cancel_Master_Guide_Lock', label: '取消引导总锁'},
/** 封锁车站所有信号机 */ /** 封锁车站所有信号机 */
CMD_STATION_CANCEL_MASTER_GUIDE: {value: 'Station_Cancel_Master_Guide_Lock', label: '封锁集中站信号'} CMD_STATION_CANCEL_MASTER_GUIDE: {value: 'Station_Cancel_Master_Guide_Lock', label: '封锁集中站信号'},
/** 上电解锁 */
CMD_STATION_POWER_ON_UNLOCK: {value: ' Station_Power_On_Unlock', label: '上电解锁'},
/** 执行关键操作测试 */
CMD_STATION_KEY_OPERATION_TEST: {value: 'Station_Key_Operation_Test', label: '执行关键操作测试'}
}, },
// 列车 // 列车
@ -218,7 +222,29 @@ export default {
}, },
TrainWindow: { TrainWindow: {
/** 修改列车识别号 */ /** 修改列车识别号 */
CMD_TRAIN_UPDATE_TYPE: {value: 'Train_Update_Type', label: '修改列车识别号'} CMD_TRAIN_UPDATE_TYPE: {value: 'Train_Update_Type', label: '修改列车识别号'},
/** 设置车组号 */
CMD_TRAIN_ADD_TRAIN_TRACE: {value: 'Train_Add_Train_Trace', label: '设置车组号'},
/** 删除车组号 */
CMD_TRAIN_REMOVE_TRAIN_TRACE: {value: 'Train_Remove_Train_Trace', label: '删除车组号'},
/** 移动车组号 */
CMD_TRAIN_MOVE_TRAIN_TRACE: {value: 'Train_Move_Train_Trace', label: '移动车组号'},
/** 设计划车 */
CMD_TRAIN_SET_PLAN: {value: 'Train_Set_Plan', label: '设计划车'},
/** 设头码车 */
CMD_TRAIN_SET_HEAD: {value: 'Train_Set_Head', label: '设头码车'},
/** 设人工车 */
CMD_TRAIN_SET_MANUAL: {value: 'Train_Set_Manual', label: '设人工车'},
/** 设乘务组号 */
CMD_TRAIN_SET_CREW_NUMBER: {value:'Train_Set_Crew_Number', label: '设乘务组号'},
/** 标记ATP切除 */
CMD_TRAIN_TAG_ATP_CUT: {value: 'Train_Tag_Atp_Cut', label: '标记ATP切除'},
/** 标记ATP恢复 */
CMD_TRAIN_TAG_ATP_RECOVER: {value: 'Train_Tag_Atp_Recover', label: '标记ATP恢复'},
/** 放行冲突列车 */
CMD_TRAIN_ALLOW_PASS: {value:'Train_Allow_Pass', label: '放行冲突列车'},
/** 列车信息 */
CMD_TRAIN_INFO: {value: 'Train_Info', label:'列车信息'}
}, },
Fault: { Fault: {
CMD_SET_FAULT: {value: 'Set_Fault', label: '设置故障'}, CMD_SET_FAULT: {value: 'Set_Fault', label: '设置故障'},

View File

@ -17,7 +17,8 @@ class CommandHandle {
Local: {}, Local: {},
Common: { Common: {
Set_Fault:{operate: 'Set_Fault', paramList:[{name: 'code'}, {name: 'faultType'}]}, Set_Fault:{operate: 'Set_Fault', paramList:[{name: 'code'}, {name: 'faultType'}]},
Cancel_Fault: {operate:'Cancel_Fault', paramList:[{name: 'code'}, {name: 'faultType'}]} Cancel_Fault: {operate:'Cancel_Fault', paramList:[{name: 'code'}, {name: 'faultType'}]},
Train_Init_Plan: {operate: 'Train_Init_Plan', paramList: [{name: 'sectionCode'}, {name: 'serviceNumber'}, {name: 'tripNumber'}]}
} }
}; };
(list || []).forEach(definition => { (list || []).forEach(definition => {

View File

@ -1954,8 +1954,18 @@ export const OperationEvent = {
operation: '70e4', operation: '70e4',
domId: '_Tips-Train-createPlanTrain-ChangeTripNumber' domId: '_Tips-Train-createPlanTrain-ChangeTripNumber'
} }
},
// 查看列车详细信息
trainDetailInfo: {
menu: {
operation: '70f',
domId: '_Tip-Train_trainDetailInfo-Menu'
},
confirm: {
operation: '70f1',
domId: '_Tips-Train-trainDetailInfo-Confirm'
}
} }
}, },
// 取消全线临时限速 // 取消全线临时限速

View File

@ -88,7 +88,7 @@ const permission = {
if (roles.includes(admin) && !roles.includes(user)) { // 只拥有管理员 不拥有普通用户权限 则增加用户权限 if (roles.includes(admin) && !roles.includes(user)) { // 只拥有管理员 不拥有普通用户权限 则增加用户权限
roles.push(user); roles.push(user);
} }
const routeList = resetAsyncRouter(PermissionParam[getSessionStorage('project')]); const routeList = resetAsyncRouter(PermissionParam[getSessionStorage('project') || 'login']);
const accessedRouters = filterAsyncRouter(routeList, roles); const accessedRouters = filterAsyncRouter(routeList, roles);
accessedRouters.forEach(route => { accessedRouters.forEach(route => {

View File

@ -4,7 +4,7 @@ export function getBaseUrl() {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.41:9000'; // 张赛
BASE_API = 'http://192.168.3.82:9000'; // 杜康 BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.41:9000'; // 张赛

View File

@ -1,5 +1,5 @@
<template> <template>
<el-dialog v-dialogDrag title="创建竞赛" :visible.sync="dialogVisible" width="500px" center> <el-dialog v-dialogDrag title="创建竞赛" :visible.sync="dialogVisible" width="500px" center :show-close="false" :close-on-click-modal="false" :close-on-press-escape="false">
<el-form ref="form" :model="formModel" :rules="rules" label-width="90px"> <el-form ref="form" :model="formModel" :rules="rules" label-width="90px">
<el-form-item label="竞赛名称:" prop="name"> <el-form-item label="竞赛名称:" prop="name">
<el-input v-model="formModel.name" style="width: 220px;" /> <el-input v-model="formModel.name" style="width: 220px;" />
@ -14,7 +14,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="开日期:" prop="startDate"> <el-form-item label="开日期:" prop="startDate">
<el-date-picker <el-date-picker
v-model="formModel.startDate" v-model="formModel.startDate"
type="date" type="date"

View File

@ -2,6 +2,7 @@
<div> <div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" /> <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<create-race ref="createRace" :map-list="mapList" @refresh="refresh" /> <create-race ref="createRace" :map-list="mapList" @refresh="refresh" />
<input id="competition-manage-url" v-model="url" style="opacity: 0;">
</div> </div>
</template> </template>
@ -79,6 +80,10 @@ export default {
{ {
name: '参赛地址', name: '参赛地址',
handleClick: this.showJoinUrl handleClick: this.showJoinUrl
},
{
name: '裁判地址',
handleClick: this.showRefereeUrl
} }
] ]
} }
@ -88,7 +93,8 @@ export default {
] ]
}, },
mapList: [], mapList: [],
currentModel: {} currentModel: {},
url: ''
}; };
}, },
computed: { computed: {
@ -117,10 +123,50 @@ export default {
this.$refs.createRace.doShow(row); this.$refs.createRace.doShow(row);
}, },
showJoinUrl(index, row) { showJoinUrl(index, row) {
this.$messageBox(`${row.name}参赛路径:${window.location.protocol}//${window.location.host}/jsxt/login?raceId=${row.id}`); const url = `${window.location.protocol}//${window.location.host}/jsxt/login?raceId=${row.id}`;
this.url = url;
this.$messageBox();
this.$confirm(`${row.name}参赛路径:${url}`, '参赛路径', {
confirmButtonText: '复制路径',
cancelButtonText: '关闭',
type: 'success'
}).then(() => {
const inputText = document.getElementById('competition-manage-url');
inputText.select(); //
document.execCommand('Copy'); //
this.$message.success('参赛路径已经复制到粘贴板');
});
}, },
showApplyUrl(index, row) { showApplyUrl(index, row) {
this.$messageBox(`${row.name}报名路径:${window.location.protocol}//${window.location.host}/jsxtApply?raceId=${row.id}`); // this.$messageBox(`${row.name}${window.location.protocol}//${window.location.host}/jsxtApply?raceId=${row.id}`);
const url = `${window.location.protocol}//${window.location.host}/jsxtApply?raceId=${row.id}`;
this.url = url;
this.$messageBox();
this.$confirm(`${row.name}报名路径:${url}`, '报名路径', {
confirmButtonText: '复制路径',
cancelButtonText: '关闭',
type: 'success'
}).then(() => {
const inputText = document.getElementById('competition-manage-url');
inputText.select(); //
document.execCommand('Copy'); //
this.$message.success('报名路径已经复制到粘贴板');
});
},
showRefereeUrl(index, row) {
const url = `${window.location.protocol}//${window.location.host}/refereeJsxt/login?raceId=${row.id}`;
this.url = url;
this.$messageBox();
this.$confirm(`${row.name}裁判地址:${url}`, '报名路径', {
confirmButtonText: '复制路径',
cancelButtonText: '关闭',
type: 'success'
}).then(() => {
const inputText = document.getElementById('competition-manage-url');
inputText.select(); //
document.execCommand('Copy'); //
this.$message.success('报名路径已经复制到粘贴板');
});
} }
} }
}; };

View File

@ -2,12 +2,14 @@
<div class="drivepane"> <div class="drivepane">
<div style="position: absolute;right:50%;top:60%;z-index:10;background: #EBEBEB;"> <div style="position: absolute;right:50%;top:60%;z-index:10;background: #EBEBEB;">
<el-select v-model="value" placeholder="请选择列车" @change="currentsel" @visible-change="clickselect"> <el-select v-model="value" placeholder="请选择列车" @change="currentsel" @visible-change="clickselect" >
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value"
:disabled="item.disabled"
>
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
@ -143,10 +145,13 @@ import axios from 'axios';
for(let i=0;i<netdata.data.length;i++){ for(let i=0;i<netdata.data.length;i++){
let option= { let option= {
value: netdata.data[i].groupNumber, value: netdata.data[i].groupNumber,
label: netdata.data[i].groupNumber label: netdata.data[i].groupNumber,
name:null,
} }
option.disabled = false;
if(netdata.data[i].name){ if(netdata.data[i].name){
option.label = netdata.data[i].name+"正在驾驶"+netdata.data[i].groupNumber; option.label = netdata.data[i].name+"正在驾驶"+netdata.data[i].groupNumber;
option.disabled = true;
} }
if(netdata.data[i].driverId){ if(netdata.data[i].driverId){
if(netdata.data[i].driverId == this.userId){ if(netdata.data[i].driverId == this.userId){

View File

@ -0,0 +1,169 @@
<template>
<div class="editassets">
<div class="asset-list">
<!-- <el-tabs v-model="activeName"> -->
<div class="devicelisttop">
<p style="font-size:20px;color:#FFFFFF;">故障列表</p>
</div>
<div class="devicelistbottom">
<div class="displaylist " v-for="(part,index) in devicelist" v-show="true" >
<div class="faultmodel">
<div>设备编号:{{part.code}}</div>
<div>设备类型:{{part.type}}</div>
<div>故障内容:</div>
<div>{{part.text}}</div>
<div class="faultbutton" v-on:click="getIndex(part)" >前往确认</div>
</div>
</div>
</div>
<!-- </el-tabs> -->
</div>
</div>
</template>
<script>
export default {
name: 'DevicefaultList',
components: {
},
props: ['devicelist'],
data() {
return {
activeName: 'train',
filterText: '',
defaultProps: {
children: 'children',
label: 'label'
},
devicetype:true,
}
},
beforeDestroy() {
},
watch: {
filterText(val) {
this.$refs.tree2.filter(val);
},
},
methods: {
getIndex(device){
this.$emit('selectdevice',device);
},
init: function() {
},
back() {
},
},
mounted() {
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.editassets {
position: absolute;
float:right;
left:2%;
top:6%;
width: 20%;
height: 50%;
// background-color: #FFFFFF;
// border-radius:5px;
background-image:url("/static/texture/devicelistpane.png");
background-repeat: no-repeat;
overflow: hidden;
background-size:90% 100%;
text-align: center;
z-index:4;
}
.asset-list{
// position:absolute;
width: 85%;
height: 100%;
}
.el-tabs{
height:100%;
}
.el-scrollbar__wrap.default-scrollbar__wrap {
overflow-x: hidden;
overflow-y: auto;
}
.devicelisttop{
height:10%;
width:100%;
top:0;
}
.devicelistbottom{
height:85%;
width:100%;
top:10%;
overflow-y: auto;
}
.displaylist {
float:left;
position: relative;
width:90%;
// height:20px;
margin:0px 5px 0px 5px;
}
.modelpic{
left:0;
position: absolute;
width:100%;
height:100%;
}
.modeltop{
bottom:0;
z-index:0;
}
.modeldown{
top:0;
z-index:0;
}
.faultmodel{
width:100%;
height:90px;
border:1px solid #FFFFFF;
font-size:15px;
color:#FFFFFF;
text-align: left;
}
.faultbutton{
position: absolute;
border: 1px solid #FFFFFF;
left: 20%;
bottom: 0;
width: 60%;
text-align: center;
}
</style>

View File

@ -0,0 +1,257 @@
<template>
<div id="jl3ddevicefault" class="jl3dfaultdraw">
<canvas id="canvastexture" />
<!-- <div class="jl3dcontrolpane" v-show="isswitch">
<el-button-group>
<el-button type="primary" @click="back">初始化</el-button>
<el-button type="primary" @click="alldisper">{{disperreset}}</el-button>
<el-button type="primary" @click="dispersed">{{devicestats}}</el-button>
<el-button type="primary" @click="switchhide">{{switchshow}}</el-button>
</el-button-group>
</div> -->
<div id="jl3ddevicerepir" class="repirbutton" @click="devicerepir"></div>
<div id="jl3dclose" class="backbutton" @click="close3ddeviceview"></div>
</div>
</template>
<script>
import Vue from 'vue';
import { Jl3dfaultdevice } from '@/jlmap3d/jl3dmaintainer/Jl3dfaultdevice.js';
import { sendCommandNew } from '@/api/jmap/training';
import Command from '@/scripts/cmdPlugin/Command';
import Handler from '@/scripts/cmdPlugin/Handler';
export default {
name: 'FaultDevice',
components: {
},
data() {
return {
datastatus:"",
jl3d: null,
psdlist:this.$store.state.map.map.psdList,
windowstatus:false,
devicelist:[],
devicestats:"分步拆解",
disperreset:"整体拆解",
switchshow:"隐藏轨道",
switchstatus:true,
isswitch:false,
nowdevice:null,
}
},
watch: {
// 'jl3d.animastats': {
// handler: function (newVal, oldVal) {
// if (newVal != oldVal) {
// if(newVal == false){
// this.devicestats = "";
//
// this.disperreset = "";
// }
// if(newVal == true){
// this.devicestats = "";
//
// this.disperreset = "";
// }
// }
// }
// },
// '$store.state.menuOperation.selectedCount': {
// handler: function (newVal, oldVal) {
// if(this.datastatus == "new"){
// if (newVal != oldVal) {
// if(this.$store.state.menuOperation.selected._type){
// if(this.$store.state.menuOperation.selected._type == "StationStand"){
// let standcode = this.$store.state.menuOperation.selected.code;
// for(let i=0,leni=this.psdlist.length;i<leni;i++){
// if(standcode == this.psdlist[i].standCode){
// this.jl3d.selectmodel(Vue.prototype.$jlmap.mapDevice[this.psdlist[i].code]);
// break;
// }
// }
// }else{
// this.jl3d.selectmodel(this.$store.state.menuOperation.selected);
// }
// }
// }
// }
//
// }
// },
// '$store.state.socket.device': {
// deep: true,
// handler: function (newVal, oldVal) {
// if (newVal.code == oldVal.code) {
// this.jl3d.updateaction(newVal);
// } else {
//
// }
//
// }
// },
// '$store.state.socket.simulationOverCount': function () {
// this.unsubscribe();
// }
},
computed: {
code() {
return this.$route.query.code;
},
mapId() {
return this.$route.query.mapId;
},
group(){
return this.$route.query.group;
},
},
mounted() {
window.updatemenulist = this.updatemenulist;
let code = this.$route.query.code;
let group = this.$route.query.group;
let header = this.$route.query.token;
// console.log(this.$store.state.menuOperation);
// console.log(this.$store.state.map.map.linkList);
// console.log(this.$store.state.map.map.linkList);
this.datastatus = "new";
this.initnewdata(group,header);
// const mapdata = this.$store.getters['map/map'];
// console.log(mapdata);
// if (group) {
// this.init(group,header);
// // this.subscribe(code,group,header);
// }
},
beforeDestroy() {
},
methods: {
initnewdata: function (group,header){
let dom = document.getElementById('jl3ddevicefault');
this.jl3d = new Jl3dfaultdevice(dom,group,header,this.mapId);
},
close3ddeviceview: function(){
this.$emit('closedevice3dview');
},
windowchange: function(){
let changeelement = document.getElementById('jl3ddevicefault');
if(this.windowstatus){
changeelement.style.width = '40%';
changeelement.style.height = '40%';
changeelement.style.top = '0';
changeelement.style.right = '0';
this.windowstatus = false;
this.jl3d.updatewindowstatus('0');
}else{
changeelement.style.width = '100%';
changeelement.style.height = '100%';
changeelement.style.top = '0';
this.windowstatus = true;
this.jl3d.updatewindowstatus('1');
}
if(this.jl3d.domresize){
this.jl3d.domresize();
}
},
devicerepir(){
if(this.nowdevice){
let command = {
code:this.nowdevice.code,
faultType:this.nowdevice.fault,
};
sendCommandNew(this.group,"Cancel_Fault", command).then((response) => {
// resolve(response);
if(response.code == 200){
warningmsg("故障修复成功");
this.jl3d.repairpsd();
}else{
warningmsg("故障修复失败或已无故障");
}
this.nowdevice = null;
}).catch(error => {
warningmsg("故障修复失败");
// reject(error);
});
}
},
updatemenulist(devicelist) {
if(devicelist){
this.devicelist = devicelist;
this.isswitch = true;
}else{
this.devicelist = [];
this.isswitch = false;
}
},
showmodel(devicedata){
this.jl3d.updatewindowstatus('1');
this.jl3d.selectmodel(devicedata);
this.nowdevice = devicedata;
},
back(){
this.jl3d.resetmodel();
},
}
}
</script>
<style scoped>
/* #jl3d {
width: 937px;
height: 937px;
} */
.jl3dfaultdraw {
position: absolute;
float: right;
top:0;
right:0;
/* left: 0; */
width: 100%;
height: 100%;
z-index: 3;
}
#canvastexture {
position: absolute;
float: left;
left: 0;
z-index: -12;
}
.repirbutton{
width:160px;
height:160px;
position: absolute;
right:15px;
bottom:5px;
background-image:url("/static/texture/xiuli.png");
background-repeat:no-repeat;
background-size:100%;
}
.backbutton{
width:50px;
height:50px;
position: absolute;
right:15px;
top:5px;
background-image:url("/static/texture/xx.png");
background-repeat:no-repeat;
background-size:100%;
}
#canvastexture {
position: absolute;
float: left;
left: 0;
z-index: -12;
}
.jl3dcontrolpane{
position: absolute;
top:0;
left:0;
}
</style>

View File

@ -10,17 +10,28 @@
</div> </div>
<!-- <Jlmap3d-Menu :trainlist="trainlist" :stationlist="stationlist" @sstation="sstation" @strain="strain" /> <Devicefault-List
v-show="faultlistshow"
<Jlmap3d-Config @showstationmsg="showstationmsg" @showtrainmsg="showtrainmsg" /> --> :devicelist="devicelist"
@selectdevice="selectdevice"
<!-- <Jlmap3d-Msg v-bind:msgdata="msgdata" > >
</Jlmap3d-Msg > --> </Devicefault-List>
<Fault-Device
v-show="deviceShow"
ref = "faultdevice"
@closedevice3dview ="devicemodel"
/>
<div id="testjlmap3d" class="jlmap3ddraw"> <div id="testjlmap3d" class="jlmap3ddraw">
<canvas id="canvastexture" /> <canvas id="canvastexture" />
</div> </div>
<div class="msg" v-show ="msgshow">
<div class="msgtext">
{{controlmsg}}
</div>
</div>
</div> </div>
</template> </template>
@ -37,9 +48,8 @@
// import { UrlConfig } from '@/router/index'; // import { UrlConfig } from '@/router/index';
import { JLmap3dMaintainer } from '@/jlmap3d/jl3dmaintainer/jlmap3dmaintainer.js'; import { JLmap3dMaintainer } from '@/jlmap3d/jl3dmaintainer/jlmap3dmaintainer.js';
import DevicefaultList from '@/views/jlmap3d/maintainer/component/devicefaultlist';
// components import FaultDevice from '@/views/jlmap3d/maintainer/component/faultdevice';
import Jlmap3dMenu from '@/views/jlmap3d/simulation/show/menu';
import Jlmap3dConfig from '@/views/jlmap3d/simulation/show/configmenu'; import Jlmap3dConfig from '@/views/jlmap3d/simulation/show/configmenu';
import { ProjectIcon } from '@/scripts/ProjectConfig'; import { ProjectIcon } from '@/scripts/ProjectConfig';
@ -50,17 +60,13 @@ var train;
export default { export default {
name: 'Jl3dMaintainer', name: 'Jl3dMaintainer',
components: { components: {
Jlmap3dMenu, DevicefaultList,
Jlmap3dConfig FaultDevice
// Jlmap3dMsg // Jlmap3dMsg
// ShowProperty // ShowProperty
}, },
data() { data() {
return { return {
trainlist: null,
stationlist: null,
msgdata: null,
training: { training: {
id: '', id: '',
name: '', name: '',
@ -72,7 +78,12 @@ export default {
selectmodel: null, selectmodel: null,
mapid:null, mapid:null,
group:null, group:null,
token:null token:null,
faultlistshow:true,
devicelist:[],
deviceShow:true,
msgshow:false,
controlmsg:"",
}; };
}, },
beforeDestroy() { beforeDestroy() {
@ -90,7 +101,10 @@ export default {
document.querySelector("link[rel*='icon']").href = ProjectIcon[this.$route.query.project]; document.querySelector("link[rel*='icon']").href = ProjectIcon[this.$route.query.project];
}, },
mounted() { mounted() {
window.updatemenulist = this.updatemenulist; window.updatefault = this.updatefault;
window.resetfaultlist = this.resetfaultlist;
window.deletefault = this.deletefault;
window.warningmsg = this.warningmsg;
this.getParams(); this.getParams();
// console.log(""); // console.log("");
@ -101,9 +115,7 @@ export default {
this.mapid = this.$route.query.mapId; this.mapid = this.$route.query.mapId;
this.group = this.$route.query.group; this.group = this.$route.query.group;
this.token = this.$route.query.token; this.token = this.$route.query.token;
console.log(this.mapid);
console.log(this.group);
console.log(this.token);
this.init(this.mapid, this.group); this.init(this.mapid, this.group);
}, },
show: function (skinCode, group) { show: function (skinCode, group) {
@ -121,7 +133,7 @@ export default {
const dom = document.getElementById('app'); const dom = document.getElementById('app');
const project = this.$route.query.project; const project = this.$route.query.project;
// console.log(project); // console.log(project);
this.deviceShow = false;
if (project) { if (project) {
this.jlmap3d = new JLmap3dMaintainer(dom, mapdata, skinCode, this.$store, group, project); this.jlmap3d = new JLmap3dMaintainer(dom, mapdata, skinCode, this.$store, group, project);
@ -155,31 +167,41 @@ export default {
showtrainmsg(showtype) { showtrainmsg(showtype) {
this.jlmap3d.showtrainmsg(showtype); this.jlmap3d.showtrainmsg(showtype);
}, },
updatemenulist(stationlist, trainlist) { resetfaultlist(){
const stations = []; this.devicelist = [];
for (const k in stationlist) {
stations.push(stationlist[k]);
}
const trains = [];
for (const k in trainlist) {
trains.push(trainlist[k]);
}
this.stationlist = stations;
this.trainlist = trains;
// console.log(this.stationlist);
}, },
updatefault(fault) {
sstation(changedata) { this.devicelist.push(fault);
this.jlmap3d.updatecamera(changedata.mesh, 'station');
}, },
strain(changedata) { deletefault(code){
for(let i=0,leni=this.devicelist.length;i<leni;i++){
if (changedata.dispose == false) { if(code == this.devicelist[i].code){
this.jlmap3d.updatecamera(changedata, 'train'); this.devicelist.splice(i,1);
break;
} }
}
},
devicemodel(){
if (this.deviceShow == false) {
this.deviceShow = true;
} else {
this.deviceShow = false;
}
},
selectdevice(divicedata){
this.deviceShow = true;
this.$refs.faultdevice.showmodel(divicedata);
},
warningmsg(nowmsg){
console.log(nowmsg);
this.controlmsg = nowmsg;
this.msgshow = true;
setTimeout(this.warningmsgoff,3000);
},
warningmsgoff(){
this.msgshow = false;
}, },
back() { back() {
this.$emit('back'); this.$emit('back');
} }
@ -237,7 +259,7 @@ export default {
position:absolute; position:absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: 30; z-index: 2;
} }
.jlmap3ddraw { .jlmap3ddraw {
@ -250,6 +272,24 @@ export default {
z-index: -1; z-index: -1;
} }
.msg{
width:40%;
// height:50px;
left:30%;
top:10%;
text-align: center;
position:absolute;
z-index:5;
}
.msgtext{
width:100%;
// height:50px;
border-radius:5px;
background:#C0C0C0;
color:#FFFFFF;
font-size: 40px;
}
#canvastexture { #canvastexture {
position: absolute; position: absolute;
float: left; float: left;

View File

@ -1,56 +1,68 @@
<template> <template>
<div class="dictionary_box"> <div class="dictionary_box">
<h2 style="text-align: center;">报名系统</h2> <template v-if="applyFlag">
<div class="joylink-card"> <h2 style="text-align: center;">报名系统</h2>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" /> <div class="joylink-card">
<span class="dialog-footer" style="margin: 0 auto; display: table;"> <data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<el-button type="primary" @click="handleApply">报名</el-button> <span class="dialog-footer" style="margin: 0 auto; display: table;">
</span> <el-button type="primary" @click="handleApply">报名</el-button>
<el-dialog title="请先登陆" custom-class="dialog-apply" :visible.sync="dialogVisible" width="740px" :close-on-press-escape="false" :show-close="false" :close-on-click-modal="false" :modal="true"> </span>
<div class="content-box"> <el-dialog title="请先登陆" custom-class="dialog-apply" :visible.sync="dialogVisible" width="740px" :close-on-press-escape="false" :show-close="false" :close-on-click-modal="false" :modal="true">
<div class="qrcode-main"> <div class="content-box">
<div class="login-code-box" @click="loginRefresh"> <div class="qrcode-main">
<qrcode-vue <div class="login-code-box" @click="loginRefresh">
v-loading="loadingCode" <qrcode-vue
:value="loginUrl" v-loading="loadingCode"
:class-name="qrcodeClassName" :value="loginUrl"
:size="150" :class-name="qrcodeClassName"
:element-loading-text="this.$t('login.clickRefresh')" :size="150"
element-loading-spinner="el-icon-refresh" :element-loading-text="this.$t('login.clickRefresh')"
element-loading-background="rgba(255, 255, 255, 0.9)" element-loading-spinner="el-icon-refresh"
/> element-loading-background="rgba(255, 255, 255, 0.9)"
</div> />
<div class="login-tip"> </div>
<span class="sub-title">使用手机微信扫码登录</span> <div class="login-tip">
<span class="sub-title">使用手机微信扫码登录</span>
</div>
</div> </div>
<el-form ref="loginForm" class="login-form" :model="loginForm" :rules="loginRules" label-position="left">
<el-form-item prop="username" class="item_form_box">
<span class="svg-container svg-container_login"><svg-icon icon-class="user" /></span>
<el-input v-model="loginForm.username" name="username" type="text" :placeholder="this.$t('login.mobilePhoneNumberOrEmail')" @keyup.enter.native="goToNext" />
</el-form-item>
<el-form-item prop="password" class="item_form_box item_form_password">
<span class="svg-container"><svg-icon icon-class="password" /></span>
<el-input
ref="password"
v-model="loginForm.password"
name="password"
:type="pwdType"
:placeholder="this.$t('login.password')"
@keyup.enter.native="handleLogin"
/>
<span class="show-pwd" @click="showPwd">
<svg-icon v-if="pwdDisplay" icon-class="eye" />
<svg-icon v-else icon-class="eye-open" />
</span>
</el-form-item>
<el-form-item>
<el-button type="primary" style="width:100%;" :loading="loading" @click.native.prevent="handleLogin">登陆</el-button>
</el-form-item>
</el-form>
</div> </div>
<el-form ref="loginForm" class="login-form" :model="loginForm" :rules="loginRules" label-position="left"> </el-dialog>
<el-form-item prop="username" class="item_form_box"> </div>
<span class="svg-container svg-container_login"><svg-icon icon-class="user" /></span> </template>
<el-input v-model="loginForm.username" name="username" type="text" :placeholder="this.$t('login.mobilePhoneNumberOrEmail')" @keyup.enter.native="goToNext" /> <template v-else>
</el-form-item> <div v-if="flag" class="apply_box">
<el-form-item prop="password" class="item_form_box item_form_password"> <i class="el-icon-success" style="color: green; font-size: 40px;" />
<span class="svg-container"><svg-icon icon-class="password" /></span> <span class="title">报名成功!</span>
<el-input </div>
ref="password" <div v-if="!flag" class="apply_box">
v-model="loginForm.password" <i class="el-icon-info" style="color: green; font-size: 40px;" />
name="password" <span class="title">您已报过名了!</span>
:type="pwdType" </div>
:placeholder="this.$t('login.password')" </template>
@keyup.enter.native="handleLogin"
/>
<span class="show-pwd" @click="showPwd">
<svg-icon v-if="pwdDisplay" icon-class="eye" />
<svg-icon v-else icon-class="eye-open" />
</span>
</el-form-item>
<el-form-item>
<el-button type="primary" style="width:100%;" :loading="loading" @click.native.prevent="handleLogin">登陆</el-button>
</el-form-item>
</el-form>
</div>
</el-dialog>
</div>
</div> </div>
</template> </template>
@ -63,6 +75,7 @@ import Cookies from 'js-cookie';
import QrcodeVue from 'qrcode.vue'; import QrcodeVue from 'qrcode.vue';
import { getUserinfoMobileCode } from '@/api/management/user'; import { getUserinfoMobileCode } from '@/api/management/user';
import { postSignUp } from '@/api/competition'; import { postSignUp } from '@/api/competition';
import { getIsSignUp } from '@/api/competition';
export default { export default {
name: '', name: '',
@ -84,6 +97,8 @@ export default {
}; };
return { return {
dialogVisible: false, dialogVisible: false,
applyFlag: true,
flag: true,
loginClient: 'Design', loginClient: 'Design',
checkLogin: null, checkLogin: null,
sessionId: '', sessionId: '',
@ -166,9 +181,21 @@ export default {
if (getToken()) { if (getToken()) {
this.$store.dispatch('GetInfo', getToken()).then(res => { this.$store.dispatch('GetInfo', getToken()).then(res => {
this.userId = res.id; this.userId = res.id;
if (this.checkLogin) {
this.clearTimer(this.checkLogin);
}
getIsSignUp(this.$route.query.raceId).then(res => {
if (res.data) {
//
this.applyFlag = false;
this.flag = false;
}
});
this.dialogVisible = false;
}); });
} else { } else {
this.dialogVisible = true; this.dialogVisible = true;
this.applyFlag = true;
this.loginRefresh(); this.loginRefresh();
} }
}, },
@ -210,7 +237,6 @@ export default {
this.loading = false; this.loading = false;
setTimeout(() => { this.tipsMsg = ''; }, 5000); setTimeout(() => { this.tipsMsg = ''; }, 5000);
}); });
this.dialogVisible = false;
} else { } else {
console.log('error submit!!'); console.log('error submit!!');
return false; return false;
@ -302,7 +328,9 @@ export default {
}; };
if (this.$route.query.raceId) { if (this.$route.query.raceId) {
postSignUp(this.$route.query.raceId, param).then(res => { postSignUp(this.$route.query.raceId, param).then(res => {
this.$messageBox('报名成功!'); // this.$messageBox('');
this.applyFlag = false;
this.flag = true;
}).catch(error => { }).catch(error => {
console.log(error); console.log(error);
}); });
@ -363,6 +391,19 @@ export default {
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
} }
} }
.apply_box{
display: flex;
justify-content: center;
align-items: center;
margin-top: 50px;
font-size: 25px;
.title{
margin-left: 7px;
text-align: left;
font-size: 25px;
width: auto;
}
}
/deep/{ /deep/{
.dialog-apply{ .dialog-apply{
.el-form-item{ .el-form-item{

Binary file not shown.

BIN
static/texture/xiuli.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
static/texture/xiuli1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

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