# Conflicts:
#	src/views/newMap/displayNew/dispatherContest/index.vue
This commit is contained in:
joylink_cuiweidong 2020-09-18 16:05:07 +08:00
commit 41548dd32f
46 changed files with 1491 additions and 628 deletions

View File

@ -239,4 +239,19 @@ export function getTheroyCompetitionResult(competitionId, raceUserId) {
method: 'get'
});
}
/** 项目获取试题列表 */
export function getItemListByProjectCode(projectCode, params) {
return request({
url: `api/v1/competitionTheory/project/${projectCode}`,
method: 'get',
params
});
}
/** 项目提交试卷 */
export function commitProjectTestPaper(projectCode, data, mode) {
return request({
url: `api/v1/competitionTheory/project/${projectCode}/submit?mode=${mode}`,
method: 'post',
data
});
}

View File

@ -621,11 +621,10 @@ export function getPlcGateway(group) {
// });
// }
export function handlerIbpEvent(group, data) {
export function handlerIbpEvent(group, button, stationCode) {
return request({
url: `/simulation/${group}/ibp/button`,
method: 'put',
data
url: `/simulation/${group}/ibp/${button}?stationCode=${stationCode}`,
method: 'put'
});
}
@ -815,3 +814,10 @@ export function putSimulationDisconnectById(group, id) {
method: 'put'
});
}
// 获取IBP盘初始状态
export function getIbpInitialState (group, stationCode) {
return request({
url: `/simulation/${group}/${stationCode}/ibp/status`,
method: 'get'
});
}

BIN
src/assets/buzzer.mp3 Normal file

Binary file not shown.

View File

@ -140,8 +140,8 @@ class IbpPan {
this.$painter.delete(oDevice);
if (!elem._dispose) {
// this.ibpDevice[code] = nDevice;
this.mapDevice[code] = deepAssign(this.mapDevice[code] || {}, nDevice);
this.$painter.add(this.mapDevice[code]);
this.ibpDevice[code] = deepAssign(this.ibpDevice[code] || {}, nDevice);
this.$painter.add(this.ibpDevice[code]);
}
});
if (this.methods.viewUpdate instanceof Function) { this.methods.viewUpdate(list); }
@ -189,16 +189,17 @@ class IbpPan {
const oDevcie = this.ibpDevice[code].instance;
oDevcie.setStatus(model);
}
setDeviceStatus(list) {
setDeviceStatus(val) {
const deviceList = Object.values(this.ibpDevice);
deviceList.forEach(elem =>{
(list || []).forEach(it =>{
if (elem.model.linkDevice === it.code) {
elem.instance.setStatus(it);
for (var key in val) {
if (elem.model.mean === key) {
const state = {};
state[key] = val[key];
elem.instance.setStatus(state);
}
});
}
});
}
drawIbpInit() {
this.$mouseController.setAllowDragging(true);

View File

@ -40,8 +40,8 @@ export default class CircularLamp extends Group {
setCircularLampColor(color) {
this.lamp.setStyle({fill: color});
}
setStatus(model) {
if (this.mean && this.mean.statusValue.includes(model[this.mean.statusKey])) {
setStatus(state) {
if (state.xxkcLight || state.sxkcLight || state.jjtcLight || state.xxgmLight || state.xxkmLight || state.sxgmLight || state.sxkmLight ) {
this.setCircularLampColor('#D8FCF2');
} else {
this.setCircularLampColor('#332C22');

View File

@ -188,12 +188,10 @@ export default class clock extends Group {
}
}
handleClock(_this) {
_this.initTime += 1000;
const newDate = new Date();
newDate.setTime(_this.initTime);
let seconds = newDate.getSeconds() + '';
let minutes = newDate.getMinutes() + '';
let hours = newDate.getHours() + '';
_this.initTime += 1;
let seconds = this.initTime % 60 + '';
let minutes = Math.floor(this.initTime / 60) % 60 + '';
let hours = Math.floor(this.initTime / 3600) + '';
if (seconds.length < 2) {
seconds = '0' + seconds;
}
@ -233,11 +231,9 @@ export default class clock extends Group {
}
setClockTime(initTime) {
this.initTime = initTime;
const newDate = new Date();
newDate.setTime(initTime);
let seconds = newDate.getSeconds() + '';
let minutes = newDate.getMinutes() + '';
let hours = newDate.getHours() + '';
let seconds = this.initTime % 60 + '';
let minutes = Math.floor(this.initTime / 60) % 60 + '';
let hours = Math.floor(this.initTime / 3600) + '';
if (seconds.length < 2) {
seconds = '0' + seconds;
}
@ -253,6 +249,7 @@ export default class clock extends Group {
this.setNumPic(3, minutes.charAt(0));
this.setNumPic(2, hours.charAt(1));
this.setNumPic(1, hours.charAt(0));
this.setClockStart(true);
}
setModel(dx, dy) {
this.model.point.x += dx;

View File

@ -163,19 +163,12 @@ export default class key extends Group {
}
}
setStatus(model) {
switch (model.status) {
case 'on': {
// 开放
if (model.xxys || model.sxys) {
this.keyImage.setStyle({image: keyPicOn});
this.model.status = 'on';
break;
}
case 'off': {
// 关闭
} else {
this.keyImage.setStyle({image: keyPic});
this.model.status = 'off';
break;
}
}
}
setModel(dx, dy) {

View File

@ -296,9 +296,22 @@ deviceRender[deviceType.IscsImage] = {
zlevel: 1,
z: 5
};
// 福州iscs扇门
deviceRender[deviceType.OrdinaryDoor] = {
_type: deviceType.OrdinaryDoor,
zlevel: 1,
z: 4
};
// 福州门禁
deviceRender[deviceType.FuzhouDoor] = {
_type: deviceType.FuzhouDoor,
zlevel: 1,
z: 4
};
// 福州通讯图符
deviceRender[deviceType.CommunicationButcher] = {
_type: deviceType.CommunicationButcher,
zlevel: 1,
z: 4
};
export default deviceRender;

View File

@ -46,7 +46,9 @@ const deviceType = {
Elevator: 'Elevator',
Draught: 'Draught',
IscsImage: 'IscsImage',
OrdinaryDoor: 'ordinaryDoor'
OrdinaryDoor: 'OrdinaryDoor',
FuzhouDoor: 'FuzhouDoor',
CommunicationButcher: 'CommunicationButcher'
};
export default deviceType;

View File

@ -0,0 +1,218 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
import Line from 'zrender/src/graphic/shape/Line';
export default class CommunicationButcher extends Group {
constructor(device) {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this._type = device.model._type;
this._code = device.model.code;
this.create();
this.setState(this.model);
}
create() {
this.grouper = new Group({
id: this.model.code,
position: [this.model.point.x, this.model.point.y]
});
this.add(this.grouper);
this.rect1 = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: 0,
y: 0,
width: this.model.width,
height: this.model.width * 5 / 12
},
style: {
fill: '#0F0',
stroke: '#000',
lineWidth: 2
}
});
this.rect2 = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: this.model.width / 30,
y: this.model.width * 5 / 12,
width: this.model.width - this.model.width / 15,
height: this.model.width / 30
},
style: {
fill: '#000'
}
});
this.rect3 = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: this.model.width / 4 * 3,
y: this.model.width / 8,
width: this.model.width / 7,
height: this.model.width / 12
},
style: {
fill: 'rgba(0,0,0,0)',
lineWidth: 1,
stroke: '#000'
}
});
this.line1 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 24,
y1: 0,
x2: this.model.width * 7 / 24,
y2: this.model.width * 5 / 12
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line2 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 12,
y1: 0,
x2: this.model.width * 7 / 12,
y2: this.model.width * 5 / 12
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line3 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 24,
y1: this.model.width * 5 / 84,
x2: this.model.width * 7 / 12,
y2: this.model.width * 5 / 84
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line4 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 24,
y1: this.model.width * 5 / 42,
x2: this.model.width * 7 / 12,
y2: this.model.width * 5 / 42
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line5 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 24,
y1: this.model.width * 5 / 28,
x2: this.model.width * 7 / 12,
y2: this.model.width * 5 / 28
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line6 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 24,
y1: this.model.width * 5 / 21,
x2: this.model.width * 7 / 12,
y2: this.model.width * 5 / 21
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line7 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 24,
y1: this.model.width * 25 / 84,
x2: this.model.width * 7 / 12,
y2: this.model.width * 25 / 84
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line8 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 24,
y1: this.model.width * 5 / 14,
x2: this.model.width * 7 / 12,
y2: this.model.width * 5 / 14
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line9 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 3 / 4,
y1: this.model.width / 6,
x2: this.model.width * 25 / 28,
y2: this.model.width / 6
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.grouper.add(this.rect1);
this.grouper.add(this.rect2);
this.grouper.add(this.rect3);
this.grouper.add(this.line1);
this.grouper.add(this.line2);
this.grouper.add(this.line3);
this.grouper.add(this.line4);
this.grouper.add(this.line5);
this.grouper.add(this.line6);
this.grouper.add(this.line7);
this.grouper.add(this.line8);
this.grouper.add(this.line9);
this.add(this.grouper);
}
setState(model) {
if (model.state === 'normal') {
this.rect1.setStyle({fill: '#0F0'});
} else if (model.state === 'fault') {
this.rect1.setStyle({fill: '#F00'});
} else if (model.state === 'unknow') {
this.rect1.setStyle({fill: '#00F'});
}
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
}

View File

@ -47,6 +47,8 @@ import Elevator from './bas/elevator';
import Draught from './bas/draught';
import IscsImage from './iscsImage';
import OrdinaryDoor from './ordinaryDoor';
import FuzhouDoor from './fuzhouDoor';
import CommunicationButcher from './communicationButcher';
const iscsShape = {};
iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton;
@ -98,6 +100,8 @@ iscsShape[deviceType.Elevator] = Elevator;
iscsShape[deviceType.Draught] = Draught;
iscsShape[deviceType.IscsImage] = IscsImage;
iscsShape[deviceType.OrdinaryDoor] = OrdinaryDoor;
iscsShape[deviceType.FuzhouDoor] = FuzhouDoor;
iscsShape[deviceType.CommunicationButcher] = CommunicationButcher;
function shapefactory(device, iscs) {
const type = device.model._type;

View File

@ -0,0 +1,138 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
import Polygon from 'zrender/src/graphic/shape/Polygon';
export default class fuzhouDoor extends Group {
constructor(device) {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this._type = device.model._type;
this._code = device.model.code;
this.create();
this.setState(this.model);
}
create() {
this.grouper = new Group({
id: this.model.code,
position: [this.model.point.x, this.model.point.y]
});
this.door = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: 0,
y: 0,
width: this.model.width,
height: this.model.width * 25 / 16
},
style: {
fill: '#33CC00',
stroke: '#000',
lineWidth: 2
}
});
this.doorWindow = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: this.model.width * 2 / 17,
y: this.model.width * 6 / 17,
width: this.model.width * 13 / 17,
height: this.model.width * 4 / 17
},
style: {
fill: '#000'
}
});
this.doorknob = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: this.model.width * 12 / 17,
y: this.model.width * 20 / 17,
width: this.model.width / 9,
height: this.model.width / 9
},
style: {
fill: '#000'
}
});
this.polygon1 = new Polygon({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
points:[
[0, 0],
[this.model.width * 3 / 4, this.model.width * 7 / 24],
[this.model.width * 3 / 4, this.model.width * 7 / 4],
[0, this.model.width * 25 / 16]
]
},
style: {
fill: '#0F0',
stroke: '#000',
lineWidth: 2
}
});
this.polygon2 = new Polygon({
zlevel: this.zlevel,
z: this.z + 2,
shape: {
points: [
[this.model.width / 8, this.model.width / 4],
[this.model.width * 5 / 8, this.model.width * 5 / 12],
[this.model.width * 5 / 8, this.model.width * 3 / 4],
[this.model.width / 8, this.model.width * 7 / 12]
]
},
style: {
fill: '#000'
}
});
this.polygon3 = new Polygon({
zlevel: this.zlevel,
z: this.z + 2,
shape: {
points: [
[this.model.width * 5 / 12, this.model.width * 55 / 48],
[this.model.width * 14 / 24, this.model.width * 29 / 24],
[this.model.width * 14 / 24, this.model.width * 21 / 16],
[this.model.width * 5 / 12, this.model.width * 5 / 4]
]
},
style: {
fill: '#000'
}
});
this.doorWindow.hide();
this.doorknob.hide();
this.polygon1.hide();
this.polygon2.hide();
this.polygon3.hide();
this.grouper.add(this.door);
this.grouper.add(this.doorWindow);
this.grouper.add(this.doorknob);
this.grouper.add(this.polygon1);
this.grouper.add(this.polygon2);
this.grouper.add(this.polygon3);
this.add(this.grouper);
}
setState(model) {
if (model.doorOpen) {
this.door.setStyle({fill: '#D3D0C9'});
this.polygon1.show();
this.polygon2.show();
this.polygon3.show();
} else {
this.door.setStyle({fill: '#0F0'});
this.doorWindow.show();
this.doorknob.show();
}
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
}

View File

@ -22,11 +22,11 @@ export default class OrdinaryDoor extends Group {
zlevel: this.zlevel,
z: this.z,
shape: {
cx: this.model.point.x,
cy: this.model.point.y - this.model.r,
cx: 0,
cy: this.model.r,
r: this.model.r,
startAngle: Math.PI / 2,
endAngle: Math.PI
startAngle: Math.PI / 2 * 3,
endAngle: 2 * Math.PI
},
style: {
fill: 'rgba(0, 0, 0, 0)',
@ -34,6 +34,7 @@ export default class OrdinaryDoor extends Group {
lineWidth: 1
}
});
this.grouper.add(this.sector1);
if (this.model.doorType === '1') {
this.createLine(this.model.r);
} else if (this.model.doorType === '2') {
@ -47,17 +48,20 @@ export default class OrdinaryDoor extends Group {
this.createRect(this.model.r * 2);
this.createLine(this.model.r * 2);
}
this.grouper.origin = [0, 0];
this.grouper.rotation = Math.PI / 180 * (this.model.rotationAngle || 0);
this.add(this.grouper);
}
createSector2() {
this.sector2 = new Sector({
zlevel: this.zlevel,
z: this.z,
shape: {
cx: this.model.point.x + this.model.r * 2,
cy: this.model.point.y,
cx: this.model.r * 2,
cy: this.model.r,
r: this.model.r,
startAngle: 0,
endAngle: Math.PI / 2
startAngle: Math.PI,
endAngle: Math.PI / 2 * 3
},
style: {
fill: 'rgba(0,0,0,0)',
@ -72,10 +76,10 @@ export default class OrdinaryDoor extends Group {
zlevel: this.zlevel,
z: this.z,
shape: {
x1: this.model.point.x,
y1: this.model.point.y - this.model.r,
x2: this.model.point.x + length,
y2: this.model.point.y - this.model.r
x1: 1,
y1: this.model.r,
x2: length - 1,
y2: this.model.r
},
style: {
stroke: '#45607B',
@ -89,8 +93,8 @@ export default class OrdinaryDoor extends Group {
zlevel: this.zlevel,
z: this.z,
shape: {
x: this.model.point.x,
y: this.model.point.y - this.model.r,
x: 0,
y: this.model.r,
width: length,
height: this.model.r
},
@ -102,4 +106,8 @@ export default class OrdinaryDoor extends Group {
});
this.grouper.add(this.bottomRect);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
}

View File

@ -187,6 +187,12 @@ export function parser(data) {
zrUtil.each(data.ordinaryDoorList || [], elem => {
iscsDevice[elem.code] = deviceFactory(deviceType.OrdinaryDoor, elem);
});
zrUtil.each(data.fuzhoudoorList || [], elem => {
iscsDevice[elem.code] = deviceFactory(deviceType.FuzhouDoor, elem);
});
zrUtil.each(data.communicationButcherList || [], elem => {
iscsDevice[elem.code] = deviceFactory(deviceType.CommunicationButcher, elem);
});
}
return iscsDevice;

View File

@ -986,23 +986,26 @@ export function SectionList() {
}
console.log(scope.sections.datalist);
for(let i=0;i<section2d.length;i++){
if(section2d[i].type == "01" || section2d[i].type == "03"){
scope.sections.datalist[section2d[i].code].rsection = section2d[i].rightSectionCode;
scope.sections.datalist[section2d[i].code].lsection = section2d[i].leftSectionCode;
scope.sections.datalist[section2d[i].code].points = section2d[i].points;
scope.sections.datalist[section2d[i].code].pointslength = section2d[i].points.length-1;
if(section2d[i].standTrack == true){
if(scope.sections.datalist[section2d[i].code]){
scope.sections.datalist[section2d[i].code].rsection = section2d[i].rightSectionCode;
scope.sections.datalist[section2d[i].code].lsection = section2d[i].leftSectionCode;
scope.sections.datalist[section2d[i].code].points = section2d[i].points;
scope.sections.datalist[section2d[i].code].pointslength = section2d[i].points.length-1;
if(section2d[i].standTrack == true){
scope.sections.datalist[section2d[i].code].standLeftX = section2d[i].points[0].x;
scope.sections.datalist[section2d[i].code].standLeftY = section2d[i].points[0].y;
scope.sections.datalist[section2d[i].code].standRightLeftX = section2d[i].points[1].x;
scope.sections.datalist[section2d[i].code].standRightRightY = section2d[i].points[1].y;
scope.sections.datalist[section2d[i].code].leftStopPointOffset = section2d[i].leftStopPointOffset;
scope.sections.datalist[section2d[i].code].rightStopPointOffset = section2d[i].leftStopPointOffset+124;
scope.sections.datalist[section2d[i].code].standLeftX = section2d[i].points[0].x;
scope.sections.datalist[section2d[i].code].standLeftY = section2d[i].points[0].y;
scope.sections.datalist[section2d[i].code].standRightLeftX = section2d[i].points[1].x;
scope.sections.datalist[section2d[i].code].standRightRightY = section2d[i].points[1].y;
scope.sections.datalist[section2d[i].code].leftStopPointOffset = section2d[i].leftStopPointOffset;
scope.sections.datalist[section2d[i].code].rightStopPointOffset = section2d[i].leftStopPointOffset+124;
}
}
}
}

View File

@ -15,6 +15,10 @@ export function SectionModel(data) {
this.isStandTrack = null;
this.rsection = null;
this.lsection = null;
this.type = null;
//指向模型
this.mesh = null;

View File

@ -277,10 +277,10 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
function setpsdstationmap(stationlist){
for(let i=0,leni=stationlist.length;i<leni;i++){
psdtexturemap[stationlist[i].direction1.code] = stationlist[i].code;
psdtexturemap[stationlist[i].direction2.code] = stationlist[i].code;
psdtexturemap[stationlist[i].direction1.name] = stationlist[i].code;
psdtexturemap[stationlist[i].direction2.name] = stationlist[i].code;
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;
}
}

View File

@ -114,7 +114,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
// 地图模型数据
let mapdata = new Jl3ddata();
let camera = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 400);
let camera = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 0.1, 400);
camera.position.set( 0, 0, 0 );
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
@ -143,8 +143,8 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
// controls3.getObject().rotation.x = Math.PI/2;
scene.add(controls3.getObject());
let cameracctv = new THREE.PerspectiveCamera(50, dom.clientWidth/dom.clientHeight, 1, 50);
cameracctv.position.set( 0, -1,30 );
let cameracctv = new THREE.PerspectiveCamera(50, dom.clientWidth/dom.clientHeight, 0.1, 50);
cameracctv.position.set( 0, -0.4,29 );
// cameracctv.rotation.y = Math.PI/2;
camera.add(cameracctv);

View File

@ -508,23 +508,28 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
trainmodel.position.x = pos.x;
// trainmodel.children[0].position.z = pos.z;
if(data.right == "0"){
if(-trainmodel.children[0].position.z != pos.z){
if(-trainmodel.children[0].position.z != pos.z || trainmodel.children[0].position.y != pos.y){
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
let tangent = trainmodel.curve.getTangentAt(data.offset).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
trainmodel.children[0].rotation.x = -Math.PI/2;
let newRotationZ = trainmodel.children[0].rotation.z;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
trainmodel.children[0].rotation.y = -newRotationZ;
let rotas = {
posr:pos,
rota:trainmodel.children[0].rotation.z
roty:trainmodel.children[0].rotation.y,
rotz:trainmodel.children[0].rotation.z
}
trainmodel.children[1].rotalist.push(rotas);
let offsetz = pos.z + trainmodel.children[0].position.z;
trainmodel.children[0].position.z -= offsetz;
let offsety = pos.y - trainmodel.children[0].position.y;
trainmodel.children[0].position.y += offsetz;
// trainmodel.position.z = point.z;
}
@ -537,6 +542,9 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) + parseFloat(trainmodel.children[rs].position.z);
trainmodel.children[rs].position.z -= offsetz;
let offsety = parseFloat(trainmodel.children[rs].rotalist[0].posr.y) - parseFloat(trainmodel.children[rs].position.y);
trainmodel.children[rs].position.y += offsety;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]+10)>=trainmodel.children[rs].rotalist[0].posr.x){
@ -547,7 +555,8 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
}
//let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12];
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rotz;
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].roty;
trainmodel.children[rs].rotalist.splice(0,1)
xh--;
}else{
@ -565,7 +574,12 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
}else{
//
if(trainmodel.children[0].position.z < pos.z){
let rotas = {
posr:null,
roty:null,
rotz:null,
};
if(trainmodel.children[0].position.z < pos.z ){
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
let tangent = trainmodel.curve.getTangentAt(data.offset).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
@ -574,12 +588,10 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
let rotas = {
posr:pos,
rota:trainmodel.children[0].rotation.z
}
trainmodel.children[1].rotalist.push(rotas);
rotas.posr = pos;
// rotas.roty = trainmodel.children[0].rotation.y;
rotas.rotz = trainmodel.children[0].rotation.z;
let offsetz = parseFloat(pos.z) - parseFloat(trainmodel.children[0].position.z);
trainmodel.children[0].position.z += offsetz;
@ -592,26 +604,56 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
let rotas = {
posr:pos,
rota:trainmodel.children[0].rotation.z
}
trainmodel.children[1].rotalist.push(rotas);
rotas.posr = pos;
// rotas.roty = trainmodel.children[0].rotation.y;
rotas.rotz = trainmodel.children[0].rotation.z;
let offsetz = parseFloat(pos.z) - parseFloat(trainmodel.children[0].position.z);
trainmodel.children[0].position.z += offsetz;
}
if(trainmodel.children[0].position.y != pos.y){
if(rotas.posr == null){
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
let tangent = trainmodel.curve.getTangentAt(data.offset).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
rotas.posr = pos;
rotas.roty = trainmodel.children[0].rotation.y;
rotas.rotz = trainmodel.children[0].rotation.z;
let offsetz = parseFloat(pos.z) - parseFloat(trainmodel.children[0].position.z);
trainmodel.children[0].position.z += offsetz;
let offsety = parseFloat(pos.y) - parseFloat(trainmodel.children[0].position.y);
trainmodel.children[0].position.y += offsety;
}else{
rotas.roty = trainmodel.children[0].rotation.y;
let offsety = parseFloat(rotas.posr.y) - parseFloat(trainmodel.children[0].position.y);
trainmodel.children[0].position.y += offsety;
}
}
if(rotas.posr!= null){
trainmodel.children[1].rotalist.push(rotas);
}
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){
//console.log(rs);
if(trainmodel.children[rs].rotalist[0]){
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) - parseFloat(trainmodel.children[rs].matrixWorld.elements[14]);
trainmodel.children[rs].position.z += offsetz;
let offsety = parseFloat(trainmodel.children[rs].rotalist[0].posr.y) - parseFloat(trainmodel.children[rs].matrixWorld.elements[13]);
trainmodel.children[rs].position.y += offsety;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]-10)<=trainmodel.children[rs].rotalist[0].posr.x){
@ -620,8 +662,10 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
trainmodel.children[rs+1].rotalist.push(asd);
}
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
if(trainmodel.children[rs].rotalist[0].roty != null){
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].roty;
}
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rotz;
trainmodel.children[rs].rotalist.splice(0,1)
xh--;
}else{

View File

@ -166,8 +166,9 @@ export function Jl3dfaultdevice(dom,group,token,skinCode) {
function setpsdstationmap(stationlist){
for(let i=0,leni=stationlist.length;i<leni;i++){
psdtexturemap[stationlist[i].direction1.code] = stationlist[i].code;
psdtexturemap[stationlist[i].direction2.code] = stationlist[i].code;
console.log(stationlist[i]);
psdtexturemap[stationlist[i].stands[0].code] = stationlist[i].code;
psdtexturemap[stationlist[i].stands[1].code] = stationlist[i].code;
}
}
this.startAnimate = function(){

View File

@ -172,72 +172,6 @@ let views2 = [
},
];
//
// let views4 = [
// {
// left: 0,
// bottom: 0,
// width: 0.5,
// height: 0.5,
// background: new THREE.Color( 0.5, 0.5, 0.7 ),
// eye: [ 3.7, 16, 26 ],
// up: [3.7, 10 ,16 ],
// fov: 30
// },
// {
// left: 0,
// bottom: 0.5,
// width: 0.5,
// height: 0.5,
// background: new THREE.Color( 0.5, 0.5, 0.7 ),
// eye: [ 3.7,17,-4 ],
// up: [ 3.7, 10 ,16],
// fov: 30
// },
// {
// left: 0.5,
// bottom: 0,
// width: 0.5,
// height: 0.5,
// background: new THREE.Color( 0.7, 0.5, 0.5 ),
// eye: [ -60, 6,11],
// up: [ -59, 5.9,11 ],
// fov: 45
// },
// {
// left: 0.5,
// bottom: 0.5,
// width: 0.5,
// height: 0.5,
// background: new THREE.Color( 0.5, 0.7, 0.7 ),
// eye: [ -7,17,2],
// up: [-7, 10, 8],
// fov: 60
// }
// ];
//
// let views2 = [
// {
// left: 0,
// bottom: 0,
// width: 0.5,
// height: 1,
// background: new THREE.Color( 0.5, 0.5, 0.7 ),
// eye: [ 3.7, 16, 26 ],
// up: [3.7, 10 ,16 ],
// fov: 60
// },
// {
// left: 0.5,
// bottom: 0,
// width: 0.5,
// height: 1,
// background: new THREE.Color( 0.7, 0.5, 0.5 ),
// eye: [ -60, 6,11],
// up: [ -59, 5.9,11 ],
// fov: 60
// },
// ];
export function Jl3dpassflow(dom,skinCode,routegroup,viewMap) {
let scope = this;
initView(viewMap);
@ -255,6 +189,9 @@ export function Jl3dpassflow(dom,skinCode,routegroup,viewMap) {
renderer.setClearColor(new THREE.Color(0x000000));
renderer.setSize(dom.offsetWidth, dom.offsetHeight);
windowWidth = dom.offsetWidth ;
windowHeight = dom.offsetHeight;
this.dom.appendChild(renderer.domElement);
//定义相机

View File

@ -278,7 +278,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
let newRotationZ = trainlisttest.list[code].children[0].rotation.z;
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
trainlisttest.list[code].children[0].rotation.y = 0;
trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
// trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
let rotas = {
posr:point,
@ -290,8 +290,8 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z);
trainlisttest.list[code].children[0].position.z += offsetz;
// let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
// trainlisttest.list[code].children[0].position.y += offsety;
let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
trainlisttest.list[code].children[0].position.y += offsety;
}
if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){
@ -299,8 +299,8 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
if(trainlisttest.list[code].children[rs].rotalist[0]){
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]);
trainlisttest.list[code].children[rs].position.z += offsetz;
// let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
// trainlisttest.list[code].children[rs].position.y += offsety;
let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
trainlisttest.list[code].children[rs].position.y += offsety;
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])>=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
@ -316,7 +316,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
}
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rotz;
// trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty;
trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty;
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
xh--;
}else{
@ -369,7 +369,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let newRotationZ = trainlisttest.list[code].children[0].rotation.z;
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
trainlisttest.list[code].children[0].rotation.y = 0;
// trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
let rotas = {
posr:point,
@ -379,8 +379,8 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
trainlisttest.list[code].children[1].rotalist.push(rotas);
let offsetz = point.z + trainlisttest.list[code].children[0].position.z;
trainlisttest.list[code].children[0].position.z -= offsetz;
// let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
// trainlisttest.list[code].children[0].position.y += offsety;
let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
trainlisttest.list[code].children[0].position.y += offsety;
// trainlisttest.list[code].position.z = point.z;
}
@ -392,8 +392,8 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) + parseFloat(trainlisttest.list[code].children[rs].position.z);
trainlisttest.list[code].children[rs].position.z -= offsetz;
// let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
// trainlisttest.list[code].children[rs].position.y += offsety;
let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
trainlisttest.list[code].children[rs].position.y += offsety;
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
@ -402,8 +402,8 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let asd = trainlisttest.list[code].children[rs].rotalist[0];
trainlisttest.list[code].children[rs+1].rotalist.push(asd);
}
//let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12];
// trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty;
let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12];
trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty;
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rotz;
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
xh--;

View File

@ -116,8 +116,8 @@ this.loadpromise = function(sectionList,sectiondata,rails,scene,assetloader){
};
var shape = new THREE.Shape();
len = closedSpline.getLength();
if(newsection.railpoint[0].y != newsection.railpoint[2].y){
console.log(newsection);
shape.moveTo( -2, 0 );
shape.lineTo( 2, 0 );
}else{

View File

@ -15,6 +15,10 @@ export function SectionModel(data) {
this.isStandTrack = null;
this.rsection = null;
this.lsection = null;
this.type = null;
//指向模型
this.mesh = null;

View File

@ -156,7 +156,7 @@ export function StationStandListN() {
for(let i=0;i<standsdata.length;i++){
let newstationstand = new StationStandModel(standsdata[i]);
console.log(standsdata[i]);
// console.log(standsdata[i]);
if(standsdata[i].code != "Station96090"){
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;

View File

@ -69,14 +69,22 @@ export function TrainListN() {
selectmesh = assetloader.modellist[n].mesh;
scope.trainmesh = assetloader.modellist[n].mesh
ntracks1 = assetloader.modellist[n].animations.slice(16,27);
// ntracks1 = assetloader.modellist[n].animations.slice(16,27);
//
// tclip = new THREE.AnimationClip("three",2,ntracks1);
//
// ntracks2 = assetloader.modellist[n].animations.slice(0,15);
//
// fclip = new THREE.AnimationClip("four",2,ntracks2);
tclip = new THREE.AnimationClip("three",2,ntracks1);
ntracks2 = assetloader.modellist[n].animations.slice(0,15);
ntracks2 = assetloader.modellist[n].animations.slice(6,13);
fclip = new THREE.AnimationClip("four",2,ntracks2);
ntracks1 = assetloader.modellist[n].animations.slice(0,5);
tclip = new THREE.AnimationClip("three",2,ntracks1);
n = 0;
}
}
@ -202,21 +210,21 @@ export function TrainListN() {
selectmesh = assetloader.modellist[n].mesh
ntracks1 = assetloader.modellist[n].animations.slice(16,27);
// ntracks1 = assetloader.modellist[n].animations.slice(16,27);
//
// tclip = new THREE.AnimationClip("three",2,ntracks1);
//
// ntracks2 = assetloader.modellist[n].animations.slice(0,15);
//
// fclip = new THREE.AnimationClip("four",2,ntracks2);
tclip = new THREE.AnimationClip("three",2,ntracks1);
ntracks2 = assetloader.modellist[n].animations.slice(0,15);
ntracks2 = assetloader.modellist[n].animations.slice(6,13);
fclip = new THREE.AnimationClip("four",2,ntracks2);
// ntracks2 = assetloader.modellist[n].animations.slice(6,13);
//
// fclip = new THREE.AnimationClip("four",2,ntracks2);
//
// ntracks1 = assetloader.modellist[n].animations.slice(0,5);
//
// tclip = new THREE.AnimationClip("three",2,ntracks1);
ntracks1 = assetloader.modellist[n].animations.slice(0,5);
tclip = new THREE.AnimationClip("three",2,ntracks1);
n = 0;
}
}

View File

@ -332,7 +332,7 @@ class SkinCode extends defaultStyle {
spareColor: '#5b5b5b' // 区段显示颜色
},
core: {
length: 4 // 道岔单边长度
length: 8 // 道岔单边长度
},
jointImg: { // 道岔 A B C D四元素属性配置
trapezoidLength: 8, // 直角梯形元素默认长度

View File

@ -1,63 +0,0 @@
import Group from 'zrender/src/container/Group';
import Polygon from 'zrender/src/graphic/shape/Polygon';
class ERhomboid extends Group {
constructor(model) {
super();
this.model = model;
this.create();
}
create() {
const model = this.model;
const style = this.model.style;
this.section = new Polygon({ // 平行四边形
zlevel: model.zlevel,
z: model.z + 1,
shape: {
points: model.sectionPoints
},
style: {
fill: style.Section.line.spareColor
// fill: 'green'
},
cursor: model.cursor,
onmouseover: model.onmouseover,
onmouseout: model.onmouseout
});
this.hide();
this.add(this.section);
}
hide() {
this.section.hide();
}
show() {
this.section.show();
}
setColor(color) {
this.section.setStyle({ fill: color });
}
stopAnimation(flag) {
this.section.stopAnimation(flag);
}
getSection() {
return this.section;
}
setStyle(styles) {
this.eachChild((child) => {
if (child.setStyle) {
child.setStyle(styles);
}
});
}
}
export default ERhomboid;

View File

@ -1,5 +1,5 @@
import Group from 'zrender/src/container/Group';
import Polygon from 'zrender/src/graphic/shape/Polygon';
import Polyline from 'zrender/src/graphic/shape/Polyline';
class ESwLnversion extends Group {
constructor(model) {
@ -11,15 +11,17 @@ class ESwLnversion extends Group {
create() {
const model = this.model;
const style = this.model.style;
this.relocShelter = new Polygon({ // 遮盖B区段范围
this.relocShelter = new Polyline({ // 遮盖B区段范围
zlevel: model.zlevel,
z: model.z,
z: model.z + 4,
shape: {
points: model.shelterPoints
},
style: {
fill: style.backgroundColor
// fill: style.backgroundColor
// fill: 'yellow'
lineWidth: style.Section.line.width,
stroke: style.backgroundColor
},
cursor: model.cursor,
onmouseover: model.onmouseover,
@ -31,7 +33,7 @@ class ESwLnversion extends Group {
hide() {
this.relocShelter.hide();
this.relocShelter.setStyle({ fill: this.model.style.backgroundColor });
this.relocShelter.setStyle({ stroke: this.model.style.backgroundColor });
this.stopAnimation(false);
}
@ -40,7 +42,12 @@ class ESwLnversion extends Group {
}
setColor(color) {
this.relocShelter.setStyle({ fill: color });
// this.relocShelter.setStyle({ fill: color });
this.relocShelter.setStyle({ stroke: color });
}
setStyle(data) {
this.relocShelter.setStyle(data);
}
stopAnimation(flag) {

View File

@ -1,5 +1,5 @@
import Group from 'zrender/src/container/Group';
import Polygon from 'zrender/src/graphic/shape/Polygon';
import Polyline from 'zrender/src/graphic/shape/Polyline';
class ESwLocal extends Group {
constructor(model) {
@ -12,15 +12,17 @@ class ESwLocal extends Group {
const model = this.model;
const style = this.model.style;
this.locShelter = new Polygon({
this.locShelter = new Polyline({
zlevel: model.zlevel,
z: model.z,
z: model.z + 5,
shape: {
points: model.shelterPoints
},
style: {
fill: style.backgroundColor
// fill: style.backgroundColor,
// fill: 'red'
lineWidth: style.Section.line.width,
stroke: style.backgroundColor
},
cursor: model.cursor,
onmouseover: model.onmouseover,
@ -33,7 +35,7 @@ class ESwLocal extends Group {
hide() {
this.locShelter.hide();
this.locShelter.setStyle({ fill: this.model.style.backgroundColor });
this.locShelter.setStyle({ stroke: this.model.style.backgroundColor });
this.stopAnimation(false);
}
@ -46,7 +48,12 @@ class ESwLocal extends Group {
}
setColor(color) {
this.locShelter.setStyle({ fill: color });
// this.locShelter.setStyle({ fill: color });
this.locShelter.setStyle({ stroke: color });
}
setStyle(data) {
this.locShelter.setStyle(data);
}
animateStyle(cb) {
@ -55,7 +62,7 @@ class ESwLocal extends Group {
});
}
getLocal() {
return this.locShelter;
return this.locShelter;
}
}

View File

@ -13,14 +13,14 @@ class ETriangle extends Group {
const style = this.model.style;
this.section = new Polyline({ // 平行四边形
zlevel: model.zlevel,
z: model.z + 1,
z: model.z + 3,
shape: {
points: model.sectionPoints
},
style: {
fill: style.Section.line.spareColor,
// fill: style.Section.line.spareColor,
// fill: 'red',
lineWidth: 0,
lineWidth: style.Section.line.width,
stroke: style.Section.line.spareColor
},
cursor: model.cursor,
@ -41,7 +41,11 @@ class ETriangle extends Group {
}
setColor(color) {
this.section.setStyle({ fill: color });
this.section.setStyle({ stroke: color });
}
attr(data) {
this.section.attr(data);
}
stopAnimation(flag) {

View File

@ -1,6 +1,3 @@
/*
* 道岔
*/
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
import Rect from 'zrender/src/graphic/shape/Rect';
@ -12,7 +9,6 @@ import ELockRect from './ELockRect';
import ELockArc from './ELockArc';
import EMouse from './EMouse';
import EHighlight from '../element/EHighlight';
// import ERhomboid from './ERhomboid';
import ETriangle from './ETriangle';
import store from '@/store/index_APP_TARGET';
import Vue from 'vue';
@ -49,63 +45,58 @@ export default class Switch extends Group {
const model = this.model;
const style = this.style;
const switchWidth = style.Section.line.width + style.Section.line.beyondWidth * 2; // 超出宽度多少
const swPadding = style.Switch.core.length;
const swPadding = style.Switch.core.length + style.Section.line.width / 2;
const directx = this.triangle.drictx;
const directy = this.triangle.dricty;
const direct = -this.triangle.drictx * this.triangle.dricty;
const switchWidth1 = style.Section.line.width / 2;
const width1 = switchWidth1 * this.triangle.getSinRate();
const height1 = switchWidth1 * this.triangle.getCosRate();
const width2 = (height1 + switchWidth1) / this.triangle.getTanRate();
const width3 = (style.Section.line.width / this.triangle.getSinRate()) - width2 - width1;
const detailWidth = 0.2; // 调整定位模糊宽度
const point1 = [model.intersection.x - directx * width3 - directx * detailWidth, model.intersection.y + directy * switchWidth1];
const point2 = [model.intersection.x + directx * (width2 + width1) + directx * detailWidth, point1[1]];
const point3 = [point2[0] + directx * this.triangle.getCotRate() * swPadding, point2[1] + directy * swPadding];
const point4 = [point3[0] + direct * this.triangle.getSin(switchWidth) - directx * 2 * detailWidth, point3[1] - direct * this.triangle.getCos(switchWidth)];
this.locShelter = new ESwLocal({ // 定位 覆盖形状 A
let directxA = 1;
const sectionAModel = Vue.prototype.$jlmap.mapDevice[model.sectionACode];
const sectionBModel = Vue.prototype.$jlmap.mapDevice[model.sectionBCode];
let sectionATriangle = new JTriangle(sectionAModel.points[0], sectionAModel.points[1]);
let sectionBTriangle = new JTriangle(sectionBModel.points[0], sectionBModel.points[1]);
const sectionAPoint = { x: model.intersection.x, y: model.intersection.y };
if (sectionAModel.points[0].x == model.intersection.x && sectionAModel.points[0].y == model.intersection.y) {
sectionATriangle = new JTriangle(sectionAModel.points[0], sectionAModel.points[1]);
sectionBTriangle = new JTriangle(sectionBModel.points[0], sectionBModel.points[1]);
directxA = 1;
}
if (sectionAModel.points[sectionAModel.points.length - 1].x == model.intersection.x && sectionAModel.points[sectionAModel.points.length - 1].y == model.intersection.y) {
sectionATriangle = new JTriangle(sectionAModel.points[sectionAModel.points.length - 2], sectionAModel.points[sectionAModel.points.length - 1]);
sectionBTriangle = new JTriangle(sectionBModel.points[sectionBModel.points.length - 2], sectionBModel.points[sectionBModel.points.length - 1]);
directxA = -1;
}
const drictyyA = sectionATriangle.dricty;
const point1 = [model.intersection.x + directx * this.triangle.getCotRate() * swPadding, model.intersection.y + directy * swPadding];
const point2 = [model.intersection.x, model.intersection.y];
const point3 = [sectionAPoint.x + directxA * (switchWidth1 * sectionATriangle.getCosRate()), sectionAPoint.y + drictyyA * switchWidth1 * sectionATriangle.getSinRate()];
this.shapeModelA = new ESwLocal({ // 形状 A 层级最高 反位折线覆盖
zlevel: this.zlevel,
z: this.z,
style: style,
shelterPoints: [point1, point2, point3, point4],
shelterPoints: [point1, point2, point3],
cursor: 'pointer',
triangle: this.triangle,
onmouseover: () => { this.name.getArrowText().show(); },
onmouseout: () => { this.name.getArrowText().hide(); }
});
const rpoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1];
const rpoint2 = [rpoint1[0] + directx * (width2 + width1) - directx * width3, model.intersection.y + directy * switchWidth1];
const rpoint3 = [rpoint2[0] + directx * 10, rpoint2[1]];
const rpoint4 = [rpoint2[0] + directx * 10, rpoint1[1]];
this.relocShelter = new ESwLnversion({ // 反位覆盖形状 B
const relocShelterLength = 15;
const rpoint1 = [sectionAPoint.x - directxA * (relocShelterLength * sectionBTriangle.getCosRate()), sectionAPoint.y - drictyyA * relocShelterLength * sectionBTriangle.getSinRate()];
const rpoint2 = [sectionAPoint.x, sectionAPoint.y];
const rpoint3 = [sectionAPoint.x + directxA * (switchWidth1 * sectionATriangle.getCosRate()), sectionAPoint.y + drictyyA * switchWidth1 * sectionATriangle.getSinRate()];
this.shapeModelB = new ESwLnversion({ // 形状 B 层级居中 定位折线覆盖
zlevel: this.zlevel,
z: this.z,
style: style,
shelterPoints: [rpoint1, rpoint2, rpoint3, rpoint4],
shelterPoints: [rpoint1, rpoint2, rpoint3],
cursor: 'pointer',
onmouseover: () => { this.name.getArrowText().show(); },
onmouseout: () => { this.name.getArrowText().hide(); }
});
// const spoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1];
// const spoint2 = [spoint1[0] - directx * (width2 + width1) - directx * width3, spoint1[1]];
// const spoint3 = [model.intersection.x - directx * width3, model.intersection.y + directy * switchWidth1];
// const spoint4 = [spoint1[0] + directx * (width2 + width1) - directx * width3, spoint3[1]];
// this.rhomboid = new ERhomboid({ // 岔芯 平行四边形 佛山线路专用
// zlevel: this.zlevel,
// z: this.z,
// style: style,
// sectionPoints: [spoint1, spoint2, spoint3, spoint4],
// cursor: 'pointer',
// onmouseover: () => { this.name.getArrowText().show(); },
// onmouseout: () => { this.name.getArrowText().hide(); }
// });
if (this.style.Switch.text.lossRect) { // 道岔失表显示红色矩形框
const lossRect = this.locShelter.getLocal().getBoundingRect();
const lossRect = this.shapeModelA.getLocal().getBoundingRect();
this.lossShow = new Rect({
zlevel: this.zlevel,
z: this.z + 1,
@ -125,16 +116,14 @@ export default class Switch extends Group {
this.add(this.lossShow);
this.lossShow.hide();
}
const Tspoint1 = [model.intersection.x + directx * width3 + directx * (width2 + width1) - directx * width3, model.intersection.y + directy * switchWidth1];
const Tspoint2 = [model.intersection.x - directx * width3, Tspoint1[1]];
const Tspoint3 = [model.intersection.x - directx * width3, model.intersection.y - directy * switchWidth1];
const Tspoint4 = [model.intersection.x + directx * width3, Tspoint3[1]];
const Tspoint5 = [Tspoint1[0], Tspoint1[1]];
this.sheltertriangle = new ETriangle({ // 岔芯 直角梯形 C
const Tspoint1 = [model.intersection.x + directx * this.triangle.getCotRate() * swPadding, model.intersection.y + directy * swPadding];
const Tspoint2 = [model.intersection.x, model.intersection.y];
this.shapeModelC = new ETriangle({ // 形状 C 层级最低 应用佛山反位覆盖
zlevel: this.zlevel,
z: this.z,
style: style,
sectionPoints: [Tspoint1, Tspoint2, Tspoint3, Tspoint4, Tspoint5],
sectionPoints: [Tspoint1, Tspoint2],
cursor: 'pointer',
onmouseover: () => { this.name.getArrowText().show(); },
onmouseout: () => { this.name.getArrowText().hide(); }
@ -174,10 +163,9 @@ export default class Switch extends Group {
}
});
this.add(this.locShelter);
this.add(this.relocShelter);
// this.add(this.rhomboid);
this.add(this.sheltertriangle);
this.add(this.shapeModelA);
this.add(this.shapeModelB);
this.add(this.shapeModelC);
this.add(this.name);
this.add(this.enabledName);
style.Switch.text.show && model.nameShow ? this.name.show() : this.name.hide();
@ -264,32 +252,33 @@ export default class Switch extends Group {
this.lockRect.hide(); // 矩形包围框
this.lockArc.hide(); // 圆形单锁框
this.name.getNameText().stopAnimation(false);
this.sheltertriangle.hide(); // 直角梯形覆盖图形
this.sheltertriangle.setColor(this.style.Section.line.spareColor);
this.sheltertriangle.stopAnimation(false);
this.shapeModelC.hide(); // 形状 C
this.shapeModelA.hide(); // 形状 A
this.shapeModelB.hide(); // 形状 B
this.setHasTextBorder(0);
this.locShelter.hide(); // 定位覆盖图形
this.relocShelter.hide(); // 反位覆盖图形
this.enabledName.hide(); // 使能隐藏
this.shapeModelC.attr({
z: this.z + 3
});
this.enabledName && this.enabledName.hide(); // 使能隐藏
this.lossShow && this.lossShow.hide(); // 道岔失去矩形
this.lossShow && this.lossShow.stopAnimation(false);
}
/** 定位*/
setLocationAction() {
if (this.style.Switch.core.splice) {
this.locShelter.hide();
if (this.style.Switch.core.splice) { // 哈尔滨线路
this.shapeModelB.hide();
this.shapeModelC.hide();
} else {
this.locShelter.show();
this.shapeModelB.show();
this.shapeModelB.setColor(this.style.Section.line.spareColor);
this.shapeModelC.show();
}
if (this.style.Switch.core.graphShow) { // 佛山线路显示
this.relocShelter.show();
this.sheltertriangle.show();
this.relocShelter.setColor('#00FF00');
this.sheltertriangle.setColor('#00FF00');
} else {
this.relocShelter.hide();
this.sheltertriangle.hide();
this.shapeModelB.show();
this.shapeModelB.setColor('#00FF00');
this.shapeModelC.show();
this.shapeModelC.setColor(this.style.backgroundColor);
}
this.setTextColor(this.style.Switch.text.locateColor);
}
@ -298,26 +287,28 @@ export default class Switch extends Group {
setInversionAction() {
this.setTextColor(this.style.Switch.text.inversionColor);
if (this.style.Switch.core.splice) {
this.relocShelter.hide();
// this.shapeModelA.show();
// this.shapeModelA.setColor(this.style.Section.line.spareColor);
} else {
this.relocShelter.show(); // 反位
this.shapeModelB.show();
}
this.locShelter.hide(); // 定位
this.sheltertriangle.hide();
this.shapeModelA.show();
this.shapeModelA.setColor(this.style.Section.line.spareColor);
if (this.style.Switch.core.graphShow) { // 佛山线路显示
this.locShelter.show();
this.locShelter.setColor('#FFFF00');
this.sheltertriangle.show();
this.sheltertriangle.setColor('#FFFF00');
this.shapeModelC.show();
this.shapeModelC.setColor('#FFFF00');
this.shapeModelC.attr({
z: this.z + 6
});
}
}
/** 失去*/
setLossAction() {
this.locShelter.show();
this.relocShelter.show();
this.sheltertriangle.show();
this.sheltertriangle.setColor(this.style.backgroundColor);
this.shapeModelA.show();
this.shapeModelB.show();
this.shapeModelC.show();
this.shapeModelC.setColor(this.style.backgroundColor);
this.setTextColor(this.style.Switch.text.lossColor);
this.style.Switch.text.faultFlashing && this.nameTextAnimation();
@ -329,8 +320,8 @@ export default class Switch extends Group {
.start();
}
setSwitchFault(split) {
if (this.style.Switch.jointImg.faultStatus && split) {
this.setForkAction(); // 道岔挤岔 宁波线失表状态
if (this.style.Switch.jointImg.faultStatus && split) { // 宁波线失表状态
this.setForkAction(); // 道岔挤岔
} else {
if (this.model.switchFaultCode && split) {
const switchFault = store.getters['map/getDeviceByCode'](this.model.switchFaultCode);
@ -345,28 +336,28 @@ export default class Switch extends Group {
setForkAction() {
if (this.style.Switch.jointImg.fork) {
this.recover();
this.relocShelter.show();
this.relocShelter.animateStyle(item => {
this.shapeModelB.show();
this.shapeModelB.animateStyle(item => {
item.animateStyle(true)
.when(0, { fill: this.style.backgroundColor })
.when(1000, { fill: 'red' })
.when(2000, { fill: this.style.backgroundColor })
.when(0, { stroke: this.style.backgroundColor })
.when(1000, { stroke: 'red' })
.when(2000, { stroke: this.style.backgroundColor })
.start();
});
this.sheltertriangle.show(); // 宁波线路挤叉特殊显示
this.sheltertriangle.animateStyle(item => {
this.shapeModelC.show(); // 宁波线路挤叉特殊显示
this.shapeModelC.animateStyle(item => {
item.animateStyle(true)
.when(0, { fill: this.style.backgroundColor })
.when(1000, { fill: 'red' })
.when(2000, { fill: this.style.backgroundColor })
.when(0, { stroke: this.style.backgroundColor })
.when(1000, { stroke: 'red' })
.when(2000, { stroke: this.style.backgroundColor })
.start();
});
this.locShelter.show();
this.locShelter.animateStyle(item => {
this.shapeModelA.show();
this.shapeModelA.animateStyle(item => {
item.animateStyle(true)
.when(0, { fill: this.style.backgroundColor })
.when(1000, { fill: 'red' })
.when(2000, { fill: this.style.backgroundColor })
.when(0, { stroke: this.style.backgroundColor })
.when(1000, { stroke: 'red' })
.when(2000, { stroke: this.style.backgroundColor })
.start();
});
this.setTextColor('red');
@ -395,28 +386,28 @@ export default class Switch extends Group {
/** 封锁 */
block() {
if (this.style.Switch.jointImg.block) { // 宁波专用封锁显示
this.relocShelter.show();
this.relocShelter.animateStyle(item => {
this.shapeModelB.show();
this.shapeModelB.animateStyle(item => {
item.animateStyle(true)
.when(0, { fill: this.style.backgroundColor })
.when(1000, { fill: this.style.Switch.jointImg.flashingColors })
.when(2000, { fill: this.style.backgroundColor })
.when(0, { stroke: this.style.backgroundColor })
.when(1000, { stroke: this.style.Switch.jointImg.flashingColors })
.when(2000, { stroke: this.style.backgroundColor })
.start();
});
this.sheltertriangle.show();
this.sheltertriangle.animateStyle(item => {
this.shapeModelC.show();
this.shapeModelC.animateStyle(item => {
item.animateStyle(true)
.when(0, { fill: this.style.backgroundColor })
.when(1000, { fill: this.style.Switch.jointImg.flashingColors })
.when(2000, { fill: this.style.backgroundColor })
.when(0, { stroke: this.style.backgroundColor })
.when(1000, { stroke: this.style.Switch.jointImg.flashingColors })
.when(2000, { stroke: this.style.backgroundColor })
.start();
});
this.locShelter.show();
this.locShelter.animateStyle(item => {
this.shapeModelA.show();
this.shapeModelA.animateStyle(item => {
item.animateStyle(true)
.when(0, { fill: this.style.backgroundColor })
.when(1000, { fill: this.style.Switch.jointImg.flashingColors })
.when(2000, { fill: this.style.backgroundColor })
.when(0, { stroke: this.style.backgroundColor })
.when(1000, { stroke: this.style.Switch.jointImg.flashingColors })
.when(2000, { stroke: this.style.backgroundColor })
.start();
});
}
@ -427,8 +418,8 @@ export default class Switch extends Group {
this.setTextColor(this.style.Switch.text.blockText);
}
if (this.style.Switch.jointImg.trapezoidBlock && this.model.reversePosition) { // 范围且封锁时显示
this.sheltertriangle.show();
this.sheltertriangle.getSection().setStyle('fill', '#000080');
this.shapeModelC.show();
this.shapeModelC.getSection().setStyle('fill', '#000080');
}
if (this.style.Switch.rectLock.block) {
this.lockRect.show();
@ -468,35 +459,43 @@ export default class Switch extends Group {
}
// 处理岔芯颜色
setSectionState(section, state) {
setSectionState(state) {
const sectionC = store.getters['map/getDeviceByCode'](state.sectionCCode);
if (sectionC && state.reversePosition) {
this.setSwitchModelStatus(this.shapeModelA, sectionC);
}
const sectionA = store.getters['map/getDeviceByCode'](state.sectionACode);
if (sectionA) {
// 空闲
section.setStyle({'fill': this.style.Section.line.spareColor});
if (sectionA && state.normalPosition && !this.style.Switch.core.graphShow) {
this.setSwitchModelStatus(this.shapeModelB, sectionA);
}
}
// 处理道岔元素状态
setSwitchModelStatus(section, sectionModel) {
// 空闲
section.setStyle({'stroke': this.style.Section.line.spareColor});
section.show();
// 道岔保护区段锁闭
if (sectionModel.overlapLock) {
section.setStyle({'stroke': this.style.Section.line.protectiveLockColor});
section.show();
// 道岔保护区段锁闭
if (sectionA.overlapLock) {
section.show();
section.setStyle({'fill': this.style.Section.line.protectiveLockColor});
}
// 空闲锁闭或者叫进路锁闭
if (sectionA.routeLock) {
section.setStyle({'fill': this.style.Section.line.routeLockColor, 'stroke': this.style.Section.line.routeLockColor, 'lineWidth': this.style.Section.line.beyondWidth});
section.show();
}
// 非CBTC车占用
if (sectionA.nctOccupied) {
section.show();
section.setStyle({'fill': this.style.Section.line.unCommunicationOccupiedColor, 'stroke': this.style.Section.line.unCommunicationOccupiedColor, 'lineWidth': this.style.Section.line.beyondWidth});
}
// CBTC车占用
if (sectionA.ctOccupied) {
section.show();
section.setStyle({'fill': this.style.Section.line.communicationOccupiedColor, 'stroke': this.style.Section.line.communicationOccupiedColor, 'lineWidth': this.style.Section.line.beyondWidth});
}
if (sectionA.cutOff) {
section.hide();
}
}
// 空闲锁闭或者叫进路锁闭
if (sectionModel.routeLock) {
section.setStyle({'stroke': this.style.Section.line.routeLockColor});
section.show();
}
// 非CBTC车占用
if (sectionModel.nctOccupied) {
section.setStyle({'stroke': this.style.Section.line.unCommunicationOccupiedColor});
section.show();
}
// CBTC车占用
if (sectionModel.ctOccupied) {
section.setStyle({'stroke': this.style.Section.line.communicationOccupiedColor});
section.show();
}
if (sectionModel.cutOff) {
section.hide();
}
}
@ -517,8 +516,8 @@ export default class Switch extends Group {
model.blockade && this.block(); // 道岔封锁
model.singleLock && model.blockade && this.blockMonolock(); // 单锁&锁闭状态
const path = window.location.href;
if (!this.style.Switch.core.graphShow && !path.includes('/map/draw')) {
this.setSectionState(this.sheltertriangle, this.model); // 处理岔芯颜色
if (!path.includes('/map/draw')) {
this.setSectionState(this.model); // 处理元素颜色
}
// this.interlockingReserved(); // 联锁预留道岔

View File

@ -161,7 +161,6 @@ const iscs = {
if (!(models instanceof Array)) {
models = [models];
}
commit('iscsRender', models);
resolve(models);
});

View File

@ -131,6 +131,10 @@ function handle(state, data) {
break;
case 'Simulation_Time_Sync':
state.simulationTimeSync = msg;
break;
case 'Simulation_IbpStatus':
state.simulationIbpStatus = msg;
break;
}
}
@ -264,7 +268,8 @@ const socket = {
runPlanReloadCount: 0, // 仿真运行图变更
memberChangeCount: 0, // 仿真成员变更
roomInvite: {},
simulationTimeSync: '' // 仿真时间
simulationTimeSync: '', // 仿真时间
simulationIbpStatus: null
},
getters: {
},

View File

@ -25,9 +25,6 @@
/>
</el-select>
</el-form-item>
<el-form-item label="关联设备">
<el-input v-model="form.linkDevice" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" type="danger" @click="deleteDevice">{{ $t('global.delete') }}</el-button>
@ -48,17 +45,20 @@ export default {
buttonText: this.$t('ibp.createNow'),
showDeleteButton: false,
showMeanList: [
{label: '扣车', value: 'Show_Detain'},
{label: '屏蔽门打开', value: 'Show_Open_Screen_Door'},
{label: '屏蔽门紧闭', value: 'Show_Close_Screen_Door'}
{label: '下行扣车', value: 'xxkcLight'},
{label: '上行扣车', value: 'sxkcLight'},
{label: '下行关门灯', value: 'xxgmLight'},
{label: '下行开门灯', value: 'xxkmLight'},
{label: '上行关门灯', value: 'sxgmLight'},
{label: '上行开门灯', value: 'sxkmLight'},
{label: '紧急停车灯', value: 'jjtcLight'}
],
form: {
code: '',
r: '',
x: 10,
y: 10,
mean: '',
linkDevice: ''
mean: ''
},
rules: {
code: [
@ -85,7 +85,6 @@ export default {
this.form.x = model.point.x;
this.form.y = model.point.y;
this.form.mean = model.mean;
this.form.linkDevice = model.linkDevice;
}
}
},
@ -104,7 +103,6 @@ export default {
code: this.form.code,
r: this.form.r,
mean: this.form.mean,
linkDevice: this.form.linkDevice,
fillColor: '#332C22'
};
this.$emit('createData', lampModel);
@ -125,7 +123,6 @@ export default {
code: this.form.code,
r: this.form.r,
mean: this.form.mean,
linkDevice: this.form.linkDevice,
fillColor: '#332C22'
};
this.$emit('deleteDataModel', lampModel );
@ -140,8 +137,7 @@ export default {
r: '',
x: 10,
y: 10,
mean: '',
linkDevice: ''
mean: ''
};
},
generateCode() {

View File

@ -2,20 +2,25 @@
<div>
<div :id="ibpId" v-loading="loading" :style="{ width: canvasWidth+'px', height: canvasHeight +'px',background:'#000' }" class="ibp-canvas" />
<el-button v-if="showBackButton" class="ibp-button" type="primary" @click="back">{{ $t('global.back') }}</el-button>
<audio id="buzzer" controls loop="loop">
<source :src="buzzerAudio" type="audio/mpeg">
</audio>
</div>
</template>
<script>
import Vue from 'vue';
import IbpPan from '@/ibp/ibpPan';
// import ibpData from '@/ibp/constant/ibpData';
import { parser } from '@/ibp/utils/parser';
import { mapGetters } from 'vuex';
import { exitFullscreen } from '@/utils/screen';
import { handlerIbpEvent } from '@/api/simulation';
import { IbpOperation } from '@/scripts/ConstDic';
import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
import { getToken } from '@/utils/auth';
import { getIbpInfoByStation } from '@/api/ibp';
import { getSimulationInfoNew, getIbpInitialState } from '@/api/simulation';
import BuzzerAudio from '@/assets/buzzer.mp3';
export default {
name: 'Ibp',
@ -49,7 +54,8 @@ export default {
loading: false,
stationCode: '',
banUpOpenScreenDoor: false,
banDownOpenScreenDoor: false
banDownOpenScreenDoor: false,
buzzerAudio:BuzzerAudio
};
},
computed: {
@ -68,26 +74,28 @@ export default {
'$store.state.config.canvasSizeCount': function (val) {
this.reSize();
},
'$store.state.training.initTime': function (initTime) {
this.initTime = initTime;
if (this.$ibp) {
this.initClockTime(initTime);
'$store.state.socket.simulationIbpStatus': function (val) {
if (val && val[this.stationCode]) {
this.statusMessage(val[this.stationCode]);
this.controlAudio(val[this.stationCode].jjtcBuzzer);
}
},
'$store.state.training.started': function (started) {
this.started = started;
'$store.state.socket.simulationTimeSync': function (time) { // 仿
if (this.$ibp) {
this.setClockStart(started);
}
},
'$store.state.socket.equipmentStatus': function (val) {
if (val.length) {
this.statusMessage(val);
this.initClockTime(time);
}
}
},
async mounted() {
this.setWindowSize();
if (this.$route.query.noPreLogout) {
this.subscribe();
getSimulationInfoNew(this.$route.query.group).then(resp => {
if (resp.data && resp.data.systemTime) {
this.initTime = resp.data.systemTime;
}
});
}
this.initIbp();
if (this.$route.query.loadAll && this.$route.query.stationCode) {
await this.show(this.$route.query.stationCode);
@ -96,6 +104,10 @@ export default {
}
},
beforeDestroy() {
if (this.$route.query.noPreLogout) {
this.clearSubscribe();
this.$ibp.setClockStart(false);
}
this.ibpDestroy();
},
methods: {
@ -119,6 +131,7 @@ export default {
}
});
Vue.prototype.$ibp = this.$ibp;
this.initClockTime(this.initTime || this.$store.state.socket.simulationTimeSync);
this.$ibp.on('contextmenu', this.onContextMenu, this);
if (this.$route.query.group) {
this.$ibp.on('selected', this.onSelected, this);
@ -135,6 +148,14 @@ export default {
if (res.data.data) {
const ibpDatas = JSON.parse(res.data.data).drawData;
this.stationCode = deviceCode;
getIbpInitialState(this.$route.query.group, this.stationCode).then(resp => {
if (resp.data) {
this.statusMessage(resp.data);
this.controlAudio(resp.data.jjtcBuzzer);
}
}).catch(() => {
this.$message.error('获取IBP盘初始状态异常');
});
document.getElementById(this.ibpId).oncontextmenu = function (e) {
return false;
};
@ -150,7 +171,6 @@ export default {
this.setIbp(data, ibpDatas);
this.$store.dispatch('ibp/setIbpData', ibpDatas);
this.handleBanOpenScreenDoorStatus();
this.initClockTime(this.initTime);
} else {
//
this.loading = false;
@ -191,15 +211,10 @@ export default {
onMouseDown(em) {
if (em.deviceModel.mean) {
if (IbpOperation[em.deviceModel.mean]) {
handlerIbpEvent(this.$route.query.group, {button: IbpOperation[em.deviceModel.mean].event, stationCode: this.stationCode});
handlerIbpEvent(this.$route.query.group, IbpOperation[em.deviceModel.mean].event, this.stationCode);
}
}
},
openScreenDoor(flag, buttonOperate) {
if (flag) {
handlerIbpEvent(this.$route.query.group, {button: buttonOperate, stationCode: this.stationCode});
}
},
//
onContextMenu(em) {
this.$store.dispatch('ibp/setUpdateDeviceData', em.eventTarget.model);
@ -217,10 +232,6 @@ export default {
initClockTime(initTime) {
this.$ibp.initClockTime(initTime);
},
//
setClockStart(started) {
this.$ibp.setClockStart(started);
},
reSize() {
this.width = this.$store.state.config.width;
this.height = this.$store.state.config.height;
@ -256,6 +267,27 @@ export default {
},
statusMessage(val) {
this.$ibp && this.$ibp.setDeviceStatus(val);
},
async subscribe() {
this.clearSubscribe();
const header = { group: this.$route.query.group || '', 'X-Token': getToken() };
creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header);
await this.$store.dispatch('training/setHasSubscribed');
},
clearSubscribe() {
clearSubscribe(`${displayTopic}\/${this.$route.query.group}`);
},
controlAudio(val) {
const audio = document.getElementById('buzzer');
console.log(val, audio);
if (audio !== null) {
if (val) {
audio.play();
} else if (val === false) {
audio.pause();
}
}
}
}
};

View File

@ -454,97 +454,97 @@ export default {
},
{
name: '自动售检票/门禁',
mode: '',
id: '',
type: '',
mode: 'fafc',
id: 'fafc',
type: 'totalSystem',
children: [
{
name: '自动售检票系统',
mode: '',
id: '',
type: ''
mode: 'autoTicket',
id: 'autoTicket',
type: 'interface'
},
{
name: '门禁系统',
mode: '',
id: '',
type: ''
mode: 'entranceGuard',
id: 'entranceGuard',
type: 'interface'
}
]
},
{
name: '火灾报警系统',
mode: '',
id: '',
type: '',
mode: 'ffas',
id: 'ffas',
type: 'totalSystem',
children: [
{
name: '火灾报警系统-FAS联动',
mode: '',
id: '',
type: ''
mode: 'linkage',
id: 'linkage',
type: 'interface'
},
{
name: '火灾报警系统-站厅层',
mode: '',
id: '',
type: ''
mode: 'stationHall',
id: 'stationHall',
type: 'interface'
},
{
name: '火灾报警系统-站台层',
mode: '',
id: '',
type: ''
mode: 'platform',
id: 'platform',
type: 'interface'
},
{
name: '火灾报警系统-区间',
mode: '',
id: '',
type: ''
mode: 'section',
id: 'section',
type: 'interface'
},
{
name: '感温光纤探测系统',
mode: '',
id: '',
type: ''
mode: 'sensing',
id: 'sensing',
type: 'interface'
},
{
name: '气体灭火系统',
mode: '',
id: '',
type: ''
mode: 'gas',
id: 'gas',
type: 'interface'
}
]
},
{
name: '信号系统',
mode: '',
id: '',
type: '',
mode: 'signalSystem',
id: 'signalSystem',
type: 'totalSystem',
children: [
{
name: 'TIS管理器',
mode: '',
id: '',
type: ''
mode: 'tis',
id: 'tis',
type: 'interface'
},
{
name: '列车时刻表',
mode: '',
id: '',
type: ''
mode: 'schedule',
id: 'schedule',
type: 'interface'
},
{
name: '信号系统',
mode: '',
id: '',
type: ''
mode: 'signal',
id: 'signal',
type: 'interface'
},
{
name: '全线信号系统界面',
mode: '',
id: '',
type: ''
mode: 'allLineSignal',
id: 'allLineSignal',
type: 'interface'
}
]
}

View File

@ -50,14 +50,30 @@
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-table-column label="扇门" name="ordinaryDoor">
<el-tab-pane label="扇门" name="ordinaryDoor">
<ordinary-door
ref="ordinaryDoor"
style="width: 100%;height: 100%;"
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-table-column>
</el-tab-pane>
<el-tab-pane label="门禁" name="fuzhouDoor">
<fuzhou-door
ref="fuzhouDoor"
style="width: 100%;height: 100%;"
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="通讯图符" name="communicationButcher">
<communication-butcher
ref="communication"
style="width: 100%;height: 100%;"
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
@ -71,6 +87,8 @@ import IscsLine from '../iscsCommonElem/line';
import IscsText from '../iscsCommonElem/text';
import IscsRect from '../iscsCommonElem/rect';
import OrdinaryDoor from '../iscsCommonElem/ordinaryDoor';
import FuzhouDoor from '../iscsCommonElem/fuzhouDoor';
import CommunicationButcher from '../iscsCommonElem/communicationButcher';
export default {
name: 'IscsAcsOperate',
@ -80,7 +98,9 @@ export default {
IscsLine,
IscsText,
IscsRect,
OrdinaryDoor
OrdinaryDoor,
FuzhouDoor,
CommunicationButcher
},
mixins: [
],

View File

@ -0,0 +1,110 @@
<template>
<div style="overflow-y: scroll;height: calc(100% - 46px); width: 100%;">
<el-form ref="form" :rules="rules" :model="form" label-width="80px" style="width: 100%;padding: 10px 50px;">
<el-form-item label="门宽:" prop="height">
<el-input-number v-model="form.width" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="X轴坐标:">
<el-input-number v-model="form.x" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="Y轴坐标:">
<el-input-number v-model="form.y" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" size="small" type="danger" @click="deleteDevice">删除</el-button>
<el-button v-show="showDeleteButton" size="small" @click="initPage">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import {getUID} from '@/iscs/utils/Uid';
import { mapGetters } from 'vuex';
export default {
name: 'CommunicationButcher',
data() {
return {
form:{
code: '',
width: 50,
x: 10,
y: 10
},
rules: {},
isUpdate: false,
buttonText: '立即创建',
showDeleteButton: false
};
},
computed:{
...mapGetters('iscs', [
'iscs'
])
},
watch:{
'$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData'];
if (model._type === 'CommunicationButcher' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.x = model.point.x;
this.form.y = model.point.y;
this.form.width = model.width;
}
}
},
mounted() {},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const model = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.isUpdate ? this.form.code : getUID('CommunicationButcher', this.iscs.communicationButcherList),
_type: 'CommunicationButcher',
width: this.form.width
};
this.$emit('createDataModel', model);
this.initPage();
} else {
return false;
}
});
},
deleteDevice() {
const model = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.form.code,
_type: 'CommunicationButcher',
width: this.form.width
};
this.$emit('deleteDataModel', model);
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code: '',
width: 50,
x: 10,
y: 10
};
}
}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,110 @@
<template>
<div style="overflow-y: scroll;height: calc(100% - 46px); width: 100%;">
<el-form ref="form" :rules="rules" :model="form" label-width="80px" style="width: 100%;padding: 10px 50px;">
<el-form-item label="门宽:" prop="height">
<el-input-number v-model="form.width" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="X轴坐标:">
<el-input-number v-model="form.x" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="Y轴坐标:">
<el-input-number v-model="form.y" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" size="small" type="danger" @click="deleteDevice">删除</el-button>
<el-button v-show="showDeleteButton" size="small" @click="initPage">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import {getUID} from '@/iscs/utils/Uid';
import { mapGetters } from 'vuex';
export default {
name: 'FuzhouDoor',
data() {
return {
form:{
code: '',
width: 20,
x: 10,
y: 10
},
rules: {},
isUpdate: false,
buttonText: '立即创建',
showDeleteButton: false
};
},
computed:{
...mapGetters('iscs', [
'iscs'
])
},
watch:{
'$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData'];
if (model._type === 'FuzhouDoor' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.x = model.point.x;
this.form.y = model.point.y;
this.form.width = model.width;
}
}
},
mounted() {},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const model = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.isUpdate ? this.form.code : getUID('FuzhouDoor', this.iscs.fuzhouDoorList),
_type: 'FuzhouDoor',
width: this.form.width
};
this.$emit('createDataModel', model);
this.initPage();
} else {
return false;
}
});
},
deleteDevice() {
const model = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.form.code,
_type: 'FuzhouDoor',
width: this.form.width
};
this.$emit('deleteDataModel', model);
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code: '',
width: 20,
x: 10,
y: 10
};
}
}
};
</script>
<style scoped>
</style>

View File

@ -53,6 +53,7 @@ export default {
{label: '单扇有矩形', value: '3'},
{label: '双扇有矩形', value: '4'}
],
rules: {},
isUpdate: false,
buttonText: '立即创建',
showDeleteButton: false
@ -74,6 +75,7 @@ export default {
this.form.x = model.point.x;
this.form.y = model.point.y;
this.form.r = model.r;
this.form.doorType = model.doorType;
this.form.rotationAngle = model.rotationAngle;
}
}
@ -85,16 +87,14 @@ export default {
if (valid) {
const model = {
point: {
x: this.form.x1,
y: this.form.y1
x: this.form.x,
y: this.form.y
},
code: this.isUpdate ? this.form.code : getUID('OrdinaryDoor', this.iscs.ordinaryDoorList),
_type: 'OrdinaryDoor',
lineWidth: this.form.lineWidth,
fillColor: this.form.fillColor,
classify: this.form.classify,
arrowShow: this.form.arrowShow,
arrowSize: this.form.arrowSize
rotationAngle: this.form.rotationAngle,
r: this.form.r,
doorType: this.form.doorType
};
this.$emit('createDataModel', model);
this.initPage();
@ -105,21 +105,15 @@ export default {
},
deleteDevice() {
const lineModel = {
point1: {
x: this.form.x1,
y: this.form.y1
},
point2: {
x: this.form.x2,
y: this.form.y2
point: {
x: this.form.x,
y: this.form.y
},
code: this.form.code,
_type: 'IscsLine',
lineWidth: this.form.lineWidth,
fillColor: this.form.fillColor,
classify: this.form.classify,
arrowShow: this.form.arrowShow,
arrowSize: this.form.arrowSize
_type: 'OrdinaryDoor',
rotationAngle: this.form.rotationAngle,
r: this.form.r,
doorType: this.form.doorType
};
this.$emit('deleteDataModel', lineModel);
},
@ -129,15 +123,11 @@ export default {
this.showDeleteButton = false;
this.form = {
code: '',
lineWidth: '',
fillColor: '#fff',
arrowShow: 'none',
arrowSize: 5,
x1: 10,
y1: 10,
x2: 20,
y2: 10,
classify:'solid'
doorType: '1',
r: 1,
rotationAngle: 0,
x: 10,
y: 10
};
}
}

View File

@ -67,7 +67,8 @@
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
<scene-list ref="sceneList" @selectScript="selectScript" />
<theory-quiz ref="theoryQuiz" />
<theory-quiz ref="theoryQuiz" @commitResult="commitResult" />
<throry-result ref="theoryResult" @restart="goTheoryQuiz" />
</div>
</template>
@ -80,6 +81,7 @@ import DemonChat from '../demonChat';
import SceneList from './sceneList';
import MenuSchema from '@/views/newMap/displayNew/menuSchema';
import TheoryQuiz from './quiz';
import ThroryResult from './result';
import { getGoodsTryUse } from '@/api/management/goods';
import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@/api/simulation';
import { PermissionType } from '@/scripts/ConstDic';
@ -103,7 +105,8 @@ export default {
MenuSchema,
DemonMenu,
SceneList,
TheoryQuiz
TheoryQuiz,
ThroryResult
},
props: {
offset: {
@ -561,6 +564,9 @@ export default {
},
goTheoryQuiz() {
this.$refs.theoryQuiz.doShow();
},
commitResult(result) {
this.$refs.theoryResult.doShow(result);
}
}
};

View File

@ -27,19 +27,17 @@
</template>
<script>
// import { commitExam, getExamInfo, getUserExam, saveExamAnswer } from '@/api/exam.js';
// import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import Question from './question';
import localStore from 'storejs';
import { postCompetitionTheory, getTheoryQuestion, quitCurrentRace } from '@/api/competition';
import { getItemListByProjectCode, commitProjectTestPaper } from '@/api/competition';
import { computationTime } from '@/utils/date';
import { getSessionStorage } from '@/utils/auth';
import { ProjectCode } from '@/scripts/ProjectConfig';
export default {
components: {
Question
},
mixins: [
// WindowResizeHandler
],
data() {
return {
@ -60,39 +58,7 @@ export default {
theoryExamTime: 0,
countdown: null,
dialogVisible: false,
data: {
theoryExamTime:1,
questions:[
{
id:1,
type:'select',
topic:'。。。。。',
optionList:[
{
id:1,
questionId:1,
content:'啊'
},
{
id:2,
questionId:1,
content:'吧'
},
{
id:3,
questionId:1,
content:'从'
},
{
id:4,
questionId:1,
content:'的'
}
],
score:10
}
]
}
data: {}
};
},
computed: {
@ -105,6 +71,9 @@ export default {
question() {
return this.examQuestions[this.index] || {};
},
project() {
return getSessionStorage('project');
},
index2UnicodeList() {
return ['一', '二', '三', '四'];
},
@ -122,63 +91,41 @@ export default {
}
},
watch: {
'$router': function() {
this.loadInitData();
}
},
created() {
this.loadInitData();
},
beforeDestroy() {
quitCurrentRace(this.$route.query.raceId, {}).then(res=>{
});
if (this.countdown) {
clearInterval(this.countdown);
}
},
methods: {
doShow() {
this.dialogVisible = true;
},
loadInitData() {
// this.theoryAnswers = [];
this.theoryAnswersMap = {};
// getTheoryQuestion(this.$route.query.raceId).then((resp)=>{
// const storeAnswersKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'theoryAnswers';
// const storeAnswers = localStore.get(storeAnswersKey);
// if (storeAnswers) {
// this.theoryAnswersMap = storeAnswers;
// }
if (this.data) {
this.examQuestions = this.data.questions.map((el, i) => {
el.index = i;
el.answer = this.theoryAnswersMap[el.id];
return el;
});
const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'theory';
const startTime = localStore.get(storeKey);
if (startTime) {
const dt = new Date().getTime() - startTime;
this.theoryExamTime = this.data.theoryExamTime * 60 - Math.floor(dt / 1000);
} else {
this.theoryExamTime = this.data.theoryExamTime * 60;
const storeValue = new Date().getTime();
localStore.set(storeKey, storeValue);
}
this.countdownTime = computationTime(this.theoryExamTime);
this.countdown = setInterval(() => {
if (this.theoryExamTime <= 0) {
if (this.countdown) {
clearInterval(this.countdown);
}
this.commit();
}
this.theoryExamTime--;
this.dialogVisible = true;
getItemListByProjectCode(ProjectCode[this.project]).then(resp => {
if (resp.data) {
this.examQuestions = resp.data.map((el, i) => {
el.index = i;
el.answer = this.theoryAnswersMap[el.id];
return el;
});
this.theoryExamTime = 3600;
this.countdownTime = computationTime(this.theoryExamTime);
}, 1000);
}
// }).catch(error => { this.$message.error(`${error.message}`); });
this.countdown = setInterval(() => {
if (this.theoryExamTime <= 0) {
if (this.countdown) {
clearInterval(this.countdown);
}
this.commit();
}
this.theoryExamTime--;
this.countdownTime = computationTime(this.theoryExamTime);
}, 1000);
}
}).catch(() => {
this.$message.error('获取试题列表失败!');
});
},
resizeHandler() {
this.height = this._clientHeight;
@ -219,25 +166,15 @@ export default {
for (const key in this.theoryAnswersMap) {
theoryAnswers.push({questionId: key, answerOptionId: this.theoryAnswersMap[key]});
}
const params = {
competitionId: this.$route.query.raceId,
theoryAnswers: theoryAnswers
};
// postCompetitionTheory(params).then(()=>{
// const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'theory';
// localStore.remove(storeKey);
// this.$router.push({ path: `/jsxt/theory/result?raceId=${this.$route.query.raceId}` });
// });
commitProjectTestPaper(ProjectCode[this.project], theoryAnswers).then(resp => {
this.$emit('commitResult', resp.data);
this.dialogVisible = false;
}).catch(() => {
this.$message.error('提示试卷失败');
});
},
onSave(data) {
// this.theoryAnswers.push({
// answerOptionId: data.answer,
// questionId: data.userExamQuestionId
// });
this.theoryAnswersMap[data.userExamQuestionId] = data.answer;
// console.log(data, '', this.theoryAnswers, this.theoryAnswersMap);
const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'theoryAnswers';
localStore.set(storeKey, this.theoryAnswersMap);
}
}
};

View File

@ -0,0 +1,116 @@
<template>
<div class="question">
<div class="ql-editor" v-html="appendIndex($escapeHTML(`${option.topic}`), $vnode.key, option)" />
<template v-if="checkType(option, 'judge')">
<el-radio-group v-model="answer" disabled :class="{'select-box': option.rightAnswer != option.answer}" @change="onChnage">
<el-radio v-for="(el,i) in option.optionList" :key="i" :label="$str2number(el.id)" style="display: inline">
<span>{{ el.content }}</span>
</el-radio>
</el-radio-group>
</template>
<template v-else-if="checkType(option, 'select')">
<el-radio-group v-model="answer" disabled :class="{'select-box': option.rightAnswer != option.answer}" @change="onChnage">
<el-radio v-for="(el,i) in option.optionList" :key="i" :label="$str2number(el.id)" style="display: block">
<span>{{ $asc2chart(i+65) }}. </span>
<div class="ql-editor" style="display: inline; padding: 0" v-html="$escapeHTML(el.content)" />
</el-radio>
</el-radio-group>
</template>
</div>
</template>
<script>
export default {
props: {
value: {
type: String,
default: ''
},
option: {
type: Object,
required: true
}
},
data() {
return {
answer: 0
};
},
watch: {
value(val) {
this.changeValue();
}
},
mounted() {
this.changeValue();
},
methods: {
changeValue() {
this.answer = parseInt(this.value);
},
checkType(option, type) {
return option.type == type;
},
appendIndex(str, index, option) {
let result = '';
const i = option.optionList.findIndex(ele => ele.correct);
if (option.type === 'select') {
if (option.answer == option.optionList[i].id) {
result = `<span style="color: green;margin-left: 10px;">(正确 得分: ${option.score})</span>`;
} else {
result = `<span style="color: red;margin-left: 10px;">(错误 正确答案: ${this.$asc2chart(i + 65)})</span>`;
}
} else if (option.type === 'judge') {
if (option.answer == option.optionList[i].id) {
result = `<span style="color: green;margin-left: 10px;">(正确 得分: ${option.score})</span>`;
} else {
result = `<span style="color: red;margin-left: 10px;">(错误 正确答案: ${option.optionList[i].content})</span>`;
}
}
this.$set(option, 'rightAnswer', option.optionList[i].id);
//
return `${index + 1}. ${str} ${result}`;
},
onChnage(e) {
const answer = `${e}`;
this.$emit('input', answer);
this.$emit('save', {userExamQuestionId: this.option.id, answer: answer});
}
}
};
</script>
<style lang="scss" scoped>
.rich-text {
padding: 0;
display: inline;
}
.question {
/deep/ {
.ql-editor {
line-height: 26px;
padding: 0;
}
.el-radio {
color: #000;
}
.el-radio__label {
font-size: 16px;
line-height: 26px;
}
.el-radio-group .is-disabled .el-radio__label{
color: #333;
}
.select-box.el-radio-group .is-checked.is-disabled .el-radio__label{
color: red;
}
}
}
</style>

View File

@ -0,0 +1,185 @@
<template>
<el-dialog :visible.sync="dialogVisible" fullscreen>
<el-container class="quiz">
<el-container class="quiz__container">
<el-header class="quiz__container-header layer-center">
<div class="titles">考试结果</div>
</el-header>
<el-main class="quiz__container-main layer-center">
<div v-for="(el,i) in sortedList" :id="'anchor__lst-'+i" :key="i" class="section">
<template v-if="el.children.length">
<div class="caption">{{ index2UnicodeList[i] }}{{ el.title }}</div>
<question v-for="(item,j) in el.children" :id="'anchor__lst-'+item.type+'-'+item.index" :key="j" v-model="item.answer" class="context" :option="item" />
</template>
</div>
<div style="padding-left: 20px;margin-top: 20px;">
<span>考试总分: </span>
<span style="font-size: 20px">{{ totalScore }}</span>
</div>
</el-main>
<el-footer class="quiz__container-footer layer-center" @click="returnTop">
<el-button-group class="buttons">
<el-button type="primary" @click="restart">重新测验</el-button>
<el-button type="primary" @click="close">返回</el-button>
</el-button-group>
</el-footer>
</el-container>
</el-container>
</el-dialog>
</template>
<script>
import Question from './requestQuestion';
export default {
name: 'ExamResult',
components: {
Question
},
props: {
},
data() {
return {
index: 0,
height: 0,
loading: false,
formModel: {
description: '',
duration: 10,
name: '',
status: '',
totalScore: 0,
passScore: 10
},
totalScore: 0,
examQuestions: [],
dialogVisible: false
};
},
computed: {
examId() {
return this.$route.params.examId;
},
userExamId() {
return this.$route.params.userExamId;
},
question() {
return this.examQuestions[this.index] || {};
},
index2UnicodeList() {
return ['一', '二', '三', '四'];
},
sortedList() {
return [
{
title: '判断题',
children: this.examQuestions.filter(el => { return el.type === 'judge'; })
},
{
title: '选择题',
children: this.examQuestions.filter(el => { return el.type === 'select'; })
}
];
}
},
created() {
},
methods: {
doShow(result) {
this.examQuestions = [];
this.dialogVisible = true;
if (result.length) {
result.forEach((item, i) => {
this.examQuestions.push({...item.question, ...{answer: String(item.answerOptionId), score: item.score, index: i}});
});
this.totalScore = result.reduce((pre, ver) => pre + ver.score, 0);
}
},
restart() {
this.$emit('restart');
},
close() {
this.dialogVisible = false;
},
returnTop() {
document.querySelector('.el-header').scrollIntoView(true);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.layer-center {
width: 900px;
height: 100%;
margin: auto;
background: #fff;
padding-top: 0;
}
.quiz {
background: #eee;
height: 100%;
&::-webkit-scrollbar {
display:none
}
&__card {
height: 100%;
.dir-item {
padding-left: 25px;
}
.dir-caption {
padding-left: 10px;
line-height: 26px;
background: #f1f1f1;
}
}
&__container {
height: 100%;
&-header {
height: auto !important;
.titles {
font-size: 24px;
line-height: 60px;
font-weight: bold;
text-align: center;
margin: 0 auto;
}
.notes {
color:#606266;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin: 0 20px;
}
}
&-main {
.section {
padding: 5px 20px;
.caption {
line-height: 26px;
}
.context {
}
}
}
&-footer {
text-align: right;
position: sticky;
bottom: 0px;
padding: 40px ;
.buttons {
position: relative;
bottom: 20px;
}
}
}
}
</style>

View File

@ -214,7 +214,8 @@ export default {
mapId: this.$route.query.mapId,
group: this.$route.query.group,
stationCode: 'Station25166',
loadAll: true
loadAll: true,
noPreLogout: true
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');