This commit is contained in:
joylink_cuiweidong 2020-11-30 10:23:47 +08:00
commit 706335aadf
2 changed files with 20 additions and 12 deletions

View File

@ -31,12 +31,13 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe
const data = JSON.parse(Response.body); const data = JSON.parse(Response.body);
if(data.type == "PFV"){ if(data.type == "PFV"){
console.log(data); // console.log(data);
console.log(trafficTrain.trainList); // console.log(trafficTrain.trainList);
for(let k in trafficTrain.trainList){ for(let k in trafficTrain.trainList){
if(trafficTrain.trainList[k].code == data.body){ if(trafficTrain.trainList[k].code == data.body){
updateValue(data.body); updateValue(data.body);
trafficTrain.updateNowTrainCode(data.body); trafficTrain.updateNowTrainCode(data.body);
trafficTrain.updateNowTrunk(0+'');
break; break;
} }
} }
@ -55,8 +56,9 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe
} }
} }
if(data.type == "TRAIN_PFI_BL"){
if(data.type == "TRAIN_PFI_BL"){
// console.log(data);
trafficTrain.updateTrainData(data.body); trafficTrain.updateTrainData(data.body);

View File

@ -244,7 +244,9 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap,initCode) {
window.onresize = function () { window.onresize = function () {
passerRender.reSize(scope.dom.offsetWidth,scope.dom.offsetHeight); passerRender.reSize(scope.dom.offsetWidth,scope.dom.offsetHeight);
} }
this.updateNowTrunk = function(newTrunkNum){
passerHuman.nowTrunk = newTrunkNum;
};
this.switchcamera = function(trunkNum){ this.switchcamera = function(trunkNum){
passerHuman.nowTrunk = trunkNum; passerHuman.nowTrunk = trunkNum;
@ -316,10 +318,14 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap,initCode) {
this.updateTrainData = function(newData){ this.updateTrainData = function(newData){
if(scope.trainList.length > 0){ // console.log(scope.trainList);
for(let i=0;i<scope.trainList.length;i++){ // if(scope.trainList.length > 0){
if(newData.code == scope.trainList[i].code){ // for(let k in scope.trainList.length){
scope.trainList[i].num = scope.trainList[i].num + newData.in - newData.out; let k = newData.code;
if(scope.trainList[k]){
// console.log(newData);
// console.log(scope.trainList[k].num);
scope.trainList[k].num = scope.trainList[k].num + newData.in - newData.out;
if(passerTrain.toptrain.nowcode == newData.code){ if(passerTrain.toptrain.nowcode == newData.code){
scope.humanWaitIn = getnum(newData.in,6); scope.humanWaitIn = getnum(newData.in,6);
@ -330,15 +336,15 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap,initCode) {
// console.log("------------------"); // console.log("------------------");
passerHuman.initTrainRail(humanlist,scope.humanWaitIn,scope.humanWaitOut,nowLeaveDoor); passerHuman.initTrainRail(humanlist,scope.humanWaitIn,scope.humanWaitOut,nowLeaveDoor);
let trainDataList = getnum(scope.trainList[i].num,6); let trainDataList = getnum(scope.trainList[k].num,6);
// nowTrunk.code = newCode; // nowTrunk.code = newCode;
scope.nowTrunk.numList = trainDataList; scope.nowTrunk.numList = trainDataList;
updateTrainNum(trainDataList); updateTrainNum(trainDataList);
} }
i = scope.trainList.length; // i = scope.trainList.length;
}
}
} }
// }
// }
} }
this.updateNowTrainCode = function(newCode){ this.updateNowTrainCode = function(newCode){