Merge remote-tracking branch 'origin/test'

# Conflicts:
#	src/utils/baseUrl.js
This commit is contained in:
fan 2020-11-02 19:10:32 +08:00
commit a7558b0764
108 changed files with 2624 additions and 1991 deletions

View File

@ -23,9 +23,9 @@ export function listStations(lineId) {
/** /**
* 更新线路车站 * 更新线路车站
*/ */
export function updateStation(lineId, data) { export function updateStation(stationId, data) {
return request({ return request({
url: `/api/rpTools/station/${lineId}`, url: `/api/rpTools/station/${stationId}`,
method: 'put', method: 'put',
data data
}) })
@ -179,3 +179,19 @@ export function justTripTurnBack(planId, tripNo, data) {
data data
}); });
} }
/** 开始编辑*/
export function startRpEdit(planId) {
return request({
url: `/api/rpTools/${planId}/edit`,
method: 'put'
})
}
/** 开始编辑*/
export function endRpEdit(planId) {
return request({
url: `/api/rpTools/${planId}/endEdit`,
method: 'put'
})
}

View File

@ -380,3 +380,19 @@ export function getIbpInitialState (group, stationCode) {
method: 'get' method: 'get'
}); });
} }
// 获取报警列表
export function getAlarmList(group, params) {
return request({
url: `/simulation/${group}/alarm`,
method: 'get',
params:params
});
}
// 报警确认
export function confirmAlarm(group, data) {
return request({
url: `/simulation/${group}/alarm/confirm`,
method: 'put',
data
});
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@ -17,10 +17,10 @@ export default {
/** 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px*/ /** 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px*/
if (sty.left.includes('%')) { if (sty.left.includes('%')) {
styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100); styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100);
styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100); styT = +document.body.clientHeight * (+sty.bottom.replace(/\%/g, '') / 100);
} else { } else {
styL = +sty.left.replace(/\px/g, ''); styL = +sty.left.replace(/\px/g, '');
styT = +sty.top.replace(/\px/g, ''); styT = +sty.bottom.replace(/\px/g, '');
} }
document.onmousemove = function (e) { document.onmousemove = function (e) {
@ -28,20 +28,23 @@ export default {
const l = e.clientX - disX; const l = e.clientX - disX;
const t = e.clientY - disY; const t = e.clientY - disY;
console.log(l, l + styL, dragDom.style.left);
/** 移动当前元素*/ /** 移动当前元素*/
if (l + styL < 0) { if (l + styL < 0) {
dragDom.style.left = `0px`; dragDom.style.left = `0px`;
} else if (l + styL > document.body.clientWidth - dragDom.clientWidth - 30) { } else if (l + styL > document.body.clientWidth - dragDom.clientWidth - 100) {
dragDom.style.left = `${document.body.clientWidth - dragDom.clientWidth - 30}px`; dragDom.style.left = `${document.body.clientWidth - dragDom.clientWidth - 100}px`;
} else { } else {
dragDom.style.left = `${l + styL}px`; dragDom.style.left = `${l + styL}px`;
} }
if (t + styT < 0) {
dragDom.style.top = `0px`; if (document.body.clientHeight - (styT - t) - dragDom.clientHeight < 0) {
} else if (t + styT > document.body.clientHeight - dragDom.clientHeight - 10) { dragDom.style.bottom = `${document.body.clientHeight - dragDom.clientHeight}px`;
dragDom.style.top = `${document.body.clientHeight - dragDom.clientHeight - 10}px`; } else if (document.body.clientHeight - (styT - t) - dragDom.clientHeight > document.body.clientHeight - dragDom.clientHeight) {
dragDom.style.bottom = `0px`;
} else { } else {
dragDom.style.top = `${t + styT}px`; dragDom.style.bottom = `${styT - t}px`;
} }
/** 将此时的位置传出去*/ /** 将此时的位置传出去*/

View File

@ -32,23 +32,32 @@ export function initDataSave(data) {
let sections = []; let sections = [];
// console.log(data.mapdata.sectionlist.sections.datalist); // console.log(data.mapdata.sectionlist.sections.datalist);
for(let i in data.mapdata.sectionlist.sections.datalist){ for(let i in data.mapdata.sectionlist.sections.datalist){
console.log(data.mapdata.sectionlist.sections.datalist[i].mesh.railpoint);
let section = { let section = {
// uuid:data.mapdata.sectionlist.sections.modellist[i].uuid, // uuid:data.mapdata.sectionlist.sections.modellist[i].uuid,
code:data.mapdata.sectionlist.sections.datalist[i].code, code:data.mapdata.sectionlist.sections.datalist[i].code,
name:data.mapdata.sectionlist.sections.datalist[i].name, name:data.mapdata.sectionlist.sections.datalist[i].name,
lengthFact:data.mapdata.sectionlist.sections.datalist[i].mesh.lengthFact, lengthFact:null,
standTrack:data.mapdata.sectionlist.sections.datalist[i].standTrack, standTrack:data.mapdata.sectionlist.sections.datalist[i].standTrack,
rp:data.mapdata.sectionlist.sections.datalist[i].rp, rp:data.mapdata.sectionlist.sections.datalist[i].rp,
lp:data.mapdata.sectionlist.sections.datalist[i].lp, lp:data.mapdata.sectionlist.sections.datalist[i].lp,
railpoint:data.mapdata.sectionlist.sections.datalist[i].mesh.railpoint, railpoint:null,
rail:data.mapdata.sectionlist.sections.datalist[i].rail, rail:data.mapdata.sectionlist.sections.datalist[i].rail,
position:data.mapdata.sectionlist.sections.datalist[i].mesh.position, position:null,
rotation:data.mapdata.sectionlist.sections.datalist[i].mesh.rotation, rotation:null,
scale:data.mapdata.sectionlist.sections.datalist[i].mesh.scale, scale:null,
} }
let nowmesh = data.mapdata.sectionlist.sectiongroup.getObjectByProperty("code",section.code); if(data.mapdata.sectionlist.sections.datalist[i].mesh){
section.railpoint = nowmesh.railpoint; console.log(data.mapdata.sectionlist.sections.datalist[i].mesh.railpoint);
let nowmesh = data.mapdata.sectionlist.sectiongroup.getObjectByProperty("code",section.code);
section.railpoint = nowmesh.railpoint;
section.lengthFact = data.mapdata.sectionlist.sections.datalist[i].mesh.lengthFact;
section.position = data.mapdata.sectionlist.sections.datalist[i].mesh.position;
section.rotation = data.mapdata.sectionlist.sections.datalist[i].mesh.rotation;
section.scale = data.mapdata.sectionlist.sections.datalist[i].mesh.scale;
sections.push(section);
}
// console.log(nowmesh.railpoint); // console.log(nowmesh.railpoint);
// if(data.mapdata.sectionlist.sections.datalist[i].rsection){ // if(data.mapdata.sectionlist.sections.datalist[i].rsection){
// section.rsection = data.mapdata.sectionlist.sections.datalist[i].rsection; // section.rsection = data.mapdata.sectionlist.sections.datalist[i].rsection;
@ -62,7 +71,7 @@ export function initDataSave(data) {
// testmesh1.position.z = link.position.z; // testmesh1.position.z = link.position.z;
sections.push(section);
} }
let arrray = { let arrray = {
section:sections, section:sections,

View File

@ -423,63 +423,12 @@ export function JLmap3dEdit(dom, data, mapid) {
for(let i=0;i<alignmentModel.railpoint.length;i++){ for(let i=0;i<alignmentModel.railpoint.length;i++){
newpointlist.push(new THREE.Vector3(alignmentModel.railpoint[i].x,alignmentModel.railpoint[i].y,alignmentModel.railpoint[i].z)); newpointlist.push(new THREE.Vector3(alignmentModel.railpoint[i].x,alignmentModel.railpoint[i].y,alignmentModel.railpoint[i].z));
} }
let closedSpline = new THREE.CatmullRomCurve3(newpointlist);
closedSpline.type = 'catmullrom';
closedSpline.closed = false;
let extrudeSettings = {
steps : 5,
curveSegments : 1,
bevelSegments : 1,
bevelEnabled : false,
extrudePath : closedSpline,
};
var shape = new THREE.Shape(); let newSection = reCreatSection(newpointlist,oldobject);
shape.moveTo( 0,-2 ); newSection.meshtype = "section";
shape.lineTo( 0, 2 ); scope.mapdata.sectionlist.sections.datalist[alignmentCode].mesh = newSection;
let selectmaterial = oldobject.material; objectparent.add(newSection);
var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
let newAlignmentSection = new THREE.Mesh( geometry, selectmaterial );
newAlignmentSection.code = oldobject.code;
newAlignmentSection.railpoint = [];
for(let i=0;i<newpointlist.length;i++){
newAlignmentSection.railpoint[i] = {
x:newpointlist[i].x,
y:newpointlist[i].y,
z:newpointlist[i].z
}
}
newAlignmentSection.lengthFact = closedSpline.arcLengthDivisions/4;
if(newpointlist.length>2){
newAlignmentSection.lengthFact = newAlignmentSection.lengthFact/5;
}
let len = newAlignmentSection.lengthFact;
// closedSpline.arcLengthDivisions;
let count = newAlignmentSection.geometry.attributes.position.count/3;
for(let i=0;i<count;i++){
let ui=i*6;
if(i%2 != 0){
newAlignmentSection.geometry.attributes.uv.array[ui] = 0;
newAlignmentSection.geometry.attributes.uv.array[ui+1] = 1;
newAlignmentSection.geometry.attributes.uv.array[ui+2] = len;
newAlignmentSection.geometry.attributes.uv.array[ui+3] = 1;
newAlignmentSection.geometry.attributes.uv.array[ui+4] = len;
newAlignmentSection.geometry.attributes.uv.array[ui+5] = 0;
}else{
newAlignmentSection.geometry.attributes.uv.array[ui] = 0;
newAlignmentSection.geometry.attributes.uv.array[ui+1] = 0;
newAlignmentSection.geometry.attributes.uv.array[ui+2] = 0;
newAlignmentSection.geometry.attributes.uv.array[ui+3] = 1;
newAlignmentSection.geometry.attributes.uv.array[ui+4] = len;
newAlignmentSection.geometry.attributes.uv.array[ui+5] = 0;
}
}
newAlignmentSection.meshtype = "section";
scope.mapdata.sectionlist.sections.datalist[alignmentCode].mesh = newAlignmentSection;
objectparent.add(newAlignmentSection);
}; };
//区段平整 //区段平整
@ -493,6 +442,34 @@ export function JLmap3dEdit(dom, data, mapid) {
for(let i=0;i<alignmentModel.railpoint.length;i++){ for(let i=0;i<alignmentModel.railpoint.length;i++){
newpointlist.push(new THREE.Vector3(alignmentModel.railpoint[i].x,alignmentModel.railpoint[0].y,alignmentModel.railpoint[i].z)); newpointlist.push(new THREE.Vector3(alignmentModel.railpoint[i].x,alignmentModel.railpoint[0].y,alignmentModel.railpoint[i].z));
} }
let newSection = reCreatSection(newpointlist,oldobject);
newSection.meshtype = "section";
scope.mapdata.sectionlist.sections.datalist[alignmentCode].mesh = newSection;
objectparent.add(newSection);
}
//直区段修复
this.straightSection = function(alignmentCode){
let oldobject = scope.mapdata.sectionlist.sections.datalist[alignmentCode].mesh;
let alignmentModel = scope.mapdata.sectionlist.sections.datalist[alignmentCode];
let objectparent = oldobject.parent;
objectparent.remove(oldobject);
let newpointlist = [];
newpointlist.push(new THREE.Vector3(alignmentModel.railpoint[0].x,alignmentModel.railpoint[0].y,alignmentModel.railpoint[0].z));
newpointlist.push(new THREE.Vector3(alignmentModel.railpoint[1].x,alignmentModel.railpoint[0].y,alignmentModel.railpoint[0].z+0.001));
newpointlist.push(new THREE.Vector3(alignmentModel.railpoint[2].x,alignmentModel.railpoint[0].y,alignmentModel.railpoint[0].z));
// console.log(oldobject);
let newSection = reCreatSection(newpointlist,oldobject);
newSection.meshtype = "section";
scope.mapdata.sectionlist.sections.datalist[alignmentCode].mesh = newSection;
objectparent.add(newSection);
}
function reCreatSection(newpointlist,oldobject){
let closedSpline = new THREE.CatmullRomCurve3(newpointlist); let closedSpline = new THREE.CatmullRomCurve3(newpointlist);
closedSpline.type = 'catmullrom'; closedSpline.type = 'catmullrom';
closedSpline.closed = false; closedSpline.closed = false;
@ -524,31 +501,29 @@ export function JLmap3dEdit(dom, data, mapid) {
if(newpointlist.length>2){ if(newpointlist.length>2){
newAlignmentSection.lengthFact = newAlignmentSection.lengthFact/5; newAlignmentSection.lengthFact = newAlignmentSection.lengthFact/5;
} }
let len = newAlignmentSection.lengthFact; let len = newAlignmentSection.lengthFact;
// closedSpline.arcLengthDivisions; // closedSpline.arcLengthDivisions;
let count = newAlignmentSection.geometry.attributes.position.count/3; let count = newAlignmentSection.geometry.attributes.position.count/3;
for(let i=0;i<count;i++){ for(let i=0;i<count;i++){
let ui=i*6; let ui=i*6;
if(i%2 != 0){ if(i%2 != 0){
newAlignmentSection.geometry.attributes.uv.array[ui] = 0; newAlignmentSection.geometry.attributes.uv.array[ui] = 0;
newAlignmentSection.geometry.attributes.uv.array[ui+1] = 1; newAlignmentSection.geometry.attributes.uv.array[ui+1] = 1;
newAlignmentSection.geometry.attributes.uv.array[ui+2] = len; newAlignmentSection.geometry.attributes.uv.array[ui+2] = len;
newAlignmentSection.geometry.attributes.uv.array[ui+3] = 1; newAlignmentSection.geometry.attributes.uv.array[ui+3] = 1;
newAlignmentSection.geometry.attributes.uv.array[ui+4] = len; newAlignmentSection.geometry.attributes.uv.array[ui+4] = len;
newAlignmentSection.geometry.attributes.uv.array[ui+5] = 0; newAlignmentSection.geometry.attributes.uv.array[ui+5] = 0;
}else{ }else{
newAlignmentSection.geometry.attributes.uv.array[ui] = 0; newAlignmentSection.geometry.attributes.uv.array[ui] = 0;
newAlignmentSection.geometry.attributes.uv.array[ui+1] = 0; newAlignmentSection.geometry.attributes.uv.array[ui+1] = 0;
newAlignmentSection.geometry.attributes.uv.array[ui+2] = 0; newAlignmentSection.geometry.attributes.uv.array[ui+2] = 0;
newAlignmentSection.geometry.attributes.uv.array[ui+3] = 1; newAlignmentSection.geometry.attributes.uv.array[ui+3] = 1;
newAlignmentSection.geometry.attributes.uv.array[ui+4] = len; newAlignmentSection.geometry.attributes.uv.array[ui+4] = len;
newAlignmentSection.geometry.attributes.uv.array[ui+5] = 0; newAlignmentSection.geometry.attributes.uv.array[ui+5] = 0;
} }
} }
newAlignmentSection.meshtype = "section"; return newAlignmentSection;
scope.mapdata.sectionlist.sections.datalist[alignmentCode].mesh = newAlignmentSection;
objectparent.add(newAlignmentSection);
} }
//屏幕自适应 //屏幕自适应

View File

@ -335,8 +335,10 @@ export function SectionList() {
for(let j=0,lenj=stopsections[i].reals.length;j<lenj;j++){ for(let j=0,lenj=stopsections[i].reals.length;j<lenj;j++){
let topnextpoint = {}; let topnextpoint = {};
console.log(stopsections[i].reals[j].section.code);
if(scope.sections.datalist[stopsections[i].reals[j].section.code].railpoint == 0){ console.log(scope.sections.datalist[stopsections[i].reals[j].section.code]);
if(scope.sections.datalist[stopsections[i].reals[j].section.code].railpoint.length == 0){
let
topnextpoint = { topnextpoint = {
x:scope.sections.datalist[stopsections[i].reals[0].section.code].railpoint[0].x, x:scope.sections.datalist[stopsections[i].reals[0].section.code].railpoint[0].x,
y:0, y:0,
@ -425,6 +427,9 @@ export function SectionList() {
position.z = py; position.z = py;
let len = scope.sections.datalist[start].lengthFact; let len = scope.sections.datalist[start].lengthFact;
let height = Math.random()/1000; let height = Math.random()/1000;
console.log(origin);
console.log(start);
console.log("++++++++++++++++++");
scope.sections.datalist[start].railpoint = [ scope.sections.datalist[start].railpoint = [
new THREE.Vector3(position.x,height,position.z), new THREE.Vector3(position.x,height,position.z),
new THREE.Vector3(position.x+0.5,height,position.z+0.0001), new THREE.Vector3(position.x+0.5,height,position.z+0.0001),
@ -496,12 +501,13 @@ export function SectionList() {
y:0, y:0,
z:position.z z:position.z
}; };
console.log(origin+"******************************"); // console.log(origin+"******************************");
console.log(start); // console.log(start);
console.log(origin); // console.log(origin);
console.log(scope.sections.datalist[start]);
if(scope.sections.datalist[start].standTrack == true && start != origin){ if(scope.sections.datalist[start].standTrack == true && start != origin){
console.log(start+"到达"); // console.log(start+"到达");
console.log("++++++++++++++++++++++++"); // console.log("++++++++++++++++++++++++");
return ; return ;
}else if(scope.sections.datalist[start].rsection == undefined){ }else if(scope.sections.datalist[start].rsection == undefined){
return ; return ;
@ -1021,7 +1027,7 @@ export function SectionList() {
let ccode = switch2d[i].sectionCCode; let ccode = switch2d[i].sectionCCode;
// console.log(switchdata[i]); // console.log(switchdata[i]);
console.log(scope.sections.datalist[acode]);
let aposx = (scope.sections.datalist[acode].points[0].x + scope.sections.datalist[acode].points[scope.sections.datalist[acode].pointslength].x)/2; let aposx = (scope.sections.datalist[acode].points[0].x + scope.sections.datalist[acode].points[scope.sections.datalist[acode].pointslength].x)/2;
let cposx = (scope.sections.datalist[ccode].points[0].x + scope.sections.datalist[ccode].points[scope.sections.datalist[ccode].pointslength].x)/2; let cposx = (scope.sections.datalist[ccode].points[0].x + scope.sections.datalist[ccode].points[scope.sections.datalist[ccode].pointslength].x)/2;

View File

@ -46,44 +46,55 @@ export function SignalList() {
} }
let section = sectiondata[data[i].sectionCode]; let section = sectiondata[data[i].sectionCode];
let posx = null; let posx = null;
if(section.lsection == undefined){
if(data[i].sectionOffset > section.lengthFact/2){ section = sectiondata[section.rsection];
posx = section.mesh.position.x + data[i].sectionOffset - section.lengthFact/2; data[i].sectionOffset = section.lengthFact;
}else{ data[i].sectionCode = section.rsection;
posx = section.mesh.position.x - (section.lengthFact/2 - data[i].sectionOffset);
} }
//根据线路方向修改信号灯位置 if(section.rsection == undefined){
if(data[i].right == false){ section = sectiondata[section.lsection];
if(section.standTrack == true){ data[i].sectionOffset = 0;
posx = posx - 7; data[i].sectionCode = section.rsection;
}
newmesh.position.set(posx,0,section.mesh.position.z-3);
newmesh.rotation.z = ( Math.PI / 2 );
}else if(data[i].right == true){
if(section.standTrack == true){
posx = posx + 7;
}
newmesh.position.set(posx,0,section.mesh.position.z+3);
newmesh.rotation.z = ( - Math.PI / 2 );
} }
newmesh.scale.x = 0.05;
newmesh.scale.y = 0.05;
newmesh.scale.z = 0.05;
newmesh.sectionOffset = data[i].sectionOffset;
newmesh.sectionCode = data[i].sectionCode;
newmesh.right = data[i].right;
newsignal.mesh = newmesh;
newsignal.sectionOffset = data[i].sectionOffset; if(data[i].sectionOffset > section.lengthFact/2){
newsignal.mesh.status = "01"; posx = section.mesh.position.x + data[i].sectionOffset - section.lengthFact/2;
newsignal.name = data[i].name; }else{
newsignal.modelid = assetloader.modellist[num].id; posx = section.mesh.position.x - (section.lengthFact/2 - data[i].sectionOffset);
newsignal.code = data[i].code; }
newsignal.sectionCode = data[i].sectionCode; //根据线路方向修改信号灯位置
newsignal.right = data[i].right; if(data[i].right == false){
scope.group.add(newmesh); if(section.standTrack == true){
scope.list.push(newsignal); posx = posx - 7;
}
newmesh.position.set(posx,0,section.mesh.position.z-3);
newmesh.rotation.z = ( Math.PI / 2 );
}else if(data[i].right == true){
if(section.standTrack == true){
posx = posx + 7;
}
newmesh.position.set(posx,0,section.mesh.position.z+3);
newmesh.rotation.z = ( - Math.PI / 2 );
}
newmesh.scale.x = 0.05;
newmesh.scale.y = 0.05;
newmesh.scale.z = 0.05;
newmesh.sectionOffset = data[i].sectionOffset;
newmesh.sectionCode = data[i].sectionCode;
newmesh.right = data[i].right;
newsignal.mesh = newmesh;
newsignal.sectionOffset = data[i].sectionOffset;
newsignal.mesh.status = "01";
newsignal.name = data[i].name;
newsignal.modelid = assetloader.modellist[num].id;
newsignal.code = data[i].code;
newsignal.sectionCode = data[i].sectionCode;
newsignal.right = data[i].right;
scope.group.add(newmesh);
scope.list.push(newsignal);
}else{ }else{
for(let j=0;j<assetloader.modellist.length;j++){ for(let j=0;j<assetloader.modellist.length;j++){

View File

@ -1,7 +1,7 @@
//转辙机动画
export function Moveanimate(main){ export function Moveanimate(main){
let scope = this; let scope = this;
//内容信息显示plane
this.helpbox = null; this.helpbox = null;
this.textplane = null; this.textplane = null;
//动画列表 //动画列表
@ -14,9 +14,8 @@ export function Moveanimate(main){
this.status = true; this.status = true;
//当前动画模型 //当前动画模型
this.nowmodelname = undefined; this.nowmodelname = undefined;
//定义转辙机零件动画
this.initlistnew = function(switchmodel){ this.initlistnew = function(switchmodel){
scope.animatelist[switchmodel.animacode+"chaijie"] = []; scope.animatelist[switchmodel.animacode+"chaijie"] = [];
scope.animatelist[switchmodel.animacode+"fuwei"] = []; scope.animatelist[switchmodel.animacode+"fuwei"] = [];
for(let i=0,leni=switchmodel.children.length;i<leni;i++){ for(let i=0,leni=switchmodel.children.length;i<leni;i++){
@ -29,8 +28,6 @@ export function Moveanimate(main){
points2.push(new THREE.Vector3(switchmodel.children[i].position.x-1.5,switchmodel.children[i].position.y,switchmodel.children[i].position.z)); points2.push(new THREE.Vector3(switchmodel.children[i].position.x-1.5,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z)); points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"dizuooff",points2,0.5,true,0); scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"dizuooff",points2,0.5,true,0);
} }
if(switchmodel.children[i].name == "DJZ"){ if(switchmodel.children[i].name == "DJZ"){
let points1 = []; let points1 = [];
@ -186,7 +183,6 @@ export function Moveanimate(main){
// scope.initanimate(switchmodel.children[i],switchmodel.name+"select1",points,true); // scope.initanimate(switchmodel.children[i],switchmodel.name+"select1",points,true);
let modelorderlist = []; let modelorderlist = [];
modelorderlist[switchmodel.animacode] = [ modelorderlist[switchmodel.animacode] = [
{name:"SZ",pos:[-1.5,0,-1]}, {name:"SZ",pos:[-1.5,0,-1]},
{name:"DINGK",pos:[0,9,0]}, {name:"DINGK",pos:[0,9,0]},
@ -194,8 +190,6 @@ export function Moveanimate(main){
{name:"DJZ",pos:[-3,0,0]}, {name:"DJZ",pos:[-3,0,0]},
{name:"DDJ",pos:[-1.5,0,0]}, {name:"DDJ",pos:[-1.5,0,0]},
{name:"JSQ",pos:[-3,3,0]}, {name:"JSQ",pos:[-3,3,0]},
{name:"ZDKBQ",pos:[0,3,0]}, {name:"ZDKBQ",pos:[0,3,0]},
@ -210,48 +204,45 @@ export function Moveanimate(main){
{name:"BSG",pos:[1,0,-5]}, {name:"BSG",pos:[1,0,-5]},
{name:"DZG",pos:[-1,0,-5]} {name:"DZG",pos:[-1,0,-5]}
]; ];
scope.animatelist[switchmodel.animacode+"on"] = []; scope.animatelist[switchmodel.animacode+"on"] = [];
scope.animatelist[switchmodel.animacode+"off"] = []; scope.animatelist[switchmodel.animacode+"off"] = [];
for(let i=0,leni=modelorderlist[switchmodel.animacode].length;i<leni;i++){
let orderdata = modelorderlist[switchmodel.animacode]; for(let i=0,leni=modelorderlist[switchmodel.animacode].length;i<leni;i++){
let modelon = switchmodel.getObjectByName(orderdata[i].name);
// modelon.helpbox = undefined;
let pointson = [];
pointson.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z));
pointson.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2]));
let pointsoff = []; let orderdata = modelorderlist[switchmodel.animacode];
pointsoff.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2])); let modelon = switchmodel.getObjectByName(orderdata[i].name);
pointsoff.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z)); // modelon.helpbox = undefined;
let pointson = [];
pointson.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z));
pointson.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2]));
// if(i == 0){ let pointsoff = [];
scope.initanimate(scope.animatelist[switchmodel.animacode+"on"],modelon,switchmodel.animacode+modelon.name+"on",pointson,0.03,true,i); pointsoff.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2]));
scope.initanimate(scope.animatelist[switchmodel.animacode+"off"],modelon,switchmodel.animacode+modelon.name+"off",pointsoff,0.03,true,leni-i-1); pointsoff.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z));
// }else if((i+1)<leni){
// scope.initanimate(modelon,switchmodel.animacode+modelon.name+"on",pointson,0.03,true,switchmodel.animacode+orderdata[i+1].name+"on");
// scope.initanimate(modelon,switchmodel.animacode+modelon.name+"off",pointsoff,0.03,true,switchmodel.animacode+orderdata[i-1].name+"off");
// }else{
// scope.initanimate(modelon,switchmodel.animacode+modelon.name+"on",pointson,0.03,true);
// scope.initanimate(modelon,switchmodel.animacode+modelon.name+"off",pointsoff,0.03,true,switchmodel.animacode+orderdata[i-1].name+"off");
// }
// if(switchmodel.children[i].name == "xinpian"){ // if(i == 0){
// } scope.initanimate(scope.animatelist[switchmodel.animacode+"on"],modelon,switchmodel.animacode+modelon.name+"on",pointson,0.03,true,i);
// if(switchmodel.children[i].name =="cigang"){ scope.initanimate(scope.animatelist[switchmodel.animacode+"off"],modelon,switchmodel.animacode+modelon.name+"off",pointsoff,0.03,true,leni-i-1);
// } // }else if((i+1)<leni){
} // scope.initanimate(modelon,switchmodel.animacode+modelon.name+"on",pointson,0.03,true,switchmodel.animacode+orderdata[i+1].name+"on");
// scope.initanimate(modelon,switchmodel.animacode+modelon.name+"off",pointsoff,0.03,true,switchmodel.animacode+orderdata[i-1].name+"off");
// }else{
// scope.initanimate(modelon,switchmodel.animacode+modelon.name+"on",pointson,0.03,true);
// scope.initanimate(modelon,switchmodel.animacode+modelon.name+"off",pointsoff,0.03,true,switchmodel.animacode+orderdata[i-1].name+"off");
// }
// if(switchmodel.children[i].name == "xinpian"){
// }
// if(switchmodel.children[i].name =="cigang"){
// }
}
} }
//动画对象定义 //动画对象定义
this.initanimate = function(list,modelobject,name,points,speed,type,nextname){ this.initanimate = function(list,modelobject,name,points,speed,type,nextname){
let curve = new THREE.CatmullRomCurve3(points); let curve = new THREE.CatmullRomCurve3(points);
// curve动画轨迹 // curve动画轨迹
// progress动画进度 // progress动画进度
// enable当前动画开关 // enable当前动画开关
@ -273,14 +264,9 @@ export function Moveanimate(main){
} }
list[nextname].push(animate); list[nextname].push(animate);
if(nextname){
// list[nextname] = animate;
// animate.next = nextname;
}else{
// list.push(animate);
}
} }
//设置动画播放列表
this.setplaylist = function(nowlist,enable){ this.setplaylist = function(nowlist,enable){
scope.playlist = nowlist; scope.playlist = nowlist;
@ -290,6 +276,8 @@ export function Moveanimate(main){
scope.playlist[scope.playorder][i].status = "start"; scope.playlist[scope.playorder][i].status = "start";
} }
} }
//更新信息plane内容
this.updatehelpbox = function(nowhelpbox,nowtextplane){ this.updatehelpbox = function(nowhelpbox,nowtextplane){
scope.textplane = nowtextplane; scope.textplane = nowtextplane;
scope.helpbox = nowhelpbox; scope.helpbox = nowhelpbox;
@ -298,15 +286,17 @@ export function Moveanimate(main){
this.startstop = function(){ this.startstop = function(){
} }
this.next = function(){ this.next = function(){
} }
this.before = function(){ this.before = function(){
} }
//动画播放器 //动画播放器
this.animateupdate = function(){ this.animateupdate = function(){
// console.log(scope.animatelist);
if(scope.enable){ if(scope.enable){
if(scope.playlist){ if(scope.playlist){
@ -325,7 +315,6 @@ export function Moveanimate(main){
scope.playlist[scope.playorder][i].status = "end"; scope.playlist[scope.playorder][i].status = "end";
scope.playlist[scope.playorder][i].progress = 0; scope.playlist[scope.playorder][i].progress = 0;
if(i >= scope.playlist[scope.playorder].length-1){ if(i >= scope.playlist[scope.playorder].length-1){
if(scope.playorder >= scope.playlist.length-1 ){ if(scope.playorder >= scope.playlist.length-1 ){
scope.playlist = null; scope.playlist = null;
@ -340,7 +329,6 @@ export function Moveanimate(main){
} }
} }
}else{ }else{
// console.log(scope.animatelist[k].connectmodel); // console.log(scope.animatelist[k].connectmodel);
if(scope.nowmodelname != scope.playlist[scope.playorder][i].connectmodel.name){ if(scope.nowmodelname != scope.playlist[scope.playorder][i].connectmodel.name){
@ -383,5 +371,4 @@ export function Moveanimate(main){
} }
} }
} }

View File

@ -1,8 +1,8 @@
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js'; import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
//信号机贴图
export function Signallightload(lights) { export function Signallightload(lights) {
settexture(lights, "red", JL3D_LOCAL_STATIC+'/MODEL/device/signal/1.jpg'); settexture(lights, "red", JL3D_LOCAL_STATIC+'/MODEL/device/signal/1.jpg');
settexture(lights, "yellow", JL3D_LOCAL_STATIC+'/MODEL/device/signal/2.jpg'); settexture(lights, "yellow", JL3D_LOCAL_STATIC+'/MODEL/device/signal/2.jpg');
@ -12,6 +12,7 @@ export function Signallightload(lights) {
settexture(lights, "black", JL3D_LOCAL_STATIC+'/MODEL/device/signal/4.jpg'); settexture(lights, "black", JL3D_LOCAL_STATIC+'/MODEL/device/signal/4.jpg');
} }
//加载贴图
function settexture(lights, name, textureurl) { function settexture(lights, name, textureurl) {
var loader = new THREE.TextureLoader(); var loader = new THREE.TextureLoader();

View File

@ -4,13 +4,6 @@ export function Textconfig(){
this.devicelist = []; this.devicelist = [];
this.jdqinit = function(){
}
this.jdqraycast = function(){
}
//配置继电器文字信息 //配置继电器文字信息
this.initdevicetext = function(selectmodel){ this.initdevicetext = function(selectmodel){

View File

@ -1,729 +0,0 @@
import { Staticmodel } from '@/jlmap3d/jl3ddevice/config.js';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
//loader
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
import { ModelManager } from '@/jlmap3d/jl3ddevice/loader.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 StompClient from '@/utils/sock';
var clock = new THREE.Clock();
export function Jl3ddevice(dom,group,token) {
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;
//点击事件状态
this.raycasterstatus = false;
//动画状态
this.animastats = false;
//当前选中模型
this.nowobject = null;
//当前动画播放模型
this.animationmodel = null;
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(dom.offsetWidth, dom.offsetHeight);
this.renderer.shadowMap.enabled = true;
this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
this.dom.appendChild(this.renderer.domElement);
//定义相机
this.camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 120);
this.camera.position.set(0, 20, 30);
this.camera.aspect = dom.offsetWidth / dom.offsetHeight;
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 ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
this.scene.add(ambientLight);
var spotLight = new THREE.SpotLight(0xffffff);
spotLight.position.set(-50, 60, 15);
spotLight.castShadow = true;
spotLight.shadow.mapSize.width = 1024;
spotLight.shadow.mapSize.height = 1024;
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.update();
this.selectmodel = null;
let moveanima = new Moveanimate(scope);
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{
scope.updateaction(data);
}
}
window.onresize = function () {
scope.camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight;
scope.camera.updateProjectionMatrix();
scope.renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
}
this.domresize = function(){
scope.camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight;
scope.camera.updateProjectionMatrix();
scope.renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
}
this.anime = null;
this.modelmanager = new ModelManager();
this.modelmanager.loadpromise(Staticmodel, scope.mixers).then(function (data) {
moveanima.initlistnew(scope.modelmanager.switchmodel.mesh);
daochamodel = scope.modelmanager.switchmodel.mesh.getObjectByName("DAOCHA");
animate();
})
//循环渲染函数
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.selectmodel = function (data) {
if (scope.showmodel) {
scope.nowcode = data.body.code;
if (scope.showmodel.code != data.body.code) {
scope.scene.remove(scope.showmodel);
scope.showmodel = null
if (data.body._type == "Switch") {
scope.modelmanager.switchmodel.locateType = data.body.locateType;
scope.modelmanager.switchmodel.code = data.body.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.body._type == "Signal") {
scope.modelmanager.signalmodel.code = data.body.code;
scope.showmodel = scope.modelmanager.signalmodel.mesh;
scope.scene.add(scope.showmodel);
}
if (data.body._type == "StationStand") {
scope.modelmanager.standmodel.code = data.body.code;
scope.showmodel = scope.modelmanager.standmodel.mesh;
scope.scene.add(scope.showmodel);
}
if(scope.showmodel){
scope.resetmodel();
scope.showmodel.code = data.code;
initstatus(data);
}
}
} else {
if (data.body._type == "Switch") {
scope.modelmanager.switchmodel.locateType = data.body.locateType;
scope.modelmanager.switchmodel.code = data.body.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;
if (data.body.locateType == "01") {
scope.modelmanager.switchmodel.locateType = "01";
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.body.locateType == "02") {
scope.modelmanager.switchmodel.locateType = "02";
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{
scope.raycasterstatus = false;
scope.nowobject = "";
updatemenulist();
}
if (data.body._type == "Signal") {
scope.modelmanager.signalmodel.code = data.body.code;
scope.showmodel = scope.modelmanager.signalmodel.mesh;
scope.scene.add(scope.showmodel);
}
if (data.body._type == "StationStand") {
scope.modelmanager.standmodel.code = data.body.code;
scope.showmodel = scope.modelmanager.standmodel.mesh;
scope.scene.add(scope.showmodel);
}
initstatus(data);
}
}
this.updateaction = function (data) {
if (data.body._type == "Switch") {
if (data.body.code == scope.modelmanager.switchmodel.code) {
if (scope.modelmanager.switchmodel.locateType != data.body.locateType) {
if (data.body.locateType == "03" && scope.modelmanager.switchmodel.locateType == "01") {
scope.modelmanager.switchmodel.locateType = "02";
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.body.locateType == "03" && scope.modelmanager.switchmodel.locateType == "02") {
scope.modelmanager.switchmodel.locateType = "01";
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.body._type == "Signal") {//从上往下红绿黄
if (data.body.code == scope.modelmanager.signalmodel.code) {
scope.modelmanager.signalmodel.status = data.body.status;
if (data.body.lightType == "01") {
if (data.body.status == "01") {
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"];
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
scope.modelmanager.signalmodel.mesh.children[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.body.status == "02") {
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["green"];
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
}
//开放侧向
if (data.body.status == "03") {
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["yellow"];
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.body.status == "04") {
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"];
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["yellow"];
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.body.status == "05") {
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.body.status == "06") {
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;
}
} else if (data.body.lightType == "02") {
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.body._type == "StationStand") {
if (data.body.code == scope.modelmanager.standmodel.code) {
if (data.body.screenDoorOpenStatus == "02" && scope.modelmanager.standmodel.screenDoorOpenStatus == "01") {
scope.modelmanager.standmodel.screenDoorOpenStatus = "00";
}
if (data.body.screenDoorOpenStatus == "02" && scope.modelmanager.standmodel.screenDoorOpenStatus == "00") {
scope.modelmanager.standmodel.screenDoorOpenStatus = "02";
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = 0;
scope.modelmanager.standmodel.action.timeScale = 1;
scope.modelmanager.standmodel.action.play();
}
if (data.body.screenDoorOpenStatus == "01" && scope.modelmanager.standmodel.screenDoorOpenStatus == "02") {
scope.modelmanager.standmodel.screenDoorOpenStatus = "00";
}
if (data.body.screenDoorOpenStatus == "01" && scope.modelmanager.standmodel.screenDoorOpenStatus == "00") {
scope.modelmanager.standmodel.screenDoorOpenStatus = "01";
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.
}
function initstatus(data) {
if (data.body._type == "Switch") {
if (data.body.locateType == "01") {
scope.modelmanager.switchmodel.locateType = "01";
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.body.locateType == "02") {
scope.modelmanager.switchmodel.locateType = "02";
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.body._type == "Signal") {
if (data.body.lightType == "01") {
if (data.body.status == "01") {
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"];
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
scope.modelmanager.signalmodel.mesh.children[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.body.status == "02") {
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["green"];
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.body.switchLocateType == "03") {
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["yellow"];
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
}
//引导
if (data.body.status == "03") {
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"];
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
scope.modelmanager.signalmodel.mesh.children[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["yellow"];
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
}
//封锁
if (data.body.status == "04") {
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.body.status == "05") {
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;
}
} else if (data.body.lightType == "02") {
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.body._type == "StationStand") {
if (data.body.code == scope.modelmanager.standmodel.code) {
if (data.body.screenDoorOpenStatus == "02") {
scope.modelmanager.standmodel.screenDoorOpenStatus = "02";
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.body.screenDoorOpenStatus == "01") {
scope.modelmanager.standmodel.screenDoorOpenStatus = "01";
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = 0;
scope.modelmanager.standmodel.action.timeScale = -1;
scope.modelmanager.standmodel.action.play();
}
}
}
}
//设备分解、归位动画按钮
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.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;
}
}
}
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 = JL3D_LOCAL_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;
}
this.hideswitch = function (nowswitchstatus){
if(nowswitchstatus){
scope.modelmanager.switchmodel.mesh.add(daochamodel);
}else{
scope.modelmanager.switchmodel.mesh.remove(daochamodel);
}
}
}

View File

@ -62,7 +62,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
this.dom.appendChild(this.renderer.domElement); this.dom.appendChild(this.renderer.domElement);
//定义相机 //定义相机
this.camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 200); this.camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 200);
this.camera.position.set(0, 20, 30); this.camera.position.set(0, 20, 30);
this.camera.aspect = dom.offsetWidth / dom.offsetHeight; this.camera.aspect = dom.offsetWidth / dom.offsetHeight;
@ -87,7 +86,7 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3); let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
this.scene.add(ambientLight); this.scene.add(ambientLight);
//区域聚光灯
var spotLight = new THREE.SpotLight(0xececff); var spotLight = new THREE.SpotLight(0xececff);
spotLight.position.set(-50, 80, 0); spotLight.position.set(-50, 80, 0);
spotLight.castShadow = true; spotLight.castShadow = true;
@ -95,8 +94,7 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
spotLight.shadow.mapSize.height = 2048; spotLight.shadow.mapSize.height = 2048;
this.scene.add(spotLight); this.scene.add(spotLight);
//定义轨道视角控制器
this.controls = new THREE.OrbitControls(this.camera, dom); this.controls = new THREE.OrbitControls(this.camera, dom);
this.controls.maxPolarAngle = Math.PI / 2; this.controls.maxPolarAngle = Math.PI / 2;
this.controls.minPolarangle = Math.PI / 5; this.controls.minPolarangle = Math.PI / 5;
@ -162,6 +160,7 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
} }
} }
}); });
document.addEventListener( "mousedown", onselect, false ); document.addEventListener( "mousedown", onselect, false );
let teststomp = new StompClient(); let teststomp = new StompClient();
@ -206,12 +205,9 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
location.reload(); location.reload();
}); });
} }
// }
} }
window.onresize = function () {
window.onresize = function () {
// if(scope.windowstatus){ // if(scope.windowstatus){
// changeelement.style.width = '50%'; // changeelement.style.width = '50%';
@ -234,22 +230,18 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
scope.renderer.setSize(window.innerWidth, scope.dom.offsetHeight); scope.renderer.setSize(window.innerWidth, scope.dom.offsetHeight);
} }
// }
} }
this.domresize = function(){ this.domresize = function(){
scope.camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight; scope.camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight;
scope.camera.updateProjectionMatrix(); scope.camera.updateProjectionMatrix();
scope.renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight); scope.renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
} }
this.anime = null; this.anime = null;
this.modelmanager = new ModelManager(); this.modelmanager = new ModelManager();
getPublish3dMapDetail(skinCode).then(netdata => { getPublish3dMapDetail(skinCode).then(netdata => {
let netDataAssets = JSON.parse(netdata.data.assets); let netDataAssets = JSON.parse(netdata.data.assets);
@ -283,6 +275,7 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
}); });
//初始化屏蔽门贴图
function setpsdstationmap(stationlist){ function setpsdstationmap(stationlist){
for(let i=0,leni=stationlist.length;i<leni;i++){ for(let i=0,leni=stationlist.length;i<leni;i++){
psdtexturemap[stationlist[i].stands[0].code] = stationlist[i].code; psdtexturemap[stationlist[i].stands[0].code] = stationlist[i].code;
@ -299,7 +292,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
scope.renderer.render(scope.scene, scope.camera); scope.renderer.render(scope.scene, scope.camera);
scope.controls.update(); scope.controls.update();
//scope.camera.lookAt(plane); //scope.camera.lookAt(plane);
//
moveanima.animateupdate(); moveanima.animateupdate();
let delta = clock.getDelta(); let delta = clock.getDelta();
if (scope.mixers) { if (scope.mixers) {
@ -309,20 +301,16 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
} }
} }
} }
} }
//隐藏道岔
this.hideswitch = function (nowswitchstatus){ this.hideswitch = function (nowswitchstatus){
if(nowswitchstatus){ if(nowswitchstatus){
scope.modelmanager.switchmodel.mesh.add(daochamodel); scope.modelmanager.switchmodel.mesh.add(daochamodel);
}else{ }else{
scope.modelmanager.switchmodel.mesh.remove(daochamodel); scope.modelmanager.switchmodel.mesh.remove(daochamodel);
} }
} }
//选择模型
this.selectmodel = function (data) { this.selectmodel = function (data) {
// scope.modelmanager // scope.modelmanager
if (scope.showmodel) { if (scope.showmodel) {
@ -353,7 +341,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
scope.modelmanager.signalmodel.code = data.code; scope.modelmanager.signalmodel.code = data.code;
scope.showmodel = scope.modelmanager.signalmodel.mesh; scope.showmodel = scope.modelmanager.signalmodel.mesh;
scope.scene.add(scope.showmodel); scope.scene.add(scope.showmodel);
} }
if (data._type == "Psd") { if (data._type == "Psd") {
@ -517,7 +504,7 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
} }
scope.animationmodel = null; scope.animationmodel = null;
} }
//根据数据切换设备样式
this.updateaction = function (data) { this.updateaction = function (data) {
if (data.type == "SWITCH") { if (data.type == "SWITCH") {
if (data.normal == "0") { if (data.normal == "0") {
@ -559,7 +546,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
} }
} }
if (data.type == "PSD" || data.type == "STAND") { if (data.type == "PSD" || data.type == "STAND") {
if (data.code == scope.nowcode) { if (data.code == scope.nowcode) {
if (data.open == "1" ) { if (data.open == "1" ) {
@ -570,8 +556,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
scope.modelmanager.standmodel.action.timeScale = 1; scope.modelmanager.standmodel.action.timeScale = 1;
scope.modelmanager.standmodel.action.play(); scope.modelmanager.standmodel.action.play();
console.log(data); console.log(data);
console.log();
localVoicePlay("开往"+psdVoiceStationList[data.code].finlStationName+"方向的列车进站了!"); localVoicePlay("开往"+psdVoiceStationList[data.code].finlStationName+"方向的列车进站了!");
} }
@ -607,7 +591,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
scope.modelmanager.standmodel.action.play(); scope.modelmanager.standmodel.action.play();
} }
} }
this.deviceFaultOver = function (data) { this.deviceFaultOver = function (data) {
@ -680,7 +663,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
scope.modelmanager.switchmodel.action.timeScale = -1; scope.modelmanager.switchmodel.action.timeScale = -1;
scope.modelmanager.switchmodel.action.play(); scope.modelmanager.switchmodel.action.play();
} }
} }
} }
@ -715,13 +697,11 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"]; scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
} }
} }
if (data._type == "Psd") { if (data._type == "Psd") {
if (data.screenDoorOpenStatus == "0") { if (data.screenDoorOpenStatus == "0") {
scope.modelmanager.standmodel.screenDoorOpenStatus = "0"; scope.modelmanager.standmodel.screenDoorOpenStatus = "0";
scope.modelmanager.standmodel.action.reset(); scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration; scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration;
scope.modelmanager.standmodel.action.timeScale = 1; scope.modelmanager.standmodel.action.timeScale = 1;
@ -730,7 +710,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
if (data.screenDoorOpenStatus == "1") { if (data.screenDoorOpenStatus == "1") {
scope.modelmanager.standmodel.screenDoorOpenStatus = "1"; scope.modelmanager.standmodel.screenDoorOpenStatus = "1";
scope.modelmanager.standmodel.action.reset(); scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = 0; scope.modelmanager.standmodel.action.time = 0;
scope.modelmanager.standmodel.action.timeScale = -1; scope.modelmanager.standmodel.action.timeScale = -1;
@ -750,11 +729,12 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
} }
} }
this.updatewindowstatus = function(nowwindowstatus){ this.updatewindowstatus = function(nowwindowstatus){
scope.windowstatus == nowwindowstatus; scope.windowstatus == nowwindowstatus;
} }
//
function onselect(event){ function onselect(event){
if(event.button == '0'){ if(event.button == '0'){
@ -775,7 +755,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
raycaster.setFromCamera( mouse, scope.camera ); raycaster.setFromCamera( mouse, scope.camera );
let intersects = raycaster.intersectObjects( scope.modelmanager.switchmodel.mesh.children,true); let intersects = raycaster.intersectObjects( scope.modelmanager.switchmodel.mesh.children,true);
if(helpbox){ if(helpbox){
scope.scene.remove( helpbox ); scope.scene.remove( helpbox );
@ -787,8 +766,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
textplane.material.dispose(); textplane.material.dispose();
} }
if(intersects[0]){ if(intersects[0]){
if(intersects[0].object.raycastoff){ if(intersects[0].object.raycastoff){
helpbox = new THREE.BoxHelper( intersects[0].object.parent, 0xff0000 ); helpbox = new THREE.BoxHelper( intersects[0].object.parent, 0xff0000 );
settext(intersects[0].object.parent,intersects[0].point); settext(intersects[0].object.parent,intersects[0].point);
@ -798,9 +775,7 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 ); helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
settext(intersects[0].object,intersects[0].point); settext(intersects[0].object,intersects[0].point);
getdevicemsg(intersects[0].object.name); getdevicemsg(intersects[0].object.name);
} }
scope.scene.add( helpbox ); scope.scene.add( helpbox );
} }
} }
@ -832,7 +807,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
textplane.lookAt(scope.camera.position); textplane.lookAt(scope.camera.position);
// scope.textlist.push(textplane); // scope.textlist.push(textplane);
// newmesh.children[0].add(textplane); // newmesh.children[0].add(textplane);
scope.scene.add(textplane); scope.scene.add(textplane);
textgeometry.dispose(); textgeometry.dispose();
@ -845,28 +819,28 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
//canvas文字贴图方法 //canvas文字贴图方法
//PS:待提炼 增强功能 //PS:待提炼 增强功能
function getTextCanvas(text){ function getTextCanvas(text){
var canvas = document.getElementById('canvastexture'); var canvas = document.getElementById('canvastexture');
canvas.width = 256; canvas.width = 256;
canvas.height = 128; canvas.height = 128;
var ctx = canvas.getContext('2d'); var ctx = canvas.getContext('2d');
//var bg = canvas.createPattern(img, "no-repeat"); //var bg = canvas.createPattern(img, "no-repeat");
//ctx.fillStyle = bg; //ctx.fillStyle = bg;
ctx.fillRect(0, 0,256,128); ctx.fillRect(0, 0,256,128);
ctx.font = "20px Verdana"; ctx.font = "20px Verdana";
ctx.fillStyle = '#FFFFFF'; ctx.fillStyle = '#FFFFFF';
ctx.textAlign = 'center'; ctx.textAlign = 'center';
ctx.textBaseline = 'middle'; ctx.textBaseline = 'middle';
ctx.clearRect(0,0,256,128); ctx.clearRect(0,0,256,128);
ctx.drawImage(beauty,0,0,256, 128); ctx.drawImage(beauty,0,0,256, 128);
ctx.fillText("设备部件:"+text, 90,30); ctx.fillText("设备部件:"+text, 90,30);
// ctx.fillText("车组人员:XXX", 40,20); // ctx.fillText("车组人员:XXX", 40,20);
// ctx.fillText("速度:XXX.XXX", 40,30); // ctx.fillText("速度:XXX.XXX", 40,30);
//ctx.fillText(text.trainModel.name, width/2,height*3/4); //ctx.fillText(text.trainModel.name, width/2,height*3/4);
let data = ctx.getImageData(0, 0,256, 128); let data = ctx.getImageData(0, 0,256, 128);
return data; return data;
} }
let voiceSelect; let voiceSelect;
@ -882,18 +856,16 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
} }
function localVoicePlay(playText) { function localVoicePlay(playText) {
localVoiceCancel(); localVoiceCancel();
let toSpeak = new SpeechSynthesisUtterance(playText); let toSpeak = new SpeechSynthesisUtterance(playText);
toSpeak.rate = 0.7; toSpeak.rate = 0.7;
toSpeak.voice = voiceSelect; toSpeak.voice = voiceSelect;
window.speechSynthesis.speak(toSpeak);
}
window.speechSynthesis.speak(toSpeak);
}
function localVoiceCancel() { function localVoiceCancel() {
window.speechSynthesis.cancel(); window.speechSynthesis.cancel();
} }
} }

View File

@ -4,7 +4,6 @@ export function Standtextureload(jlmap3dedit,standTextureData){
for(let i=0,leni=standTextureData.urls.length;i<leni;i++){ for(let i=0,leni=standTextureData.urls.length;i<leni;i++){
setstationtexture(jlmap3dedit.stationtexture,standTextureData.urls[i].name,BASE_ASSET_API + standTextureData.urls[i].url); setstationtexture(jlmap3dedit.stationtexture,standTextureData.urls[i].name,BASE_ASSET_API + standTextureData.urls[i].url);
} }
} }
function settexture(materiallist,name,textureurl){ function settexture(materiallist,name,textureurl){

View File

@ -530,68 +530,71 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
}else if(data[i].deviceType == "PSD"){ }else if(data[i].deviceType == "PSD"){
initstand(data[i]); initstand(data[i]);
}else{ }else{
console.log(data[i]);
} }
} }
} }
function DeviceDestroy(data){ function DeviceDestroy(data){
for(let i=0,leni=data.body.deviceList.length;i<leni;i++){ if(data.body.deviceList.length){
for(let i=0,leni=data.body.deviceList.length;i<leni;i++){
if(data.body.deviceList[i].type == "TRAIN"){ if(data.body.deviceList[i].type == "TRAIN"){
code =data.body.deviceList[i].code; code =data.body.deviceList[i].code;
if (trainlisttest.list[code].dispose != data.body.deviceList[i].dispose && data.body.deviceList[i].dispose == "0") { if (trainlisttest.list[code].dispose != data.body.deviceList[i].dispose && data.body.deviceList[i].dispose == "0") {
if (rails.sectionrail[data.body.deviceList[i].section]) { if (rails.sectionrail[data.body.deviceList[i].section]) {
trainlisttest.group.add(trainlisttest.list[code]); trainlisttest.group.add(trainlisttest.list[code]);
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
// trainlisttest.list[code].progress = 0; // trainlisttest.list[code].progress = 0;
trainlisttest.list[code].dispose = "0"; trainlisttest.list[code].dispose = "0";
trainlisttest.list[code].nowcode = data.body.deviceList[i].section; trainlisttest.list[code].nowcode = data.body.deviceList[i].section;
trainlisttest.list[code].nextcode = null; 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.deviceList[i].dispose && data.body.deviceList[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].curve = null;
trainlisttest.list[code].nextcurve = 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; 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.deviceList[i].dispose && data.body.deviceList[i].dispose == "1") { }
trainlisttest.list[code].status = 1; if(data.body.deviceList[i].type == "SIGNAL"){
trainlisttest.group.remove(trainlisttest.list[code]); signalupdate(data.body.deviceList[i]);
trainlisttest.list[code].progress = null; }
trainlisttest.list[code].dispose = "1"; if(data.body.deviceList[i].type == "SWITCH"){
code = trainlisttest.group.children[i].name; switchupdate(data.body.deviceList[i]);
trainlisttest.list[code].rotation.y = 0; }
trainlisttest.list[code].open = '1'; if(data.body.deviceList[i].type == "PSD"){
trainlisttest.list[code].curve = null; standupdate(data.body.deviceList[i]);
trainlisttest.list[code].nextcurve = null; }
trainlisttest.list[code].speed = 0; if(data.body.deviceList[i].type == "TRAIN_DOOR"){
trainlisttest.list[code].position.x = -50000; traindoorupdate(data.body.deviceList[i]);
trainlisttest.list[code].position.y = -50000;
trainlisttest.list[code].pc = 1;
} }
} }
if(data.body.deviceList[i].type == "SIGNAL"){
signalupdate(data.body.deviceList[i]);
}
if(data.body.deviceList[i].type == "SWITCH"){
switchupdate(data.body.deviceList[i]);
}
if(data.body.deviceList[i].type == "PSD"){
standupdate(data.body.deviceList[i]);
}
if(data.body.deviceList[i].type == "TRAIN_DOOR"){
traindoorupdate(data.body.deviceList[i]);
}
} }
} }
function traindoorupdate(data){ function traindoorupdate(data){

View File

@ -1,4 +1,4 @@
//行车逻辑
export function UpdateTrain(camera,traindata){ export function UpdateTrain(camera,traindata){
if(traindata != undefined ){ if(traindata != undefined ){
for(let j=traindata.group.children.length-1;j>=0;j--){ for(let j=traindata.group.children.length-1;j>=0;j--){

View File

@ -37,7 +37,6 @@ var clock = new THREE.Clock();
export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
let scope = this; let scope = this;
this.dom = dom; this.dom = dom;
@ -46,8 +45,10 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
renderer.domElement.style.position = "absolute"; renderer.domElement.style.position = "absolute";
renderer.domElement.style.top = "0"; renderer.domElement.style.top = "0";
document.getElementById('testjlmap3d').appendChild(renderer.domElement); document.getElementById('testjlmap3d').appendChild(renderer.domElement);
//定义相机 //定义相机
let camera = SetCamera(dom); let camera = SetCamera(dom);
//定义场景(渲染容器) //定义场景(渲染容器)
let scene = SetScene(project); let scene = SetScene(project);
let scenesimulation = new THREE.Group(); let scenesimulation = new THREE.Group();
@ -79,6 +80,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
//模型操作命令组 //模型操作命令组
this.actions = {}; this.actions = {};
//设备数据
let sectionlist = null; let sectionlist = null;
let linklist = null; let linklist = null;
let signallist = null; let signallist = null;
@ -87,16 +89,17 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
let realsectionlist = null; let realsectionlist = null;
let rails = null; let rails = null;
//轨道相机
let camerarail = { let camerarail = {
curve:null, curve:null,
progress:0, progress:0,
moveswitch:false moveswitch:false
}; };
//地图模型数据 //地图模型数据
let mapdata = new Jl3ddata(); let mapdata = new Jl3ddata();
//订阅仿真socket //订阅仿真socket
this.webwork = new Worker(JL3D_LOCAL_STATIC+"/workertest/trainworker.js"); this.webwork = new Worker(JL3D_LOCAL_STATIC+"/workertest/trainworker.js");
//初始化加载数据和模型getPublishMapDetail //初始化加载数据和模型getPublishMapDetail
getPublishMapDetail(skinCode).then(data => { getPublishMapDetail(skinCode).then(data => {
@ -110,46 +113,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
SimulationLoadNew(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod); SimulationLoadNew(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
}); });
}); });
//
// let stats = new Stats();
// dom.appendChild( stats.dom );
// var timer = setInterval(function() {
// if(trainlisttest){
// if(trainlisttest.group){
// if(trainlisttest.group.children[0]){
// for(let k in rails.switchrail){
// const ddd = storemod.getters['map/getDeviceByCode'](k);
// let switchdata = rails.switchrail[k];
// rails.switchrail[k].locateType = ddd.locateType;
//
// if(ddd.locateType == "01"){
// //1--向左 2--向右
// //__\__ __/__
// if(rails.switchrail[k].directtype == "1"){
// rails.linkrail[switchdata.alink].lconnect = switchdata.blink;
// rails.linkrail[switchdata.blink].rconnect = switchdata.alink;
// }else if(rails.switchrail[k].directtype == "2"){
// rails.linkrail[switchdata.alink].rconnect = switchdata.blink;
// rails.linkrail[switchdata.blink].lconnect = switchdata.alink;
// }
//
// }else if(ddd.locateType == "02"){
// if(rails.switchrail[k].directtype == "1"){
// rails.linkrail[switchdata.alink].lconnect = switchdata.clink;
// rails.linkrail[switchdata.clink].rconnect = switchdata.alink;
// }else if(rails.switchrail[k].directtype == "2"){
// rails.linkrail[switchdata.alink].rconnect = switchdata.clink;
// rails.linkrail[switchdata.clink].lconnect = switchdata.alink;
// }
// }
// }
// clearInterval(timer);
// }
// }
// }
//
// }, 2000);
//开启渲染 //开启渲染
animate(); animate();
startWorker(scope.webwork); startWorker(scope.webwork);
@ -158,18 +122,13 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
//循环渲染函数 //循环渲染函数
function animate() { function animate() {
//循环渲染 //循环渲染
//requestAnimationFrame(animate);
//renderer.setAnimationLoop(animate);
requestAnimationFrame(animate); requestAnimationFrame(animate);
//判断渲染是否开启 //根据相机渲染场景
//根据相机渲染场景
renderer.render(scene,camera); renderer.render(scene,camera);
//检测动画构造器播放动画
// }
// stats.update(); // stats.update();
} }
//利用webworker当做定时器驱动设备动画更新列车状态车站漫游动画
function startWorker(webwork){ function startWorker(webwork){
if(typeof(Worker)!=="undefined"){ if(typeof(Worker)!=="undefined"){
@ -181,6 +140,15 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
UpdateTrain(camera,trainlisttest); UpdateTrain(camera,trainlisttest);
} }
delta = clock.getDelta();
for(let i=scope.mixers.length-1;i>=0;i--){
if(scope.mixers[i]._actions[0].isRunning()){
// console.log(scope.mixers[i]._actions[0].isRunning());
scope.mixers[i].update( delta );
}
}
//开启车站漫游
if(camerarail.moveswitch == true){ if(camerarail.moveswitch == true){
// console.log(camerarail.progress); // console.log(camerarail.progress);
if(camerarail.progress>=0.99){ if(camerarail.progress>=0.99){
@ -201,18 +169,12 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
} }
delta = clock.getDelta();
for(let i=scope.mixers.length-1;i>=0;i--){
if(scope.mixers[i]._actions[0].isRunning()){
// console.log(scope.mixers[i]._actions[0].isRunning());
scope.mixers[i].update( delta );
}
}
}; };
} }
} }
//释放场景缓存关闭渲染循环
this.dispose = function(){ this.dispose = function(){
renderer.setAnimationLoop(null); renderer.setAnimationLoop(null);
renderer.dispose(); renderer.dispose();
@ -242,6 +204,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
} }
}; };
//切换显示车站信息
this.showstationmsg = function(showtype){ this.showstationmsg = function(showtype){
if(showtype == "show"){ if(showtype == "show"){
for(let st=0;st<stationstandlist.group.children.length;st++){ for(let st=0;st<stationstandlist.group.children.length;st++){
@ -254,6 +217,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
} }
}; };
//切换显示列车信息
this.showtrainmsg = function(showtype){ this.showtrainmsg = function(showtype){
console.log(trainlisttest); console.log(trainlisttest);
if(showtype == "show"){ if(showtype == "show"){
@ -267,24 +231,23 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
} }
}; };
// this.restart = function(){ //开启轨道镜头交互
// ReStart(mapdata);
// };
this.animateon = function(){ this.animateon = function(){
controls.enabled = true; controls.enabled = true;
}; };
//关闭轨道镜头交互
this.animateoff = function(){ this.animateoff = function(){
controls.enabled = false; controls.enabled = false;
}; };
//更新加载后数据
this.loaderdata = function(loadsectionlist,loadlinklist,loadsignallist,loadstationstandlist,loadtrainlisttest,loadrealsectionlist,loadrails){ this.loaderdata = function(loadsectionlist,loadlinklist,loadsignallist,loadstationstandlist,loadtrainlisttest,loadrealsectionlist,loadrails){
sectionlist = loadsectionlist; sectionlist = loadsectionlist;
linklist = loadlinklist; linklist = loadlinklist;
signallist = loadsignallist; signallist = loadsignallist;
stationstandlist = loadstationstandlist; stationstandlist = loadstationstandlist;
trainlisttest = loadtrainlisttest; trainlisttest = loadtrainlisttest;
realsectionlist = loadrealsectionlist; realsectionlist = loadrealsectionlist;
rails = loadrails; rails = loadrails;
@ -307,8 +270,8 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
window.removeEventListener( 'resize', onWindowResize, false ); window.removeEventListener( 'resize', onWindowResize, false );
}; };
//根据菜单选项切换相机位置
this.updatecamera = function(mesh,type){ this.updatecamera = function(mesh,type){
//console.log(mesh);
if(type == "station"){ if(type == "station"){
camera.position.x = mesh.position.x; camera.position.x = mesh.position.x;
camera.position.y = mesh.position.y+800; camera.position.y = mesh.position.y+800;
@ -330,8 +293,8 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
controls.update(); controls.update();
} }
//窗口自适应
function onWindowResize() { function onWindowResize() {
//窗口自适应
camera.aspect = window.innerWidth / window.innerHeight; camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix(); camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight ); renderer.setSize( window.innerWidth, window.innerHeight );
@ -340,7 +303,6 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
//三维交互点击事件函数 //三维交互点击事件函数
function onselect(event) { function onselect(event) {
if(event.button == "0"){ if(event.button == "0"){
//定义光线 //定义光线
let raycaster = new THREE.Raycaster(); let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标 //定义平面鼠标点击坐标

View File

@ -110,6 +110,7 @@ export function StationStandListN() {
if(mode == "02"){ if(mode == "02"){
let textgeometry = new THREE.PlaneBufferGeometry( 65, 90, 1 ); let textgeometry = new THREE.PlaneBufferGeometry( 65, 90, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[i])); let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[i]));
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} ); let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial ); let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = stationdata[i].code; textplane.name = stationdata[i].code;
@ -289,6 +290,7 @@ export function StationStandListN() {
if(mode == "02"){ if(mode == "02"){
let textgeometry = new THREE.PlaneBufferGeometry( 65, 90, 1 ); let textgeometry = new THREE.PlaneBufferGeometry( 65, 90, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(standsdata[i])); let textt = new THREE.CanvasTexture(getTextCanvas(standsdata[i]));
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} ); let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial ); let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = standsdata[i].code; textplane.name = standsdata[i].code;
@ -414,7 +416,9 @@ export function StationStandListN() {
} }
} }
} }
} }
// scene.add(scope.textlist); // scene.add(scope.textlist);
stationdata = null; stationdata = null;
psddata = null; psddata = null;

View File

@ -3,6 +3,7 @@ const mapDeviceStyle = {
'02': 'fuzhou_01', '02': 'fuzhou_01',
'03': 'bejing_01', '03': 'bejing_01',
'04': 'chengdu_03', '04': 'chengdu_03',
'05': 'fuzhou_01',
'06': 'ningbo_01', '06': 'ningbo_01',
'07': 'haerbin_01', '07': 'haerbin_01',
'08': 'foshan_01', '08': 'foshan_01',

View File

@ -266,7 +266,7 @@ class SkinCode extends defaultStyle {
z:1, z:1,
position: 1, // 停跳方向 position: 1, // 停跳方向
text: 'S', // 停跳显示内容 text: 'S', // 停跳显示内容
offset: { x: 10, y: 20 }, offset: { x: 20, y: 21 },
textColor: '#00FF00', // 停跳文字颜色 textColor: '#00FF00', // 停跳文字颜色
fontWeight: 'bold', // 文字居中 fontWeight: 'bold', // 文字居中
fontSize: 18 // 文字大小 fontSize: 18 // 文字大小

View File

@ -688,6 +688,7 @@ class SkinCode extends defaultStyle {
trainServer: { trainServer: {
serviceNumberPrefix: '00', // 服务号(表号)前缀 serviceNumberPrefix: '00', // 服务号(表号)前缀
defaultServiceNumber: 'AA', // 默认服务号(表号) defaultServiceNumber: 'AA', // 默认服务号(表号)
defaultServiceHeadNum: 'MM', // 人工车号
trainServerOffset: { x: 4, y: 4 }// 列车服务号偏移 trainServerOffset: { x: 4, y: 4 }// 列车服务号偏移
}, },
trainTarget: { trainTarget: {

View File

@ -18,7 +18,7 @@ export default class AutomacticRoute extends Group {
this.model = model; this.model = model;
this.style = style; this.style = style;
this.isShowShape = true; this.isShowShape = true;
if (isShowThePrdType(model.prdType, style.AutomaticRoute.displayCondition) || model.previewOrMapDraw) { if (isShowThePrdType(model.prdType, (style.AutomaticRoute || {}).displayCondition) || model.previewOrMapDraw) {
this.create(); this.create();
this.createMouseEvent(); this.createMouseEvent();
this.setState(model); this.setState(model);
@ -134,7 +134,7 @@ export default class AutomacticRoute extends Group {
setShowMode() { setShowMode() {
const showMode = this.model.showMode; const showMode = this.model.showMode;
const showConditions = this.style.AutomaticRoute.displayCondition; const showConditions = (this.style.AutomaticRoute || {}).displayCondition;
if (!showConditions || showConditions === '01' || showMode === showConditions) { if (!showConditions || showConditions === '01' || showMode === showConditions) {
this.showMode(); this.showMode();
} else { } else {

View File

@ -18,7 +18,7 @@ export default class AxleReset extends Group {
this.model = model; this.model = model;
this.style = style; this.style = style;
this.isShowShape = true; this.isShowShape = true;
if (isShowThePrdType(model.prdType, style.AxleReset.displayCondition) || model.previewOrMapDraw) { if (isShowThePrdType(model.prdType, (style.AxleReset || {}).displayCondition) || model.previewOrMapDraw) {
this.create(); this.create();
this.createMouseEvent(); this.createMouseEvent();
this.setState(model); this.setState(model);
@ -129,7 +129,7 @@ export default class AxleReset extends Group {
} }
setShowMode() { setShowMode() {
const showMode = this.model.showMode; const showMode = this.model.showMode;
const showConditions = this.style.AxleReset.displayCondition; const showConditions = (this.style.AxleReset || {}).displayCondition;
if (!showConditions || showConditions === '01' || showMode === showConditions) { if (!showConditions || showConditions === '01' || showMode === showConditions) {
this.showMode(); this.showMode();
} else { } else {

View File

@ -13,7 +13,7 @@ export default class DirectionRod extends Group {
this.model = model; this.model = model;
this.style = style; this.style = style;
this.isShowShape = true; this.isShowShape = true;
if (isShowThePrdType(model.prdType, style.DirectionRod.displayCondition) || model.previewOrMapDraw) { if (isShowThePrdType(model.prdType, (style.DirectionRod || {}).displayCondition) || model.previewOrMapDraw) {
this.create(); this.create();
this.createMouseEvent(); this.createMouseEvent();
this.setState(model); this.setState(model);
@ -91,7 +91,7 @@ export default class DirectionRod extends Group {
setShowMode() { setShowMode() {
const showMode = this.model.showMode; const showMode = this.model.showMode;
const showConditions = this.style.DirectionRod.displayCondition; const showConditions = (this.style.DirectionRod || {}).displayCondition;
if (!showConditions || showConditions === '01' || showMode === showConditions) { if (!showConditions || showConditions === '01' || showMode === showConditions) {
this.showMode(); this.showMode();
} else { } else {

View File

@ -16,7 +16,7 @@ export default class FloodGate extends Group {
this.model = model; this.model = model;
this.style = style; this.style = style;
this.isShowShape = true; this.isShowShape = true;
if (isShowThePrdType(model.prdType, style.FloodGate.displayCondition) || model.previewOrMapDraw) { if (isShowThePrdType(model.prdType, (style.FloodGate || {}).displayCondition) || model.previewOrMapDraw) {
this.create(); this.create();
this.createMouseEvent(); this.createMouseEvent();
this.setState(model); this.setState(model);
@ -58,7 +58,7 @@ export default class FloodGate extends Group {
setShowMode() { setShowMode() {
const showMode = this.model.showMode; const showMode = this.model.showMode;
const showConditions = this.style.FloodGate.displayCondition; const showConditions = (this.style.FloodGate || {}).displayCondition;
if (!showConditions || showConditions === '01' || showMode === showConditions) { if (!showConditions || showConditions === '01' || showMode === showConditions) {
this.showMode(); this.showMode();
} else { } else {

View File

@ -18,7 +18,7 @@ export default class GuideLock extends Group {
this.model = model; this.model = model;
this.style = style; this.style = style;
this.isShowShape = true; this.isShowShape = true;
if (isShowThePrdType(model.prdType, style.GuideLock.displayCondition) || model.previewOrMapDraw) { if (isShowThePrdType(model.prdType, (style.GuideLock || {}).displayCondition) || model.previewOrMapDraw) {
this.create(); this.create();
this.createMouseEvent(); this.createMouseEvent();
this.setState(model); this.setState(model);
@ -134,7 +134,7 @@ export default class GuideLock extends Group {
} }
setShowMode() { setShowMode() {
const showMode = this.model.showMode; const showMode = this.model.showMode;
const showConditions = this.style.GuideLock.displayCondition; const showConditions = (this.style.GuideLock || {}).displayCondition;
if (!showConditions || showConditions === '01' || showMode === showConditions) { if (!showConditions || showConditions === '01' || showMode === showConditions) {
this.showMode(); this.showMode();
} else { } else {

View File

@ -85,6 +85,20 @@ export default class Line2 extends Group {
} }
} }
getBoundingRect() {
const rect = this.line.getBoundingRect().clone();
if (this.model.leftTerminal) {
const subheadText = this.leftTerminal.getBoundingRect().clone();
rect.union(subheadText);
return rect;
}
if (this.model.rightTerminal) {
const subheadText = this.rightTerminal.getBoundingRect().clone();
rect.union(subheadText);
}
return rect;
}
setLineType(type) { setLineType(type) {
switch (type) { switch (type) {
case '01': break; case '01': break;

View File

@ -23,7 +23,7 @@ export default class SaidLamp extends Group {
this.deviceStyle = style[model._type]; this.deviceStyle = style[model._type];
if (this.deviceStyle) { if (this.deviceStyle) {
this.isShowShape = true; this.isShowShape = true;
if (isShowThePrdType(model.prdType, this.deviceStyle.displayCondition) || model.previewOrMapDraw) { if (isShowThePrdType(model.prdType, (this.deviceStyle || {}).displayCondition) || model.previewOrMapDraw) {
this.create(); this.create();
this.createMouseEvent(); this.createMouseEvent();
this.setState(model); this.setState(model);
@ -206,7 +206,7 @@ export default class SaidLamp extends Group {
setShowMode() { setShowMode() {
const showMode = this.model.showMode; const showMode = this.model.showMode;
if (this.deviceStyle) { if (this.deviceStyle) {
const showConditions = this.deviceStyle.displayCondition; const showConditions = (this.deviceStyle || {}).displayCondition;
if (showConditions === '01' || showMode === showConditions) { if (showConditions === '01' || showMode === showConditions) {
this.control && this.control.show(); this.control && this.control.show();
} else { } else {

View File

@ -89,7 +89,7 @@ export default class ELimitLines extends Group {
const beg = Object.assign({}, model.points[0]); const beg = Object.assign({}, model.points[0]);
const end = Object.assign({}, model.points[model.points.length - 1]); const end = Object.assign({}, model.points[model.points.length - 1]);
if (model.isSwitchSection && beg.y !== end.y) { if (model.isSwitchSection && beg.y !== end.y) {
const swch = Vue.prototype.$jlmap.mapDevice[model.switch.code]; // 获取道岔model 及状态数据 const swch = Vue.prototype.$jlmap.mapDevice[model.relSwitchCode]; // 获取道岔model 及状态数据
if (swch && swch.instance) { if (swch && swch.instance) {
const traingle = new JTriangle(swch.intersection, swch.skew); const traingle = new JTriangle(swch.intersection, swch.skew);

View File

@ -126,7 +126,7 @@ class ETextName extends Group {
fontSize: styleModel.fontSize, fontSize: styleModel.fontSize,
fontFamily: styleModel.fontFamily || this.model.style.fontFamily, fontFamily: styleModel.fontFamily || this.model.style.fontFamily,
text: styleName, text: styleName,
textFill: model.approach ? styleModel.approachColor : styleModel.fontColor, textFill: model.approach && this.model.type === 'name' ? styleModel.approachColor : styleModel.fontColor,
textAlign: styleModel.textAlign, textAlign: styleModel.textAlign,
textPosition: styleModel.textPosition || 'inside', textPosition: styleModel.textPosition || 'inside',
textVerticalAlign: styleModel.textVerticalAlign || null textVerticalAlign: styleModel.textVerticalAlign || null

View File

@ -290,7 +290,7 @@ export default class Section extends Group {
getShapeTipPoint() { getShapeTipPoint() {
let rect = this.getBoundingRect(); let rect = this.getBoundingRect();
const distance = this.style.Section.line.width / 2; const distance = this.style.Section.line.width / 2;
if (this.line) { if (this.line && this.line.getBoundingRect()) {
rect = this.line.getBoundingRect(); rect = this.line.getBoundingRect();
} }
return { return {

View File

@ -371,6 +371,10 @@ class Signal extends Group {
} else { } else {
this.lamps[0].setColor(this.style.Signal.lamp.redColor); this.lamps[0].setColor(this.style.Signal.lamp.redColor);
} }
} else if (this.count == 3) {
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.redColor);
this.lamps[1] && this.lamps[1].setColor(this.style.backgroundColor);
this.lamps[2] && this.lamps[2].setColor(this.style.backgroundColor);
} }
} }
} }

View File

@ -160,7 +160,7 @@ export default class StationTurnBack extends Group {
setShowMode() { setShowMode() {
const showMode = this.model.showMode; const showMode = this.model.showMode;
const showConditions = this.style.StationTurnBack.displayCondition; const showConditions = (this.style.StationTurnBack || {}).displayCondition;
if (!showConditions || showConditions == '01' || showMode === showConditions) { if (!showConditions || showConditions == '01' || showMode === showConditions) {
this.eachChild(item => item.show() ); this.eachChild(item => item.show() );
} else { } else {

View File

@ -40,12 +40,22 @@ export default class TrainBody extends Group {
create() { create() {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
const serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceNumber);// 服务号(表号) this.nameFormat = model.nameFormat;
const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode
? (model.directionCode || style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber) ? (model.directionCode || style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber)
: model.tripNumber || style.Train.trainTarget.defaultTripNumber); // 车次号 : model.tripNumber || style.Train.trainTarget.defaultTripNumber); // 车次号
let targetCode = style.Train.trainNumber.targetCodePrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode); // 目的地码
const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (style.Train.trainTargetNumber.lineNumber || '') + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber); // 车组号 const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (style.Train.trainTargetNumber.lineNumber || '') + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber); // 车组号
let serviceNumber = ''; // 服务号(表号)
if (this.model.type == 'PLAN') { // 计划车
serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceNumber);
} else if (this.model.type == 'HEAD') { // 头码车
serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode);
this.nameFormat = 'serviceNumber:groupNumber';
} else if (this.model.type == 'MANUAL') { // 人工车
serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceHeadNum);
this.nameFormat = 'serviceNumber:groupNumber';
}
let targetCode = style.Train.trainNumber.targetCodePrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode); // 目的地码
if (Vue.prototype.$jlmap.lineCode == '09') { // 暂时先写死 后面有了删掉就好 if (Vue.prototype.$jlmap.lineCode == '09') { // 暂时先写死 后面有了删掉就好
targetCode = '01'; targetCode = '01';
} }

View File

@ -2,6 +2,12 @@ import { createSeriesModel, createMarkLineModels, createRectArea, createMartPoin
import { toTimeStamp } from '@/utils/date'; import { toTimeStamp } from '@/utils/date';
export default { export default {
/** 最小时间*/
MinTime: 0,
/** 最大时间*/
MaxTime: 3600*24-1,
/** 边缘高度*/ /** 边缘高度*/
EdgeHeight: 600, EdgeHeight: 600,
@ -13,11 +19,10 @@ export default {
/** 转换model为Rect数据*/ /** 转换model为Rect数据*/
calcAreaArgsByModel(chart, model) { calcAreaArgsByModel(chart, model) {
const startTime = model.startTime;
const endTime = model.endTime;
const fartherKmRange = model.fartherKmRange; const fartherKmRange = model.fartherKmRange;
const closerKmRange = model.closerKmRange; const closerKmRange = model.closerKmRange;
const startTime = model.startTime;
const endTime = model.endTime;
const point1 = [ startTime, this.getCoordinateYByKmRange(fartherKmRange)]; const point1 = [ startTime, this.getCoordinateYByKmRange(fartherKmRange)];
const point2 = [ endTime, this.getCoordinateYByKmRange(closerKmRange)] const point2 = [ endTime, this.getCoordinateYByKmRange(closerKmRange)]
const position1 = chart.convertToPixel('grid', point1); const position1 = chart.convertToPixel('grid', point1);
@ -43,8 +48,8 @@ export default {
planData.areaList && planData.areaList &&
planData.areaList.length) { planData.areaList.length) {
planData.areaList.forEach(model => { planData.areaList.forEach(model => {
model.startTime = toTimeStamp(model.startTime); if (typeof model.startTime == 'string') model.startTime = toTimeStamp(model.startTime);
model.endTime = toTimeStamp(model.endTime); if (typeof model.endTime == 'string') model.endTime = toTimeStamp(model.endTime);
graphs.push(createRectArea(this.calcAreaArgsByModel(chart, model))); graphs.push(createRectArea(this.calcAreaArgsByModel(chart, model)));
}) })
} }
@ -235,13 +240,32 @@ export default {
return null; return null;
}, },
/**限制区域范围 */
limitAreaTime(model) {
if (model) {
model.startTime = model.startTime < this.MinTime
? this.MinTime
: model.startTime > this.MaxTime
? this.MaxTime
: model.startTime;
model.endTime = model.endTime < this.MinTime
? this.MinTime
: model.endTime > this.MaxTime
? this.MaxTime
: model.endTime;
}
return model;
},
/** 检查公里表是否超出范围*/ /** 检查公里表是否超出范围*/
limitAreaKmRange(stations, model) { limitAreaKmRange(stations, model) {
const closerKmRange = model.closerKmRange; const closerKmRange = model.closerKmRange;
const fartherKmRange = model.fartherKmRange; const fartherKmRange = model.fartherKmRange;
const length = stations.length; const length = stations.length;
const first = stations[0]||{};
const last = stations[length-1]||{}; const last = stations[length-1]||{};
const minRange = -this.EdgeHeight/2; const minRange = first.kmRange-this.EdgeHeight;
const maxRange = last.kmRange; const maxRange = last.kmRange;
const tolerant = 0; const tolerant = 0;

View File

@ -52,6 +52,8 @@ export function createRectArea(opt, style={}) {
point1: opt.point1, point1: opt.point1,
point2: opt.point2, point2: opt.point2,
model: opt.model, model: opt.model,
culling: true,
progressive: true,
shape: { shape: {
x: 0, x: 0,
y: 0, y: 0,
@ -96,10 +98,13 @@ export function createMarkLineModels(stations, computedYaxis) {
show: true, show: true,
position: 'start', position: 'start',
formatter: elem.name, formatter: elem.name,
color: 'black' color: elem.transferable ? '#000': '#000',
backgroundColor: elem.transferable ? '#008800': '',
padding: [5,3,3,3],
}, },
lineStyle: { lineStyle: {
type: 'solid', type: 'solid',
color: elem.transferable? '#008800': '#000',
width: 0.5, width: 0.5,
opacity: 0.5 opacity: 0.5
}, },

View File

@ -126,7 +126,8 @@ export default {
Local: [ Local: [
{ {
title: '系统', title: '系统',
operate: OperationEvent.Command.mBar.system, // operate: OperationEvent.Command.mBar.system,
operate: '',
children: [ children: [
{ {
title: '登录', title: '登录',
@ -174,7 +175,8 @@ export default {
}, },
{ {
title: '查看', title: '查看',
operate: OperationEvent.Command.mBar.check, // operate: OperationEvent.Command.mBar.check,
operate: '',
children: [ children: [
{ {
title: '运行图', title: '运行图',
@ -287,7 +289,8 @@ export default {
}, },
{ {
title: '显示', title: '显示',
operate: OperationEvent.Command.mBar.view, // operate: OperationEvent.Command.mBar.view,
operate: '',
hide: true, hide: true,
children: [ children: [
{ {

View File

@ -119,7 +119,11 @@ export default {
if (selected._type == 'Train') { if (selected._type == 'Train') {
name = selected.serviceNumber; name = selected.serviceNumber;
} }
this.deviceName = deviceType[selected._type] + '-' + name; if (name) {
this.deviceName = deviceType[selected._type] + '-' + name;
} else {
this.deviceName = deviceType[selected._type];
}
this.faultList = deviceFaultType[selected._type]; this.faultList = deviceFaultType[selected._type];
if (this.faultList && this.faultList.length) { if (this.faultList && this.faultList.length) {
this.form.faultType = this.faultList[0].value; this.form.faultType = this.faultList[0].value;

View File

@ -302,6 +302,11 @@ export const menuOperate = {
// 批量取消扣车 // 批量取消扣车
operation: OperationEvent.StationStand.cancelBulkBuckleTrain.menu.operation, operation: OperationEvent.StationStand.cancelBulkBuckleTrain.menu.operation,
cmdType:CMD.Stand.CMD_STAND_CANCEL_HOLD_TRAIN_ALL cmdType:CMD.Stand.CMD_STAND_CANCEL_HOLD_TRAIN_ALL
},
openPsdByHand:{
// 手动开启屏蔽门
operation: OperationEvent.StationStand.openPsdByHand.menu.operation,
cmdType:CMD.Stand.CMD_STAND_OPEN_PSD
} }
}, },
StationControl:{ StationControl:{

View File

@ -15,120 +15,232 @@ export default {
beginRow: 1, beginRow: 1,
beginCol: 0, beginCol: 0,
// fieldNum: 10, // fieldNum: 10,
columns: { trainId: '车次号',
'默认上行折返轨': { key: 'upTrack', formatter: (val) => { return val; } }, columns: ['备注', '车次号']
'默认下行折返轨': { key: 'downTrack', formatter: (val) => { return val; } } // beginRow: 1,
} // beginCol: 0,
// // fieldNum: 10,
// columns: {
// '默认上行折返轨': { key: 'upTrack', formatter: (val) => { return val; } },
// '默认下行折返轨': { key: 'downTrack', formatter: (val) => { return val; } }
// }
}, },
// /** 解析exal数据转换为Json后台数据*/
// importData(Sheet, JsonData) {
// const dataList = convertSheetToList(Sheet, true);
// const needList = Object.keys(this.ExcelConfig.columns);
// const tripObj = { upTrack: '', downTrack: '' };
// if (dataList && dataList.length && dataList[1] && dataList[0]) {
// const tIndex = dataList.findIndex(it => { return it[0]; });
// if (dataList[0][0] == needList[0] && dataList[1][0] == needList[1]) {
// for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList.length; colIndex += 1) {
// var isContinue = true;
// for (var rowIndex = this.ExcelConfig.beginRow; isContinue; rowIndex += 1) {
// isContinue = false;
// var title = dataList[colIndex][0];
// var value = dataList[colIndex][rowIndex];
// if (title && value) {
// // 数据列解析
// isContinue = true;
// var titleStr = `${title}`.replace(/\s*/g, '');
// var valueStr = `${value}`.replace(/\s*/g, '');
// // 取需要的字段
// if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) {
// tripObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr);
// }
// }
// }
// }
// } else {
// /** 解析二维数组为json对象*/
// const reg0 = /^[↑|↓|¡|ü|ý|]+(.*)/; // ↑|↓
// const reg1 = /^([▼|▲|¡ø|¨‹]+)\s*(\d+:\d+:\d+)/; // ▲ 06:10:00
// const reg2 = /^(\d+:\d+:\d+)\s*([▼|▲|¡ø|¨‹]+)/; // 06:10:00 ▲
// const reg3 = /^(\d+:\d+:\d+)\s*(\d+:\d+:\d+|)/; // 06:10:00 06:12:00
// const reg4 = /[▼|▲|¡|ø|¨|‹]+/; // ▲
// dataList.forEach((elem, i) => {
// var begin = -1;
// /** 跳过名称所在的行*/
// if (i != tIndex && elem && elem.length > 0) {
// elem.forEach((item, j) => {
// /** 过滤空值*/
// if (item) {
// var value = `${item}`.trim();
// var title = `${dataList[tIndex][j]}`.replace(/\s*/g, '');
// /** 匹配到开始位置或者结束位置*/
// if (reg0.test(value)) {
// if (begin == -1) {
// begin = value; // 设置初始索引
// JsonData.push({
// code: reg0.exec(value)[1],
// arrivalList: []
// });
// } else if (begin === value) {
// begin = -1; // 清空初始索引
// }
// } else if (begin !== -1) {
// /** 匹配到中间位置*/
// var begTime, endTime;
// var runFlag = JsonData[JsonData.length - 1].code[2];
// var stationName = title.replace(/\s/, '');
// var need = false;
// var flag = false;
// if (reg1.test(value)) {
// /** 含有特殊字符的时间格式*/
// [, begTime, endTime] = reg1.exec(value);
// begTime = reg4.test(begTime) ? '' : begTime;
// endTime = reg4.test(endTime) ? '' : endTime;
// /** 下行方向时间互换*/
// if (runFlag === '2') {
// [begTime, endTime] = [endTime, begTime];
// }
// /** 设置标志*/
// [need, flag] = [true, true];
// } else if (reg2.test(value)) {
// /** 含有特殊字符的时间格式*/
// [, begTime, endTime] = reg2.exec(value);
// begTime = reg4.test(begTime) ? '' : begTime;
// endTime = reg4.test(endTime) ? '' : endTime;
// /** 下行方向时间互换*/
// if (runFlag === '2') {
// [begTime, endTime] = [endTime, begTime];
// }
// /** 设置标志*/
// [need, flag] = [true, true];
// } else if (reg3.test(value)) {
// /** 正常时间格式*/
// [, begTime, endTime] = reg3.exec(value);
// /** 如果只存在一个数据时,则开始和结束设置一样*/
// endTime = endTime || begTime;
// /** 下行方向时间互换*/
// if (runFlag === '2') {
// [begTime, endTime] = [endTime, begTime];
// }
// /** 设置标志*/
// [need, flag] = [true, false];
// }
// /** 添加json数据*/
// if (need) { // 储存非空 数据
// var stationObj = {
// stationName: stationName
// };
// if (begTime) { stationObj['arriveTime'] = prefixTime(begTime); }
// if (endTime) { stationObj['departureTime'] = prefixTime(endTime); }
// if (flag) { stationObj['flag'] = flag; } // 是否转换轨
// JsonData[JsonData.length - 1].arrivalList.push(stationObj);
// }
// }
// }
// });
// }
// });
// }
// }
// JsonData.forEach(item => {
// item['upTrack'] = tripObj.upTrack;
// item['downTrack'] = tripObj.downTrack;
// });
// return JsonData;
// },
/** 解析exal数据转换为Json后台数据*/ /** 解析exal数据转换为Json后台数据*/
importData(Sheet, JsonData) { importData(Sheet, JsonData) {
const dataList = convertSheetToList(Sheet, true); const dataList = convertSheetToList(Sheet, true);
const needList = Object.keys(this.ExcelConfig.columns);
const tripObj = { upTrack: '', downTrack: '' };
if (dataList && dataList.length && dataList[1] && dataList[0]) { if (dataList && dataList.length && dataList[1] && dataList[0]) {
const tIndex = dataList.findIndex(it => { return it[0]; }); const tIndex = 8; // 设置不用过滤行数
if (dataList[0][0] == needList[0] && dataList[1][0] == needList[1]) { /** 解析二维数组为json对象*/
for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList.length; colIndex += 1) { const reg3 = /^(\d+:\d+:\d+|)/; // 06:12:00
var isContinue = true; const reg4 = /[▼|▲|¡|ø|¨|‹]+/; // ▲
dataList.forEach((elem, i) => {
for (var rowIndex = this.ExcelConfig.beginRow; isContinue; rowIndex += 1) { var begin = -1;
isContinue = false; /** 跳过名称所在的行*/
if (i != tIndex && elem && elem.length > 0) {
var title = dataList[colIndex][0]; let flag = false;
var value = dataList[colIndex][rowIndex]; let param = { begTime: '', endTime: '' };
if (i > tIndex) { elem.reverse(); }
if (title && value) { let interval = 1;
// 数据列解析 for (let j = 0; j < elem.length;) {
isContinue = true; const item = elem[j];
var titleStr = `${title}`.replace(/\s*/g, ''); let title = '';
var valueStr = `${value}`.replace(/\s*/g, ''); var value = `${item}`.trim();
if (i > tIndex) { // 上行线
// 取需要的字段 title = `${dataList[tIndex][dataList[tIndex].length - j - 1]}`.replace(/\s*/g, '');
if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) { if (title == 'undefined') {
tripObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr); title = `${dataList[tIndex][dataList[tIndex].length - j - 2]}`.replace(/\s*/g, '');
}
} else { // 下行线
title = `${dataList[tIndex][j]}`.replace(/\s*/g, '');
if (title == 'undefined') {
title = `${dataList[tIndex][j - 1]}`.replace(/\s*/g, '');
} }
} }
} /** 匹配到开始位置或者结束位置*/
} if (title == this.ExcelConfig.trainId && value != 'undefined') {
} else { if (begin == -1) {
/** 解析二维数组为json对象*/ interval = 2;
const reg0 = /^[↑|↓|¡|ü|ý|]+(.*)/; // ↑|↓ flag = true;
const reg1 = /^([▼|▲|¡ø|¨‹]+)\s*(\d+:\d+:\d+)/; // ▲ 06:10:00 begin = value; // 设置初始索引
const reg2 = /^(\d+:\d+:\d+)\s*([▼|▲|¡ø|¨‹]+)/; // 06:10:00 ▲ JsonData.push({
const reg3 = /^(\d+:\d+:\d+)\s*(\d+:\d+:\d+|)/; // 06:10:00 06:12:00 code: value,
const reg4 = /[▼|▲|¡|ø|¨|‹]+/; // ▲ destinationCode: '',
arrivalList: []
dataList.forEach((elem, i) => { });
var begin = -1; } else if (flag) {
/** 跳过名称所在的行*/ interval = 1;
if (i != tIndex && elem && elem.length > 0) { begin = -1; // 清空初始索引
elem.forEach((item, j) => { JsonData[JsonData.length - 1].destinationCode = value;
/** 过滤空值*/ flag = false;
if (item) { }
var value = `${item}`.trim(); } else if (title == this.ExcelConfig.columns[0]) {
var title = `${dataList[tIndex][j]}`.replace(/\s*/g, ''); interval = 1;
/** 匹配到开始位置或者结束位置*/ } else if (begin !== -1) {
if (reg0.test(value)) { const item1 = `${elem[j]}`.trim();
if (begin == -1) { const item2 = `${elem[j + 1]}`.trim();
begin = value; // 设置初始索引 if (item1 != 'undefined' || item2 != 'undefined') {
JsonData.push({ /** 匹配到中间位置*/
code: reg0.exec(value)[1], var stationName = title.replace(/\s/, '');
arrivalList: [] const flag = reg3.test(item1) || reg3.test(item2);
}); if (this.ExcelConfig.columns.indexOf(stationName) == -1 && flag) {
} else if (begin === value) { let need = false;
begin = -1; // 清空初始索引 if (value.split(':')[0] == '24') { // 24:XX:XX 类似这种数据 变24为00
const arr = value.split(':');
arr[0] = '00';
value = arr.join(':');
}
const item1 = elem[j] ? `${elem[j]}`.trim() : '';
const item2 = elem[j + 1] ? `${elem[j + 1]}`.trim() : '';
if (item1 && item2) {
param.begTime = item1;
param.endTime = item2;
} else if (item1 && !item2) {
param.begTime = item1;
param.endTime = item1;
} else if (!item1 && item2) {
param.begTime = item2;
param.endTime = item2;
} }
} else if (begin !== -1) {
/** 匹配到中间位置*/
var begTime, endTime;
var runFlag = JsonData[JsonData.length - 1].code[2];
var stationName = title.replace(/\s/, '');
var need = false;
var flag = false;
if (reg1.test(value)) {
/** 含有特殊字符的时间格式*/
[, begTime, endTime] = reg1.exec(value);
begTime = reg4.test(begTime) ? '' : begTime; if (param.begTime && param.endTime) {
endTime = reg4.test(endTime) ? '' : endTime; need = true;
/** 下行方向时间互换*/
if (runFlag === '2') {
[begTime, endTime] = [endTime, begTime];
}
/** 设置标志*/
[need, flag] = [true, true];
} else if (reg2.test(value)) {
/** 含有特殊字符的时间格式*/
[, begTime, endTime] = reg2.exec(value);
begTime = reg4.test(begTime) ? '' : begTime;
endTime = reg4.test(endTime) ? '' : endTime;
/** 下行方向时间互换*/
if (runFlag === '2') {
[begTime, endTime] = [endTime, begTime];
}
/** 设置标志*/
[need, flag] = [true, true];
} else if (reg3.test(value)) {
/** 正常时间格式*/
[, begTime, endTime] = reg3.exec(value);
/** 如果只存在一个数据时,则开始和结束设置一样*/
endTime = endTime || begTime;
/** 下行方向时间互换*/
if (runFlag === '2') {
[begTime, endTime] = [endTime, begTime];
}
/** 设置标志*/
[need, flag] = [true, false];
} }
/** 添加json数据*/ /** 添加json数据*/
@ -136,25 +248,32 @@ export default {
var stationObj = { var stationObj = {
stationName: stationName stationName: stationName
}; };
if (reg4.test(param.begTime)) {
if (begTime) { stationObj['arriveTime'] = prefixTime(begTime); } param.begTime = '';
if (endTime) { stationObj['departureTime'] = prefixTime(endTime); } }
if (flag) { stationObj['flag'] = flag; } // 是否转换轨 if (reg4.test(param.endTime)) {
param.endTime = '';
}
stationObj['arriveTime'] = prefixTime(param.begTime);
stationObj['departureTime'] = prefixTime(param.endTime);
JsonData[JsonData.length - 1].arrivalList.push(stationObj); JsonData[JsonData.length - 1].arrivalList.push(stationObj);
param = { begTime: '', endTime: '' };
} }
} }
} }
}); }
j = j + interval;
} }
}); }
} });
} }
JsonData.forEach(item => { const arr = [];
item['upTrack'] = tripObj.upTrack; JsonData.forEach((item, i) => {
item['downTrack'] = tripObj.downTrack; if (item.code) {
arr.push(item);
}
}); });
return arr;
return JsonData;
}, },
/** 将后台数据解析成图表*/ /** 将后台数据解析成图表*/

View File

@ -36,9 +36,9 @@
<el-col :span="10"> <el-col :span="10">
<div class="nav-border"> <div class="nav-border">
<el-row> <el-row>
<el-col :span="6"><el-button style="width: 80px;" plain :style="{background: level === 'A'? '#F00': '#FFF' }" @click="clearLevel">A级警报</el-button></el-col> <el-col :span="6"><el-button style="width: 80px;" :style="{background:isNoRecoverLevelA || isNoConfirmLevelA?'#F00':'#FFF' }" plain :class="{'headerBox' :isNoConfirmLevelA}" @click="showLowAlarm('A')">A级警报</el-button></el-col>
<el-col :span="6"><el-button style="width: 80px;" plain :style="{background: level === 'B'? '#F00': '#FFF' }" @click="clearLevel">B级警报</el-button></el-col> <el-col :span="6"><el-button style="width: 80px;" :style="{background:isNoRecoverLevelB || isNoConfirmLevelB?'#F00':'#FFF' }" plain :class="{'headerBox' :isNoConfirmLevelB}" @click="showLowAlarm('B')">B级警报</el-button></el-col>
<el-col :span="6"><el-button style="width: 80px;" plain :style="{background: level === 'C'? '#F00': '#FFF' }" @click="clearLevel">C级警报</el-button></el-col> <el-col :span="6"><el-button style="width: 80px;" :style="{background:isNoRecoverLevelC?'#F00':'#FFF' }" plain>C级警报</el-button></el-col>
<el-col :span="6"><el-button style="width: 80px;" plain @click="undeveloped">记录</el-button></el-col> <el-col :span="6"><el-button style="width: 80px;" plain @click="undeveloped">记录</el-button></el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -107,13 +107,13 @@
<el-col :span="4"> <el-col :span="4">
<div style="width: calc(100% - 10px);border: 2px solid #DDD9CA;border-radius: 5px;"> <div style="width: calc(100% - 10px);border: 2px solid #DDD9CA;border-radius: 5px;">
<el-row style="height: 68px;display: flex; justify-content: space-between;align-items: center;"> <el-row style="height: 68px;display: flex; justify-content: space-between;align-items: center;">
<div style="width: 40px;" class="div-simulate-button" :style="{background: level === 'A'? '#F00': '#FFF' }" @click="clearLevel">A</div> <div style="width: 40px;" class="div-simulate-button" :style="{background:isNoRecoverLevelA || isNoConfirmLevelA?'#F00':'#FFF' }" :class="{'headerBox' :isNoConfirmLevelA}" @click="showHimAlarm('A')">A</div>
<div style="width: 40px;" class="div-simulate-button" :style="{background: level === 'B'? '#F00': '#FFF' }" @click="clearLevel">B</div> <div style="width: 40px;" class="div-simulate-button" :style="{background:isNoRecoverLevelB || isNoConfirmLevelB?'#F00':'#FFF' }" :class="{'headerBox' :isNoConfirmLevelB}" @click="showHimAlarm('B')">B</div>
<div style="width: 40px;" class="div-simulate-button" :style="{background: level === 'C'? '#F00': '#FFF' }" @click="clearLevel">C</div> <div style="width: 40px;" class="div-simulate-button" :style="{background:isNoRecoverLevelC?'#F00':'#FFF' }" @click="showHimAlarm('C')">C</div>
<img :src="voiceIcon" style="width: 40px;height: 40px;" @click="controlAudio(false)"> <img :src="voiceIcon" style="width: 40px;height: 40px;" @click="controlAudio(false)">
</el-row> </el-row>
<el-row class="button-row"> <el-row class="button-row">
<div style="width: 80px;" class="div-simulate-button" @click="undeveloped">报警</div> <div style="width: 80px;" class="div-simulate-button" @click="showHimAlarm">报警</div>
<div style="width: 80px;" class="div-simulate-button" @click="undeveloped">运图</div> <div style="width: 80px;" class="div-simulate-button" @click="undeveloped">运图</div>
</el-row> </el-row>
<el-row class="button-row" style="margin-top: 10px;"> <el-row class="button-row" style="margin-top: 10px;">
@ -136,6 +136,8 @@
</el-row> </el-row>
</div> </div>
<notice-info ref="noticeInfo" pop-class="haerbin-01__systerm" /> <notice-info ref="noticeInfo" pop-class="haerbin-01__systerm" />
<alarm-table-low ref="alarmTableLow" />
<alarm-table-hmi ref="alarmTableHmi" />
<audio id="buzzer" controls loop="loop" style="width: 0;height: 0"> <audio id="buzzer" controls loop="loop" style="width: 0;height: 0">
<source :src="buzzerAudio" type="audio/mpeg"> <source :src="buzzerAudio" type="audio/mpeg">
</audio> </audio>
@ -148,11 +150,15 @@ import { EventBus } from '@/scripts/event-bus';
import voiceOpen from '@/assets/voiceOpen.png'; import voiceOpen from '@/assets/voiceOpen.png';
import voiceClose from '@/assets/voiceClose.png'; import voiceClose from '@/assets/voiceClose.png';
import BuzzerAudio from '@/assets/buzzer.mp3'; import BuzzerAudio from '@/assets/buzzer.mp3';
import AlarmTableHmi from './menuDialog/alarmTableHmi';
import AlarmTableLow from './menuDialog/alarmTableLow';
export default { export default {
name: 'MenuBar', name: 'MenuBar',
components: { components: {
NoticeInfo NoticeInfo,
AlarmTableLow,
AlarmTableHmi
}, },
props: { props: {
selected: { selected: {
@ -181,9 +187,18 @@ export default {
version: '', version: '',
centralizedMap: {}, centralizedMap: {},
tipContent: [], tipContent: [],
level: '',
sound: false, sound: false,
buzzerAudio: BuzzerAudio buzzerAudio: BuzzerAudio,
noConfirmMapA: {},
noConfirmMapB: {},
confirmNoRecoverMapA: {},
confirmNoRecoverMapB: {},
confirmNoRecoverMapC: {},
noConfirmMapAString: '{}',
noConfirmMapBString: '{}',
confirmNoRecoverMapAString: '{}',
confirmNoRecoverMapBString: '{}',
confirmNoRecoverMapCString: '{}'
}; };
}, },
computed: { computed: {
@ -202,6 +217,21 @@ export default {
}, },
voiceIcon() { voiceIcon() {
return this.sound ? voiceOpen : voiceClose; return this.sound ? voiceOpen : voiceClose;
},
isNoConfirmLevelA() {
return this.noConfirmMapAString !== '{}';
},
isNoConfirmLevelB() {
return this.noConfirmMapBString !== '{}';
},
isNoRecoverLevelA() {
return this.confirmNoRecoverMapAString !== '{}';
},
isNoRecoverLevelB() {
return this.confirmNoRecoverMapBString !== '{}';
},
isNoRecoverLevelC() {
return this.confirmNoRecoverMapCString !== '{}';
} }
}, },
watch: { watch: {
@ -237,13 +267,52 @@ export default {
} }
}, },
'$store.state.socket.simulationAlarmInfo': function(val) { '$store.state.socket.simulationAlarmInfo': function(val) {
if (val) { (val || []).forEach(item => {
this.tipContent.push(val); if (!item.confirmed) {
this.handleAlarm(val); this.tipContent.push(item);
if (this.tipContent.length > 3) { this.handleAlarm(item);
this.tipContent.shift(); if (this.tipContent.length > 3) {
this.tipContent.shift();
}
if (item.level === 'A') {
this.noConfirmMapA[item.code] = item;
this.noConfirmMapAString = JSON.stringify(this.noConfirmMapA);
} else if (item.level === 'B') {
this.noConfirmMapB[item.code] = item;
this.noConfirmMapBString = JSON.stringify(this.noConfirmMapB);
}
} else if (!item.recovered) {
if (item.level === 'A') {
delete this.noConfirmMapA[item.code];
this.confirmNoRecoverMapA[item.code] = item;
this.noConfirmMapAString = JSON.stringify(this.noConfirmMapA);
this.confirmNoRecoverMapAString = JSON.stringify(this.confirmNoRecoverMapA);
} else if (item.level === 'B') {
delete this.noConfirmMapB[item.code];
this.confirmNoRecoverMapB[item.code] = item;
this.noConfirmMapBString = JSON.stringify(this.noConfirmMapB);
this.confirmNoRecoverMapBString = JSON.stringify(this.confirmNoRecoverMapB);
} else if (item.level === 'C') {
this.confirmNoRecoverMapC[item.code] = item;
this.confirmNoRecoverMapCString = JSON.stringify(this.confirmNoRecoverMapC);
}
} else {
if (item.level === 'A') {
delete this.noConfirmMapA[item.code];
delete this.confirmNoRecoverMapA[item.code];
this.noConfirmMapAString = JSON.stringify(this.noConfirmMapA);
this.confirmNoRecoverMapAString = JSON.stringify(this.confirmNoRecoverMapA);
} else if (item.level === 'B') {
delete this.noConfirmMapB[item.code];
delete this.confirmNoRecoverMapB[item.code];
this.noConfirmMapBString = JSON.stringify(this.noConfirmMapB);
this.confirmNoRecoverMapBString = JSON.stringify(this.confirmNoRecoverMapB);
} else if (item.level === 'C') {
delete this.confirmNoRecoverMapC[item.code];
this.confirmNoRecoverMapCString = JSON.stringify(this.confirmNoRecoverMapC);
}
} }
} });
} }
}, },
mounted() { mounted() {
@ -256,8 +325,9 @@ export default {
}, },
methods: { methods: {
handleAlarm(val) { handleAlarm(val) {
this.level = val.level; if (val.level === 'A' || val.level === 'B') {
this.controlAudio(true); this.controlAudio(true);
}
}, },
initMenu() { initMenu() {
// //
@ -342,8 +412,11 @@ export default {
} }
}); });
}, },
clearLevel() { showHimAlarm(level) {
this.level = ''; this.$refs.alarmTableHmi.doShow(level);
},
showLowAlarm(level) {
this.$refs.alarmTableLow.doShow(level);
}, },
controlAudio(val) { controlAudio(val) {
const audio = document.getElementById('buzzer'); const audio = document.getElementById('buzzer');
@ -561,4 +634,32 @@ export default {
display: flex; display: flex;
justify-content:space-between; justify-content:space-between;
} }
@keyframes fade {
from {
opacity: 1.0;
}
50% {
opacity: 0.4;
}
to {
opacity: 1.0;
}
}
@-webkit-keyframes fade {
from {
opacity: 1.0;
}
50% {
opacity: 0.4;
}
to {
opacity: 1.0;
}
}
.headerBox {
background: #f00;
animation: fade 600ms infinite;
-webkit-animation: fade 600ms infinite;
}
</style> </style>

View File

@ -1,44 +0,0 @@
<template>
<el-dialog v-dialogDrag class="haerbin-01__systerm manage-user" :title="title" :visible.sync="show" width="420px" :z-index="2000" :modal="false" :close-on-click-modal="false">
<div>
<el-table
:data="tableData"
style="width: 100%"
>
<el-table-column
prop="time"
label="日期/时间"
width="180"
/>
<el-table-column
prop="name"
label="等级"
width="180"
/>
<el-table-column
prop="address"
label="设备类型"
/>
<el-table-column
prop="address"
label="设备编号"
/>
</el-table>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'Alarm',
data() {
return {
tableData: []
};
}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,155 @@
<template>
<el-dialog v-dialogDrag class="haerbin-01__systerm manage-user" title="报警列表" :before-close="handleClose" :visible.sync="show" width="70%" :z-index="2000" :modal="false" :close-on-click-modal="false">
<div style="text-align: center;">
<div style="text-align: left;width: 90%;margin-left: 5%;border: 1px solid #808080;border-radius: 5px;padding: 10px;">
<el-row>
<el-col :span="10" style="text-align: center;">
<div style="display: inline-block;margin-right: 5px;">开始时间:</div>
<el-date-picker
v-model="startTime"
size="small"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间"
/>
</el-col>
<el-col :span="10" style="text-align: center;">
<div style="display: inline-block;margin-right: 5px;margin-left: 10px;">结束时间:</div>
<el-date-picker
v-model="endTime"
size="small"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间"
/>
</el-col>
<el-col :span="4" style="text-align: center;">
<el-button style="margin-left: 10px;" @click="queryData(true)">查询</el-button>
<el-button style="margin-left: 10px;" @click="queryData(false)">撤销查询</el-button>
</el-col>
</el-row>
</div>
<div style="position: relative;height: 20px;line-height: 20px;top: -120px;text-align: left;right: -80px;background: #F0F0F0;width: 88px;">筛选条件查询</div>
<el-row>
<el-col :span="8">
<el-button @click="infoConfirm">消息确认</el-button>
</el-col>
<el-col :span="8">
<el-button :disabled="true">消息打印</el-button>
</el-col>
<el-col :span="8">
<el-button :disabled="true">删除备注</el-button>
</el-col>
</el-row>
<el-table
:data="totalData"
style="width: 100%"
height="450"
>
<el-table-column prop="operate" label="操作">
<template slot-scope="scope">
<el-checkbox v-model="checkList[scope.$index]" @change="operateChange(scope)" />
</template>
</el-table-column>
<el-table-column prop="level" label="报警级别" />
<el-table-column prop="time" label="日期/时间" width="150px" />
<el-table-column prop="code" label="报警序号" />
<el-table-column prop="deviceCode" label="设备编号">
<template slot-scope="scope">
<span>{{ handleDeviceName(scope.row.deviceCode) }}</span>
</template>
</el-table-column>
<el-table-column prop="address" label="信号编号" />
<el-table-column prop="address" label="元素编号" />
<el-table-column prop="confirmed" label="确认">
<template slot-scope="scope">
<span>{{ scope.row.confirmed? 'Y':'N' }}</span>
</template>
</el-table-column>
<el-table-column prop="confirmedUserName" label="确认人编号" width="120px" />
<el-table-column prop="confirmTime" label="确认时间" width="150px" />
<el-table-column prop="recoverTime" label="恢复">
<template slot-scope="scope">
<span>{{ scope.row.recovered? 'Y':'N' }}</span>
</template>
</el-table-column>
<el-table-column prop="address" label="恢复时间" />
<el-table-column prop="address" label="备注信息" width="200px" />
</el-table>
</div>
</el-dialog>
</template>
<script>
import {getAlarmList, confirmAlarm} from '@/api/simulation';
export default {
name: 'AlarmHmi',
data() {
return {
currentPage: 1,
show: false,
level: '',
startTime: '',
endTime: '',
deviceCode: '',
elementCode: '',
totalData: [],
checkList: []
};
},
computed:{
},
methods:{
doShow(level) {
this.show = true;
this.level = level;
this.queryData(false);
},
handleClose() {
this.level = '';
this.startTime = '';
this.endTime = '';
this.show = false;
},
operateChange(row) {
},
queryData(flag) {
if (!flag) {
this.endTime = '';
this.startTime = '';
this.deviceCode = '';
this.elementCode = '';
}
const params = { level: this.level, startTime: this.startTime, endTime:this.endTime };
getAlarmList(this.$route.query.group, params).then(resp => {
this.totalData = resp.data;
});
},
infoConfirm() {
const codes = [];
this.checkList.forEach((check, index) => {
if (check) {
codes.push(this.totalData[index].code);
}
});
confirmAlarm(this.$route.query.group, codes).then(resp => {
this.queryData(true);
}).catch(() => {
this.$message.error('确认消息失败!');
});
},
handleDeviceName(code) {
const device = this.$store.getters['map/getDeviceByCode'](code);
return device.name;
}
}
};
</script>
<style scoped>
/deep/ .el-dialog .el-input {
border: 0 !important;
}
</style>

View File

@ -0,0 +1,114 @@
<template>
<el-dialog v-dialogDrag class="haerbin-01__systerm manage-user" title="报警列表" :before-close="handleClose" :visible.sync="show" width="70%" :z-index="2000" :modal="false" :close-on-click-modal="false">
<div style="text-align: center;">
<div style="text-align: left;">
<div style="display: inline-block;margin-right: 5px;">开始时间:</div>
<el-date-picker
v-model="startTime"
size="small"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间"
/>
<div style="display: inline-block;margin-right: 5px;margin-left: 10px;">结束时间:</div>
<el-date-picker
v-model="endTime"
size="small"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间"
/>
<el-button style="margin-left: 10px;" @click="queryData">查询</el-button>
</div>
<el-table
:data="totalData"
style="width: 100%"
height="600"
>
<el-table-column prop="time" label="日期/时间" width="150px" />
<el-table-column prop="level" label="等级" />
<el-table-column prop="deviceCode" label="设备类型">
<template slot-scope="scope">
<span>{{ handleDeviceType(scope.row.deviceCode) }}</span>
</template>
</el-table-column>
<el-table-column prop="deviceCode" label="设备编号">
<template slot-scope="scope">
<span>{{ handleDeviceName(scope.row.deviceCode) }}</span>
</template>
</el-table-column>
<el-table-column prop="code" label="故障号" />
<el-table-column prop="description" label="故障描述" />
<el-table-column prop="recover" label="已恢复">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.recovered" />
</template>
</el-table-column>
<el-table-column prop="address" label="恢复时间" />
<el-table-column prop="confirm" label="已确认">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.confirmed" />
</template>
</el-table-column>
<el-table-column prop="confirmedUserName" label="确认人" />
<el-table-column prop="confirmTime" label="确认时间" width="150px" />
<el-table-column prop="address" label="备注信息" width="200px" />
</el-table>
</div>
</el-dialog>
</template>
<script>
import {getAlarmList} from '@/api/simulation';
import {deviceType} from '@/scripts/cmdPlugin/Config';
export default {
name: 'AlarmLow',
data() {
return {
currentPage: 1,
show: false,
level: '',
startTime: '',
endTime: '',
totalData: [],
tableData: []
};
},
computed:{
},
methods:{
doShow(level) {
this.show = true;
this.level = level;
this.queryData();
},
handleClose() {
this.level = '';
this.startTime = '';
this.endTime = '';
this.show = false;
},
queryData() {
const params = { level: this.level, startTime: this.startTime, endTime:this.endTime };
getAlarmList(this.$route.query.group, params).then(resp => {
this.totalData = resp.data;
});
},
handleDeviceType(code) {
const device = this.$store.getters['map/getDeviceByCode'](code);
return deviceType[device.type];
},
handleDeviceName(code) {
const device = this.$store.getters['map/getDeviceByCode'](code);
return device.name;
}
}
};
</script>
<style scoped>
/deep/ .el-dialog .el-input {
border: 0 !important;
}
</style>

View File

@ -110,6 +110,7 @@ export default {
// //
if (!this.dialogShow) { if (!this.dialogShow) {
this.addModel.groupNumber = selected.groupNumber; this.addModel.groupNumber = selected.groupNumber;
this.addModel.serviceNumber = selected.serviceNumber;
} }
this.dialogShow = true; this.dialogShow = true;
this.$nextTick(function () { this.$nextTick(function () {

View File

@ -19,18 +19,18 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="11">服务</el-col> <el-col :span="11">车次</el-col>
<el-col :span="11" :offset="2">序列</el-col> <el-col :span="11" :offset="2">服务</el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="11"> <el-col :span="11">
<el-input :id="domIdServerNoChange" v-model="addModel.serviceNumber" size="mini" />
<div style="color:red;font-size:13px;margin-top:5px;">{{ messageTip1 }}</div>
</el-col>
<el-col :span="11" :offset="2">
<el-input :id="domIdTrainNoChange" v-model="addModel.tripNumber" size="mini" /> <el-input :id="domIdTrainNoChange" v-model="addModel.tripNumber" size="mini" />
<div style="color:red;font-size:13px;margin-top:5px;">{{ messageTip2 }}</div> <div style="color:red;font-size:13px;margin-top:5px;">{{ messageTip2 }}</div>
</el-col> </el-col>
<el-col :span="11" :offset="2">
<el-input :id="domIdServerNoChange" v-model="addModel.serviceNumber" size="mini" />
<div style="color:red;font-size:13px;margin-top:5px;">{{ messageTip1 }}</div>
</el-col>
</el-row> </el-row>
<el-row justify="center" class="button-group"> <el-row justify="center" class="button-group">
<el-col :span="10"> <el-col :span="10">
@ -50,6 +50,7 @@ import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo'; import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate'; import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import {mouseCancelState} from '@/jmapNew/theme/components/utils/menuItemStatus'; import {mouseCancelState} from '@/jmapNew/theme/components/utils/menuItemStatus';
import {getTrainDetailBytripNumber} from '@/api/simulation';
export default { export default {
name: 'TrainSetPlan', name: 'TrainSetPlan',
@ -99,6 +100,13 @@ export default {
if (this.dialogShow) { if (this.dialogShow) {
this.commit(); this.commit();
} }
},
'addModel.tripNumber': function(val) {
if (val.length == 4) {
this.trainNoChange(val);
} else {
this.addModel.serviceNumber = '';
}
} }
}, },
mounted() { mounted() {
@ -127,6 +135,15 @@ export default {
this.$store.dispatch('map/setTrainWindowShow', false); this.$store.dispatch('map/setTrainWindowShow', false);
mouseCancelState(this.selected); mouseCancelState(this.selected);
}, },
trainNoChange(tripNumber) {
getTrainDetailBytripNumber(this.$route.query.group, {tripNumber:tripNumber}).then(resp => {
if (resp.data) {
this.addModel.serviceNumber = resp.data.serviceNumber;
}
}).catch(() => {
this.$message.error('获取列车信息失败!');
});
},
commit() { commit() {
if (!this.addModel.serviceNumber) { if (!this.addModel.serviceNumber) {
this.messageTip1 = '请输入服务号'; this.messageTip1 = '请输入服务号';

View File

@ -13,6 +13,7 @@
<menu-train ref="menuTrain" :selected="selected" /> <menu-train ref="menuTrain" :selected="selected" />
<menu-station ref="menuStation" :selected="selected" /> <menu-station ref="menuStation" :selected="selected" />
<menu-limit ref="menuLimit" :selected="selected" /> <menu-limit ref="menuLimit" :selected="selected" />
<menu-power ref="menuPower" :selected="selected" />
<!--<passive-alarm ref="passiveAlarm" />--> <!--<passive-alarm ref="passiveAlarm" />-->
<passive-contorl ref="passiveControl" pop-class="ningbo-01__systerm" /> <passive-contorl ref="passiveControl" pop-class="ningbo-01__systerm" />
<!--<passive-Timeout ref="passiveTimeout" />--> <!--<passive-Timeout ref="passiveTimeout" />-->
@ -34,6 +35,7 @@ import MenuStation from './menuStation';
import MenuBar from './menuBar'; import MenuBar from './menuBar';
import MenuLimit from './menuLimit'; import MenuLimit from './menuLimit';
import MenuStationTurnBack from './menuStationTurnBack'; import MenuStationTurnBack from './menuStationTurnBack';
import MenuPower from './menuPower';
// import PassiveAlarm from './passiveDialog/alarm'; // import PassiveAlarm from './passiveDialog/alarm';
import PassiveContorl from '@/jmapNew/theme/components/menus/passiveDialog/control'; import PassiveContorl from '@/jmapNew/theme/components/menus/passiveDialog/control';
// import PassiveTimeout from './passiveDialog/timeout'; // import PassiveTimeout from './passiveDialog/timeout';
@ -54,6 +56,7 @@ export default {
MenuTrain, MenuTrain,
MenuStationTurnBack, MenuStationTurnBack,
MenuLimit, MenuLimit,
MenuPower,
// PassiveAlarm, // PassiveAlarm,
PassiveContorl PassiveContorl
// PassiveTimeout // PassiveTimeout

View File

@ -0,0 +1,117 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<set-fault ref="setFault" pop-class="ningbo-01__systerm" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import { mapGetters } from 'vuex';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import SetFault from '@/jmapNew/theme/components/menus/dialog/setFault';
// import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
export default {
name: 'SectionMenu',
components: {
PopMenu,
SetFault
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data( ) {
return {
menu: [],
menuForce: [
{
label: '设置故障',
handler: this.setStoppage,
cmdType:CMD.Fault.CMD_SET_FAULT
},
{
label: '取消故障',
handler: this.cancelStoppage,
cmdType:CMD.Fault.CMD_CANCEL_FAULT
},
{
label: '触发故障管理',
handler: this.triggerFaultManagement,
cmdType: CMD.Fault.CMD_TRIGGER_FAULT
}
]
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Power) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
// this.menu = MenuContextHandler.covert(this.menuNormal);
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce;
}
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
setStoppage() {
commitOperate(menuOperate.Common.setFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.setFault, this.selected);
}
});
},
//
cancelStoppage() {
commitOperate(menuOperate.Common.cancelFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.cancelFault, this.selected);
}
});
},
triggerFaultManagement() {
this.$store.dispatch('training/setTriggerFaultCount', this.selected);
}
}
};
</script>

View File

@ -100,12 +100,12 @@ export default {
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO
}, },
{ {
label: '进路交人工控', label: '进路自排关',
handler: this.humanControl, handler: this.humanControl,
cmdType: CMD.Signal.CMD_SIGNAL_CLOSE_AUTO_SETTING cmdType: CMD.Signal.CMD_SIGNAL_CLOSE_AUTO_SETTING
}, },
{ {
label: '进路交自动控', label: '进路自排开',
handler: this.atsAutoControl, handler: this.atsAutoControl,
cmdType: CMD.Signal.CMD_SIGNAL_OPEN_AUTO_SETTING cmdType: CMD.Signal.CMD_SIGNAL_OPEN_AUTO_SETTING
}, },
@ -137,12 +137,12 @@ export default {
cmdType: CMD.Signal.CMD_SIGNAL_REOPEN_SIGNAL cmdType: CMD.Signal.CMD_SIGNAL_REOPEN_SIGNAL
}, },
{ {
label: '进路交人工控', label: '进路自排关',
handler: this.humanControl, handler: this.humanControl,
cmdType: CMD.Signal.CMD_SIGNAL_CLOSE_AUTO_SETTING cmdType: CMD.Signal.CMD_SIGNAL_CLOSE_AUTO_SETTING
}, },
{ {
label: '进路交自动控', label: '进路自排开',
handler: this.atsAutoControl, handler: this.atsAutoControl,
cmdType: CMD.Signal.CMD_SIGNAL_OPEN_AUTO_SETTING cmdType: CMD.Signal.CMD_SIGNAL_OPEN_AUTO_SETTING
}, },
@ -291,7 +291,7 @@ export default {
} }
}); });
}, },
// //
humanControl() { humanControl() {
commitOperate(menuOperate.Signal.humanControl, {signalCode:this.selected.code}, 0).then(({valid, operate})=>{ commitOperate(menuOperate.Signal.humanControl, {signalCode:this.selected.code}, 0).then(({valid, operate})=>{
if (valid) { if (valid) {
@ -299,7 +299,7 @@ export default {
} }
}); });
}, },
// //
atsAutoControl() { atsAutoControl() {
commitOperate(menuOperate.Signal.atsAutoControl, {signalCode:this.selected.code}, 0).then(({valid, operate})=>{ commitOperate(menuOperate.Signal.atsAutoControl, {signalCode:this.selected.code}, 0).then(({valid, operate})=>{
if (valid) { if (valid) {

View File

@ -142,12 +142,17 @@ export default {
{ {
label: '设置故障', label: '设置故障',
handler: this.setStoppage, handler: this.setStoppage,
cmdType:CMD.Stand.CMD_STAND_ADD_FAULT cmdType:CMD.Fault.CMD_SET_FAULT
}, },
{ {
label: '取消故障', label: '取消故障',
handler: this.cancelStoppage, handler: this.cancelStoppage,
cmdType:CMD.Stand.CMD_STAND_REMOVE_FAULT cmdType:CMD.Fault.CMD_CANCEL_FAULT
},
{
label: '手动开启屏蔽门',
handler: this.openPsdByHand,
cmdType: CMD.Stand.CMD_STAND_OPEN_PSD
}, },
{ {
label: '触发故障管理', label: '触发故障管理',
@ -317,6 +322,13 @@ export default {
}, },
triggerFaultManagement() { triggerFaultManagement() {
this.$store.dispatch('training/setTriggerFaultCount', this.selected); this.$store.dispatch('training/setTriggerFaultCount', this.selected);
},
//
openPsdByHand() {
commitOperate(menuOperate.StationStand.openPsdByHand, {standCode:this.selected.code}, 3).then(({valid, operate})=>{
}).catch(error=>{
this.$refs.noticeInfo.doShow({}, error.message);
});
} }
} }
}; };

View File

@ -114,7 +114,7 @@ export default {
pointdata.name = `${service.serviceNumber}${train.tripNumber}`; pointdata.name = `${service.serviceNumber}${train.tripNumber}`;
pointdata.color = '#000' || lineStyle.color; pointdata.color = '#000' || lineStyle.color;
pointdata.directionCode = train.directionCode; pointdata.directionCode = train.directionCode;
pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, train.stationTimeList[1], train.directionCode, false)]; pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, train.stationTimeList[1], train.right, false)];
/** 给服务对象添加服务名称和标记点*/ /** 给服务对象添加服务名称和标记点*/
opt.markPointData.push(createMartPoint(pointdata)); opt.markPointData.push(createMartPoint(pointdata));
@ -130,7 +130,7 @@ export default {
index > 0 && index < train.stationTimeList.length - 1) { index > 0 && index < train.stationTimeList.length - 1) {
// ${train.directionCode} // ${train.directionCode}
const aa = `${train.tripNumber}`; const aa = `${train.tripNumber}`;
opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode, aa]); opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.right, false), elem.stationCode, aa]);
} }
}); });
@ -141,8 +141,8 @@ export default {
num = this.computedReentryNumber(train.tripNumber); num = this.computedReentryNumber(train.tripNumber);
// ${train.directionCode} // ${train.directionCode}
const aa = `${train.tripNumber}`; const aa = `${train.tripNumber}`;
opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true, num), lastPoint.stationCode, aa]); opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.right, true, num), lastPoint.stationCode, aa]);
opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.directionCode, true, num), nextPoint.stationCode, aa]); opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.right, true, num), nextPoint.stationCode, aa]);
} }
/** 如果是备用车,按车次添加线*/ /** 如果是备用车,按车次添加线*/
@ -221,13 +221,14 @@ export default {
} }
/** 计算折返点*/ /** 计算折返点*/
var nextPoint = [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false), elem.directionCode]; elem.right = elem.tripNumber[0] == '2';
var nextPoint = [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false), elem.tripNumber, elem.right];
if (serie.data.length > 0) { if (serie.data.length > 0) {
var lastPoint = serie.data[serie.data.length - 1]; var lastPoint = serie.data[serie.data.length - 1];
if (lastPoint[2] !== nextPoint[2]) { if (lastPoint[2] !== nextPoint[2]) {
var num = this.computedReentryNumber(elem.tripNumber); var num = this.computedReentryNumber(elem.tripNumber);
serie.data.push([lastPoint[0], this.getYvalueByDirectionCode(lastPoint[1], lastPoint[2], num), lastPoint[2]]); serie.data.push([lastPoint[0], this.getYvalueByDirectionCode(lastPoint[1], lastPoint[3], num), lastPoint[3]]);
serie.data.push([nextPoint[0], this.getYvalueByDirectionCode(nextPoint[1], lastPoint[2], num), lastPoint[2]]); serie.data.push([nextPoint[0], this.getYvalueByDirectionCode(nextPoint[1], lastPoint[3], num), lastPoint[3]]);
} }
} }
@ -295,10 +296,10 @@ export default {
}, },
/** 根据方向计算y折返偏移量*/ /** 根据方向计算y折返偏移量*/
getYvalueByDirectionCode(defaultVlue, directionCode, num) { getYvalueByDirectionCode(defaultVlue, right, num) {
if (directionCode === '1') { if (!right) {
defaultVlue -= this.EdgeHeight / 2 * num; defaultVlue -= this.EdgeHeight / 2 * num;
} else if (directionCode === '2') { } else if (right) {
defaultVlue += this.EdgeHeight / 2 * num; defaultVlue += this.EdgeHeight / 2 * num;
} }
@ -306,13 +307,13 @@ export default {
}, },
/** 根据elem计算y值*/ /** 根据elem计算y值*/
getCoordYByElem(stations, kmRangeCoordMap, elem, directionCode, isSpecial, num) { getCoordYByElem(stations, kmRangeCoordMap, elem, right, isSpecial, num) {
var defaultVlue = 0; var defaultVlue = 0;
var station = stations.find(it => { return it.code == elem.stationCode; }); var station = stations.find(it => { return it.code == elem.stationCode; });
if (station) { if (station) {
defaultVlue = kmRangeCoordMap[`${station.kmRange}`]; defaultVlue = kmRangeCoordMap[`${station.kmRange}`];
if (isSpecial) { if (isSpecial) {
defaultVlue = this.getYvalueByDirectionCode(defaultVlue, directionCode, num); defaultVlue = this.getYvalueByDirectionCode(defaultVlue, right, num);
} }
} }

View File

@ -236,6 +236,14 @@
</div> </div>
</div> </div>
</div> </div>
<div class="form_box">
<div class="title">单位:</div>
<div class="content_box_info">
<div v-show="companyShow" class="show_box">
<span>{{ handleCompany(userInfo.companyId) }}</span>
</div>
</div>
</div>
<div v-if="!wmOpenId" class="form_box"> <div v-if="!wmOpenId" class="form_box">
<div class="title">绑定微信:</div> <div class="title">绑定微信:</div>
<div class="content_box_info"> <div class="content_box_info">
@ -278,6 +286,7 @@ import QrcodeVue from 'qrcode.vue';
import { setInterval, clearInterval } from 'timers'; import { setInterval, clearInterval } from 'timers';
import { checkLoginStatus } from '@/api/login'; import { checkLoginStatus } from '@/api/login';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import { getCompanyList } from '@/api/company';
export default { export default {
components: { QrcodeVue }, components: { QrcodeVue },
@ -296,14 +305,16 @@ export default {
nickname: '', nickname: '',
mobile: '', mobile: '',
email: '', email: '',
passWord: '' passWord: '',
companyId: ''
}, },
editInfo: { editInfo: {
name: '', name: '',
nickname: '', nickname: '',
mobile: '', mobile: '',
email: '', email: '',
passWord: '' passWord: '',
companyId: ''
}, },
nationCode: '86', nationCode: '86',
nameShow: true, nameShow: true,
@ -311,6 +322,7 @@ export default {
mobileShow: true, mobileShow: true,
emailShow: true, emailShow: true,
passwordShow: true, passwordShow: true,
companyShow: true,
mobileCode: null, mobileCode: null,
emailCode: null, emailCode: null,
passWordCode: null, passWordCode: null,
@ -340,7 +352,8 @@ export default {
nationCodeInit: '86', // nationCodeInit: '86', //
loginClient: 'LianKeTang', loginClient: 'LianKeTang',
project:'', project:'',
wmOpenId: '' wmOpenId: '',
companyList: []
}; };
}, },
computed: { computed: {
@ -372,7 +385,8 @@ export default {
nickname: user.nickname, nickname: user.nickname,
mobile: user.mobile, mobile: user.mobile,
email: user.email, email: user.email,
passWord: '' passWord: '',
companyId: user.companyId
}; };
this.wmOpenId = user.wmOpenId || ''; this.wmOpenId = user.wmOpenId || '';
this.oldPassWord = user.password; this.oldPassWord = user.password;
@ -384,6 +398,11 @@ export default {
.catch(error => { .catch(error => {
console.log(error, '请求个人信息失败'); console.log(error, '请求个人信息失败');
}); });
getCompanyList().then(resp => {
this.companyList = resp.data;
}).catch((error) => {
console.log(error, '获取公司列表信息失败');
});
}, },
doClose() { doClose() {
this.visible = false; this.visible = false;
@ -394,6 +413,10 @@ export default {
this.editInfo.name = this.userInfo.name; this.editInfo.name = this.userInfo.name;
this.nameShow = !this.nameShow; this.nameShow = !this.nameShow;
}, },
switcherCompany() {
this.editInfo.companyId = this.userInfo.companyId;
this.companyShow = !this.companyShow;
},
async saveName() { async saveName() {
if (this.editInfo.name) { if (this.editInfo.name) {
try { try {
@ -406,7 +429,16 @@ export default {
} }
} }
}, },
async saveCompany() {
try {
await getUserinfoName(this.info.id, this.editInfo.name);
this.userInfo.name = this.editInfo.name;
this.nameShow = !this.nameShow;
this.$store.commit('SET_NAME', this.editInfo.name);
} catch (error) {
console.log(error, '错误');
}
},
switcherNickname() { switcherNickname() {
this.editInfo.nickname = this.userInfo.nickname; this.editInfo.nickname = this.userInfo.nickname;
this.nickNameShow = !this.nickNameShow; this.nickNameShow = !this.nickNameShow;
@ -426,7 +458,15 @@ export default {
} }
} }
}, },
handleCompany(companyId) {
let name = '';
this.companyList.forEach(item => {
if (item.id == companyId) {
name = item.name;
}
});
return name;
},
switcherMobile() { switcherMobile() {
// this.editInfo.mobile = this.userInfo.mobile; // this.editInfo.mobile = this.userInfo.mobile;
this.mobileShow = !this.mobileShow; this.mobileShow = !this.mobileShow;

View File

@ -95,9 +95,9 @@ export default {
{label: '司机', value: 'DRIVER', enLabel: 'Driver '}, {label: '司机', value: 'DRIVER', enLabel: 'Driver '},
{label: '通号', value: 'MAINTAINER', enLabel: 'Repairman '}, {label: '通号', value: 'MAINTAINER', enLabel: 'Repairman '},
{label: '车辆段调度', value: 'DEPOT_DISPATCHER', enLabel: 'Depot dispatcher '}, {label: '车辆段调度', value: 'DEPOT_DISPATCHER', enLabel: 'Depot dispatcher '},
{label: '电调度', value: 'ELECTRIC_DISPATCHER', enLabel: 'Electric dispatcher'}, {label: '调度', value: 'ELECTRIC_DISPATCHER', enLabel: 'Electric dispatcher'},
{label: '行调', value: 'DISPATCHER', enLabel: 'Dispatcher '}, {label: '行调', value: 'DISPATCHER', enLabel: 'Dispatcher '},
{label: '上级部门', value: 'PARENT_DEPARTMENT', enLabel: 'Parent_department'} {label: '上级部门', value: 'PARENT_DEPARTMENT', enLabel: 'Parent department'}
], ],
SimulationType: [ SimulationType: [

View File

@ -118,6 +118,7 @@ export const DeviceMenu = {
AxleReset: '12', AxleReset: '12',
Enabled: '13', Enabled: '13',
StationTurnBack: '14', StationTurnBack: '14',
Power:'15',
Map: '100', Map: '100',
PrdCategory: '101', PrdCategory: '101',
@ -128,7 +129,7 @@ export const DeviceMenu = {
SetDriver: '106', SetDriver: '106',
Script: '107', Script: '107',
IscsSystem: '108', IscsSystem: '108',
IscsInterface: '109' IscsInterface: '109'
}; };
/** /**

View File

@ -12,6 +12,7 @@ import FaviconTky from '@/assets/icon/favicon_tky.png';
import FaviconBxkc from '@/assets/icon/favicon_bxkc.png'; import FaviconBxkc from '@/assets/icon/favicon_bxkc.png';
import FaviconCrsc from '@/assets/icon/favicon_crsc.png'; import FaviconCrsc from '@/assets/icon/favicon_crsc.png';
import FaviconNty from '@/assets/icon/favicon_nty.png'; import FaviconNty from '@/assets/icon/favicon_nty.png';
import FaviconBjd from '@/assets/icon/favicon_bjd.png';
import Link_Bxkc from '@/assets/icon/link_bxkc.png'; import Link_Bxkc from '@/assets/icon/link_bxkc.png';
import Link_Crsc from '@/assets/icon/link_crsc.png'; import Link_Crsc from '@/assets/icon/link_crsc.png';
import Link_Hls from '@/assets/icon/link_hls.png'; import Link_Hls from '@/assets/icon/link_hls.png';
@ -29,6 +30,19 @@ export const loginInfo = {
navigationMarginLeft: '60px', navigationMarginLeft: '60px',
systemType: '013' systemType: '013'
}, },
bjd: {
title: '城市轨道交通列车运行智慧辅助系统',
loginPath: '/login?project=bjd',
logoWidth: '400px',
bottomIcon: FaviconBjd,
bottomColumn: '',
loginTitle: '空串',
linkIcon: FaviconBjd,
loginParam: 'BJD',
navigationLogoWidth: '160px',
navigationMarginLeft: '175px',
systemType: '011'
},
nty: { nty: {
title: '南京铁道职业技术学院城市轨道交通实训平台', title: '南京铁道职业技术学院城市轨道交通实训平台',
loginPath:'/login?project=nty', loginPath:'/login?project=nty',
@ -72,6 +86,18 @@ export const loginInfo = {
navigationMarginLeft: '60px', navigationMarginLeft: '60px',
systemType: '020' systemType: '020'
}, },
designbjd: {
title: '城市轨道交通列车运行智慧辅助系统',
loginPath: '/design/login?project=bjd',
logoWidth: '400px',
bottomIcon: FaviconBjd,
bottomColumn: '',
linkIcon: '',
loginParam: 'BJD',
navigationLogoWidth: '160px',
navigationMarginLeft: '175px',
systemType: '011'
},
designxty: { designxty: {
title: '西安铁路职业技术学院城市轨道交通设计平台', title: '西安铁路职业技术学院城市轨道交通设计平台',
loginPath:'/design/login?project=xty', loginPath:'/design/login?project=xty',
@ -352,7 +378,9 @@ export const ProjectIcon = {
drts: Favicon, drts: Favicon,
designdrts: Favicon, designdrts: Favicon,
nty: FaviconNty, nty: FaviconNty,
designnty: FaviconNty designnty: FaviconNty,
bjd: FaviconBjd,
designbjd: FaviconBjd
}; };
export const ProjectCode = { export const ProjectCode = {
@ -375,7 +403,7 @@ export const CaseHideProjectList = ['heb', 'designheb']; // 案例展示隐藏
export const VersionBaseNoShow = ['heb', 'designheb', 'hls', 'designhls', 'drts', 'hyd', 'designhyd']; // 登录页右下角版本开发基于不展示 export const VersionBaseNoShow = ['heb', 'designheb', 'hls', 'designhls', 'drts', 'hyd', 'designhyd']; // 登录页右下角版本开发基于不展示
export const MainBodyNoShow = ['heb', 'designheb', 'jyd', 'designjyd', 'tky', 'designtky', 'bxkc', 'designbxkc', 'crsc', 'designcrsc', 'hls', 'designhls', 'hyd', 'designhyd']; // 登录页右下角主体不展示 export const MainBodyNoShow = ['heb', 'designheb', 'jyd', 'designjyd', 'tky', 'designtky', 'bxkc', 'designbxkc', 'crsc', 'designcrsc', 'hls', 'designhls', 'hyd', 'designhyd']; // 登录页右下角主体不展示
export const GenerateRouteProjectList = ['jsxt', 'refereeJsxt'];// 需要在公共路由中生成登录页面的项目 export const GenerateRouteProjectList = ['jsxt', 'refereeJsxt'];// 需要在公共路由中生成登录页面的项目
export const ProjectLoginStyleList = ['jsxt', 'refereeJsxt', 'gzb', 'designgzb', 'xty', 'designxty', 'xadt', 'designxadt', 'tky', 'designtky', 'jyd', 'designjyd', 'bxkc', 'designbxkc', 'crsc', 'designcrsc', 'hls', 'designhls', 'drts', 'hyd', 'designhyd', 'nty', 'designnty']; // 登录页样式 export const ProjectLoginStyleList = ['jsxt', 'refereeJsxt', 'gzb', 'designgzb', 'xty', 'designxty', 'xadt', 'designxadt', 'tky', 'designtky', 'jyd', 'designjyd', 'bxkc', 'designbxkc', 'crsc', 'designcrsc', 'hls', 'designhls', 'drts', 'hyd', 'designhyd', 'nty', 'designnty', 'bjd', 'designbjd']; // 登录页样式
export const NoQrcodeList = ['heb', 'designheb']; export const NoQrcodeList = ['heb', 'designheb'];
export const goOtherPlatformMenu = { // 导航栏快速切换平台 export const goOtherPlatformMenu = { // 导航栏快速切换平台
login: '/design/login', login: '/design/login',

View File

@ -183,7 +183,9 @@ export default {
/** 查看站台状态 */ /** 查看站台状态 */
CMD_STAND_VIEW_STATUS:{value:'Stand_View_Status', label: '查看站台状态'}, CMD_STAND_VIEW_STATUS:{value:'Stand_View_Status', label: '查看站台状态'},
/** 站台总取消 */ /** 站台总取消 */
CMD_STAND_TOTAL_CANCLE:{value:'Stand_Total_Cancle', label: '站台总取消'} CMD_STAND_TOTAL_CANCLE:{value:'Stand_Total_Cancle', label: '站台总取消'},
/** 手动开启屏蔽门 */
CMD_STAND_OPEN_PSD:{value:'Stand_Open_Psd', label: '手动开启屏蔽门'}
}, },
Station: { Station: {

View File

@ -41,13 +41,17 @@ export const deviceFaultType = {
{label: '反位失表', value: 'REVERSE_SPLIT'} {label: '反位失表', value: 'REVERSE_SPLIT'}
], ],
StationStand: [ StationStand: [
{label: '屏蔽门故障打开', value: 'FAULT_PSD_OPEN'} {label: '屏蔽门无法关闭', value: 'PSD_CANNOT_BE_CLOSED'},
{label: '屏蔽门无法开启', value: 'PSD_CANNOT_BE_OPENED'}
], ],
ZcControl:[ ZcControl:[
{label: 'zc故障', value: 'FAULT'} {label: 'zc故障', value: 'FAULT'}
], ],
Train: [ Train: [
{label: '通信异常', value: 'COMMUNICATION_ABNORMAL'} {label: '通信异常', value: 'COMMUNICATION_ABNORMAL'}
],
Power:[
{label: '供电故障', value: 'FAULT'}
] ]
}; };
/** 设备类型 */ /** 设备类型 */
@ -58,5 +62,6 @@ export const deviceType = {
Station: '车站', Station: '车站',
StationStand: '站台', StationStand: '站台',
Train: '列车', Train: '列车',
ZcControl:'ZC' ZcControl:'ZC',
Power:'供电线'
}; };

View File

@ -141,7 +141,7 @@ class Handler {
} }
getTrainingStart() { getTrainingStart() {
return store.state.training.started; return store.state.training.trainingStart;
} }
getOperateBreakStatus () { getOperateBreakStatus () {

View File

@ -42,15 +42,15 @@ class MenuContextHandler {
data.conditionList.forEach(val=>{ data.conditionList.forEach(val=>{
switch (val.expression) { switch (val.expression) {
case 'eq': { case 'eq': {
result = result || (selected[val.name].toString() == val.value); result = result || ((selected[val.name] || 0).toString() == val.value);
break; break;
} }
case 'neq': { case 'neq': {
result = result || (selected[val.name].toString() != val.value); result = result || ((selected[val.name] || 0).toString() != val.value);
break; break;
} }
default: { default: {
result = result || (selected[val.name].toString() == val.value); result = result || ((selected[val.name] || 0).toString() == val.value);
break; break;
} }
} }

View File

@ -1766,6 +1766,13 @@ export const OperationEvent = {
operation: '518', operation: '518',
domId: '_Tips-Stand-cancelDetainTrainAuto-Menu' domId: '_Tips-Stand-cancelDetainTrainAuto-Menu'
} }
},
// 手动开启屏蔽门
openPsdByHand:{
menu: {
operation: '519',
domId: '_Tips-Stand-openPsdByHand-Menu'
}
} }
}, },

View File

@ -31,7 +31,6 @@ class ValidateHandler {
const steps = Handler.getSteps(); const steps = Handler.getSteps();
const order = Handler.getOrder(); const order = Handler.getOrder();
let valid = false; let valid = false;
if (operate.over && steps.length == 1) { // 右键菜单直接发送校验 if (operate.over && steps.length == 1) { // 右键菜单直接发送校验
if (operate && steps[0] && if (operate && steps[0] &&
operate.code == steps[0].code && operate.code == steps[0].code &&

View File

@ -65,7 +65,6 @@ function handle(state, data) {
break; break;
case 'Simulation_Reset': // 仿真-仿真重置消息 退出计划行车 case 'Simulation_Reset': // 仿真-仿真重置消息 退出计划行车
state.simulationReset += 1; state.simulationReset += 1;
state.simulationAlarmInfoList = [];
break; break;
case 'Simulation_Conversation': // 仿真-用户交互消息(聊天/命令) case 'Simulation_Conversation': // 仿真-用户交互消息(聊天/命令)
handleSimulationInfo(state, msg); handleSimulationInfo(state, msg);
@ -277,8 +276,7 @@ const socket = {
simulationTimeSync: '', // 仿真时间 simulationTimeSync: '', // 仿真时间
simulationIbpStatus: null, simulationIbpStatus: null,
competitionPracticeFinish:0, // 竞赛场景结束标识 competitionPracticeFinish:0, // 竞赛场景结束标识
simulationAlarmInfo: {}, // 仿真报警信息 simulationAlarmInfo: []// 仿真报警信息
simulationAlarmInfoList: []
}, },
getters: { getters: {
}, },

View File

@ -43,7 +43,8 @@ const training = {
scriptQuitCount: 0, // 主动退出剧本 scriptQuitCount: 0, // 主动退出剧本
scriptOperationType: '', // 剧本操作类型 scriptOperationType: '', // 剧本操作类型
triggerFaultCount: 0, // 触发故障计数器 triggerFaultCount: 0, // 触发故障计数器
triggerFaultDevice: '' // 触发故障目标设备 triggerFaultDevice: '', // 触发故障目标设备
trainingStart: false // 实训开始状态
}, },
getters: { getters: {
@ -279,6 +280,9 @@ const training = {
setTriggerFaultCount: (state, device) => { setTriggerFaultCount: (state, device) => {
state.triggerFaultCount++; state.triggerFaultCount++;
state.triggerFaultDevice = device; state.triggerFaultDevice = device;
},
setTrainingStart: (state, flag) => {
state.trainingStart = flag;
} }
}, },
@ -314,7 +318,6 @@ const training = {
*/ */
reset: ({ commit }) => { reset: ({ commit }) => {
commit('over'); commit('over');
commit('resetOrder');
// commit('stopCountTime'); // commit('stopCountTime');
// 清空计时器以及得分 // 清空计时器以及得分
@ -338,13 +341,20 @@ const training = {
commit('resetScore'); commit('resetScore');
commit('start'); commit('start');
}, },
// setTrainingStart:({ commit }) ={
// commit('setTrainingStart');
// },
setTrainingStart: ({ commit }, flag) => {
commit('setTrainingStart', flag);
if (!flag) {
commit('resetOrder');
}
},
/** /**
* 结束 * 结束
*/ */
over: ({ commit }) => { over: ({ commit }) => {
commit('over'); commit('over');
commit('resetOrder');
// commit('stopCountTime'); // commit('stopCountTime');
}, },
@ -368,7 +378,7 @@ const training = {
* 主动判断是否结束 * 主动判断是否结束
*/ */
judgeFinish: ({ dispatch, commit, state }, rtn) => { judgeFinish: ({ dispatch, commit, state }, rtn) => {
if (state.started) { if (state.trainingStart) {
if (state.order >= state.steps.length) { if (state.order >= state.steps.length) {
if (rtn && rtn.valid) { if (rtn && rtn.valid) {
commit('next'); commit('next');
@ -470,7 +480,7 @@ const training = {
try { try {
// 处理operation // 处理operation
Handler.handle(operate).then(rtn => { Handler.handle(operate).then(rtn => {
if (state.started) { if (state.trainingStart) {
// 教学和联系模式需要给出过程步骤提示 // 教学和联系模式需要给出过程步骤提示
if (TrainingMode.TEACH === state.mode || TrainingMode.PRACTICE === state.mode) { if (TrainingMode.TEACH === state.mode || TrainingMode.PRACTICE === state.mode) {
if (rtn && rtn.valid) { if (rtn && rtn.valid) {

View File

@ -16,8 +16,8 @@ export function now() {
return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second; return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
} }
export function timeFormat(usedTime) { export function timeFormat(usedTime=0) {
let hour = 0; let minute = 0; let second = 0; let sumTime = usedTime; let hour = 0; let minute = 0; let second = 0; let sumTime = usedTime;
if (sumTime) { if (sumTime) {
if (sumTime >= 3600) { if (sumTime >= 3600) {
hour = Math.floor(sumTime / 3600) % 24; hour = Math.floor(sumTime / 3600) % 24;
@ -37,8 +37,8 @@ export function timeFormat(usedTime) {
// 时分秒转为时间戳 // 时分秒转为时间戳
export function toTimeStamp(time) { export function toTimeStamp(time='') {
let s = 0; let s = 0;
const hour = time.split(':')[0]; const hour = time.split(':')[0];
const min = time.split(':')[1]; const min = time.split(':')[1];
const sec = time.split(':')[2]; const sec = time.split(':')[2];

View File

@ -159,8 +159,9 @@ export default {
if (this.option.optionList[index]) { if (this.option.optionList[index]) {
this.option.optionList[index].content = item; this.option.optionList[index].content = item;
this.option.optionList[index].correct = true; this.option.optionList[index].correct = true;
this.option.optionList[index].order = index + 1;
} else { } else {
this.option.optionList[index] = { content: item, correct: true }; this.option.optionList[index] = { content: item, correct: true, order: index + 1 };
} }
}); });
} else if (this.option.type === 'answer') { } else if (this.option.type === 'answer') {

View File

@ -271,7 +271,9 @@ export default {
this.formModel.operationScore = row.operationScore; this.formModel.operationScore = row.operationScore;
this.formModel.scriptId = row.scriptId; this.formModel.scriptId = row.scriptId;
getScriptByIdNew(row.scriptId).then(res=>{ getScriptByIdNew(row.scriptId).then(res=>{
this.actionList = res.data.actionList; this.actionList = res.data.actionList.filter(action=>{
return action.type != 'Exit_Conversation' && action.type != 'Accept_Conversation_Invitation';
});
getCompetitionPracticalSceneById(row.id).then(response=>{ getCompetitionPracticalSceneById(row.id).then(response=>{
const commandEvaluationRuleVOs = {}; const commandEvaluationRuleVOs = {};
if (response.data.commandEvaluationRuleVOs) { if (response.data.commandEvaluationRuleVOs) {

View File

@ -26,7 +26,6 @@
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js'; import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
import { Jl3ddevice } from '@/jlmap3d/jl3ddevice/jl3ddevice.js';
import { Jl3ddeviceNew } from '@/jlmap3d/jl3ddevice/jl3ddeviceNew.js'; import { Jl3ddeviceNew } from '@/jlmap3d/jl3ddevice/jl3ddeviceNew.js';
import Jl3ddeviceMsg from '@/views/jlmap3d/device/component/devicemsg'; import Jl3ddeviceMsg from '@/views/jlmap3d/device/component/devicemsg';
@ -135,13 +134,10 @@
this.windowstatus = true; this.windowstatus = true;
// this.jl3d.updatewindowstatus('1'); // this.jl3d.updatewindowstatus('1');
} }
if(this.$store.state.map.map.linkList){ //
this.datastatus = "old"; this.datastatus = "new";
this.initolddata(group,header); this.initnewdata(group,header);
}else{
this.datastatus = "new";
this.initnewdata(group,header);
}
if(this.$route.query.type == "VR_PSD"){ if(this.$route.query.type == "VR_PSD"){
this.jl3d.updatewindowstatus('1'); this.jl3d.updatewindowstatus('1');
this.psdCode = this.$route.query.psdCode; this.psdCode = this.$route.query.psdCode;
@ -156,11 +152,6 @@
beforeDestroy() { beforeDestroy() {
}, },
methods: { methods: {
initolddata: function (group,header) {
// let mapdata = this.$store.state.socket.device;
let dom = document.getElementById('jl3d');
this.jl3d = new Jl3ddevice(dom,group,header,this.mapId);
},
initnewdata: function (group,header){ initnewdata: function (group,header){
let dom = document.getElementById('jl3d'); let dom = document.getElementById('jl3d');
this.jl3d = new Jl3ddeviceNew(dom,group,header,this.mapId); this.jl3d = new Jl3ddeviceNew(dom,group,header,this.mapId);

View File

@ -17,7 +17,7 @@
<div id="bmcbtc" class="panebutton" style="top:8%;left:17%;" @click="bmcbtcclick"> <div id="bmcbtc" class="panebutton" style="top:8%;left:17%;" @click="bmcbtcclick">
<img class="buttonimg" :src="cbtcbuttonimg" /> <img class="buttonimg" :src="cbtcbuttonimg" />
<div class="buttontext">BM/CBTC</div> <div class="buttontext">BM/CBTC</div>
</div> --> </div>
<!-- RM --> <!-- RM -->
<div id="rm" class="panebutton" style="top:8%;left:31%;" @click="rmclick"> <div id="rm" class="panebutton" style="top:8%;left:31%;" @click="rmclick">
<img class="buttonimg" :src="rmbuttonimg" /> <img class="buttonimg" :src="rmbuttonimg" />
@ -83,20 +83,20 @@
</div> --> </div> -->
<!-- 受电弓升 --> <!-- 受电弓升 -->
<!-- <div id="sg" class="panebutton" style="bottom:6%;left:3%;" @click="sgclink"> <div id="sg" class="panebutton" style="bottom:6%;left:3%;" @click="sgclink">
<img class="buttonimg" :src="sgimg" /> <img class="buttonimg" :src="sgimg" />
<div class="buttontext">{{ $t('jlmap3d.electricGongSheng') }}</div> <div class="buttontext">{{ $t('jlmap3d.electricGongSheng') }}</div>
</div> --> </div>
<!-- 受电弓降 --> <!-- 受电弓降 -->
<!-- <div id="jg" class="panebutton" style="bottom:6%;left:17%;" @click="jgclick"> <div id="jg" class="panebutton" style="bottom:6%;left:17%;" @click="jgclick">
<img class="buttonimg" :src="jgimg" /> <img class="buttonimg" :src="jgimg" />
<div class="buttontext">{{ $t('jlmap3d.pantographFall') }}</div> <div class="buttontext">{{ $t('jlmap3d.pantographFall') }}</div>
</div> --> </div>
<!-- 试灯按钮 --> <!-- 试灯按钮 -->
<!-- <div id="sl" class="panebutton" style="bottom:6%;left:40%;" @click="slclick"> <!-- <div id="sl" class="panebutton" style="bottom:6%;left:40%;" @click="slclick">
<img class="buttonimg" :src="slimg" /> <img class="buttonimg" :src="slimg" />
<div class="buttontext">{{ $t('jlmap3d.lampButton') }}</div> <div class="buttontext">{{ $t('jlmap3d.lampButton') }}</div>
</div> --> </div>
<!-- ATP切除 --> <!-- ATP切除 -->
<div id="atp" class="panebutton" style="bottom:6%;left:31%;" @click="atpclick"> <div id="atp" class="panebutton" style="bottom:6%;left:31%;" @click="atpclick">
<img class="buttonimg" :src="atpimg" /> <img class="buttonimg" :src="atpimg" />
@ -193,6 +193,11 @@
doorleftimg:JL3D_LOCAL_STATIC+"/jl3d/control/green.png", doorleftimg:JL3D_LOCAL_STATIC+"/jl3d/control/green.png",
doorrightimg:JL3D_LOCAL_STATIC+"/jl3d/control/green.png", doorrightimg:JL3D_LOCAL_STATIC+"/jl3d/control/green.png",
//lightdark
sgl:JL3D_LOCAL_STATIC+"/jl3d/control/greenz.png",
jgl:JL3D_LOCAL_STATIC+"/jl3d/control/redz.png",
sgd:JL3D_LOCAL_STATIC+"/jl3d/control/greenz.png",
jgd:JL3D_LOCAL_STATIC+"/jl3d/control/redz.png",
} }
}, },
watch: { watch: {

View File

@ -0,0 +1,95 @@
<template>
<div class = "tmsfault" >
<div class = "tmsvoltage">{{voltage}}</div>
<div class = "tmscurrent">{{current}}</div>
<div class = "tmslevel">{{level}}</div>
<div class = "tmsspeed">{{speed}}</div>
</div>
</template>
<script>
import axios from 'axios';
export default {
name: 'TmsFault',
components: {
},
data() {
return {
voltage:"750V",
current:"0A",
level:"",
speed:"km/h",
}
},
mounted() {
},
beforeDestroy() {
},
watch: {
},
methods: {
init(){
},
},
beforeDestroy() {
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.tmsfault{
position: absolute;
// border-style:solid;
// border-color: #ffffff;
top:7%;
width:100%;
height:84%;
color:white;
}
.tmsvoltage{
top:7%;
left:3%;
width: 15%;
position: absolute;
text-align: center;
// border-style:solid;
// border-color: #ffffff;
}
.tmscurrent{
top:7%;
left:19%;
width: 15%;
position: absolute;
text-align: center;
// border-style:solid;
// border-color: #ffffff;
}
.tmslevel{
top:7%;
left:60%;
width: 20%;
position: absolute;
text-align: center;
// border-style:solid;
// border-color: #ffffff;
}
.tmsspeed{
top:7%;
left:82%;
width: 15%;
position: absolute;
text-align: center;
// border-style:solid;
// border-color: #ffffff;
}
</style>

View File

@ -1,6 +1,7 @@
<template> <template>
<div class = "tms" :style="{'background-image': 'url('+localStatic+'/jl3d/tms.png)'}" > <div class = "tms" :style="{'background-image': 'url('+localStatic+'/jl3d/tms.png)'}" >
<Tms-Fault>
</Tms-Fault>
</div> </div>
@ -10,10 +11,13 @@
import axios from 'axios'; import axios from 'axios';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js'; import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
export default {
name: 'SimulationTms',
components: {
import TmsFault from '@/views/jlmap3d/drive/sceneview/tmscomponent/tmsfault';
export default {
name: 'DriveTms',
components: {
TmsFault,
}, },
data() { data() {
return { return {

View File

@ -55,6 +55,8 @@
<el-button v-if="selectmodel.meshtype == 'section'" type="vexscal" @click="sectionFlat">区段平整</el-button> <el-button v-if="selectmodel.meshtype == 'section'" type="vexscal" @click="sectionFlat">区段平整</el-button>
<el-button v-if="selectmodel.meshtype == 'section'" type="vexscal" @click="sectionStraight">直区段修复</el-button>
<el-button v-if="selectmodel.meshtype == 'station'" @click="changeStationPos">自动对齐停车点</el-button> <el-button v-if="selectmodel.meshtype == 'station'" @click="changeStationPos">自动对齐停车点</el-button>
<!-- <el-button v-if="selectmodel.meshtype == 'station'" type="vexscal" @click="vexScalVertical">高度改变</el-button> --> <!-- <el-button v-if="selectmodel.meshtype == 'station'" type="vexscal" @click="vexScalVertical">高度改变</el-button> -->
@ -191,7 +193,9 @@ export default {
sectionFlat(){ sectionFlat(){
this.$emit('flat',this.selectmodel.code); this.$emit('flat',this.selectmodel.code);
}, },
sectionStraight(){
this.$emit('straight',this.selectmodel.code);
},
changeStationPos(){ changeStationPos(){
this.$emit('changeStationPos',this.selectmodel); this.$emit('changeStationPos',this.selectmodel);
}, },

View File

@ -8,7 +8,7 @@
<Edit-Action ref="action" @saction="saction" @actionevent="actionevent"> <Edit-Action ref="action" @saction="saction" @actionevent="actionevent">
</Edit-Action> </Edit-Action>
<Edit-Property ref="property" :selectmodel='selectmodel' @alignment="alignment" @vexscal= "vexscal" @changeStationPos="changeStationPos" @flat="flat"> <Edit-Property ref="property" :selectmodel='selectmodel' @alignment="alignment" @vexscal= "vexscal" @changeStationPos="changeStationPos" @flat="flat" @straight="straight">
</Edit-Property> </Edit-Property>
<Edit-Assets ref="assets" @smodel="smodel" @stexture="stexture"> <Edit-Assets ref="assets" @smodel="smodel" @stexture="stexture">
@ -198,6 +198,10 @@
this.jlmap3dedit.vexscaloff(); this.jlmap3dedit.vexscaloff();
this.jlmap3dedit.flatSection(alignmentCode); this.jlmap3dedit.flatSection(alignmentCode);
}, },
straight(alignmentCode){
this.jlmap3dedit.vexscaloff();
this.jlmap3dedit.straightSection(alignmentCode);
},
save() { save() {
//console.log("save"); //console.log("save");
console.log(this.jlmap3dedit.assetManager); console.log(this.jlmap3dedit.assetManager);

View File

@ -375,6 +375,8 @@ export default {
dispatcherList[item.id] = this.memberData[item.id]; dispatcherList[item.id] = this.memberData[item.id];
break; break;
case 'ELECTRIC_DISPATCHER': case 'ELECTRIC_DISPATCHER':
this.memberData[item.id].label = '电力调度' + (item.name || '');
this.memberData[item.id].labelName = '电力调度' + (item.name || '');
electricDispatcherList[item.id] = this.memberData[item.id]; electricDispatcherList[item.id] = this.memberData[item.id];
break; break;
case 'DEPOT_DISPATCHER': case 'DEPOT_DISPATCHER':
@ -439,6 +441,11 @@ export default {
id: 'parentDepartment', id: 'parentDepartment',
type: 'role', type: 'role',
children: parentDepartmentList children: parentDepartmentList
}, {
label: '电力调度',
id: 'electricDispatcher',
type: 'role',
children: electricDispatcherList
}]; }];
this.initCommonMemberList(); this.initCommonMemberList();
this.filterNode(); this.filterNode();
@ -449,8 +456,10 @@ export default {
// }); // });
} }
}, },
'$store.state.socket.simulationReset': function () { '$store.state.socket.simulationReset': function () { // 仿
this.conversitionStateMap = {}; this.conversitionStateMap = {};
document.querySelector('#teleName').classList.remove('flash');
document.querySelector('#teleRing').pause();
}, },
'$store.state.socket.acceptConversionInvite':function(val) { '$store.state.socket.acceptConversionInvite':function(val) {
this.conversitionStateMap[val.memberId].connect = true; this.conversitionStateMap[val.memberId].connect = true;

View File

@ -5,12 +5,18 @@
<div :class="chatContent.memberId == myMemberId?'rightUser':'leftUser'"> <div :class="chatContent.memberId == myMemberId?'rightUser':'leftUser'">
<div class="userHeader"> <div class="userHeader">
<div v-if="!chatContent.self" class="userName">{{ covertName(chatContent.memberId) }}</div> <div v-if="!chatContent.self" class="userName">{{ covertName(chatContent.memberId) }}</div>
<div :class="chatContent.memberId == myMemberId?'userChatTime textRight':'userChatTime'">{{ chatContent.time }}</div> <div :class="chatContent.memberId == myMemberId?'userChatTime textRight':'userChatTime'">{{ covertTime(chatContent.time) }}</div>
</div> </div>
<div class="userBubble" @click="playAudio(baseUrl+chatContent.src)"> <div class="userBubble" @click="playAudio(baseUrl+chatContent.src, chatContent)">
<div class="userMessage"> <div class="userMessage">
<!-- <span class="el-icon-video-play playicon" /> --> <!-- <span class="el-icon-video-play playicon" /> -->
<img :src="yuyin" class="playicon1"> <!-- <img :src="yuyin" class="playicon1"> -->
<!-- 语音播放 -->
<div class="wifi-symbol">
<div class="wifi-circle first" />
<div class="wifi-circle second" :class="{'second-amit': chatContent.activeAtuo}" />
<div class="wifi-circle third" :class="{'third-amit': chatContent.activeAtuo}" />
</div>
<!-- <span class="messageText">{{ chatContent.content }}</span> --> <!-- <span class="messageText">{{ chatContent.content }}</span> -->
</div> </div>
</div> </div>
@ -21,8 +27,9 @@
</div> </div>
</template> </template>
<script> <script>
import yuyin from '@/assets/yuyin.png'; // import yuyin from '@/assets/yuyin.png';
import {overConversationMessage} from '@/api/chat'; import {overConversationMessage} from '@/api/chat';
// this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
export default { export default {
props:{ props:{
messageList:{ messageList:{
@ -70,7 +77,7 @@ export default {
return { return {
chatContentList:[], chatContentList:[],
currentAudioList:[], currentAudioList:[],
yuyin:yuyin, // yuyin:yuyin,
currentAudioIndex:0, currentAudioIndex:0,
isPlay:false, isPlay:false,
baseUrl:process.env.VUE_APP_VOICE_API baseUrl:process.env.VUE_APP_VOICE_API
@ -126,10 +133,20 @@ export default {
}, },
playEachAudio(audioObject) { playEachAudio(audioObject) {
this.$nextTick(function() { this.$nextTick(function() {
this.messageList.forEach(item => {
if (item.id == audioObject.id) {
this.$set(item, 'activeAtuo', true);
}
});
document.querySelector('#audioPlay').src = audioObject.audioUrl; document.querySelector('#audioPlay').src = audioObject.audioUrl;
document.querySelector('#audioPlay').play(); document.querySelector('#audioPlay').play();
const that = this; const that = this;
document.querySelector('#audioPlay').onended = function() { document.querySelector('#audioPlay').onended = function() {
that.messageList.forEach(item => {
if (item.id == audioObject.id) {
that.$set(item, 'activeAtuo', false);
}
});
overConversationMessage(that.$route.query.group, audioObject.id).then(res=>{ overConversationMessage(that.$route.query.group, audioObject.id).then(res=>{
that.currentAudioList.shift(); that.currentAudioList.shift();
if (that.currentAudioList.length > 0) { if (that.currentAudioList.length > 0) {
@ -153,11 +170,27 @@ export default {
} }
return name; return name;
}, },
playAudio(audioUrl) { covertTime(time) {
const date = new Date(time);
let hour = date.getHours();
let minute = date.getMinutes();
let second = date.getSeconds();
hour = hour > 9 ? hour : '0' + hour;
minute = minute > 9 ? minute : '0' + minute;
second = second > 9 ? second : '0' + second;
return hour + ':' + minute + ':' + second;
},
playAudio(audioUrl, data) {
this.messageList.forEach(item => {
this.$set(item, 'activeAtuo', false);
});
if (!this.isPlay) { if (!this.isPlay) {
const that = this;
document.querySelector('#audioPlay').src = audioUrl; document.querySelector('#audioPlay').src = audioUrl;
this.$set(data, 'activeAtuo', true);
document.querySelector('#audioPlay').play(); document.querySelector('#audioPlay').play();
document.querySelector('#audioPlay').onended = function() { document.querySelector('#audioPlay').onended = function() {
that.$set(data, 'activeAtuo', false);
}; };
} }
}, },
@ -204,16 +237,73 @@ export default {
border-radius: 5px; border-radius: 5px;
cursor: pointer; cursor: pointer;
display:inline-block; display:inline-block;
height: 30px;
overflow: hidden;
} }
.playicon{ .playicon{
font-size: 20px; font-size: 20px;
vertical-align: top; vertical-align: top;
} }
.playicon1{ // .playicon1{
width:17px; // width:17px;
// }
.wifi-symbol {
width: 48px;
height: 48px;
box-sizing: border-box;
overflow: hidden;
transform: rotate(135deg);
position: absolute;
left: 5px;
top: -13px;
}
.wifi-circle {
border: 1px solid #000000;
border-radius: 50%;
position: absolute;
}
.first {
width: 9px;
height: 9px;
background: #cccccc;
top: 45px;
left: 45px;
border: 2px solid #000;
}
.second {
width: 20px;
height: 20px;
top: 40px;
left: 40px;
&.second-amit{
animation: fadeInOut 1s infinite 0.2s;
}
}
.third {
width: 26px;
height: 26px;
top: 36px;
left: 36px;
&.third-amit{
animation: fadeInOut 1s infinite 0.4s;
}
}
@keyframes fadeInOut {
0% {
opacity: 0; /*初始状态 透明度为0*/
}
100% {
opacity: 1; /*结尾状态 透明度为1*/
}
} }
.textRight{text-align: right;} .textRight{text-align: right;}
.userMessage{} .userMessage{
position: relative;
}
.messageText{line-height: 20px;} .messageText{line-height: 20px;}
.chatContentInClass{ .chatContentInClass{
display: inline-block; display: inline-block;

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<el-dialog v-dialogDrag title="场景列表" :visible.sync="dialogVisible" width="800px" center> <el-dialog v-dialogDrag title="场景列表" :visible.sync="dialogVisible" width="900px" center>
<el-tabs v-model="activeName" type="card" style="height: 500px;"> <el-tabs v-model="activeName" type="card" style="height: 500px;">
<el-tab-pane label="主场景列表" name="first"> <el-tab-pane label="主场景列表" name="first">
<el-table :data="mainSceneData" border :span-method="objectSpanMethod" stripe :cell-style="{padding: '8px 0'}"> <el-table :data="mainSceneData" border :span-method="objectSpanMethod" stripe :cell-style="{padding: '8px 0'}">
@ -60,6 +60,7 @@ export default {
{type: '供电系统故障', scene: '接触轨(网)断电', result:[]}, {type: '供电系统故障', scene: '接触轨(网)断电', result:[]},
{type: '供电系统故障', scene: '车站照明熄灭影响乘降', result:[]}, {type: '供电系统故障', scene: '车站照明熄灭影响乘降', result:[]},
{type: '车站机电设备故障', scene: '站台门故障', result:[]}, {type: '车站机电设备故障', scene: '站台门故障', result:[]},
// {type: '', scene: '', result:[]},
{type: '限速', scene: '列车限速', result:[]}, {type: '限速', scene: '列车限速', result:[]},
{type: '轨道故障', scene: '线路故障影响列车运行', result:[]} {type: '轨道故障', scene: '线路故障影响列车运行', result:[]}
], ],
@ -77,7 +78,7 @@ export default {
getCompetitionPracticalScene({pageSize:100, pageNum:1}).then(res=>{ getCompetitionPracticalScene({pageSize:100, pageNum:1}).then(res=>{
if (res.data.list && res.data.list.length > 0) { if (res.data.list && res.data.list.length > 0) {
res.data.list.forEach(each=>{ res.data.list.forEach(each=>{
if (each.name == '场景1' || each.name == '场景7') { if (each.name == '场景1' || each.name == '场景2' || each.name == '场景3' || each.name == '场景7') {
this.mainSceneData[1].result.push({id:each.id, name:each.name}); this.mainSceneData[1].result.push({id:each.id, name:each.name});
} else if (each.name == '场景4') { } else if (each.name == '场景4') {
this.mainSceneData[0].result.push({id:each.id, name:'场景4'}); this.mainSceneData[0].result.push({id:each.id, name:'场景4'});
@ -85,10 +86,11 @@ export default {
this.mainSceneData[4].result.push({id:each.id, name:'场景5'}); this.mainSceneData[4].result.push({id:each.id, name:'场景5'});
} else if (each.name == '场景9') { } else if (each.name == '场景9') {
this.mainSceneData[6].result.push({id:each.id, name:'场景9'}); this.mainSceneData[6].result.push({id:each.id, name:'场景9'});
} else if (each.name == '场景8') {
this.mainSceneData[5].result.push({id:each.id, name:'场景8'});
} else if (each.name == '场景10') { } else if (each.name == '场景10') {
this.mainSceneData[7].result.push({id:each.id, name:'场景10'}); this.mainSceneData[7].result.push({id:each.id, name:'场景10'});
} }
}); });
} }
}); });
@ -168,6 +170,10 @@ export default {
member.label = '上级部门' + (member.name ? member.name : ''); member.label = '上级部门' + (member.name ? member.name : '');
break; break;
} }
case 'ELECTRIC_DISPATCHER': {
member.label = '电力调度' + (member.name ? member.name : '');
break;
}
} }
// if (member.type === 'DISPATCHER') { // if (member.type === 'DISPATCHER') {
// this.memberId = member.id; // this.memberId = member.id;

View File

@ -96,14 +96,14 @@ export default {
this.startLoading = true; this.startLoading = true;
if (this.$route.query.trainingId) { if (this.$route.query.trainingId) {
this.isDisable = true; this.isDisable = true;
this.$store.dispatch('training/setMapDefaultState');
startTrainingNew({ id: this.$route.query.trainingId }, this.group).then(response => { startTrainingNew({ id: this.$route.query.trainingId }, this.group).then(response => {
this.$store.dispatch('training/setTrainingStart', true);
this.$store.dispatch('training/examModeStart'); this.$store.dispatch('training/examModeStart');
this.$store.dispatch('exam/start'); this.$store.dispatch('exam/start');
this.$store.dispatch('map/clearJlmapTrainView').then(() => { this.$store.dispatch('map/clearJlmapTrainView').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => { this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/countTime', 'Lesson'); //
this.$store.dispatch('training/countTime', 'Lesson'); //
});
}); });
this.startLoading = false; this.startLoading = false;
}).catch(() => { }).catch(() => {

View File

@ -1,75 +1,78 @@
<template> <template>
<div v-drag class="reminder-drag"> <div v-quickMenuDrag class="reminder-drag" :style="{bottom: offsetBottom + 'px'}">
<div ref="drapBox" class="reminder-box" :style="{bottom: offsetBottom + 'px'}"> <div ref="drapBox" class="reminder-box">
<div class="tip-title"> <div class="tip-title">
<i v-show="isShrink" class="icon el-icon-minus" @click="shrink" /> <i v-show="isShrink" class="icon el-icon-minus" @click="shrink" />
<i v-show="!isShrink" class="icon el-icon-plus" @click="shrink" /> <i v-show="!isShrink" class="icon el-icon-plus" @click="shrink" />
<p v-if="!isShrink" style="color: #fff;"> <p v-if="!isShrink" style="color: #fff;">
<span class="time-label">{{ $t('display.exam.examTime') }}</span> <span class="time-label">{{ $t('display.exam.examTime') }}</span>
<span class="time-elem">{{ formatRemainTime }}</span> <span class="time-elem">{{ formatRemainTime }}</span>
</p> </p>
<p v-if="isShrink" style="color: #fff;"> <p v-if="isShrink" style="color: #fff;">
<span>{{ examName }}</span> <span>{{ examName }}</span>
</p> </p>
</div> </div>
<div ref="dragBody" class="tip-body-box"> <div v-if="isShrink" class="reminder-box-content">
<div v-show="detailShow" class="tip-body"> <div class="zhezhao" />
<el-scrollbar wrap-class="scrollbar-wrapper"> <div ref="dragBody" class="tip-body-box">
<el-tree <div v-show="detailShow" class="tip-body">
ref="treeQuestion" <el-scrollbar wrap-class="scrollbar-wrapper">
:data="trainingList" <el-tree
node-key="id" ref="treeQuestion"
highlight-current style="background:rgba(0,0,0,0)"
@node-click="getTrainDetail" :data="trainingList"
> node-key="id"
<span slot-scope="{ data }"> highlight-current
<span :style="{color: data.usedTime !== undefined ? 'green':''}">&nbsp;{{ trainingList.indexOf(data)+1 }}.{{ @node-click="getTrainDetail"
data.trainingName }} >
<span slot-scope="{ data }">
<span :style="{color: data.usedTime !== undefined ? 'green':''}">&nbsp;{{ trainingList.indexOf(data)+1 }}.{{
data.trainingName }}
</span>
</span> </span>
</span> </el-tree>
</el-tree> </el-scrollbar>
</el-scrollbar>
</div>
<div v-show="!detailShow" class="tip-body">
<el-scrollbar wrap-class="scrollbar-wrapper">
<p class="list-item">
<span class="list-label">{{ $t('display.exam.questionTitle') }}</span>
<span class="list-elem">{{ courseModel.name }}</span>
</p>
<p class="list-item">
<span class="list-label">{{ $t('display.exam.bestTime') }}</span>
<span class="list-elem">{{ courseModel.minDuration }} {{ $t('display.seconds') }} </span>
</p>
<p class="list-item">
<span class="list-label">{{ $t('display.exam.maximumTime') }}</span>
<span class="list-elem">{{ courseModel.maxDuration }} {{ $t('display.seconds') }} </span>
</p>
<p class="list-item">
<span class="list-label"> {{ $t('display.exam.trainingInstructions') }}</span>
<span class="list-elem">{{ courseModel.remarks }}</span>
</p>
</el-scrollbar>
</div>
<div class="tip-foot">
<div v-show="!detailShow" class="foot-detail">
<el-button class="btn" @click="backList">{{ $t('display.exam.viewQuestions') }}</el-button>
<el-button v-if="!isFirst" class="btn" type="primary" @click="lastExam">{{ $t('display.exam.prev') }}</el-button>
<el-button v-if="!isLast" class="btn" type="primary" @click="nextExam">{{ $t('display.exam.next') }}</el-button>
<el-button v-if="isLast" class="btn" type="primary" @click="overExam">{{ $t('display.exam.submitExaminationPaper') }}</el-button>
</div> </div>
<div v-show="detailShow" class="foot-submit"> <div v-show="!detailShow" class="tip-body">
<el-button class="btn" type="primary" @click="overExam">{{ $t('display.exam.submitExaminationPaper') }}</el-button> <el-scrollbar wrap-class="scrollbar-wrapper">
<p class="list-item">
<span class="list-label">{{ $t('display.exam.questionTitle') }}</span>
<span class="list-elem">{{ courseModel.name }}</span>
</p>
<p class="list-item">
<span class="list-label">{{ $t('display.exam.bestTime') }}</span>
<span class="list-elem">{{ courseModel.minDuration }} {{ $t('display.seconds') }} </span>
</p>
<p class="list-item">
<span class="list-label">{{ $t('display.exam.maximumTime') }}</span>
<span class="list-elem">{{ courseModel.maxDuration }} {{ $t('display.seconds') }} </span>
</p>
<p class="list-item">
<span class="list-label"> {{ $t('display.exam.trainingInstructions') }}</span>
<span class="list-elem">{{ courseModel.remarks }}</span>
</p>
</el-scrollbar>
</div> </div>
<p style="color: #000; float: left;"> <div class="tip-foot">
<span class="time-label">{{ $t('display.exam.examTime') }}</span> <div v-show="!detailShow" class="foot-detail">
<span class="time-elem">{{ formatRemainTime }}</span> <el-button class="btn" @click="backList">{{ $t('display.exam.viewQuestions') }}</el-button>
</p> <el-button v-if="!isFirst" class="btn" type="primary" @click="lastExam">{{ $t('display.exam.prev') }}</el-button>
<el-button v-if="!isLast" class="btn" type="primary" @click="nextExam">{{ $t('display.exam.next') }}</el-button>
<el-button v-if="isLast" class="btn" type="primary" @click="overExam">{{ $t('display.exam.submitExaminationPaper') }}</el-button>
</div>
<div v-show="detailShow" class="foot-submit">
<el-button class="btn" type="primary" @click="overExam">{{ $t('display.exam.submitExaminationPaper') }}</el-button>
</div>
<p style="color: #000; float: left;">
<span class="time-label">{{ $t('display.exam.examTime') }}</span>
<span class="time-elem">{{ formatRemainTime }}</span>
</p>
</div>
<div class="drag-right" />
<div class="drag-left" />
<div class="drag-bottom" />
<div class="drag-top" />
</div> </div>
<div class="drag-right" />
<div class="drag-left" />
<div class="drag-bottom" />
<div class="drag-top" />
</div> </div>
</div> </div>
</div> </div>
@ -298,16 +301,22 @@ export default {
}); });
}, },
shrink() { shrink() {
const height = this.$refs.dragBody.offsetHeight + 40; // const height = this.$refs.dragBody.offsetHeight + 40;
const top = this.$refs.drapBox.style.top; // const top = this.$refs.drapBox.style.top;
if (this.isShrink) { if (this.isShrink) {
this.$refs.drapBox.style.height = '40px'; // this.$refs.drapBox.style.height = '40px';
this.$refs.drapBox.style.top = ''; // this.$refs.drapBox.style.top = '';
this.isShrink = false; this.isShrink = false;
} else { } else {
this.$refs.drapBox.style.height = height + 'px'; // this.$refs.drapBox.style.height = height + 'px';
this.$refs.drapBox.style.top = top; // this.$refs.drapBox.style.top = top;
this.isShrink = true; this.isShrink = true;
this.$nextTick(()=>{
const dragDom = document.querySelector('.reminder-drag').style.bottom;
if (document.body.clientHeight - 470 - parseInt(dragDom.replace('px', '')) < 0) {
document.querySelector('.reminder-drag').style.bottom = `${document.body.clientHeight - 470}px`;
}
});
} }
} }
} }
@ -316,26 +325,46 @@ export default {
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss"; @import "src/styles/mixin.scss";
.reminder-drag{
position: absolute;
bottom: 0px;
left: 15px;
z-index: 10;
}
.tip-body-box { .tip-body-box {
position: relative; position: relative;
height: 430px; height: 430px;
position: absolute;
left: 0;
top: 0;
width: 100%;
}
.zhezhao{
width: 100%;
height: 100%;
filter: blur(8px);
background: rgba(255,255,255,0.9);
}
.reminder-box-content{
width: 500px;
height: 430px;
left: 0;
top: 0;
z-index: 2;
background: rgba(255,255,255,0.8);
position: relative;
} }
.reminder-box { .reminder-box {
position: absolute;
float: left;
left: 15px;
bottom: 15px;
width: 650px;
height: 470px;
background-color: #fff;
border-radius: 5px; border-radius: 5px;
overflow: hidden; overflow: hidden;
z-index: 10; z-index: 10;
font-size: 18px; font-size: 18px;
.tip-title { .tip-title {
width: 100%; width: 500px;
overflow: hidden; overflow: hidden;
height: 40px; height: 40px;
display: flex; display: flex;
@ -385,7 +414,7 @@ export default {
} }
.tip-body { .tip-body {
height: 366px; height: 370px;
padding: 10px; padding: 10px;
.list-label { .list-label {
@ -398,7 +427,6 @@ export default {
position: absolute; position: absolute;
right: 0px; right: 0px;
bottom: 0px; bottom: 0px;
background-color: #fff;
padding: 10px 0 10px 10px; padding: 10px 0 10px 10px;
.foot-detail { .foot-detail {

View File

@ -81,7 +81,6 @@ export default {
computed: { computed: {
...mapGetters('training', [ ...mapGetters('training', [
'score', 'score',
'started',
'usedTime', 'usedTime',
'basicInfo' 'basicInfo'
]), ]),
@ -155,18 +154,17 @@ export default {
start() { start() {
// //
this.$store.dispatch('menuOperation/setButtonOperation', null); this.$store.dispatch('menuOperation/setButtonOperation', null);
this.$store.dispatch('training/setMapDefaultState');
this.startLoading = true; this.startLoading = true;
// console.log(2222222222222, this.startLoading, this.started, this.trainingObj);
if (this.trainingObj && this.trainingObj.id) { if (this.trainingObj && this.trainingObj.id) {
startTrainingNew(this.trainingObj, this.group).then(response => { startTrainingNew(this.trainingObj, this.group).then(response => {
this.isDisable = true; this.isDisable = true;
this.$store.dispatch('training/setTrainingStart', true);
this.$store.dispatch('map/clearJlmapTrainView').then(() => { this.$store.dispatch('map/clearJlmapTrainView').then(() => {
this.$store.dispatch('training/teachModeStart', this.demoMode).then(()=>{ this.$store.dispatch('training/teachModeStart', this.demoMode).then(()=>{
this.$store.dispatch('training/countTime', 'Lesson'); // this.$store.dispatch('training/countTime', 'Lesson'); //
this.$store.dispatch('training/setMapDefaultState').then(() => { this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('training/emitTipFresh'); this.tipInfo({ color: 'green', message: this.$t('global.pleaseOpearte') });
this.tipInfo({ color: 'green', message: this.$t('global.pleaseOpearte') });
});
}); });
}); });
this.startLoading = false; this.startLoading = false;
@ -192,6 +190,7 @@ export default {
this.$store.dispatch('training/judgeFinish', data).then(rsp => { this.$store.dispatch('training/judgeFinish', data).then(rsp => {
this.$store.dispatch('training/setStopCountTime'); this.$store.dispatch('training/setStopCountTime');
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('training/setTrainingStart', false);
}); });
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('display.lesson.endTrainingError')); this.$messageBox(this.$t('display.lesson.endTrainingError'));
@ -200,45 +199,42 @@ export default {
end() { end() {
// //
if (this.trainingObj && this.trainingObj.id) { if (this.trainingObj && this.trainingObj.id) {
if (this.started) { this.isDisable = false;
this.isDisable = false; this.$store.dispatch('training/isStepOver').then((rnt) => {
this.$store.dispatch('training/isStepOver').then((rnt) => { if (rnt) {
if (rnt) { this.endCommit();
this.endCommit(); } else {
} else { this.backDisable = true;
this.backDisable = true; this.$confirm(this.$t('display.lesson.endTrainingTip'), this.$t('global.tips'), {
this.$confirm(this.$t('display.lesson.endTrainingTip'), this.$t('global.tips'), { cancelButtonText: this.$t('global.cancel'),
cancelButtonText: this.$t('global.cancel'), confirmButtonText: this.$t('global.confirm'),
confirmButtonText: this.$t('global.confirm'), type: 'warning',
type: 'warning', center: true,
center: true, zIndex: 9999
zIndex: 9999 }).then(() => {
}).then(() => { this.backDisable = false;
this.backDisable = false; const mode = {
const mode = { mode: this.demoMode,
mode: this.demoMode, id: this.trainingObj.id,
id: this.trainingObj.id, lessonId: this.$route.query.lessonId,
lessonId: this.$route.query.lessonId, usedTime: this.usedTime
usedTime: this.usedTime };
}; endTrainingNew(mode, this.group).then(response => {
endTrainingNew(mode, this.group).then(response => { // const data = response.data;
// const data = response.data; this.$store.dispatch('training/end', null);
this.$store.dispatch('training/end', null); this.$store.dispatch('training/setStopCountTime');
this.$store.dispatch('training/setStopCountTime'); this.$store.dispatch('training/setScore', 0);
this.$store.dispatch('training/setScore', 0); this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/setTrainingStart', false);
}).catch(() => {
this.$messageBox(this.$t('display.lesson.endTrainingError'));
});
}).catch(() => { }).catch(() => {
this.isDisable = true; this.$messageBox(this.$t('display.lesson.endTrainingError'));
this.backDisable = false;
}); });
} }).catch(() => {
}); this.isDisable = true;
} else { this.backDisable = false;
this.$messageBox(this.$t('display.lesson.startTrainingTip')); });
} }
});
} }
}, },
back() { back() {

View File

@ -1,16 +1,16 @@
<template> <template>
<!-- v-drag 拖拽 调整宽高 --> <!-- v-drag 拖拽 调整宽高 -->
<div v-quickMenuDrag class="reminder-drag"> <div v-quickMenuDrag class="reminder-drag" :style="{bottom: offsetBottom + 'px'}">
<div ref="drapBox" class="reminder-box" :style="{bottom: offsetBottom + 'px'}"> <div ref="drapBox" class="reminder-box">
<div class="zhezhao" /> <div class="tip-title">
<div class="reminder-box-content"> <i v-show="isShrink" class="icon el-icon-minus" @click="shrink" />
<div class="tip-title"> <i v-show="!isShrink" class="icon el-icon-plus" @click="shrink" />
<i v-show="isShrink" class="icon el-icon-minus" @click="shrink" /> <p v-if="isShrink" style="color: #fff;">
<i v-show="!isShrink" class="icon el-icon-plus" @click="shrink" /> <span>{{ lessonName }}</span>
<p v-if="isShrink" style="color: #fff;"> </p>
<span>{{ lessonName }}</span> </div>
</p> <div v-if="isShrink" class="reminder-box-content">
</div> <div class="zhezhao" />
<div ref="dragBody" class="tip-body-box"> <div ref="dragBody" class="tip-body-box">
<div class="tip-body"> <div class="tip-body">
<el-scrollbar wrap-class="scrollbar-wrapper"> <el-scrollbar wrap-class="scrollbar-wrapper">
@ -135,16 +135,23 @@ export default {
launchFullscreen(); launchFullscreen();
}, },
shrink() { shrink() {
const height = this.$refs.dragBody.offsetHeight + 40; // const height = this.$refs.dragBody.offsetHeight + 40;
const top = this.$refs.drapBox.style.top; // const top = this.$refs.drapBox.style.top;
if (this.isShrink) { if (this.isShrink) {
this.$refs.drapBox.style.height = '40px'; //
this.$refs.drapBox.style.top = ''; // this.$refs.drapBox.style.height = '40px';
// this.$refs.drapBox.style.top = '';
this.isShrink = false; this.isShrink = false;
} else { } else {
this.$refs.drapBox.style.height = height + 'px';
this.$refs.drapBox.style.top = top;
this.isShrink = true; this.isShrink = true;
this.$nextTick(()=>{
const dragDom = document.querySelector('.reminder-drag').style.bottom;
if (document.body.clientHeight - 300 - parseInt(dragDom.replace('px', '')) < 0) {
document.querySelector('.reminder-drag').style.bottom = `${document.body.clientHeight - 300}px`;
}
});
// this.$refs.drapBox.style.height = height + 'px';
// this.$refs.drapBox.style.top = top;
} }
} }
} }
@ -156,14 +163,17 @@ export default {
.tip-body-box { .tip-body-box {
position: relative; position: relative;
height: 260px; height: 260px;
position: absolute;
left: 0;
top: 0;
width: 100%;
} }
.reminder-drag{ .reminder-drag{
position: absolute; position: absolute;
width: 500px;
height: 300px;
bottom: 0px; bottom: 0px;
left: 0px; left: 15px;
z-index: 10;
} }
.elem-span{ .elem-span{
@ -175,37 +185,31 @@ export default {
height: 100%; height: 100%;
filter: blur(8px); filter: blur(8px);
background: rgba(255,255,255,0.9); background: rgba(255,255,255,0.9);
position:absolute;
} }
.reminder-box-content{ .reminder-box-content{
position: absolute; width: 500px;
width: 100%; height: 260px;
height: 100%;
left: 0; left: 0;
top: 0; top: 0;
z-index: 2; z-index: 2;
background: rgba(255,255,255,0.8); background: rgba(255,255,255,0.8);
position: relative;
} }
.reminder-box { .reminder-box {
position: absolute;
float: left;
left: 15px;
bottom: 15px;
width: 500px;
height: 300px;
background: transparent;
border-radius: 5px; border-radius: 5px;
overflow: hidden; overflow: hidden;
z-index: 10; z-index: 10;
font-size: 18px; font-size: 18px;
.tip-title { .tip-title {
width: 100%; width: 500px;
overflow: hidden; overflow: hidden;
height: 40px; height: 40px;
display: flex; display: flex;
align-items: center; align-items: center;
flex-direction: row-reverse; flex-direction: row-reverse;
background-color: rgba(64, 158, 255,0.8); background-color: rgba(64, 158, 255,1);
border-radius: 5px 5px 0 0; border-radius: 5px 5px 0 0;
justify-content: space-between; justify-content: space-between;
padding: 0 10px; padding: 0 10px;
@ -249,7 +253,7 @@ export default {
} }
.tip-body { .tip-body {
height: 366px; height: 260px;
padding: 10px; padding: 10px;
.list-label { .list-label {

View File

@ -8,8 +8,10 @@
<!-- 加载剧本 --> <!-- 加载剧本 -->
<el-button v-if="isDemon && !isScheduling && !isContest" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">{{ $t('display.schema.loadScript') }}</el-button> <el-button v-if="isDemon && !isScheduling && !isContest" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">{{ $t('display.schema.loadScript') }}</el-button>
<!-- 运行图加载 --> <!-- 运行图加载 -->
<el-button v-if="notScript && running" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('display.schema.previewRunDiagram') }}</el-button> <!-- notScript && -->
<el-button v-if="notScript && !running" size="small" type="warning" @click="loadRunPlan">{{ $t('display.schema.loadRunDiagram') }}</el-button> <el-button v-if="running" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('display.schema.previewRunDiagram') }}</el-button>
<!-- notScript && -->
<el-button v-if="!running" size="small" type="warning" @click="loadRunPlan">{{ $t('display.schema.loadRunDiagram') }}</el-button>
</el-button-group> </el-button-group>
<el-button v-if="!isScheduling" size="small" :type="faultMode ? '':'primary' " @click="changeOperateMode()">{{ faultMode?'切换到普通模式':'切换到故障模式' }}</el-button> <el-button v-if="!isScheduling" size="small" :type="faultMode ? '':'primary' " @click="changeOperateMode()">{{ faultMode?'切换到普通模式':'切换到故障模式' }}</el-button>
<!-- <el-button v-if="!isLocalStation" size="small" :type="faultMode ? 'danger' : ''" @click="changeDirectiveMode()">指令模式</el-button> --> <!-- <el-button v-if="!isLocalStation" size="small" :type="faultMode ? 'danger' : ''" @click="changeDirectiveMode()">指令模式</el-button> -->

View File

@ -58,12 +58,34 @@ export const operateEnum = {
// } // }
}, },
ControlConvertMenu:{ ControlConvertMenu:{
type:'控制模式',
CM_Apply_For_Station_Control:{ CM_Apply_For_Station_Control:{
code:'stationCodes', code:'stationCodes',
isList:true, isList:true,
isDevice:true, isDevice:true,
name:'车站列表', name:'车站列表',
function:getStationNameById function:getStationNameById
},
CM_Reply_Station_Control:{
code:'replyVOList',
name:'车站列表',
isList:true,
isDevice:true,
function:getStationResultById
},
CM_Reply_Center_Control:{
code:'replyVOList',
name:'车站列表',
isList:true,
isDevice:true,
function:getStationResultById
},
CM_Apply_For_Center_Control:{
code:'stationCodes',
isList:true,
isDevice:true,
name:'车站列表',
function:getStationNameById
} }
}, },
Stand:{ Stand:{
@ -125,7 +147,7 @@ export const operateEnum = {
params:[ params:[
{ {
code:'open', code:'open',
name:'', name:'状态',
result:[ result:[
{data:true, name:'开', judge:'='}, {data:true, name:'开', judge:'='},
{data:false, name:'关', judge:'='} {data:false, name:'关', judge:'='}
@ -133,13 +155,17 @@ export const operateEnum = {
}, },
{ {
code:'right', code:'right',
name:'', name:' 方向',
result:[ result:[
{data:true, name:'左门', judge:'='}, {data:true, name:'左门', judge:'='},
{data:false, name:'右门', judge:'='} {data:false, name:'右门', judge:'='}
] ]
} }
] ]
},
Driver_Drive_Mode_Change:{
code:'driveMode',
name:'模式为'
} }
}, },
TrainWindow:{ TrainWindow:{
@ -179,13 +205,13 @@ export function covertOperate(operationType, operationParamMap) {
if (operationType == 'Set_Fault' || operationType == 'Cancel_Fault') { if (operationType == 'Set_Fault' || operationType == 'Cancel_Fault') {
let deviceName = ''; let deviceName = '';
const device = store.getters['map/getDeviceByCode'](operationParamMap.code); const device = store.getters['map/getDeviceByCode'](operationParamMap.code);
if (device._type == 'StationStand') { if (device._type == 'StationStand' || device._type == 'Signal' || device._type == 'Switch') {
const station = store.getters['map/getDeviceByCode'](device.stationCode); const station = store.getters['map/getDeviceByCode'](device.stationCode);
deviceName += '【车站-' + station.name + '】/'; deviceName += '【车站-' + station.name + '】 / ' + deviceType[device._type] + device.name;
} else { } else {
deviceName = '' + device.name; deviceName = '' + device.name;
} }
let tip = '请找到' + deviceType[device._type] + deviceName + ','; let tip = '请找到' + deviceName + ',';
if (operationType == 'Set_Fault') { if (operationType == 'Set_Fault') {
tip += '设置故障,'; tip += '设置故障,';
} else { } else {
@ -233,31 +259,57 @@ export function covertOperate(operationType, operationParamMap) {
} }
} }
function covertOperation(deviceType, operationParamMap, operationType) { function covertDeviceName(deviceInfo, deviceType) {
let deviceName = ''; let deviceName = '';
const device = store.getters['map/getDeviceByCode'](deviceInfo);
if (device._type == 'StationStand' || device._type == 'Signal' || device._type == 'Switch') {
const station = store.getters['map/getDeviceByCode'](device.stationCode);
deviceName += '车站-' + station.name + ' / ';
}
if (device._type == 'Section') {
if (device.parentCode && device.type == '02') {
const parentSection = store.getters['map/getDeviceByCode'](device.parentCode);
deviceName += operateEnum[deviceType].type + ' ' + parentSection.name + '-' + device.name;
} else {
deviceName += operateEnum[deviceType].type + device.name;
}
} else {
let deviceNameIn = '';
if (device.name) {
deviceNameIn = device.name;
} else {
deviceNameIn = '(车组号:' + device.groupNumber + ')';
}
deviceName += operateEnum[deviceType].type + ' ' + deviceNameIn;
}
return deviceName;
}
function covertOperation(deviceType, operationParamMap, operationType) {
let deviceName = '【';
let paramName = ''; let paramName = '';
if (operateEnum[deviceType].code) { if (operateEnum[deviceType].code) {
const device = store.getters['map/getDeviceByCode'](operationParamMap[operateEnum[deviceType].code]); const deviceInfo = operationParamMap[operateEnum[deviceType].code];
if (device._type == 'StationStand') { if (deviceInfo) {
const station = store.getters['map/getDeviceByCode'](device.stationCode); deviceName += covertDeviceName(deviceInfo, deviceType);
deviceName += '【车站-' + station.name + '】/';
}
if (device._type == 'Section') {
if (device.parentCode && device.type == '02') {
const parentSection = store.getters['map/getDeviceByCode'](device.parentCode);
deviceName += '【' + operateEnum[deviceType].type + ' ' + parentSection.name + '-' + device.name + '】';
} else {
deviceName += '【' + operateEnum[deviceType].type + device.name + '】';
}
} else { } else {
let deviceNameIn = ''; const deviceCode = operationParamMap[operateEnum[deviceType][operationType].code];
if (device.name) { const device = store.getters['map/routeList'].find(route=>{ return route.code == deviceCode; });
deviceNameIn = device.name; deviceName += covertDeviceName(device.startSignalCode, deviceType);
} else {
deviceNameIn = '(车组号:' + device.groupNumber + ')';
}
deviceName += '【' + operateEnum[deviceType].type + ' ' + deviceNameIn + '】';
} }
// if (deviceInfo instanceof Array) {
// deviceInfo.forEach((each, index)=>{
// deviceName = +covertDeviceName(each, deviceType);
// if (index != deviceInfo.length - 1) {
// deviceName += '';
// }
// });
// } else {
// }
deviceName += '】';
} else if (operateEnum[deviceType].type) {
deviceName += operateEnum[deviceType].type + '】';
} }
const paramInfo = operateEnum[deviceType][operationType]; const paramInfo = operateEnum[deviceType][operationType];
if (paramInfo) { if (paramInfo) {
@ -333,11 +385,17 @@ function getRouteNameById(routeId) {
const route = routeList.find(route=>{ const route = routeList.find(route=>{
return route.code == routeId; return route.code == routeId;
}); });
if (route) { return route.name; } else { return ''; } if (route) { return route.turnBack ? route.name + '(Z)' : route.name; } else { return ''; }
} }
function getStationNameById(stationId) { function getStationNameById(stationId) {
const station = store.getters['map/getDeviceByCode'](stationId); const station = store.getters['map/getDeviceByCode'](stationId);
return station.name; return station.name;
} }
function getStationResultById(stationResult) {
const station = store.getters['map/getDeviceByCode'](stationResult.stationCode);
let param = '不同意';
if (stationResult.agree) { param = '同意'; }
return station.name + ' ' + param;
}

View File

@ -222,6 +222,12 @@ export default {
id: 'parentDepartment', id: 'parentDepartment',
type: 'role', type: 'role',
children: result.deviceListData[5] children: result.deviceListData[5]
},
{
label: '电力调度',
id: 'electricDispatcher',
type: 'role',
children: result.deviceListData[6]
}]; }];
const lastMemberList = result.lastMemberList; const lastMemberList = result.lastMemberList;
this.$emit('setTreeData', treeData); this.$emit('setTreeData', treeData);

View File

@ -28,15 +28,12 @@
/> />
<set-time ref="setTime" @ConfirmSelectBeginTime="start" /> <set-time ref="setTime" @ConfirmSelectBeginTime="start" />
<tip-script-record-new <tip-script-record-new
ref="tipTaskRecordNew" ref="tipTaskRecordNew"
:group="group" :group="group"
:offset-bottom="offsetBottom" :offset-bottom="offsetBottom"
:offset="offset" :offset="offset"
:tree-data="treeData"
:member-list="memberData"
@changeTreeData="changeTreeData"
@addScriptMember="addScriptMember"
@resetChat="resetChat" @resetChat="resetChat"
/> />
<chat-box <chat-box
@ -56,7 +53,6 @@ import TipScriptRecordNew from '@/views/scriptManage/tipScriptRecord';
import SetTime from '@/views/newMap/displayNew/demon/setTime'; import SetTime from '@/views/newMap/displayNew/demon/setTime';
import { Notification } from 'element-ui'; import { Notification } from 'element-ui';
import { ranAsPlan, exitRunPlan } from '@/api/simulation'; import { ranAsPlan, exitRunPlan } from '@/api/simulation';
import {covertMemberData} from '@/views/newMap/displayNew/utils';
import { getSimulationMemberList} from '@/api/simulation'; import { getSimulationMemberList} from '@/api/simulation';
import ChatBox from '@/views/newMap/chatView/chatBox.vue'; import ChatBox from '@/views/newMap/chatView/chatBox.vue';
@ -101,10 +97,6 @@ export default {
return { return {
isDisable: false, isDisable: false,
isScriptCommand:false, isScriptCommand:false,
driverList:[],
treeData:[],
memberData:[],
activeTrainList:[],
userRole:'' userRole:''
}; };
}, },
@ -133,82 +125,16 @@ export default {
'$store.state.scriptRecord.bgSet':function (val) { '$store.state.scriptRecord.bgSet':function (val) {
this.isScriptCommand = val; this.isScriptCommand = val;
}, },
// ()
'$store.state.map.activeTrainListChange': function (val) {
// driverList
const activeTrainList = this.$store.state.map.activeTrainList;
if (this.driverList.length > 0) {
const driverList = [];
if (activeTrainList && activeTrainList.length) {
activeTrainList.sort();
activeTrainList.forEach(groupNumber => {
const drivers = this.driverList.find(driver=>{
return driver.deviceCode == groupNumber;
});
if (drivers) {
driverList.push(drivers);
}
});
}
// this.memberData = [...this.treeData[0].children, ...this.treeData[1].children, ...this.treeData[2].children, ...this.treeData[3].children, ...this.treeData[4].children];
this.treeData[2].children = driverList;
} else {
this.activeTrainList = activeTrainList;
}
},
'$store.state.map.mapViewLoadedCount': function (val) { // '$store.state.map.mapViewLoadedCount': function (val) { //
getSimulationMemberList(this.group).then(resp => { getSimulationMemberList(this.group).then(resp => {
// this.$store.dispatch('training/setMemberList', {memberList:resp.data, userId:this.$store.state.user.id}); this.$store.dispatch('training/setMemberList', {memberList:resp.data, userId:this.$store.state.user.id});
this.driverList = [];
this.treeData = [];
if (this.$store.state.training.started) {
this.activeTrainList = this.$store.state.map.activeTrainList;
}
// 仿
const result = covertMemberData(this.activeTrainList, resp.data);
this.driverList = result.driverList;
this.treeData = [{
label: '行调',
id: 'dispatcher',
type: 'role',
children: result.deviceListData[0]
}, {
label: '车站值班员',
id: 'stationSupervisor',
type: 'role',
children: result.deviceListData[2]
}, {
label: '司机',
id: 'driver',
type: 'role',
children: result.deviceListData[3]
}, {
label: '通号',
id: 'maintainer',
type: 'role',
children: result.deviceListData[1]
}, {
label: '车辆段',
id: 'depotDispatcher',
type: 'role',
children: result.deviceListData[4]
}, {
label: '上级部门',
id: 'parentDepartment',
type: 'role',
children: result.deviceListData[5]
}
// PARENT_DEPARTMENT
];
this.memberData = result.lastMemberList;
// //
const member = resp.data.find(mem=>{ const member = resp.data.find(mem=>{
return mem.userId != '' && mem.userId != undefined; return mem.userId != '' && mem.userId != undefined;
}); });
if (member) { if (member) {
const memberType = ['STATION_SUPERVISOR', 'DISPATCHER', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER', 'PARENT_DEPARTMENT']; const memberType = ['STATION_SUPERVISOR', 'DISPATCHER', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER', 'PARENT_DEPARTMENT', 'ELECTRIC_DISPATCHER'];
const prdTypeList = ['01', '02', '04', '', '', '']; const prdTypeList = ['01', '02', '04', '', '05', '', ''];
const index = memberType.indexOf(member.type); const index = memberType.indexOf(member.type);
let prdType; let prdType;
if (index >= 0) { if (index >= 0) {
@ -223,6 +149,9 @@ export default {
}).catch(() => { }).catch(() => {
this.$messageBox('获取仿真成员列表失败!'); this.$messageBox('获取仿真成员列表失败!');
}); });
},
'$store.state.scriptRecord.userRole':function (val) {
this.userRole = val;
} }
}, },
beforeDestroy() { beforeDestroy() {
@ -305,48 +234,6 @@ export default {
}, },
resetChat() { resetChat() {
// this.$refs.chatbox.resetCoversition(); // this.$refs.chatbox.resetCoversition();
},
changeTreeData({newRole, oldRole}) {
const deviceTypeList = ['DISPATCHER', 'STATION_SUPERVISOR', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER', 'PARENT_DEPARTMENT'];
if (oldRole.id) {
const oldIndex = deviceTypeList.indexOf(oldRole.type);
if (oldIndex >= 0) {
const oldTreeDataIn = this.treeData[oldIndex];
oldTreeDataIn.children.map(device=>{
if (device.id == oldRole.id) {
device.userName = '';
delete device.userId;
device.disabled = false;
device.label = device.type + (device.deviceName ? '- ' + device.deviceName : '') + (device.name ? device.name : '');
}
});
this.treeData[oldIndex] = oldTreeDataIn;
}
}
const newIndex = deviceTypeList.indexOf(newRole.type);
if (newIndex >= 0) {
const newTreeDataIn = this.treeData[newIndex];
newTreeDataIn.children.map(device=>{
if (device.id == newRole.id) {
device.userName = this.$store.state.user.nickname;
device.userId = this.$store.state.user.id;
device.disabled = true;
device.label = device.type + (device.deviceName ? '- ' + device.deviceName : '') + (device.name ? device.name : '') + '-' + device.userName;
}
});
this.treeData[newIndex] = newTreeDataIn;
}
this.userRole = newRole.type;
},
addScriptMember(member) {
this.memberData.push(member);
const deviceTypeList = ['行调', '行值', '司机', '通号', '车辆段调度', '上级部门'];
const index = deviceTypeList.indexOf(member.type);
if (index >= 0) {
const treeDataIn = this.treeData[index];
treeDataIn.children.push(member);
this.treeData[index] = treeDataIn;
}
} }
} }
}; };

View File

@ -15,7 +15,7 @@ export function covertMemberData (activeTrainList, resp) {
lastData = JSON.parse(lastData); lastData = JSON.parse(lastData);
const lastMemberList = []; const lastMemberList = [];
// const electricDispatcherList = []; // const electricDispatcherList = [];
const deviceListData = [[], [], [], [], [], []]; const deviceListData = [[], [], [], [], [], [], []];
const driverList = []; const driverList = [];
lastData.forEach((member, index)=>{ lastData.forEach((member, index)=>{
if (member.userId && member.userId == store.state.user.id) { if (member.userId && member.userId == store.state.user.id) {
@ -37,7 +37,7 @@ export function covertMemberData (activeTrainList, resp) {
member.label = member.type + name + userName; member.label = member.type + name + userName;
member.normalName = member.type + name; member.normalName = member.type + name;
} }
const deviceType = ['行调', '通号', '行值', '司机', '车辆段调度', '上级部门']; const deviceType = ['行调', '通号', '行值', '司机', '车辆段调度', '上级部门', '电力调度'];
const deviceTypeIndex = deviceType.indexOf(member.type); const deviceTypeIndex = deviceType.indexOf(member.type);
if (deviceTypeIndex >= 0) { if (deviceTypeIndex >= 0) {
if (deviceTypeIndex == 3) { if (deviceTypeIndex == 3) {

View File

@ -154,9 +154,11 @@ export default {
dispatcherList.push(this.memberData[item.id]); dispatcherList.push(this.memberData[item.id]);
break; break;
case 'ELECTRIC_DISPATCHER': case 'ELECTRIC_DISPATCHER':
this.memberData[item.id].labelName = '电力调度' + (item.name || '');
electricDispatcherList.push(this.memberData[item.id]); electricDispatcherList.push(this.memberData[item.id]);
break; break;
case 'DEPOT_DISPATCHER': case 'DEPOT_DISPATCHER':
this.memberData[item.id].labelName = '车辆段调度' + (item.name || '');
depotDispatcherList.push(this.memberData[item.id]); depotDispatcherList.push(this.memberData[item.id]);
break; break;
case 'STATION_SUPERVISOR': case 'STATION_SUPERVISOR':
@ -193,7 +195,12 @@ export default {
labelName: '车辆段', labelName: '车辆段',
id: 'depotDispatcher', id: 'depotDispatcher',
children: depotDispatcherList children: depotDispatcherList
}]; }, {
labelName: '电力调度',
id: 'electricDispatcher',
children: electricDispatcherList
}
];
this.$nextTick(() => { this.$nextTick(() => {
if (this.$refs.tree) { if (this.$refs.tree) {
this.$refs.tree.filter(this.queryMember); this.$refs.tree.filter(this.queryMember);

View File

@ -41,7 +41,7 @@ export default {
this.$store.dispatch('training/isTeachMode').then(() => { this.$store.dispatch('training/isTeachMode').then(() => {
this.tipShow = true; this.tipShow = true;
const offset = this.$store.state.config.canvasOffset; const offset = this.$store.state.config.canvasOffset;
if (this.$store.state.training.started) { if (this.$store.state.training.trainingStart) {
const order = this.$store.state.training.order; const order = this.$store.state.training.order;
const steps = this.$store.state.training.steps; const steps = this.$store.state.training.steps;
if (order > -1 && order < steps.length) { if (order > -1 && order < steps.length) {

View File

@ -133,6 +133,47 @@
</div> </div>
</div> </div>
</template> </template>
<template v-if="checkFieldType(item, 'sectionUnit')">
<div :key="item.prop" class="coordinate">
<span class="title" :style="{width: item.width}">{{ item.label }}</span>
<div class="point-section">
<template v-for="(sectionUnit, j) in formModel[item.prop]">
<div :key="j" style="border: 1px solid #CCCCCC; border-radius: 5px;padding: 2px;padding-top: 10px;">
<el-form-item label="左端区段" :prop="'sectionUnitList[' + j + '].leftCode'" label-width="70px">
<el-select v-model="sectionUnit.leftCode" filterable placeholder="请选择" clearable style="width: 115px;">
<el-option
v-for="elem in item.options"
:key="elem.code"
:label="elem.name"
:value="elem.code"
/>
</el-select>
<el-button
:type="item.buttonShowType && item.listIndex === ('leftCode' + j) ? 'danger' : 'primary'"
@click="item.hover(item.buttonType, `leftCode${j}`)"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="右端区段" :prop="'sectionUnitList[' + j + '].rightCode'" label-width="70px">
<el-select v-model="sectionUnit.rightCode" filterable placeholder="请选择" clearable style="width: 115px;">
<el-option
v-for="elem in item.options"
:key="elem.code"
:label="elem.name"
:value="elem.code"
/>
</el-select>
<el-button
:type="item.buttonShowType && item.listIndex === ('rightCode' + j) ? 'danger' : 'primary'"
@click="item.hover(item.buttonType, `rightCode${j}`)"
>{{ $t('map.activate') }}</el-button>
<el-button type="success" icon="el-icon-plus" circle @click="item.addSectionUnit(j)" />
<el-button v-if="j" type="danger" icon="el-icon-delete" circle @click="item.delSectionUnit(j)" />
</el-form-item>
</div>
</template>
</div>
</div>
</template>
<!-- 多个坐标点绘制 --> <!-- 多个坐标点绘制 -->
<template v-if="checkFieldType(item, 'points')"> <template v-if="checkFieldType(item, 'points')">
<div v-if="!item.isHidden" :key="item.prop" class="coordinate"> <div v-if="!item.isHidden" :key="item.prop" class="coordinate">

View File

@ -56,6 +56,7 @@ export default {
activeName: 'first', activeName: 'first',
lazy: true, lazy: true,
field: '', field: '',
listIndex: '',
terminalList: [ terminalList: [
{ label: '显示', value: true}, { label: '显示', value: true},
{ label: '隐藏', value: false } { label: '隐藏', value: false }
@ -70,7 +71,11 @@ export default {
leftSectionCode: '', leftSectionCode: '',
leftOffset: 0, leftOffset: 0,
rightSectionCode: '', rightSectionCode: '',
rightOffset: 0 rightOffset: 0,
sectionUnitList: [{
leftCode: '',
rightCode: ''
}]
}, },
addModel: { addModel: {
width: 1, width: 1,
@ -82,7 +87,8 @@ export default {
leftSectionCode: '', leftSectionCode: '',
leftOffset: 0, leftOffset: 0,
rightSectionCode: '', rightSectionCode: '',
rightOffset: 0 rightOffset: 0,
sectionUnitList: []
}, },
rules: { rules: {
code: [ code: [
@ -111,6 +117,12 @@ export default {
isButtonTypeRight() { isButtonTypeRight() {
return this.field == 'rightSectionCode'; return this.field == 'rightSectionCode';
}, },
isButtonTypeUnit() {
return this.field == 'sectionUnit';
},
listIndexProp() {
return this.listIndex;
},
form() { form() {
const form = { const form = {
labelWidth: '120px', labelWidth: '120px',
@ -131,7 +143,8 @@ export default {
{ prop: 'leftSectionCode', label: '左端点区段', type: 'selectHover', optionLabel: 'name', optionValue: 'code', options: this.sectionList, hover: this.hover, buttonType: 'leftSectionCode', buttonShowType: this.isButtonTypeLeft}, { prop: 'leftSectionCode', label: '左端点区段', type: 'selectHover', optionLabel: 'name', optionValue: 'code', options: this.sectionList, hover: this.hover, buttonType: 'leftSectionCode', buttonShowType: this.isButtonTypeLeft},
{ prop: 'leftOffset', label: '左端点区段偏移', type: 'number', min: 0}, { prop: 'leftOffset', label: '左端点区段偏移', type: 'number', min: 0},
{ prop: 'rightSectionCode', label: '右端点区段', type: 'selectHover', optionLabel: 'name', optionValue: 'code', options: this.sectionList, hover: this.hover, buttonType: 'rightSectionCode', buttonShowType: this.isButtonTypeRight}, { prop: 'rightSectionCode', label: '右端点区段', type: 'selectHover', optionLabel: 'name', optionValue: 'code', options: this.sectionList, hover: this.hover, buttonType: 'rightSectionCode', buttonShowType: this.isButtonTypeRight},
{ prop: 'rightOffset', label: '右端点区段偏移', type: 'number', min: 0} { prop: 'rightOffset', label: '右端点区段偏移', type: 'number', min: 0},
{ prop: 'sectionUnitList', label: '额外的区段单元', type: 'sectionUnit', options: this.sectionList, addSectionUnit: this.addSectionUnit, delSectionUnit: this.delSectionUnit, hover:this.hover, buttonType: 'sectionUnit', buttonShowType: this.isButtonTypeUnit, listIndex: this.listIndexProp }
] ]
}, },
map: { map: {
@ -171,14 +184,25 @@ export default {
mounted() { mounted() {
}, },
methods: { methods: {
hover(field) { hover(field, listIndex) {
this.field = field == this.field ? '' : field; if (this.listIndex != listIndex && this.field == field) {
this.field = field;
} else {
this.field = field == this.field ? '' : field;
}
this.listIndex = listIndex == this.listIndex ? '' : listIndex;
if (this.field) { if (this.field) {
this.$emit('deviceSelect', 'Power'); this.$emit('deviceSelect', 'Power');
} else { } else {
this.$emit('deviceSelect', ''); this.$emit('deviceSelect', '');
} }
}, },
addSectionUnit(i) {
this.editModel.sectionUnitList.splice(i + 1, 0, {leftCode: '', rightCode: ''});
},
delSectionUnit(i) {
this.editModel.sectionUnitList.splice(i, 1);
},
batchSetPosition() { batchSetPosition() {
const models = []; const models = [];
this.powerLineList.forEach(item => { this.powerLineList.forEach(item => {
@ -197,11 +221,11 @@ export default {
models.push(item); models.push(item);
} }
}); });
console.log(models);
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
}, },
tabClick() { tabClick() {
this.field = ''; this.field = '';
this.listIndex = '';
this.$emit('deviceSelect', ''); this.$emit('deviceSelect', '');
}, },
deviceChange(code) { deviceChange(code) {
@ -215,6 +239,9 @@ export default {
this.activeName = 'first'; this.activeName = 'first';
this.initEditModel(); this.initEditModel();
this.editModel = deepAssign(this.editModel, selected); this.editModel = deepAssign(this.editModel, selected);
if (!this.editModel.sectionUnitList) {
this.editModel.sectionUnitList = [{leftCode: '', rightCode: ''}];
}
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field === 'leftSectionCode' && this.activeName === 'first') { } else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field === 'leftSectionCode' && this.activeName === 'first') {
this.editModel.leftSectionCode = selected.code; this.editModel.leftSectionCode = selected.code;
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field === 'leftSectionCode' && this.activeName === 'second') { } else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field === 'leftSectionCode' && this.activeName === 'second') {
@ -229,6 +256,13 @@ export default {
this.addModel.rightOffset = selected.lengthFact; this.addModel.rightOffset = selected.lengthFact;
} }
this.addModel.rightSectionCode = selected.code; this.addModel.rightSectionCode = selected.code;
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field === 'sectionUnit') {
const index = this.listIndex[this.listIndex.length - 1];
if (this.listIndex.startsWith('leftCode')) {
this.editModel.sectionUnitList[index].leftCode = selected.code;
} else if (this.listIndex.startsWith('rightCode')) {
this.editModel.sectionUnitList[index].rightCode = selected.code;
}
} }
}, },
addPoint(index) { addPoint(index) {
@ -269,7 +303,29 @@ export default {
} }
}, },
updateMapModel(data) { updateMapModel(data) {
this.$emit('updateMapModel', data); const list = [];
let msg = '';
if (data.sectionUnitList && data.sectionUnitList.length) {
data.sectionUnitList.forEach(item => {
if (item.leftCode && item.rightCode) {
list.push(item);
} else if (item.leftCode && !item.rightCode) {
msg = '完善或清除填写过的额外单元信息';
} else if (!item.leftCode && item.rightCode) {
msg = '完善或清除填写过的额外单元信息';
}
});
}
if (msg) {
this.$message.error(msg);
} else {
if (list.length) {
data.sectionUnitList = list;
} else {
delete data.sectionUnitList;
}
this.$emit('updateMapModel', data);
}
}, },
deleteObj() { deleteObj() {
this.$refs.dataform.deleteObj(); this.$refs.dataform.deleteObj();
@ -289,7 +345,11 @@ export default {
leftSectionCode: '', leftSectionCode: '',
leftOffset: 0, leftOffset: 0,
rightSectionCode: '', rightSectionCode: '',
rightOffset: 0 rightOffset: 0,
sectionUnitList: [{
leftCode: '',
rightCode: ''
}]
}; };
} }
} }

View File

@ -220,22 +220,22 @@ export default {
jsonData = that.planConvert.importData(wb.Sheets[index], jsonData); jsonData = that.planConvert.importData(wb.Sheets[index], jsonData);
} }
if (that.$route.query.lineCode == '02' && !jsonData[0].downTrack && !jsonData[0].upTrack) { // if (that.$route.query.lineCode == '02' && !jsonData[0].downTrack && !jsonData[0].upTrack) {
// that.loadingDig.close();
// that.$message.warning(``);
// } else {
importRunPlan({ mapId: that.$route.params.mapId || that.$route.query.mapId || '02', runPlanList: jsonData }).then(response => {
that.loadingDig.close(); that.loadingDig.close();
that.$message.warning(`运行图暂无默认上行折返轨或默认下行折返轨,请输入`); if (response && response.code == 200) {
} else { that.$message.success(that.$t('tip.importOperationGraphSuccessfully'));
importRunPlan({ mapId: that.$route.params.mapId || that.$route.query.mapId || '02', runPlanList: jsonData }).then(response => { that.$emit('refresh');
that.loadingDig.close();
if (response && response.code == 200) {
that.$message.success(that.$t('tip.importOperationGraphSuccessfully'));
that.$emit('refresh');
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} }); // this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
} }
}).catch(error => { }).catch(error => {
that.loadingDig.close(); that.loadingDig.close();
that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`); that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`);
}); });
} // }
} catch (error) { } catch (error) {
that.loadingDig.close(); that.loadingDig.close();
that.$message.warning(`${that.$t('tip.parseRunGraphFailed')} ${error.message}`); that.$message.warning(`${that.$t('tip.parseRunGraphFailed')} ${error.message}`);

View File

@ -80,6 +80,7 @@ export default {
listLines().then(resp => { listLines().then(resp => {
this.lineList = resp.data; this.lineList = resp.data;
}).catch(error => { }).catch(error => {
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
}) })
}, },
@ -88,6 +89,7 @@ export default {
listStations(this.lineId).then(resp => { listStations(this.lineId).then(resp => {
this.stationList = resp.data; this.stationList = resp.data;
}).catch(error => { }).catch(error => {
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
}) })
} }
@ -99,10 +101,11 @@ export default {
this.$refs.modfiy.doShow(el); this.$refs.modfiy.doShow(el);
}, },
onUpdateStation(el) { onUpdateStation(el) {
updateStation(this.lineId, el).then(resp => { updateStation(el.id, el).then(resp => {
this.refreshStationList(); this.refreshStationList();
this.$message.success('修改成功。') this.$message.success('修改成功。')
}).catch(error => { }).catch(error => {
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
}) })
} }
@ -129,7 +132,7 @@ export default {
height: calc(100% - 10px); height: calc(100% - 10px);
/deep/ { /deep/ {
.el-card__body { .el-card__body {
height: 100%; height: calc(100% - 50px);
overflow-y: auto; overflow-y: auto;
&::-webkit-scrollbar { &::-webkit-scrollbar {

View File

@ -1,6 +1,6 @@
<template> <template>
<drawer :visible.sync="drawer" direction="rtl" :width="600" @before-close="e => drawer=false"> <drawer :visible.sync="drawer" direction="rtl" :width="600" @before-close="e => drawer=false">
<template slot="title">修改表单</template> <template slot="title">修改车站信息</template>
<div class="container" v-if="model"> <div class="container" v-if="model">
<el-form class="form" :model="model" :rules="rules" ref="form" label-width="100px" > <el-form class="form" :model="model" :rules="rules" ref="form" label-width="100px" >
<el-form-item label="车站名称" prop="name"> <el-form-item label="车站名称" prop="name">
@ -39,6 +39,7 @@ export default {
return { return {
drawer: false, drawer: false,
model: { model: {
id: '',
name: '', name: '',
kmRange: 0, kmRange: 0,
transferable: false, transferable: false,
@ -71,6 +72,7 @@ export default {
methods: { methods: {
doShow(model) { doShow(model) {
this.model = { this.model = {
id: model.id,
name: model.name, name: model.name,
kmRange: model.kmRange, kmRange: model.kmRange,
transferable: model.transferable, transferable: model.transferable,

View File

@ -41,10 +41,12 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.container { .container {
padding: 0 50px; padding: 10px 50px;
.el { .el {
padding: 30px 50px; padding: 30px 50px;
margin: 10px 0; &:not(:last-child) {
margin-bottom: 10px;
}
} }
} }
</style> </style>

View File

@ -136,7 +136,7 @@ export default {
} }
this.myChart = echarts.init(document.getElementById(this.canvasId)); this.myChart = echarts.init(document.getElementById(this.canvasId));
this.myChart.setOption(this.option, {notMerge: true}); this.myChart.setOption(this.option, true);
this.reSize({ width: this.width, height: this.height }); this.reSize({ width: this.width, height: this.height });
resolve(true); resolve(true);
} catch (error) { } catch (error) {
@ -151,7 +151,7 @@ export default {
this.xAxisInit(stations); this.xAxisInit(stations);
this.yAxisInit(stations); this.yAxisInit(stations);
this.myChart.setOption(this.option, {notMerge: true}); this.myChart.setOption(this.option, true);
} }
} catch (error) { } catch (error) {
this.$message.info(error.message); this.$message.info(error.message);
@ -171,22 +171,24 @@ export default {
this.pushModels(option.series, this.planUtil.parseDataToSeries(this.myChart, planData, this.stations)); this.pushModels(option.series, this.planUtil.parseDataToSeries(this.myChart, planData, this.stations));
this.pushModels(option.graphic[0].elements, this.planUtil.parseDataToGraph(this.myChart, planData, this.stations)); this.pushModels(option.graphic[0].elements, this.planUtil.parseDataToGraph(this.myChart, planData, this.stations));
this.myChart.setOption(option, {notMerge: true}); this.myChart.setOption(option, true);
} catch (error) { } catch (error) {
this.$messageBox(error.message); this.$messageBox(error.message);
} }
}, },
xAxisInit(stations) { xAxisInit(stations) {
const option = this.option; const option = this.option;
const startValue = this.planUtil.MinTime + this.planUtil.TranslationTime;
const endValue = this.planUtil.MaxTime + this.planUtil.TranslationTime;
const list = []; const list = [];
for (var time = 0 + this.planUtil.TranslationTime; time <= 3600 * 24 + this.planUtil.TranslationTime; time++) { for (var time = startValue; time <= endValue; time++) {
list.push(time); list.push(time);
} }
option.xAxis[0].data = list; option.xAxis[0].data = list;
option.dataZoom[0].startValue = 0 + this.planUtil.TranslationTime; option.dataZoom[0].startValue = this.planUtil.MinTime + this.planUtil.TranslationTime;
option.dataZoom[0].endValue = 3600 * 24 + this.planUtil.TranslationTime; option.dataZoom[0].endValue = this.planUtil.MaxTime + this.planUtil.TranslationTime;
}, },
yAxisInit(stations) { yAxisInit(stations) {
const option = this.option; const option = this.option;
@ -254,6 +256,7 @@ export default {
save_link.href = urlObject.createObjectURL(export_blob); save_link.href = urlObject.createObjectURL(export_blob);
save_link.download = 'plan.png'; save_link.download = 'plan.png';
save_link.click(); save_link.click();
this.doClose();
} }
} }
} }

View File

@ -63,7 +63,7 @@ export default {
rules: { rules: {
time: [ time: [
{ {
type: 'number', min: 0, message: 'Please select the arrival time.', trigger: 'blur' required: true, type: 'number', min: 0, message: 'Please select the arrival time.', trigger: 'blur'
}, },
{ {
validator: validator, trigger: 'blur' validator: validator, trigger: 'blur'

View File

@ -46,7 +46,7 @@ export default {
rules: { rules: {
time: [ time: [
{ {
type: 'number', min: 0, max: 12*3600, message: 'Please select the stop time.', trigger: 'blur' required: true, type: 'number', min: 0, max: 12*3600, message: 'Please select the stop time.', trigger: 'blur'
}, },
{ {
validator: validator, trigger: 'blur' validator: validator, trigger: 'blur'

View File

@ -38,7 +38,7 @@ export default {
rules: { rules: {
time: [ time: [
{ {
type: 'number', min: 0, message: 'Please select turn back time.', trigger: 'blur' required: true, type: 'number', min: 0, message: 'Please select turn back time.', trigger: 'blur'
} }
], ],
} }

View File

@ -1,6 +1,6 @@
<template> <template>
<el-dialog v-dialogDrag append-to-body title="Modification of train diagram parameters" :visible.sync="dialogShow" width="30%" :close-on-click-modal="false" :before-close="doClose"> <el-dialog v-dialogDrag append-to-body title="Modification of train diagram parameters" :visible.sync="dialogShow" width="30%" :close-on-click-modal="false" :before-close="doClose">
<el-form ref="form" label-width="160px" :model="formModel" :rules="rules"> <el-form ref="form" label-width="200px" :model="formModel" :rules="rules">
<el-form-item label="Average speed" prop="averageSpeed"> <el-form-item label="Average speed" prop="averageSpeed">
<el-input-number v-model="formModel.averageSpeed" controls-position="right" :min="20" :max="60" /> <el-input-number v-model="formModel.averageSpeed" controls-position="right" :min="20" :max="60" />
<span style="padding-left: 10px">km/h</span> <span style="padding-left: 10px">km/h</span>
@ -57,32 +57,32 @@ export default {
rules: { rules: {
averageSpeed: [ averageSpeed: [
{ {
type: 'number', min: 20, max: 60, message: 'Please select the stop time.', trigger: 'blur' required: true, type: 'number', min: 20, max: 60, message: 'Please select the stop time.', trigger: 'blur'
} }
], ],
maxSpeed: [ maxSpeed: [
{ {
type: 'number', min: 50, max: 80, message: 'Please select the stop time.', trigger: 'blur' required: true, type: 'number', min: 50, max: 80, message: 'Please select the stop time.', trigger: 'blur'
} }
], ],
stopTime: [ stopTime: [
{ {
type: 'number', min: 10, max: 120, message: 'Please select the stop time.', trigger: 'blur' required: true, type: 'number', min: 10, max: 120, message: 'Please select the stop time.', trigger: 'blur'
} }
], ],
minStopTime: [ minStopTime: [
{ {
type: 'number', min: 10, max: 30, message: 'Please select the stop time.', trigger: 'blur' required: true, type: 'number', min: 10, max: 30, message: 'Please select the stop time.', trigger: 'blur'
} }
], ],
minIntervalTime: [ minIntervalTime: [
{ {
type: 'number', min: 30, max: 360, message: 'Please select the stop time.', trigger: 'blur' required: true, type: 'number', min: 30, max: 360, message: 'Please select the stop time.', trigger: 'blur'
} }
], ],
turnBackTime: [ turnBackTime: [
{ {
type: 'number', min: 60, max: 180, message: 'Please select the stop time.', trigger: 'blur' required: true, type: 'number', min: 60, max: 180, message: 'Please select the stop time.', trigger: 'blur'
} }
] ]
} }

View File

@ -52,7 +52,7 @@
<div class="fixed" v-show="show"> <div class="fixed" v-show="show">
<textarea :auto-focus="true" v-if="textareaModel.show" v-focus v-model="textareaModel.text" class="fixed-textarea" <textarea :auto-focus="true" v-if="textareaModel.show" v-model="textareaModel.text" class="fixed-textarea"
:style="{ left: rect.x+'px', top: rect.y+'px', width: rect.width+'px', height: rect.height+'px', }"/> :style="{ left: rect.x+'px', top: rect.y+'px', width: rect.width+'px', height: rect.height+'px', }"/>
</div> </div>
@ -73,6 +73,7 @@ import * as utils from '../utils.js';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { import {
startRpEdit, endRpEdit,
listLines, listStations, listLines, listStations,
listRps, createRp, deleteRp, listRps, createRp, deleteRp,
getRpTools, clearRpPlan, addRpTrip, delRpTrip, getRpTools, clearRpPlan, addRpTrip, delRpTrip,
@ -102,6 +103,7 @@ export default {
planData: {}, planData: {},
selected: null, selected: null,
target: null, target: null,
isModify: false,
textareaModel: { textareaModel: {
id: 0, id: 0,
show: false, show: false,
@ -123,7 +125,7 @@ export default {
}, },
computed: { computed: {
disabled() { disabled() {
return !this.planId; return !this.planId || !this.isModify;
}, },
show() { show() {
return this.textareaModel.show; return this.textareaModel.show;
@ -157,14 +159,35 @@ export default {
height() { height() {
this.setPosition(); this.setPosition();
}, },
$route() { $route: function (to, from) {
this.loadPlanData(); const fromPlanId = from.query.planId;
if (fromPlanId) {
if(utils.getModifyState(fromPlanId)) {
endRpEdit(fromPlanId).then(resp => {
utils.delModifyState(fromPlanId);
this.loadPlanData();
})
} else {
this.loadPlanData();
}
} else {
this.loadPlanData();
}
} }
}, },
created() { created() {
this.planUtil = this.$theme.loadPlanConvert(this.lineCode); this.planUtil = this.$theme.loadPlanConvert(this.lineCode);
}, },
mounted() { mounted() {
window.onbeforeunload = e => {
if(this.planId &&
utils.getModifyState(this.planId)) {
endRpEdit(this.planId).then(resp => {
utils.setModifyState(this.planId, resp.data);
})
}
};
this.setPosition(); this.setPosition();
this.loadPlanData(); this.loadPlanData();
}, },
@ -177,6 +200,7 @@ export default {
return { return {
id: it.id, id: it.id,
isPlan: true, isPlan: true,
isModify: it.editable,
name: it.mapName, name: it.mapName,
lineId: it.mapId, lineId: it.mapId,
} }
@ -200,6 +224,31 @@ export default {
this.$refs.schedule.loadChartPage(stations); this.$refs.schedule.loadChartPage(stations);
if (this.planId) { if (this.planId) {
if(utils.getModifyState(this.planId)) {
endRpEdit(this.planId).then(resp => {
utils.setModifyState(this.planId, resp.data);
startRpEdit(this.planId).then(resp => {
this.isModify = resp.data;
utils.setModifyState(this.planId, resp.data);
if (this.isModify) {
listRps().then(resp => {
this.planList = this.buildPlanList(resp.data);
});
}
});
})
} else {
startRpEdit(this.planId).then(resp => {
this.isModify = resp.data;
utils.setModifyState(this.planId, resp.data);
if (this.isModify) {
listRps().then(resp => {
this.planList = this.buildPlanList(resp.data);
});
}
});
}
getRpTools(this.planId).then(rest => { getRpTools(this.planId).then(rest => {
const planData = this.planData = rest.data; const planData = this.planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData); this.$store.commit('rpTools/setPlanData', planData);
@ -215,15 +264,18 @@ export default {
turnBackTime: data.turnBackTime turnBackTime: data.turnBackTime
} }
}).catch(error => { }).catch(error => {
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
}) })
}).catch(error => { }).catch(error => {
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
}) })
} else { } else {
this.$refs.schedule.clear(); this.$refs.schedule.clear();
} }
}).catch(error => { }).catch(error => {
console.error(error);
this.$messageBox(error.message); this.$messageBox(error.message);
}) })
} else { } else {
@ -296,6 +348,7 @@ export default {
this.$refs.schedule.setLineReset(); this.$refs.schedule.setLineReset();
this.$refs.schedule.setTargetReset(); this.$refs.schedule.setTargetReset();
this.$refs.schedule.clearTrip(); this.$refs.schedule.clearTrip();
if (this.model.action != 'Translate') { if (this.model.action != 'Translate') {
this.$refs.schedule.clearDraggable(); this.$refs.schedule.clearDraggable();
} }
@ -343,8 +396,10 @@ export default {
}, },
doCreatePlan(model) { doCreatePlan(model) {
createRp(model).then(resp => { createRp(model).then(resp => {
this.$router.replace({ path: 'AUStool'});
this.$message.success('Run plan group created successfully.') this.$message.success('Run plan group created successfully.')
}).catch(error => { }).catch(error => {
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
}) })
}, },
@ -361,13 +416,16 @@ export default {
? this.$router.replace({ path: 'AUStool'}) ? this.$router.replace({ path: 'AUStool'})
: this.loadPlanData(); : this.loadPlanData();
}).catch(error => { }).catch(error => {
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
}) })
}).catch(error => { }).catch(error => {
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
}) })
}).catch(() => { }).catch(error => {
this.$message({ type: 'info', message: 'Deletion cancelled.' }); console.error(error);
this.$message.info('Deletion cancelled.');
}); });
}, },
doSetPlanParams(data) { doSetPlanParams(data) {
@ -375,6 +433,7 @@ export default {
this.config = data; this.config = data;
this.$message.success('Parameters of plan were modified successfully.'); this.$message.success('Parameters of plan were modified successfully.');
}).catch(error => { }).catch(error => {
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
}) })
}, },
@ -386,6 +445,7 @@ export default {
modifyAreaNote(this.planId, data.id, model).then(resp => { modifyAreaNote(this.planId, data.id, model).then(resp => {
this.refresh(false); this.refresh(false);
}).catch(error => { }).catch(error => {
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
this.refresh(false); this.refresh(false);
}); });
@ -400,6 +460,7 @@ export default {
justTripNoRunning(this.planId, this.selected.tripNo, model).then(resp => { justTripNoRunning(this.planId, this.selected.tripNo, model).then(resp => {
this.refresh(false); this.refresh(false);
}).catch(error => { }).catch(error => {
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
this.refresh(false); this.refresh(false);
}); });
@ -415,6 +476,7 @@ export default {
justTripNoStop(this.planId, this.selected.tripNo, model).then(resp => { justTripNoStop(this.planId, this.selected.tripNo, model).then(resp => {
this.refresh(false); this.refresh(false);
}).catch(error => { }).catch(error => {
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
this.refresh(false); this.refresh(false);
}); });
@ -430,6 +492,7 @@ export default {
justTripTurnBack(this.planId, this.selected.tripNo, model).then(resp => { justTripTurnBack(this.planId, this.selected.tripNo, model).then(resp => {
this.refresh(false); this.refresh(false);
}).catch(error => { }).catch(error => {
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
this.refresh(false); this.refresh(false);
}); });
@ -446,6 +509,7 @@ export default {
addRpTrip(this.planId, model).then(resp => { addRpTrip(this.planId, model).then(resp => {
this.refresh(); this.refresh();
}).catch(error => { }).catch(error => {
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
this.refresh(); this.refresh();
this.$refs.schedule.clearGraphic(['mark']); this.$refs.schedule.clearGraphic(['mark']);
@ -467,6 +531,7 @@ export default {
createRpArea(this.planId, model).then(resp => { createRpArea(this.planId, model).then(resp => {
this.refresh(); this.refresh();
}).catch(error => { }).catch(error => {
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
this.refresh(); this.refresh();
this.$refs.schedule.clearGraphic(['mark']); this.$refs.schedule.clearGraphic(['mark']);
@ -481,14 +546,15 @@ export default {
translateRpService(this.planId, this.selected.serviceNo, model).then(resp => { translateRpService(this.planId, this.selected.serviceNo, model).then(resp => {
this.refresh(false); this.refresh(false);
}).catch(error => { }).catch(error => {
this.refresh(false); this.refresh(false);
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
}); });
} }
}, },
doTranslateArea() { doTranslateArea() {
if (this.target) { if (this.target) {
const data = this.target.model; const data = this.target.model;
const model = { const model = {
fartherKmRange: parseInt(data.fartherKmRange), fartherKmRange: parseInt(data.fartherKmRange),
closerKmRange: parseInt(data.closerKmRange), closerKmRange: parseInt(data.closerKmRange),
@ -500,7 +566,8 @@ export default {
modifyRpArea(this.planId, data.areaNo, model).then(resp => { modifyRpArea(this.planId, data.areaNo, model).then(resp => {
this.refresh(false); this.refresh(false);
}).catch(error => { }).catch(error => {
this.refresh(false); this.refresh(false);
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
}); });
} }
@ -515,11 +582,13 @@ export default {
delRpService(this.planId, this.selected.serviceNo).then(resp => { delRpService(this.planId, this.selected.serviceNo).then(resp => {
this.refresh(); this.refresh();
}).catch(error => { }).catch(error => {
this.refresh(); this.refresh();
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
}); });
}).catch(() => { }).catch(error => {
this.$message({ type: 'info', message: 'Deletion cancelled.' }); console.error(error);
this.$message.info('Deletion cancelled.');
}); });
} }
}, },
@ -534,11 +603,13 @@ export default {
delRpTrip(this.planId, this.selected.tripNo).then(resp => { delRpTrip(this.planId, this.selected.tripNo).then(resp => {
this.refresh(); this.refresh();
}).catch(error => { }).catch(error => {
this.refresh(); this.refresh();
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
}); });
}).catch(() => { }).catch(error => {
this.$message({ type: 'info', message: 'Deletion cancelled.' }); console.error(error);
this.$message.info('Deletion cancelled.');
}); });
} }
}, },
@ -553,11 +624,13 @@ export default {
delRpArea(this.planId, data.areaNo).then(resp => { delRpArea(this.planId, data.areaNo).then(resp => {
this.refresh(); this.refresh();
}).catch(error => { }).catch(error => {
this.refresh(); this.refresh();
console.error(error);
this.$message.info(error.message); this.$message.info(error.message);
}); });
}).catch(() => { }).catch(error => {
this.$message({ type: 'info', message: 'Deletion cancelled.' }); console.error(error);
this.$message.info('Deletion cancelled.');
}); });
} }
}, },
@ -569,7 +642,8 @@ export default {
if (cls) { if (cls) {
this.onClear(); this.onClear();
} }
}).catch(() => { }).catch(error => {
console.error(error);
this.$messageBox('Failed to load the plan.'); this.$messageBox('Failed to load the plan.');
}); });
} }

View File

@ -5,14 +5,15 @@
<template slot-scope="{data}"> <template slot-scope="{data}">
<span class="flex" > <span class="flex" >
<span><i :class="data.isPlan? 'el-icon-document': 'el-icon-folder'"/>&ensp;{{data.name}}</span> <span><i :class="data.isPlan? 'el-icon-document': 'el-icon-folder'"/>&ensp;{{data.name}}</span>
<el-button <span
v-if="!data.isPlan" v-if="!data.isPlan"
type="text" class="btn-text"
style="color:red"
size="mini"
@click.stop="onDelete(data)"> @click.stop="onDelete(data)">
Delete <i class="el-icon-delete" />
</el-button> </span>
<span v-else>
<el-link :underline="false" :type="data.isModify?'warning':'info'"><code>{{data.isModify? 'edit': 'read'}}</code></el-link>
</span>
</span> </span>
</template> </template>
</el-tree> </el-tree>
@ -68,4 +69,9 @@ export default {
justify-content: space-between; justify-content: space-between;
width: 100%; width: 100%;
} }
.btn-text {
color: red;
padding: 5px 10px;
}
</style> </style>

View File

@ -42,9 +42,8 @@ export default {
const xIndex = pointInGrid[0]; const xIndex = pointInGrid[0];
const yIndex = pointInGrid[1]; const yIndex = pointInGrid[1];
const option = this.myChart.getOption(); const option = this.myChart.getOption();
const minY = option.yAxis[0].min;
const xVal = option.xAxis[0].data[xIndex]; const xVal = option.xAxis[0].data[xIndex];
const yObj = this.planUtil.getStationByCoordinateY(this.stations, yIndex-minY); const yObj = this.planUtil.getStationByCoordinateY(this.stations, yIndex);
if (yObj) { if (yObj) {
cb({yObj, xVal, pointInPixel, pointInGrid, e}); cb({yObj, xVal, pointInPixel, pointInGrid, e});
} }
@ -62,6 +61,8 @@ export default {
this.myChart.on('mouseover', this.onMouseOver); this.myChart.on('mouseover', this.onMouseOver);
this.myChart.on('mouseout', this.onMouseOut); this.myChart.on('mouseout', this.onMouseOut);
this.myChart.on('datazoom', this.onUpdateZoom); this.myChart.on('datazoom', this.onUpdateZoom);
this.myChart.on('rendered', this.onRendered);
window.addEventListener('resize', this.onUpdateZoom); window.addEventListener('resize', this.onUpdateZoom);
} }
}, },
@ -73,10 +74,13 @@ export default {
zr.off('mousedown', this.onZrMouseDown, this); zr.off('mousedown', this.onZrMouseDown, this);
zr.off('mouseup', this.onZrMouseUp, this); zr.off('mouseup', this.onZrMouseUp, this);
zr.off('mouseout', this.onZrMouseOut, this); zr.off('mouseout', this.onZrMouseOut, this);
this.myChart.off('click', this.onMouseClick); this.myChart.off('click', this.onMouseClick);
this.myChart.off('mouseover', this.onMouseOver); this.myChart.off('mouseover', this.onMouseOver);
this.myChart.off('mouseout', this.onMouseOut); this.myChart.off('mouseout', this.onMouseOut);
this.myChart.off('datazoom', this.onUpdateZoom); this.myChart.off('datazoom', this.onUpdateZoom);
this.myChart.off('rendered', this.onRendered);
window.removeEventListener('resize', this.onUpdateZoom); window.removeEventListener('resize', this.onUpdateZoom);
} }
}, },
@ -195,6 +199,45 @@ export default {
} }
}); });
}, },
onRendered(e) {
const mw = this.myChart.getWidth()-100;
const view = this.myChart.getViewOfComponentModel({__viewId: "_ec_shape_graphic"});
if (view &&
view.group) {
view.group.eachChild(el => {
if (['area'].includes(el.subType)) {
const position1 = this.myChart.convertToPixel('grid', el.point1);
const position2 = this.myChart.convertToPixel('grid', el.point2);
const oldWidth = Math.abs(position2[0]-position1[0]);
const x = el.position[0] < 160
? 160 - el.position[0]
: 0;
const dw = el.position[0] + oldWidth > mw
? el.position[0] + oldWidth - mw
: x;
const width = oldWidth-dw;
if (width < 0 || x > mw) {
el.hide();
} else {
el.setShape({x,width})
el.show();
}
el.dirty();
} else if (['drag'].includes(el.subType)) {
if (el.position[0]-el.shape.r < 160 ||
el.position[0]+el.shape.r > mw) {
el.hide();
} else {
el.show();
}
el.dirty();
}
})
}
},
onShapeMouseOver(e) { onShapeMouseOver(e) {
if (this.selected) { if (this.selected) {
this.myChart.dispatchAction({ this.myChart.dispatchAction({
@ -242,7 +285,7 @@ export default {
filters.push(utils.buildDragDataObj(pointInPixel, pointInGrid, this, 'drag')) filters.push(utils.buildDragDataObj(pointInPixel, pointInGrid, this, 'drag'))
option.graphic[0].elements = filters; option.graphic[0].elements = filters;
this.myChart.setOption(option, {notMerge: true}); this.myChart.setOption(option, true);
this.myChart.dispatchAction({ this.myChart.dispatchAction({
type: 'showTip', type: 'showTip',
seriesIndex: this.selected.seriesIndex, seriesIndex: this.selected.seriesIndex,
@ -258,7 +301,7 @@ export default {
const option = this.myChart.getOption(); const option = this.myChart.getOption();
const filters = option.graphic[0].elements.filter(el => { return el.subType != 'drag'}); const filters = option.graphic[0].elements.filter(el => { return el.subType != 'drag'});
option.graphic[0].elements = filters; option.graphic[0].elements = filters;
this.myChart.setOption(option, {notMerge: true}); this.myChart.setOption(option, true);
} }
}, },
doCreateMark({e, pointInGrid, pointInPixel, yObj}) { doCreateMark({e, pointInGrid, pointInPixel, yObj}) {
@ -268,7 +311,7 @@ export default {
elements.push(utils.buildMarkPointObj(pointInPixel, pointInGrid, this, 'mark')) elements.push(utils.buildMarkPointObj(pointInPixel, pointInGrid, this, 'mark'))
this.myChart.setOption(option, {notMerge: true}); this.myChart.setOption(option, true);
const markList = this.markList = elements.filter(el => { return el.subType == 'mark'}); const markList = this.markList = elements.filter(el => { return el.subType == 'mark'});
const elemList = elements.filter(el => { return el.subType != 'mark'}); const elemList = elements.filter(el => { return el.subType != 'mark'});
@ -291,7 +334,7 @@ export default {
elements.push(utils.buildMarkPointObj(pointInPixel, pointInGrid, this, 'mark')) elements.push(utils.buildMarkPointObj(pointInPixel, pointInGrid, this, 'mark'))
this.myChart.setOption(option, {notMerge: true}); this.myChart.setOption(option, true);
const markList = this.markList = elements.filter(el => { return el.subType == 'mark'}); const markList = this.markList = elements.filter(el => { return el.subType == 'mark'});
const elemList = elements.filter(el => { return el.subType != 'mark'}); const elemList = elements.filter(el => { return el.subType != 'mark'});
@ -366,7 +409,7 @@ export default {
series.data = service.data.filter(el => { return el instanceof Array && el[2].tripNo == value[2].tripNo }) series.data = service.data.filter(el => { return el instanceof Array && el[2].tripNo == value[2].tripNo })
this.myChart.setOption(option, {notMerge: true}); this.myChart.setOption(option, true);
} }
const obj =dataList[e.dataIndex][2]; const obj =dataList[e.dataIndex][2];
@ -401,7 +444,7 @@ export default {
elem.draggable = true; elem.draggable = true;
elem.ondrag = echarts.util.curry(this.onShapeDragging); elem.ondrag = echarts.util.curry(this.onShapeDragging);
this.myChart.setOption(option, {notMerge: true}); this.myChart.setOption(option, true);
} }
}, },
doSetAreaHorns({e}) { doSetAreaHorns({e}) {
@ -410,8 +453,11 @@ export default {
const elemList = option.graphic[0].elements.filter(el => { return !['drag'].includes(el.subType) }); const elemList = option.graphic[0].elements.filter(el => { return !['drag'].includes(el.subType) });
const elem = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.model.areaNo == e.target.model.areaNo; }); const elem = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.model.areaNo == e.target.model.areaNo; });
option.graphic[0].elements = this.calcHornList(elemList, elem); if (elem) {
this.myChart.setOption(option, {notMerge: true}); option.graphic[0].elements = this.calcHornList(elemList, elem);
}
this.myChart.setOption(option, true);
} }
}, },
doPopDialog({e, pointInGrid, pointInPixel}) { doPopDialog({e, pointInGrid, pointInPixel}) {
@ -519,7 +565,7 @@ export default {
e.target.point[0] += dx; e.target.point[0] += dx;
} }
this.myChart.setOption(option, {notMerge: true}); this.myChart.setOption(option, true);
}, },
calcAreaDragging({e, pointInGrid}) { calcAreaDragging({e, pointInGrid}) {
const model = this.target.model; const model = this.target.model;
@ -536,6 +582,7 @@ export default {
model.fartherKmRange += dy; model.fartherKmRange += dy;
model.closerKmRange += dy; model.closerKmRange += dy;
this.planUtil.limitAreaTime(model);
if (this.planUtil.limitAreaKmRange(this.stations, model)) { if (this.planUtil.limitAreaKmRange(this.stations, model)) {
this.onZrMouseUp(e); this.onZrMouseUp(e);
} }
@ -590,6 +637,7 @@ export default {
break; break;
} }
this.planUtil.limitAreaTime(model);
if (this.planUtil.limitAreaKmRange(this.stations, model)) { if (this.planUtil.limitAreaKmRange(this.stations, model)) {
this.onZrMouseUp(e); this.onZrMouseUp(e);
} }
@ -598,15 +646,17 @@ export default {
const elemList = option.graphic[0].elements.filter(el => { return !['drag'].includes(el.subType) }); const elemList = option.graphic[0].elements.filter(el => { return !['drag'].includes(el.subType) });
const elem = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.model.areaNo == model.areaNo; }); const elem = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.model.areaNo == model.areaNo; });
elem.position = args.position; if (elem) {
elem.point1 = args.point1; elem.position = args.position;
elem.point2 = args.point2; elem.point1 = args.point1;
elem.shape.width = args.width; elem.point2 = args.point2;
elem.shape.height = args.height; elem.shape.width = args.width;
elem.style.textOffset = [ -args.width/2, -args.height/2 ]; elem.shape.height = args.height;
elem.style.textOffset = [ -args.width/2, -args.height/2 ];
option.graphic[0].elements = this.calcHornList(elemList, elem);
}
option.graphic[0].elements = this.calcHornList(elemList, elem); this.myChart.setOption(option, true);
this.myChart.setOption(option, {notMerge: true});
} }
} }
} }

Some files were not shown because too many files have changed in this diff Show More