Merge remote-tracking branch 'remotes/origin/test'

This commit is contained in:
joylink_cuiweidong 2021-06-09 18:12:11 +08:00
commit 8ee881c7f9
11 changed files with 868 additions and 600 deletions

View File

@ -3,13 +3,19 @@ import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
//信号机贴图
export function Signallightload(lights) {
settexture(lights, "red", JL3D_LOCAL_STATIC+'/device/signal/1.jpg');
settexture(lights,"red",JL3D_LOCAL_STATIC+'/jl3d/railway/texture/1.jpg');
settexture(lights, "yellow", JL3D_LOCAL_STATIC+'/device/signal/2.jpg');
settexture(lights,"yellow",JL3D_LOCAL_STATIC+'/jl3d/railway/texture/2.jpg');
settexture( lights,"green",JL3D_LOCAL_STATIC+'/jl3d/railway/texture/3.jpg');
settexture( lights,"white",JL3D_LOCAL_STATIC+'/jl3d/railway/texture/4.jpg');
settexture( lights,"blue",JL3D_LOCAL_STATIC+'/jl3d/railway/texture/5.jpg');
settexture( lights,"black",JL3D_LOCAL_STATIC+'/jl3d/railway/texture/6.jpg');
settexture(lights, "green", JL3D_LOCAL_STATIC+'/device/signal/3.jpg');
settexture(lights, "black", JL3D_LOCAL_STATIC+'/device/signal/4.jpg');
}
//加载贴图

View File

@ -27,8 +27,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
var scope = this;
let helpbox,textplane;
let daochamodel;
let psdtexturemap = [];
let psdVoiceStationList = [];
this.dom = dom;
this.nowcode = null;
@ -110,9 +108,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
for(let i=0,leni=mapnetdata.switchList.length;i<leni;i++){
lableCodeMap[mapnetdata.switchList[i].name] = mapnetdata.switchList[i].code;
}
for(let i=0,leni=mapnetdata.psdList.length;i<leni;i++){
lableCodeMap[mapnetdata.psdList[i].standCode] = mapnetdata.psdList[i].code;
}
for(let i=0,leni=mapnetdata.signalList.length;i<leni;i++){
lableCodeMap[mapnetdata.signalList[i].name] = mapnetdata.signalList[i].code;
}
@ -121,20 +116,7 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
}
let stationStandList = mapnetdata.stationStandList;
let psdList = mapnetdata.psdList;
for(let i=0,leni=stationStandList.length;i<leni;i++){
for(let j=0,lenj=psdList.length;j<lenj;j++){
if(stationStandList[i].code == psdList[j].standCode){
psdVoiceStationList[psdList[j].code] = {
stationCode:stationStandList[i].stationCode,
right:stationStandList[i].right,
finlStationName:"",
nowStationName:""
}
j = lenj;
}
}
}
let stationList = [];
for(let i=0,leni=mapnetdata.stationList.length;i<leni;i++){
@ -144,32 +126,22 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
}
}
// console.log(mapnetdata.stationList);
for(let k in psdVoiceStationList){
for(let i=0,leni=stationList.length;i<leni;i++){
// console.log("---------------");
// console.log("---------------");
if(psdVoiceStationList[k].stationCode == stationList[i].code){
psdVoiceStationList[k].nowStationName = stationList[i].name;
if(psdVoiceStationList[k].right){
psdVoiceStationList[k].finlStationName = stationList[leni-1].name;
}else{
psdVoiceStationList[k].finlStationName = stationList[0].name;
}
i = leni;
}
}
}
});
document.addEventListener( "mousedown", onselect, false );
let teststomp = new StompClient();
// let topic = '/user/topic/simulation/assistant/'+group;
let topic = "/queue/simulation/"+group+"/srDeviceState";//'/user/queue/simulation/jl3d/'+group
let signalTopic = "/queue/simulation/"+group+"/srSignal/";//'/user/queue/simulation/jl3d/'+group
let switchTopic = "/queue/simulation/"+group+"/srSwitch/";//'/user/queue/simulation/jl3d/'+group
let psdTopic = "/queue/simulation/"+group+"/srPsd/";//'/user/queue/simulation/jl3d/'+group
let nowTopic = "";
let oldTopic = "";
let header = {'X-Token': token};
try {
teststomp.subscribe(topic, callback, header);
// teststomp.subscribe(topic, callback, header);
} catch (error) {
console.error('websocket订阅失败');
}
@ -178,39 +150,24 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
let data = JSON.parse(Response.body);
console.log(data);
if(data.srSignal){
if(data.srSignal[0] == scope.nowcode){
scope.updateSignal(data.srSignal[1]);
}
}
if(data.srSwitch){
if(data.srSwitch[0] == scope.nowcode){
scope.updateSwitch(data.srSwitch[1]);
}
}
if(data.type == "DeviceCtrl_3D"){
if(data.body.code == scope.nowcode){
scope.updateaction(data.body);
}
}
if(data.type == "Device_Fault_Set_3D"){
let realDeviceCode = lableCodeMap[data.body.code];
if(realDeviceCode == scope.nowcode){
scope.deviceFaultSet(data.body);
}
}
if(data.type == "Device_Fault_Over_3D"){
let realDeviceCode = lableCodeMap[data.body.code];
if(realDeviceCode == scope.nowcode){
scope.deviceFaultOver(data.body);
}
}
if(data.type == "Simulation_Reset"){
scope.deviceReset();
}
if(data.type == 'Simulation_Over'){
let projectDevice=getSessionStorage('projectDevice');
if(getSessionStorage('project').startsWith('heb')&&projectDevice){
store.dispatch('LogOut').then(() => {
location.reload();
});
}
}
}
let changeelement = document.getElementById('jl3d');
window.addEventListener('resize', () =>
@ -237,23 +194,12 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
getPublish3dMapDetail(skinCode).then(netdata => {
let netDataAssets = JSON.parse(netdata.data.assets);
if(netDataAssets.stationTextureList[0].urls.length > 1){
setpsdstationmap(JSON.parse(netdata.data.stands));
Standtextureload(scope,netDataAssets.stationTextureList[0]);
}
scope.modelmanager.loadpromise(netDataAssets.deviceAssetList, scope.mixers).then(function (data) {
//综合演练情况下当模型加载后显示
psdModelShow();
moveanima.initlistnew(scope.modelmanager.switchmodel.mesh);
daochamodel = scope.modelmanager.switchmodel.mesh.getObjectByName("DAOCHA");
if(scope.stationtexture["devicelist"]){
scope.modelmanager.standmodel.mesh.getObjectByName("zhantailiebiao").material.map =scope.stationtexture["devicelist"];
scope.modelmanager.standmodel.mesh.getObjectByName("zhantailiebiao").material.map.needsUpdate = true;
}
if(scope.stationtexture["pingbimen"]){
scope.modelmanager.standmodel.mesh.getObjectByName("pingbimen1").material.map =scope.stationtexture["pingbimen"];
scope.modelmanager.standmodel.mesh.getObjectByName("pingbimen1").material.map.needsUpdate = true;
}
})
let checkobject = setInterval(function(){
@ -267,15 +213,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
});
//初始化屏蔽门贴图
function setpsdstationmap(stationlist){
for(let i=0,leni=stationlist.length;i<leni;i++){
psdtexturemap[stationlist[i].stands[0].code] = stationlist[i].code;
psdtexturemap[stationlist[i].stands[1].code] = stationlist[i].code;
psdtexturemap[stationlist[i].stands[0].name] = stationlist[i].code;
psdtexturemap[stationlist[i].stands[1].name] = stationlist[i].code;
}
}
let stopTime = 0;
//循环渲染函数
function animate() {
@ -342,20 +279,20 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
updatemenulist();
}
if (data._type == "Signal") {
scope.modelmanager.signalmodel.code = data.code;
scope.showmodel = scope.modelmanager.signalmodel.mesh;
if(data.type == "ARRIVAL"){
scope.showmodel = scope.modelmanager.signal5.mesh;
}else if(data.type == "EXIT"){
scope.showmodel = scope.modelmanager.signal32.mesh;
}else if(data.type == "PASSING"){
scope.showmodel = scope.modelmanager.signal3.mesh;
}else if(data.type == "SHUNTING"){
scope.showmodel = scope.modelmanager.signal2.mesh;
}
scope.showmodel.code = data.code;
scope.scene.add(scope.showmodel);
}
if (data._type == "Psd") {
scope.modelmanager.standmodel.code = data.code;
scope.showmodel = scope.modelmanager.standmodel.mesh;
scope.scene.add(scope.showmodel);
if(scope.stationtexture[psdtexturemap[data.standCode]]){
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map =scope.stationtexture[psdtexturemap[data.standCode]];
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
}
}
if (data._type == "Section") {
scope.showmodel = scope.modelmanager.sectionmodel.mesh;
@ -401,29 +338,18 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
}
if (data._type == "Signal") {
scope.showmodel = scope.modelmanager.signalmodel.mesh;
scope.scene.add(scope.showmodel);
}
if (data._type == "Psd") {
scope.showmodel = scope.modelmanager.standmodel.mesh;
scope.scene.add(scope.showmodel);
if(data.standCode == undefined){
if(psdtexturemap[data.code]){
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map =scope.stationtexture[psdtexturemap[data.code]];
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
}else{
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map =scope.stationtexture["Station18398"];
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
}
console.log(data);
if(data.type == "ARRIVAL"){
scope.showmodel = scope.modelmanager.signal5.mesh;
}else if(data.type == "EXIT"){
scope.showmodel = scope.modelmanager.signal32.mesh;
}else if(data.type == "PASSING"){
scope.showmodel = scope.modelmanager.signal3.mesh;
}else if(data.type == "SHUNTING"){
scope.showmodel = scope.modelmanager.signal2.mesh;
}
if(scope.stationtexture[psdtexturemap[data.standCode]]){
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map =scope.stationtexture[psdtexturemap[data.standCode]];
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
}
scope.scene.add(scope.showmodel);
}
@ -436,6 +362,22 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
if (data._type == "Switch") {
nowTopic = switchTopic + data.code;
}
if (data._type == "Signal") {
nowTopic = signalTopic + data.code;
}
if (data._type == "Psd") {
nowTopic = psdTopic + data.code;
}
if(nowTopic != oldTopic){
teststomp.unsubscribe(oldTopic);
oldTopic = nowTopic;
teststomp.subscribe(nowTopic, callback, header);
}
}
this.changeStaticSwitch = function(mode){
@ -632,6 +574,205 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
scope.animationmodel = null;
}
//根据数据切换设备样式
this.updateSignal = function(lightType){
if(scope.showmodel.deviceType == "ARRIVAL"){
if(lightType == '0'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("03").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("03").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("04").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("04").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("05").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '3'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["yellow"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("03").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("03").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("04").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("04").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("05").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '7'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["yellow"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("03").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("03").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("04").material.map = scope.signallights["yellow"];
scope.showmodel.getObjectByName("04").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("05").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '1'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("03").material.map = scope.signallights["red"];
scope.showmodel.getObjectByName("03").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("04").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("04").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("05").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '9'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("03").material.map = scope.signallights["red"];
scope.showmodel.getObjectByName("03").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("04").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("04").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("05").material.map = scope.signallights["white"];
scope.showmodel.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '6'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["green"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("03").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("03").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("04").material.map = scope.signallights["yellow"];
scope.showmodel.getObjectByName("04").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("05").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("05").material.map.needsUpdate = true;
}
}else if(scope.showmodel.deviceType == "EXIT"){
if(lightType == '0'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("03").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("03").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("04").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("04").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("05").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '1'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("03").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("03").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("04").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("04").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("05").material.map = scope.signallights["red"];
scope.showmodel.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '2'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["green"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("03").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("03").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("04").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("04").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("05").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '3'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("03").material.map = scope.signallights["yellow"];
scope.showmodel.getObjectByName("03").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("04").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("04").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("05").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("05").material.map.needsUpdate = true;
}
}else if(scope.showmodel.deviceType == "PASSING"){
if(lightType == '0'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("03").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("03").material.map.needsUpdate = true;
}
if(lightType == '1'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("03").material.map = scope.signallights["red"];
scope.showmodel.getObjectByName("03").material.map.needsUpdate = true;
}
if(lightType == '2'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["green"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("03").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("03").material.map.needsUpdate = true;
}
if(lightType == '3'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["yellow"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("03").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("03").material.map.needsUpdate = true;
}
}else if(scope.showmodel.deviceType == "SHUNTING"){
if(lightType == '0'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
}
if(lightType == '10'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["blue"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
}
if(lightType == '11'){
scope.showmodel.getObjectByName("01").material.map = scope.signallights["white"];
scope.showmodel.getObjectByName("01").material.map.needsUpdate = true;
scope.showmodel.getObjectByName("02").material.map = scope.signallights["black"];
scope.showmodel.getObjectByName("02").material.map.needsUpdate = true;
}
}
};
this.updateSwitch = function(normal){
if (normal == "1") {
scope.modelmanager.switchmodel.normalPosition = "0";
scope.modelmanager.switchmodel.action.reset();
scope.modelmanager.switchmodel.action.time = 0;
scope.modelmanager.switchmodel.action.timeScale = 1;
scope.modelmanager.switchmodel.action.play();
} else if (normal == "2") {
scope.modelmanager.switchmodel.normalPosition = "1";
scope.modelmanager.switchmodel.action.reset();
scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration;
scope.modelmanager.switchmodel.action.timeScale = -1;
scope.modelmanager.switchmodel.action.play();
}
};
this.updateaction = function (data) {
if (data.type == "SWITCH") {
if (data.normal == "0") {
@ -675,78 +816,9 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
}
}
if (data.type == "PSD" || data.type == "STAND") {
if (data.code == scope.nowcode) {
if (data.open == "1" ) {
scope.modelmanager.standmodel.screenDoorOpenStatus = "0";
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = 0;
scope.modelmanager.standmodel.action.timeScale = 1;
scope.modelmanager.standmodel.action.play();
localVoicePlay("开往"+psdVoiceStationList[data.code].finlStationName+"方向的列车进站了!");
}
if (data.open == "0" ) {
scope.modelmanager.standmodel.screenDoorOpenStatus = "1";
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration;
scope.modelmanager.standmodel.action.timeScale = -1;
scope.modelmanager.standmodel.action.play();
}
}
}
// scope.showmodel.
}
this.deviceFaultSet = function (data) {
if (data.type == "SIGNAL") {//从上往下红绿黄
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true;
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true;
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true;
}
if (data.type == "PSD" || data.type == "STAND") {
scope.modelmanager.standmodel.screenDoorOpenStatus = "0";
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = 0;
scope.modelmanager.standmodel.action.timeScale = 1;
scope.modelmanager.standmodel.action.play();
}
}
this.deviceFaultOver = function (data) {
// if (data.type == "SIGNAL") {//从上往下红绿黄
// 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[2].material.map = scope.signallights["yellow"];
// scope.modelmanager.signalmodel.mesh.children[2].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;
// }
if (data.type == "PSD" || data.type == "STAND") {
scope.modelmanager.standmodel.screenDoorOpenStatus = "1";
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration;
scope.modelmanager.standmodel.action.timeScale = -1;
scope.modelmanager.standmodel.action.play();
}
}
this.deviceReset = function () {
scope.modelmanager.standmodel.screenDoorOpenStatus = "1";
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration;
scope.modelmanager.standmodel.action.timeScale = -1;
scope.modelmanager.standmodel.action.play();
}
this.updateselect = function(updata){
if(helpbox){
@ -796,68 +868,10 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
}
if (data._type == "Signal") {
console.log(data);
if(data.logicLight == 0){
if(data.redOpen == 1){
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = scope.signallights["red"];
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true;
}else{
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true;
}
if(data.yellowOpen == 1){
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = scope.signallights["yellow"];
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true;
}else{
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true;
}
if(data.greenOpen == 1){
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = scope.signallights["green"];
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true;
}else{
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true;
}
}else{
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true;
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true;
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = scope.signallights["black"];
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true;
}
}
if (data._type == "Psd") {
if (data.screenDoorOpenStatus == "0") {
scope.modelmanager.standmodel.screenDoorOpenStatus = "0";
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration;
scope.modelmanager.standmodel.action.timeScale = 1;
scope.modelmanager.standmodel.action.play();
}
if (data.screenDoorOpenStatus == "1") {
scope.modelmanager.standmodel.screenDoorOpenStatus = "1";
scope.modelmanager.standmodel.action.reset();
scope.modelmanager.standmodel.action.time = 0;
scope.modelmanager.standmodel.action.timeScale = -1;
scope.modelmanager.standmodel.action.play();
}
scope.camera.position.x = 0;
scope.camera.position.y = 8.3;
scope.camera.position.z = 12;
scope.controls.target = new THREE.Vector3(0,8.3,0);
scope.controls.update();
}else{
scope.camera.position.x = 0;
scope.camera.position.y = 20;
scope.camera.position.z = 30;
scope.controls.target = new THREE.Vector3(0,10,0);
scope.controls.update();
}
}

View File

@ -18,18 +18,34 @@ export function ModelManager(){
action:null
};
this.signalmodel = {
code:"signal",
this.signal5 = {
code:"s1",
lightType:"01",
status:"01",
switchLocateType:"01",
mesh:null,
action:null
};
this.standmodel = {
code:"stand",
screenDoorOpenStatus:"01",
this.signal32 = {
code:"s2",
lightType:"01",
status:"01",
mesh:null,
action:null
};
this.signal3 = {
code:"s3",
lightType:"01",
status:"01",
mesh:null,
action:null
};
this.signal2 = {
code:"s4",
lightType:"01",
status:"01",
mesh:null,
action:null
};
@ -41,12 +57,6 @@ export function ModelManager(){
action:null
};
this.roommodel = {
code:"room",
sectionstatus:"01",
mesh:null,
action:null
};
this.loadpromise = function (data,mixers){
let initlist = [];
@ -55,27 +65,61 @@ export function ModelManager(){
deviceType: "staticSwitch",
id: "x11",
packageName: "转辙教学模型",
type: "staticSwitch",
type: "static",
url: "/device/switch/511DHcongxinzuo22222222222222(1).fbx"
};
initlist.push(fbxpromise(staticSwitch,mixers,scope.staticswitchmodel));
let signal5 = {
assetname: "竖5灯",
deviceType: "ARRIVAL",
id: "s1",
packageName: "竖5灯",
type: "static",
url: "/jl3d/railway/model/signal5.FBX"
};
initlist.push(fbxpromise(signal5,mixers,scope.signal5));
let signal32 = {
assetname: "32灯",
deviceType: "EXIT",
id: "s2",
packageName: "32灯",
type: "static",
url: "/jl3d/railway/model/signal32.FBX"
};
initlist.push(fbxpromise(signal32,mixers,scope.signal32));
let signal3 = {
assetname: "3灯",
deviceType: "PASSING",
id: "s3",
packageName: "3灯",
type: "static",
url: "/jl3d/railway/model/signal3.FBX"
};
initlist.push(fbxpromise(signal3,mixers,scope.signal3));
let signal2 = {
assetname: "2灯",
deviceType: "SHUNTING",
id: "s4",
packageName: "2灯",
type: "static",
url: "/jl3d/railway/model/signal2.FBX"
};
initlist.push(fbxpromise(signal2,mixers,scope.signal2));
for(let i=0,leni=data.length;i<leni;i++){
if(data[i].deviceType == "DeviceSignal"){
initlist.push(fbxpromise(data[i],mixers,scope.signalmodel));
}
if(data[i].deviceType == "DeviceSwitch"){
initlist.push(fbxpromise(data[i],mixers,scope.switchmodel));
}
if(data[i].deviceType == "DeviceDoor"){
initlist.push(fbxpromise(data[i],mixers,scope.standmodel));
}
if(data[i].deviceType == "DeviceSection"){
initlist.push(fbxpromise(data[i],mixers,scope.sectionmodel));
}
if(data[i].deviceType == "MaintainerRoom"){
initlist.push(fbxpromise(data[i],mixers,scope.roommodel));
}
}
return new Promise(function(resolve, reject){
@ -95,11 +139,12 @@ function fbxpromise(asset,mixers,model){
return new Promise(function(resolve, reject){
var loader = new THREE.FBXLoader();
let modelurl;
if(asset.type == "staticSwitch"){
if(asset.type == "static"){
modelurl = JL3D_LOCAL_STATIC+asset.url;
}else{
modelurl = BASE_ASSET_API+asset.url;
}
loader.load( modelurl, function ( object ) {
let mixer = new THREE.AnimationMixer( object );
object.traverse( function ( child ) {
@ -109,9 +154,21 @@ function fbxpromise(asset,mixers,model){
}
} );
object.animacode = model.code;
object.deviceType = asset.deviceType;
if(asset.deviceType == "ARRIVAL" || asset.deviceType == "EXIT" || asset.deviceType == "PASSING" || asset.deviceType == "SHUNTING"){
for(let j=0;j<object.children.length;j++){
let newmaterial = new THREE.MeshPhongMaterial();
newmaterial.copy(object.children[j].material);
object.children[j].material = newmaterial;
object.children[j].material.needsUpdate = true;
newmaterial.dispose();
}
}
model.mesh = object;
if(object.animations.length>0){
if(asset.type == "staticSwitch"){
if(asset.deviceType == "staticSwitch"){
// for(let i=0;i<object.animations.length;i++){
// model.action[object.animations[i].name] = mixer.clipAction( object.animations[ i ] );

View File

@ -137,23 +137,6 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
}
function DeviceDestroy(data){
for(let i=0,leni=data.length;i<leni;i++){
if(data[i].type == "SIGNAL"){
signalupdate(data[i]);
}
if(data[i].type == "SWITCH"){
switchupdate(data[i]);
}
if(data[i].type == "PSD"){
standupdate(data[i]);
}
if(data[i].type == "TRAIN_DOOR"){
traindoorupdate(data[i]);
}
}
}
function tdtUpdate(data){
@ -531,102 +514,6 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
}
}
function traindoorupdate(data){
// console.log(data);
// console.log("direct:"+trainmodel.right);
// console.log(trainmodel.openleft);
// console.log(trainmodel.openright);
if(trainmodel.code == data.code){
if(trainmodel.right == "0"){
if(data.doorCode == "2"){
if(trainmodel.openleft != data.open && data.open == "0"){
trainmodel.openleft = "0";
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
actions["traindoor"].top[an].reset();
actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration;
actions["traindoor"].top[an].timeScale = -1;
actions["traindoor"].top[an].play();
}
}else if(trainmodel.openleft != data.open && data.open == "1"){
trainmodel.openleft = "1";
console.log(data);
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
actions["traindoor"].top[an].reset();
actions["traindoor"].top[an].time = 0;
actions["traindoor"].top[an].timeScale = 1;
actions["traindoor"].top[an].play();
}
}
}else{
if (trainmodel.openright != data.open && data.open == '0') {
trainmodel.openright = '0';
for (let an=actions["traindoor"].down.length-1; an>=0; an--) {
actions["traindoor"].down[an].reset();
actions["traindoor"].down[an].time = actions["traindoor"].down[an]._clip.duration;
actions["traindoor"].down[an].timeScale = -1;
actions["traindoor"].down[an].play();
}
} else if (trainmodel.openright != data.open && data.open == '1') {
trainmodel.openright = "1";
for(let an=actions["traindoor"].down.length-1;an>=0;an--){
actions["traindoor"].down[an].reset();
actions["traindoor"].down[an].time = 0;
actions["traindoor"].down[an].timeScale = 1;
actions["traindoor"].down[an].play();
}
}
}
}else{
if(data.doorCode == "1"){
if(trainmodel.openleft != data.open && data.open == "0"){
trainmodel.openleft = "0";
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
actions["traindoor"].top[an].reset();
actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration;
actions["traindoor"].top[an].timeScale = -1;
actions["traindoor"].top[an].play();
}
}else if(trainmodel.openleft != data.open && data.open == "1"){
trainmodel.openleft = "1";
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
actions["traindoor"].top[an].reset();
actions["traindoor"].top[an].time = 0;
actions["traindoor"].top[an].timeScale = 1;
actions["traindoor"].top[an].play();
}
}
}else{
if (trainmodel.openright != data.open && data.open == '0') {
trainmodel.openright = '0';
for (let an=actions["traindoor"].down.length-1; an>=0; an--) {
actions["traindoor"].down[an].reset();
actions["traindoor"].down[an].time = actions["traindoor"].down[an]._clip.duration;
actions["traindoor"].down[an].timeScale = -1;
actions["traindoor"].down[an].play();
}
} else if (trainmodel.openright != data.open && data.open == '1') {
trainmodel.openright = "1";
for(let an=actions["traindoor"].down.length-1;an>=0;an--){
actions["traindoor"].down[an].reset();
actions["traindoor"].down[an].time = 0;
actions["traindoor"].down[an].timeScale = 1;
actions["traindoor"].down[an].play();
}
}
}
}
}
}
function trainstatus(data){
// 遍历列车对象组
if (trainlisttest) {
@ -701,56 +588,8 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
}
}
}
function standupdate(data) {
code = data.code;
if ( actions[code]) {
if (data.open == '1') {
actions[code].status = '1';
actions[code].action.reset();
actions[code].action.time = 0;
actions[code].action.timeScale = 1;
actions[code].action.play();
}
if (data.open == '0') {
actions[code].status = '0';
actions[code].action.reset();
actions[code].action.time = actions[code].action._clip.duration;
actions[code].action.timeScale = -1;
actions[code].action.play();
}
}
}
function signalupdate(data) {
code = data.code;
if(data.red == 1){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
}else{
signallist.list[code].mesh.getObjectByName("red").material.map = materials["white"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
}
if(data.yellow == 1){
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
}else{
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["white"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
}
if(data.green == 1){
signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}else{
signallist.list[code].mesh.getObjectByName("green").material.map = materials["white"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
}
function initswitch(data) {
code = data.code;
@ -771,26 +610,6 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
}
}
function switchupdate(data) {
code = data.code;
if (actions[code].normal != data.normal) {
if (data.normal == '02') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = 0;
actions[code].action.timeScale = 1;
actions[code].action.play();
actions[code].normal = "02";
} else if (data.normal == '01') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = actions[code].action._clip.duration;
actions[code].action.timeScale = -1;
actions[code].action.play();
actions[code].normal = "01";
}
}
}
function signalLightUpdate(code,lightType){
signallist.list[code].mesh.lightType = lightType;

View File

@ -243,6 +243,7 @@ class SkinCode extends defaultStyle {
centerTrainColor: '#FFFFFF', // 中心扣车颜色
andCenterTrainColor: '#F61107', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
ibpDetainTrainColor: '#0F16DA', // IBP盘扣车文字颜色
fontSize: 11, // 字体大小
fontWeight: 'normal'
},
@ -274,7 +275,8 @@ class SkinCode extends defaultStyle {
common: { // 通用属性
textFontSize: 11, // 站台默认字体大小
functionButtonShow: '03' // 功能灯按钮显示条件01所有模式下显示 02 行调显示 03现地显示
functionButtonShow: '03', // 功能灯按钮显示条件01所有模式下显示 02 行调显示 03现地显示
ibpDetainDiffStation: true // ibp扣车不同于现地扣车
},
safetyDoor: { // 屏蔽门
height: 3, // 站台屏蔽门高度

View File

@ -148,6 +148,8 @@ class Painter {
const overlapTrainList = this.checkTrainOverlap(device);
overlapTrainList.forEach((item, index) => {
const trainDevice = this.$jmap.getDeviceByCode(item);
trainDevice._type = deviceRender['Train']._type;
trainDevice.zlevel = deviceRender['Train'].zlevel;
trainDevice.overLapIndex = index;
trainDevice.instance && this.mapInstanceLevel[deviceType.Train].remove(trainDevice.instance);
trainDevice.instance = null;

View File

@ -65,15 +65,18 @@ class EDetain extends Group {
setState(model, deviceParam = this.model.style.StationStand.detainNormal) {
/** 设置扣车*/
if (model.stationHoldTrain && model.centerHoldTrain) {
if ((model.stationHoldTrain || model.ibpHoldTrain) && model.centerHoldTrain) {
this.showMode(deviceParam);
this.setColor(deviceParam.andCenterTrainColor);
} else if (model.stationHoldTrain) {
} else if (model.stationHoldTrain || (model.ibpHoldTrain && !this.model.style.StationStand.common.ibpDetainDiffStation)) {
this.showMode(deviceParam);
this.setColor(deviceParam.detainTrainTextColor);
} else if (model.centerHoldTrain) {
this.showMode(deviceParam);
this.setColor(deviceParam.centerTrainColor);
} else if (model.ibpHoldTrain) {
this.showMode(deviceParam);
this.setColor(deviceParam.ibpDetainTrainColor);
}
}
}

View File

@ -44,6 +44,7 @@ class EDetainHollow extends EDetain {
recover() {
this.hideMode();
this.circleDetain && this.circleDetain.setStyle({ fill: '#000' });
}
hideMode() {
@ -58,6 +59,9 @@ class EDetainHollow extends EDetain {
setState(model) {
super.setState(model, this.model.style.StationStand.detainHollow);
if (model.ibpHoldTrain && this.model.style.StationStand.common.ibpDetainDiffStation) {
this.circleDetain && this.circleDetain.setStyle({ fill: '#fff' });
}
}
}

View File

@ -127,7 +127,9 @@ export default {
label: '切换驾驶模式',
children: [
{
label: '转URM模式',
// label: 'URM',
// 西URMNRM
label: '转NRM模式',
handler: this.handleApplyUrmMode
},
{
@ -135,7 +137,9 @@ export default {
handler: this.handleApplyRmMode
},
{
label: '转CM模式',
// label: 'CM',
// 西CMSM
label: '转SM模式',
handler: this.handleApplyCmMode
},
{

View File

@ -1,110 +1,250 @@
<template>
<el-dialog
v-dialogDrag
class="route-setting"
:title="title"
:visible.sync="show"
width="900px"
label-position="top"
:before-close="doClose"
:z-index="2009"
:modal="false"
:close-on-click-modal="false"
>
<div style="padding: 5px;">
<el-row>
<el-col :span="12"><span>所选位置</span></el-col>
<el-col :span="12"><span>列车号</span></el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-input v-model="sectionName" size="mini" style="width: 400px;" :disabled="true" />
</el-col>
<el-col :span="12">
<el-input v-model="trainCode" :max-length="7" size="mini" style="width: 310px;" />
<el-button size="mini" icon="el-icon-search" @click="trainFind" />
<el-button size="mini" icon="el-icon-refresh-left" @click="resetTrainCode" />
</el-col>
</el-row>
<div style="display: flex;justify-content: space-around;margin-top: 20px;">
<el-button size="mini" style="width: 280px;" @click="changeOperationType('show')">显示列车信息</el-button>
<el-button size="mini" style="width: 280px;" @click="changeOperationType('update')">修改列车资料</el-button>
<el-button size="mini" style="width: 280px;" @click="changeOperationType('create')">创建列车号</el-button>
</div>
<div style="display: flex;justify-content: space-around;margin-top: 10px;">
<el-button size="mini" style="width: 280px;" @click="changeOperationType('delete')">删除列车号</el-button>
<el-button size="mini" style="width: 280px;" @click="changeOperationType('move')">步进列车号</el-button>
<el-button size="mini" style="width: 280px;" @click="changeOperationType('resort')">重排列车号</el-button>
</div>
<div v-if="operationType === 'show'">
<el-table :data="tableData" border style="width: 100%;margin-top: 20px;" height="200">
<el-table-column prop="date" label="方向" />
<el-table-column prop="name" label="列车号" />
<el-table-column prop="address" label="位置" />
<el-table-column prop="address" label="ARS" />
<el-table-column prop="address" label="晚点" />
</el-table>
</div>
<div v-else-if="operationType === 'create'" style="display: flex;justify-content: space-between;">
<div>
<el-table :data="tableData" border style="width: 280px;margin-top: 20px;" height="200">
<el-table-column prop="date" label="方向" width="60" />
<el-table-column prop="name" label="列车号" width="157" />
<el-table-column prop="address" label="位置" width="60" />
<!--<el-dialog-->
<!--v-dialogDrag-->
<!--class="route-setting"-->
<!--:title="title"-->
<!--:visible.sync="show"-->
<!--width="900px"-->
<!--label-position="top"-->
<!--:before-close="doClose"-->
<!--:z-index="2009"-->
<!--:modal="false"-->
<!--:close-on-click-modal="false"-->
<!--&gt;-->
<div v-if="dialogShow" id="faultChoose">
<div class="falutChooseTitle">{{ title }}</div>
<div class="closeFalutChoose" @click="doClose">
<span class="el-icon-close closeFalutChooseIn" />
</div>
<div class="card" style="padding: 20px;">
<div style="padding: 5px;">
<el-row>
<el-col :span="12"><span>所选位置</span></el-col>
<el-col :span="12"><span>列车号</span></el-col>
</el-row>
<el-row style="margin-top: 10px;">
<el-col :span="12">
<el-input v-model="sectionName" size="mini" style="width: 400px;" :disabled="true" />
</el-col>
<el-col :span="12">
<el-input v-model="trainCode" :maxlength="7" size="mini" style="width: 310px;" />
<el-button size="mini" icon="el-icon-search" @click="trainFind" />
<el-button size="mini" icon="el-icon-refresh-left" @click="resetTrainCode" />
</el-col>
</el-row>
<div style="display: flex;justify-content: space-around;margin-top: 20px;">
<el-button size="mini" style="width: 280px;" :disabled="operationType === 'show'" @click="changeOperationType('show')">显示列车信息</el-button>
<el-button size="mini" style="width: 280px;" :disabled="operationType === 'update'" @click="changeOperationType('update')">修改列车资料</el-button>
<el-button size="mini" style="width: 280px;" :disabled="operationType === 'create'" @click="changeOperationType('create')">创建列车号</el-button>
</div>
<div style="display: flex;justify-content: space-around;margin-top: 10px;">
<el-button size="mini" style="width: 280px;" :disabled="operationType === 'delete'" @click="changeOperationType('delete')">删除列车号</el-button>
<el-button size="mini" style="width: 280px;" :disabled="operationType === 'move'" @click="changeOperationType('move')">步进列车号</el-button>
<el-button size="mini" style="width: 280px;" :disabled="operationType === 'resort'" @click="changeOperationType('resort')">重排列车号</el-button>
</div>
<div v-if="operationType === 'show'">
<el-table :data="tableData" border style="width: 100%;margin-top: 20px;" height="200">
<el-table-column prop="date" label="方向" />
<el-table-column prop="name" label="列车号" />
<el-table-column prop="address" label="位置" />
<el-table-column prop="address" label="ARS" />
<el-table-column prop="address" label="晚点" />
</el-table>
</div>
<div>
<div style="margin-top: 20px;display: flex;justify-content: space-between;padding: 5px;align-items: center;">
<span>位置</span>
<el-input size="mini" style="width: 150px;" />
<div v-else-if="operationType === 'create'" style="display: flex;justify-content: space-between;">
<div>
<el-table :data="tableData" border style="width: 280px;margin-top: 20px;" height="200">
<el-table-column prop="date" label="方向" width="60" />
<el-table-column prop="name" label="列车号" width="157">
<template slot-scope="scope">
<span>{{ getTrainCode(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column prop="address" label="位置" width="60">
<template slot-scope="scope">
<span>{{ scope.row.section }}</span>
</template>
</el-table-column>
</el-table>
</div>
<div style="display: flex;justify-content: space-between;padding: 5px;align-items: center;margin-top: 10px;">
<span>新列车号</span>
<el-input size="mini" style="width: 150px;" />
<div>
<div style="margin-top: 20px;display: flex;justify-content: space-between;padding: 5px;align-items: center;">
<span>位置</span>
<el-select v-model="nowSectionCode" :disabled="true" size="mini" style="width: 150px">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</div>
<div style="display: flex;justify-content: space-between;padding: 5px;align-items: center;margin-top: 5px;">
<span>新列车号</span>
<el-input v-model="newTrainCode" :maxlength="8" size="mini" style="width: 150px;" />
</div>
<div style="display: flex;justify-content: space-between;padding: 5px;margin-top: 5px;">
<span>方向</span>
<el-select v-model="direction" :disabled="true" size="mini" style="width: 80px" placeholder="请选择">
<el-option
v-for="item in directionList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
<div style="display: flex;justify-content: space-between;padding: 5px;margin-top: 5px;">
<span>设置该列车为自动排列</span>
<el-radio v-model="autoArrange" :disabled="true" label="true">开启</el-radio>
<el-radio v-model="autoArrange" :disabled="true" label="false">关闭</el-radio>
</div>
<div style="display: flex;justify-content: space-between;padding: 5px;align-items: center;margin-top: 5px;">
<span>车组号</span>
<el-input v-model="groupNumber1" :maxlength="4" size="mini" style="width: 60px;" />
<div style="border: 1px solid #DCDFE6;padding: 4px 5px;border-radius: 3px;">&lt;&gt;</div>
<el-input v-model="groupNumber2" :maxlength="4" :disabled="true" size="mini" style="width: 60px;" />
</div>
</div>
<div style="display: flex;justify-content: space-between;padding: 5px;margin-top: 10px;">
<span>设置该列车为自动排列</span>
<el-radio v-model="autoArrange" label="true">开启</el-radio>
<el-radio v-model="autoArrange" label="false">关闭</el-radio>
</div>
<div style="display: flex;justify-content: space-between;padding: 5px;align-items: center;margin-top: 10px;">
<span>车组号</span>
<el-input size="mini" style="width: 60px;" />
<div style="border: 1px solid #DCDFE6;padding: 4px 5px;border-radius: 3px;">&lt;&gt;</div>
<el-input size="mini" style="width: 60px;" />
<div>
<div style="margin-top: 20px;height: 20px;">插入位置之前</div>
<el-table :data="tableData" border style="width: 280px;" height="180">
<el-table-column prop="date" label="方向" width="60" />
<el-table-column prop="name" label="列车号" width="157" />
<el-table-column prop="address" label="位置" width="60" />
</el-table>
</div>
</div>
<div>
<div style="margin-top: 20px;height: 20px;">插入位置之前</div>
<el-table :data="tableData" border style="width: 280px;" height="180">
<el-table-column prop="date" label="方向" width="60" />
<el-table-column prop="name" label="列车号" width="157" />
<el-table-column prop="address" label="位置" width="60" />
</el-table>
<div v-else-if="operationType === 'update'" style="display: flex;justify-content: flex-start;">
<div>
<el-table :data="tableData" border style="width: 280px;margin-top: 20px;" height="200">
<el-table-column prop="date" label="方向" width="60" />
<el-table-column label="列车号" width="157">
<template slot-scope="scope">
<span>{{ getTrainCode(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column label="位置" width="60">
<template slot-scope="scope">
<span>{{ getSectionPosition(scope.row.sectionCode) }}</span>
</template>
</el-table-column>
</el-table>
</div>
<div>
<div style="margin-top: 20px;display: flex;justify-content: space-between;padding: 5px;align-items: center;">
<span>位置</span>
<el-select v-model="nowSectionCode" size="mini" style="width: 150px">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</div>
<div style="display: flex;justify-content: space-between;padding: 5px;align-items: center;margin-top: 5px;">
<span>新列车号</span>
<el-input v-model="newTrainCode" size="mini" :maxlength="8" style="width: 150px;" />
</div>
<div style="display: flex;justify-content: space-between;padding: 5px;margin-top: 5px;">
<span>方向</span>
<el-select v-model="direction" size="mini" style="width: 80px">
<el-option
v-for="item in directionList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
<div style="display: flex;justify-content: space-between;padding: 5px;margin-top: 5px;">
<span>设置该列车为自动排列</span>
<el-radio v-model="autoArrange" label="true">开启</el-radio>
<el-radio v-model="autoArrange" label="false">关闭</el-radio>
</div>
<div style="display: flex;justify-content: space-between;padding: 5px;align-items: center;margin-top: 5px;">
<span>车组号</span>
<el-input v-model="groupNumber1" :maxlength="4" size="mini" style="width: 60px;" />
<div style="border: 1px solid #DCDFE6;padding: 4px 5px;border-radius: 3px;">&lt;&gt;</div>
<el-input v-model="groupNumber2" :maxlength="4" size="mini" style="width: 60px;" />
</div>
</div>
</div>
</div>
<div v-else-if="operationType === 'delete'" style="display: flex;">
<div>
<el-table :data="tableData" border style="width: 280px;margin-top: 20px;" height="200">
<el-table-column prop="date" label="方向" width="60" />
<el-table-column prop="name" label="列车号" width="157" />
<el-table-column prop="address" label="位置" width="60" />
</el-table>
<div v-else-if="operationType === 'delete'" style="display: flex;">
<div>
<el-table :data="tableData" border style="width: 280px;margin-top: 20px;" height="200">
<el-table-column prop="date" label="方向" width="60" />
<el-table-column prop="name" label="列车号" width="157">
<template slot-scope="scope">
<span>{{ getTrainCode(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column prop="address" label="位置" width="60" />
</el-table>
</div>
<div style="width: 250px;display: flex;justify-content: space-between;margin-top: 20px;margin-left: 10px;align-items: center;height: 25px;">
<div>所选列车号</div>
<el-input v-model="nowTrainCode" style="width: 150px;" size="mini" />
</div>
</div>
<div style="width: 250px;display: flex;justify-content: space-between;margin-top: 20px;margin-left: 10px;align-items: center;height: 25px;">
<div>所选列车号</div>
<el-input style="width: 150px;" size="mini" />
<div v-else-if="operationType === 'move'" style="display: flex;justify-content: flex-start;">
<div>
<el-table :data="tableData" border style="width: 280px;margin-top: 20px;" height="200">
<el-table-column prop="date" label="方向" width="60" />
<el-table-column prop="name" label="列车号" width="157">
<template slot-scope="scope">
<span>{{ getTrainCode(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column prop="address" label="位置" width="60" />
</el-table>
</div>
<div>
<div style="margin-top: 20px;display: flex;justify-content: space-between;padding: 5px;align-items: center;">
<span>所选列车号</span>
<el-input size="mini" style="width: 150px;" />
</div>
<div style="display: flex;justify-content: space-between;padding: 5px;align-items: center;">
<span>当前位置</span>
<el-select v-model="nowSectionCode" size="mini" style="width: 150px">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</div>
<div style="display: flex;justify-content: space-between;padding: 5px;align-items: center;">
<span>新位置</span>
<el-select v-model="newSectionCode" size="mini" style="width: 150px">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</div>
</div>
</div>
<div style="display: flex;justify-content: flex-end;margin-top: 10px;border-top: 1px solid #c0c0c0;padding-top: 10px;">
<el-button v-if="operationType === 'update'" size="mini" @click="trainCommit">修改</el-button>
<el-button v-if="operationType === 'create'" size="mini" @click="trainCommit">创建</el-button>
<el-button v-if="operationType === 'delete'" size="mini" @click="trainCommit">删除</el-button>
<el-button size="mini" @click="doClose">关闭</el-button>
</div>
</div>
</div>
</el-dialog>
</div>
<!--</el-dialog>-->
</template>
<script>
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
// import { EventBus } from '@/scripts/event-bus';
// import CMD from '@/scripts/cmdPlugin/CommandEnum';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
export default {
name: 'RouteCreate',
@ -117,12 +257,22 @@ export default {
sectionName: '',
trainCode: '',
operationType: 'create',
autoArrange: false
autoArrange: false,
nowSectionCode: '',
direction: '',
newTrainCode: '',
groupNumber1: '',
groupNumber2: '',
nowTrainCode: '',
newSectionCode: '',
directionList: [{ label: '>', value: 'right' }, { label: '<', value: 'left' }],
trainModel: ''
};
},
computed: {
...mapGetters('map', [
'stationList'
'stationList',
'sectionList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
@ -131,17 +281,30 @@ export default {
return '列监';
}
},
watch: {
'$store.state.menuOperation.selectedCount':function(em) {
const device = this.$store.state.menuOperation.selected;
if (device && device.code && device._type === 'Section') {
// this.deviceSelect(device);
this.nowSectionCode = device.code;
} else if (device && device.code && device._type === 'Train') {
this.doShow(device);
}
}
},
methods: {
loadInitData(map) {
// console.log(map, 11111);
},
doShow(operate, selected) {
doShow(selected) {
this.dialogShow = true;
this.selected = selected;
this.loadInitData();
// console.log(selected, '000000');
if (selected) {
this.selected = selected;
this.tableData = [selected];
this.nowTrainCode = selected.destinationCode + selected.serviceNumber + (selected.tripNumber.substr(1, 2));
this.nowSectionCode = selected.sectionCode;
}
this.$nextTick(function () {
this.dragEvent();
this.$store.dispatch('training/emitTipFresh');
});
},
@ -156,6 +319,7 @@ export default {
trainFind() {
const train = this.$store.getters['map/getDeviceByCode'](this.trainCode);
this.tableData = [train];
this.operationType = 'show';
},
resetTrainCode() {
this.trainCode = '';
@ -163,31 +327,58 @@ export default {
changeOperationType(type) {
this.operationType = type;
},
commit() {
// const operate = {
// send: true,
// operation: OperationEvent.Section.newtrain.menu.operation,
// cmdType: CMD.Section.CMD_NEW_TRAIN,
// val: '' + this.direction + '::' + this.trainCode
// };
// this.loading = true;
// this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
// this.loading = false;
// if (valid) {
// this.doClose();
// }
// }).catch(() => {
// this.loading = false;
// this.doClose();
// EventBus.$emit('sendMsg', {message: ''});
// });
trainCommit() {
const params = {};
const step = {
over: true
};
if (this.operationType === 'update') {
params.groupNumber = this.trainModel.groupNumber;
params.serviceNumber = this.newTrainCode.slice(3, 6);
params.tripNumber = '0' + this.newTrainCode.slice(6, 8);
step.cmdType = CMD.TrainWindow.CMD_TRAIN_SET_PLAN;
step.operation = OperationEvent.Train.setPlanTrainId.menu.operation;
step.param = params;
} else if (this.operationType === 'create') {
params.sectionCode = this.nowSectionCode;
params.groupNumber = this.groupNumber1;
params.dn = this.newTrainCode.slice(0, 3);
params.sn = this.newTrainCode.slice(3, 6);
params.tn = '0' + this.newTrainCode.slice(6, 8);
step.cmdType = CMD.TrainWindow.CMD_TRAIN_ADD_TRAIN_TRACE;
step.operation = OperationEvent.Train.addTrainId.menu.operation;
step.param = params;
} else if (this.operationType === 'delete') {
params.groupNumber = this.groupNumber1;
step.cmdType = CMD.TrainWindow.CMD_TRAIN_REMOVE_TRAIN_TRACE;
step.operation = OperationEvent.Train.delTrainId.menu.operation;
step.param = params;
} else if (this.operationType === 'move') {
params.groupNumber = this.groupNumber1;
params.sectionCode = this.newSectionCode;
step.cmdType = CMD.TrainWindow.CMD_TRAIN_MOVE_TRAIN_TRACE;
step.operation = OperationEvent.Train.moveTrainId.menu.operation;
step.param = params;
}
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.changeShowMode('');
}
}).catch((error) => {
console.error(error);
});
},
changeShowMode() {
this.operationType = 'show';
this.nowSectionCode = '';
this.newSectionCode = '';
this.newTrainCode = '';
},
cancel() {
const operate = {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.doClose();
@ -195,33 +386,199 @@ export default {
}).catch(() => {
this.doClose();
});
},
getTrainCode(train) {
return train.destinationCode + train.serviceNumber + (train.tripNumber.substr(1, 2));
},
getSectionPosition(sectionCode) {
const section = this.$store.getters['map/getDeviceByCode'](sectionCode);
if (section.type === '02') {
const parentSection = this.$store.getters['map/getDeviceByCode'](section.parentCode);
return parentSection.name + '-' + section.name;
} else {
return section.name;
}
},
dragEvent() {
const offset = this.offset;
const dialogHeaderEl = document.querySelector('.falutChooseTitle');
const dragDom = document.querySelector('#faultChoose');
dialogHeaderEl.style.cursor = 'move';
/** 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);*/
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
dialogHeaderEl.onmousedown = (e) => {
/** 鼠标按下,计算当前元素距离可视区的距离*/
const disX = e.clientX - dialogHeaderEl.offsetLeft;
const disY = e.clientY - dialogHeaderEl.offsetTop;
/** 获取到的值带px 正则匹配替换*/
let styL, styT;
/** 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px*/
if (sty.left.includes('%')) {
// eslint-disable-next-line no-useless-escape
styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100);
styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100);
} else {
// eslint-disable-next-line no-useless-escape
styL = +sty.left.replace(/\px/g, '');
// eslint-disable-next-line no-useless-escape
styT = +sty.top.replace(/\px/g, '');
}
document.onmousemove = function (e) {
/** 通过事件委托,计算移动的距离*/
const l = e.clientX - disX;
const t = e.clientY - disY;
/** 移动当前元素*/
// dragDom.style.left = `${l + styL}px`;
// dragDom.style.top = `${t + styT}px`;
/** 移动当前元素*/
if (l + styL < 0) {
dragDom.style.left = `0px`;
} else if (l + styL > document.body.clientWidth - dragDom.clientWidth - 10) {
dragDom.style.left = `${document.body.clientWidth - dragDom.clientWidth - 10}px`;
} else {
dragDom.style.left = `${l + styL}px`;
}
if (t + styT <= offset) {
dragDom.style.top = offset + `px`;
} else if (t + styT > document.body.clientHeight - dragDom.clientHeight - 10) {
dragDom.style.top = `${document.body.clientHeight - dragDom.clientHeight - 10}px`;
} else {
dragDom.style.top = `${t + styT}px`;
}
/** 将此时的位置传出去*/
// binding.value({ x: e.pageX, y: e.pageY });
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
};
};
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.route-setting {
.content_box {
margin-bottom: 10px;
.el-button{
&.active{
background: #969696;
}
}
<style lang="scss">
#faultChoose .card .queryList .el-card .el-card__body .el-table--border .el-table__body-wrapper{
height: 135px !important;
overflow-y: auto !important;
}
.table_content_box{
margin-bottom: 20px;
#faultChoose .el-button--mini {
margin-left: 5px;
}
/deep/ {
.table{
.table_header_box{
.cell{
text-align: center;
word-break: break-word;
}
}
}
.triggerFaultListLeft{
display: inline-block;
float: left;
width: 730px;
}
// safariqq360
//
#faultChoose .el-table__body-wrapper::-webkit-scrollbar {
width: 6px;
height: 6px;
// height: 110px;
background-color: #FFFFFF;
}
/*定义滚动条轨道 内阴影+圆角*/
#faultChoose .el-table__body-wrapper::-webkit-scrollbar-track {
// box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
background-color: #FFFFFF;;
}
/*定义滑块 内阴影+圆角*/
#faultChoose .el-table__body-wrapper::-webkit-scrollbar-thumb {
border-radius: 10px;
// box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #eaeaea;
}
/*滑块效果*/
#faultChoose .el-table__body-wrapper::-webkit-scrollbar-thumb:hover {
border-radius: 5px;
// box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
background: rgba(0,0,0,0.4);
}
/*IE滚动条颜色*/
html {
scrollbar-face-color:#bfbfbf;/*滚动条颜色*/
scrollbar-highlight-color:#000;
scrollbar-3dlight-color:#000;
scrollbar-darkshadow-color:#000;
scrollbar-Shadow-color:#adadad;/*滑块边色*/
scrollbar-arrow-color:rgba(0,0,0,0.4);/*箭头颜色*/
scrollbar-track-color:#eeeeee;/*背景颜色*/
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
.triggerFaultInfo{
margin-bottom:10px;
padding: 10px 0px 10px 15px;
}
.triggerFaultList{
font-size: 14px;
margin-top: 10px;
line-height: 20px;
}
.triggerFaultTitle{
font-size: 15px;
font-weight: bold;
}
.falutChooseTitle{
cursor: all-scroll;
background-color: #c0c0c0;
height: 30px;
line-height: 30px;
color: #000;
padding-left: 10px;
border-radius: 6px 6px 0 0;
}
#faultChoose{
width: 1000px;
position: absolute;
left: 30%;
top: 20%;
padding:0px 0px 15px 0px;
// transform: translate3d(-50%,-50%,0);
border-radius: 6px;
z-index:2009;
background-color: #E2E2E2;
}
.faultChooseFoot{
display: inline-block;
float: right;
margin-right: 20px;
margin-top: 20px;
}
.closeFalutChoose{
position: absolute;
right: 0px;
top: 0px;
width: 30px;
height: 30px;
cursor: pointer;
line-height: 30px;
}
.closeFalutChooseIn{
font-size: 20px;
margin-left: 5px;
background-color: #f00;
color: #FFF;
border: 1px solid #fff;
border-radius: 5px;
}
/deep/ .el-table th{
background-color: #E2E2E2;
padding: 0;
}
/deep/.el-table td{
padding: 0;
}
}
</style>

View File

@ -15,7 +15,7 @@
v-show="deviceShow"
ref="Jl3dRailwayDevice"
:panel-show="deviceShow"
@closedevice3dview="jumpjlmap3dmodeFl"
@closedevice3dview="jumpjlmap3dmodel"
/>
<Jl3dRailway-Drive v-show="drivingShow" ref="Jl3dRailwayDrive" :panel-show="drivingShow" @showdriving="showdriving" />
<draw-select ref="drawSelect" />