This commit is contained in:
joylink_cuiweidong 2020-06-05 14:53:43 +08:00
commit cf0a078635
29 changed files with 605 additions and 115 deletions

View File

@ -272,4 +272,16 @@ deviceRender[deviceType.Electrically] = {
zlevel: 1, zlevel: 1,
z: 5 z: 5
}; };
// 扶梯
deviceRender[deviceType.Stairs] = {
_type: deviceType.Stairs,
zlevel: 1,
z: 5
};
// 电梯
deviceRender[deviceType.Elevator] = {
_type: deviceType.Elevator,
zlevel: 1,
z: 5
};
export default deviceRender; export default deviceRender;

View File

@ -41,7 +41,9 @@ const deviceType = {
BalancedElectric: 'BalancedElectric', BalancedElectric: 'BalancedElectric',
ElectricButterflyValve: 'ElectricButterflyValve', ElectricButterflyValve: 'ElectricButterflyValve',
Cistern: 'Cistern', Cistern: 'Cistern',
Electrically: 'Electrically' Electrically: 'Electrically',
Stairs: 'Stairs',
Elevator: 'Elevator'
}; };
export default deviceType; export default deviceType;

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,7 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import createPathSvg from '../components/pathsvg'; import Arc from 'zrender/src/graphic/shape/Arc';
import Isogon from 'zrender/src/graphic/shape/Isogon';
// import createPathSvg from '../components/pathsvg';
export default class airConditioner extends Group { export default class airConditioner extends Group {
constructor(device) { constructor(device) {
@ -12,15 +14,68 @@ export default class airConditioner extends Group {
this.create(); this.create();
} }
create() { create() {
// const model = this.model;
this.grouper = new Group({ this.grouper = new Group({
id: this.model.code, id: this.model.code,
position: [this.model.point.x, this.model.point.y] position: [this.model.point.x, this.model.point.y]
}); });
this.path = createPathSvg(this.model); this.control = new Arc({
this.grouper.add(this.path); zlevel: this.zlevel,
z: this.z,
shape: {
cx: 0,
cy: 0,
r: 4
},
style: {
lineWidth: 2,
fill: 'rgba(0,0,0,0)',
stroke: '#00FF00'
}
});
this.isogon1 = new Isogon({
zlevel: this.zlevel,
z: this.z,
shape: {
x: 8,
y: -6,
r: 5,
n: 3
},
origin: [8, -6],
rotation: Math.PI,
style: {
lineWidth: 2,
fill: '#00FF00',
stroke: '#00FF00'
}
});
this.isogon2 = new Isogon({
zlevel: this.zlevel,
z: this.z,
shape: {
x: 8,
y: 6,
r: 5,
n: 3
},
origin: [8, 6],
style: {
lineWidth: 2,
fill: '#00FF00',
stroke: '#00FF00'
}
});
// this.path = createPathSvg(this.model);
this.grouper.add(this.control);
this.grouper.add(this.isogon1);
this.grouper.add(this.isogon2);
if (this.model.rotate) { if (this.model.rotate) {
this.grouper.rotation = -Math.PI / 180 * Number(this.model.rotate); this.grouper.rotation = -Math.PI / 180 * Number(this.model.rotate);
} }
const scale = this.model.width / 20;
this.grouper.scale = [scale, scale];
this.add(this.grouper); this.add(this.grouper);
} }
setModel(dx, dy) { setModel(dx, dy) {

View File

@ -0,0 +1,30 @@
import Group from 'zrender/src/container/Group';
import createPathSvg from '../components/pathsvg';
export default class airConditioner 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();
}
create() {
this.grouper = new Group({
id: this.model.code,
position: [this.model.point.x, this.model.point.y]
});
this.path = createPathSvg(this.model);
this.grouper.add(this.path);
if (this.model.rotate) {
this.grouper.rotation = -Math.PI / 180 * Number(this.model.rotate);
}
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
}

View File

@ -0,0 +1,30 @@
import Group from 'zrender/src/container/Group';
import createPathSvg from '../components/pathsvg';
export default class airConditioner 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();
}
create() {
this.grouper = new Group({
id: this.model.code,
position: [this.model.point.x, this.model.point.y]
});
this.path = createPathSvg(this.model);
this.grouper.add(this.path);
if (this.model.rotate) {
this.grouper.rotation = -Math.PI / 180 * Number(this.model.rotate);
}
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
}

View File

@ -76,9 +76,17 @@ const map = {
width: 51, width: 51,
path: 'M51,71H0V0H12V15H23V-1h4V15H39V0H51V71ZM23,19H12v4H23V19Zm0,8H12v3H23V27Zm0,7H12v3H23V34Zm0,7H12v3H23V41Zm0,7H12v3H23V48Zm0,7H12v4H23V55ZM39,19H27v4H39V19Zm0,8H27v3H39V27Zm0,7H27v3H39V34Zm0,7H27v3H39V41Zm0,7H27v3H39V48Zm0,7H27v4H39V55ZM43,4V63H8V4H4V66H47V4H43Z' path: 'M51,71H0V0H12V15H23V-1h4V15H39V0H51V71ZM23,19H12v4H23V19Zm0,8H12v3H23V27Zm0,7H12v3H23V34Zm0,7H12v3H23V41Zm0,7H12v3H23V48Zm0,7H12v4H23V55ZM39,19H27v4H39V19Zm0,8H27v3H39V27Zm0,7H27v3H39V34Zm0,7H27v3H39V41Zm0,7H27v3H39V48Zm0,7H27v4H39V55ZM43,4V63H8V4H4V66H47V4H43Z'
}, },
Electrically: { Electrically: { // 电动阀
width: 73, width: 73,
path: 'M88,61h44L118,96v11l17,36H88l12-31a27.845,27.845,0,0,1-20,9c-10.918.076-17.578-9.2-18-19-0.3-6.868,4.7-19.035,19-19,15.658,0.038,18,8,18,8ZM71,99c2.055-8.165,13.821-5.509,17-3,2.941,2.321,1.828,10.958-1,13a12.742,12.742,0,0,1-12,1C71.1,108.294,69.5,104.972,71,99Z' path: 'M 26 0 H 72 L 56 35 V 46 L 73 82 H 26 L 38 51 a 27.845 27.845 0 0 1 -20 9 C 7.082 60.076 0.422 50.8 0 41 c -0.3 -6.868 4.7 -19.035 19 -19 c 15.658 0.038 18 8 18 8 Z m 6 39 c 0.391 11.618 -7.282 14.527 -14 14 c -5.872 -0.461 -11.018 -4.744 -11 -13 C 7.033 24.563 31.537 25.228 32 39 Z'
},
Stairs: { // 扶梯
width: 154,
path: 'M397,235l-98,64H269V256h26l88-57h40v36H397ZM297,261H274v33h24l22.522-14.478L313,272l-13-1,4.468-14.893Zm14.575-9.549,15.385,23.932,22.764-14.634L345,254l-13-2,5.2-17.339Zm46.67,3.82,23.686-15.227L377,233l-13-2,5.189-17.3-26.5,17.364ZM418,204H384l-9.3,6.092,15.738,24.482L396,231h22V204Z'
},
Elevator: { // 电梯
width: 134,
path: 'M124,10V129H9V10H124ZM16,121H117V15H16V121Zm91.5-59a3.5,3.5,0,1,1,3.5-3.5A3.5,3.5,0,0,1,107.5,62Zm0-11a3.5,3.5,0,1,1,3.5-3.5A3.5,3.5,0,0,1,107.5,51Zm0-11a3.5,3.5,0,1,1,3.5-3.5A3.5,3.5,0,0,1,107.5,40Zm0-10a3.5,3.5,0,1,1,3.5-3.5A3.5,3.5,0,0,1,107.5,30ZM67,64H64V82l-2,1v22l-5-2V85H55v21l-5-1L49,54H43V69l-4-2V50l12-1s-3.327-1.327-4-3c-1.151-2.858-2.493-7.956,5-10s10.62,2.4,11,5c0.861,5.9-2,7-2,7v3l5,2,10,9,13-2v3s-6.188,4.864-13,5S67,64,67,64Zm59-10V8H7V131H126V82h8v55H0V0H134V54h-8Z'
} }
}; };

View File

@ -42,6 +42,8 @@ import LightingGroup from './lighting';
import ElectricButterflyValve from './bas/electricButterflyValve'; import ElectricButterflyValve from './bas/electricButterflyValve';
import Cistern from './bas/cistern'; import Cistern from './bas/cistern';
import Electrically from './bas/electrically'; import Electrically from './bas/electrically';
import Stairs from './bas/stairs';
import Elevator from './bas/elevator';
const iscsShape = {}; const iscsShape = {};
iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton; iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton;
@ -88,6 +90,8 @@ iscsShape[deviceType.BalancedElectric] = BalancedElectric;
iscsShape[deviceType.ElectricButterflyValve] = ElectricButterflyValve; iscsShape[deviceType.ElectricButterflyValve] = ElectricButterflyValve;
iscsShape[deviceType.Cistern] = Cistern; iscsShape[deviceType.Cistern] = Cistern;
iscsShape[deviceType.Electrically] = Electrically; iscsShape[deviceType.Electrically] = Electrically;
iscsShape[deviceType.Stairs] = Stairs;
iscsShape[deviceType.Elevator] = Elevator;
function shapefactory(device, iscs) { function shapefactory(device, iscs) {
const type = device.model._type; const type = device.model._type;

View File

@ -172,6 +172,12 @@ export function parser(data) {
zrUtil.each(data.electricallyList || [], elem => { zrUtil.each(data.electricallyList || [], elem => {
iscsDevice[elem.code] = deviceFactory(deviceType.Electrically, elem); iscsDevice[elem.code] = deviceFactory(deviceType.Electrically, elem);
}); });
zrUtil.each(data.stairsList || [], elem => {
iscsDevice[elem.code] = deviceFactory(deviceType.Stairs, elem);
});
zrUtil.each(data.elevatorList || [], elem => {
iscsDevice[elem.code] = deviceFactory(deviceType.Elevator, elem);
});
} }
return iscsDevice; return iscsDevice;
@ -239,5 +245,7 @@ export function updateIscsData(state, device) {
case deviceType.ElectricButterflyValve: updateIscsListByDevice(state, 'electricButterflyValveList', device); break; case deviceType.ElectricButterflyValve: updateIscsListByDevice(state, 'electricButterflyValveList', device); break;
case deviceType.Cistern: updateIscsListByDevice(state, 'cisternList', device); break; case deviceType.Cistern: updateIscsListByDevice(state, 'cisternList', device); break;
case deviceType.Electrically: updateIscsListByDevice(state, 'electricallyList', device); break; case deviceType.Electrically: updateIscsListByDevice(state, 'electricallyList', device); break;
case deviceType.Stairs: updateIscsListByDevice(state, 'stairsList', device); break;
case deviceType.Elevator: updateIscsListByDevice(state, 'elevatorList', device); break;
} }
} }

View File

@ -608,14 +608,13 @@ class SkinCode extends defaultStyle {
trainTargetNumberOffset: { x: -4, y: 4 }// 车组号偏移量 trainTargetNumberOffset: { x: -4, y: 4 }// 车组号偏移量
}, },
trainHead: { trainHead: {
trainMoreLength: 0, // 列车车头比车身高出的长度,上下相比车体伸出去的边框
trainHeadTriangleFirst: { x: 7, y: 1 }, // 列车车头三角坐标1偏移量
trainHeadTriangleSecond: { x: 13, y: 10 }, // 列车车头三角坐标2偏移量
trainHeadTriangleThird: { x: 7, y: 19 }, // 列车车头三角坐标3偏移量
trainHeadRectHeight: 20, // 列车车头矩形高度 trainHeadRectHeight: 20, // 列车车头矩形高度
trainConntWidth: 3, // 列车竖杠的宽度 trainConntWidth: 3, // 列车竖杠的宽度
trainHeadFillColor: '#000000', // 列车车头矩形填充颜色 trainHeadFillColor: '#000000', // 列车车头矩形填充颜色
directionStopType:'normal' // special 西安二号线 停车 列车方向图标不消失 normal 正常 directionStopType:'normal', // special 西安二号线 停车 列车方向图标不消失 normal 正常
trainHeadHeight: 'trainBox', // 列车车头高度取决于trainBox高度
trainHeadArrowWidth: 6, // 列车车头三角宽度
trainHeadArrowOffsetX: 2 // 列车车头三角偏移
}, },
common: { common: {
trainHeight: 20, // 列车高度 trainHeight: 20, // 列车高度

View File

@ -544,14 +544,13 @@ class SkinCode extends defaultStyle {
trainTargetNumberOffset: {x: -4, y: 4}// 车组号偏移量 trainTargetNumberOffset: {x: -4, y: 4}// 车组号偏移量
}, },
trainHead: { trainHead: {
trainMoreLength: 1, // 列车车头比车身高出的长度,上下相比车体伸出去的边框
trainHeadTriangleFirst: { x: 7, y: 1}, // 列车车头三角坐标1偏移量
trainHeadTriangleSecond: { x: 13, y: 10}, // 列车车头三角坐标2偏移量
trainHeadTriangleThird: { x: 7, y: 19}, // 列车车头三角坐标3偏移量
trainConntWidth: 4, // 列车竖杠的宽度 trainConntWidth: 4, // 列车竖杠的宽度
trainHeadFillColor: '#000000', // 列车车头矩形填充颜色 trainHeadFillColor: '#000000', // 列车车头矩形填充颜色
trainHeadRectHeight: 20, // 列车车头矩形高度 trainHeadRectHeight: 20, // 列车车头矩形高度
directionStopType:'normal' // special 西安二号线 停车 列车方向图标不消失 normal 正常 directionStopType:'normal', // special 西安二号线 停车 列车方向图标不消失 normal 正常
trainHeadHeight: 'trainBox', // 列车车头高度取决于trainBox高度
trainHeadArrowWidth: 5, // 列车车头三角宽度
trainHeadArrowOffsetX: 2 // 列车车头三角偏移
}, },
common: { common: {
trainHeight: 20, // 列车高度 trainHeight: 20, // 列车高度

View File

@ -729,14 +729,13 @@ class SkinCode extends defaultStyle {
trainTargetNumberOffset: {x: -4, y: 4}// 车组号偏移量 trainTargetNumberOffset: {x: -4, y: 4}// 车组号偏移量
}, },
trainHead: { trainHead: {
trainMoreLength: 0, // 列车车头比车身高出的长度,上下相比车体伸出去的边框
trainHeadTriangleFirst: { x: 7, y: 1}, // 列车车头三角坐标1偏移量
trainHeadTriangleSecond: { x: 13, y: 10}, // 列车车头三角坐标2偏移量
trainHeadTriangleThird: { x: 7, y: 19}, // 列车车头三角坐标3偏移量
trainConntWidth: 3, // 列车竖杠的宽度 trainConntWidth: 3, // 列车竖杠的宽度
trainHeadFillColor: '#000000', // 列车车头矩形填充颜色 trainHeadFillColor: '#000000', // 列车车头矩形填充颜色
trainHeadRectHeight: 20, // 列车车头矩形高度 trainHeadRectHeight: 20, // 列车车头矩形高度
directionStopType:'normal' // special 西安二号线 停车 列车方向图标不消失 normal 正常 directionStopType:'normal', // special 西安二号线 停车 列车方向图标不消失 normal 正常
trainHeadHeight: 'trainBox', // 列车车头高度取决于trainBox高度
trainHeadArrowWidth: 6, // 列车车头三角宽度
trainHeadArrowOffsetX: 5 // 列车车头三角偏移
}, },
common: { common: {
trainHeight: 20, // 列车高度 trainHeight: 20, // 列车高度

View File

@ -413,7 +413,7 @@ class SkinCode extends defaultStyle {
}, },
core: { core: {
length: 6, // 道岔单边长度 length: 6, // 道岔单边长度
graphShow: true // 图形显示 graphShow: true // 图形显示
}, },
jointImg: { // 道岔 A B C D四元素属性配置 jointImg: { // 道岔 A B C D四元素属性配置
trapezoidLength: 8, // 直角梯形元素默认长度 trapezoidLength: 8, // 直角梯形元素默认长度
@ -582,14 +582,13 @@ class SkinCode extends defaultStyle {
trainTargetNumberOffset: {x: -1, y: 1}// 车组号偏移量 trainTargetNumberOffset: {x: -1, y: 1}// 车组号偏移量
}, },
trainHead: { trainHead: {
trainMoreLength: 1, // 列车车头比车身高出的长度,上下相比车体伸出去的边框
trainHeadTriangleFirst: { x: 0, y: 0}, // 列车车头三角坐标1偏移量
trainHeadTriangleSecond: { x: 5, y: 9}, // 列车车头三角坐标2偏移量
trainHeadTriangleThird: { x: 0, y: 18}, // 列车车头三角坐标3偏移量
trainHeadRectHeight: 18, // 列车车头矩形高度 trainHeadRectHeight: 18, // 列车车头矩形高度
trainConntWidth: 5, // 列车竖杠的宽度 trainConntWidth: 5, // 列车竖杠的宽度
trainHeadFillColor: '#EF0C08', // 列车车头矩形填充颜色 trainHeadFillColor: '#EF0C08', // 列车车头矩形填充颜色
directionStopType:'normal' // special 西安二号线 停车 列车方向图标不消失 normal 正常 directionStopType:'normal', // special 西安二号线 停车 列车方向图标不消失 normal 正常
trainHeadHeight: 'text', // 列车车头高度取决于trainBox高度
trainHeadArrowWidth: 5, // 列车车头三角宽度
trainHeadArrowOffsetX: 3 // 列车车头三角偏移
}, },
common: { common: {
useSelfFormat: true, useSelfFormat: true,

View File

@ -570,14 +570,13 @@ class SkinCode extends defaultStyle {
trainTargetNumberOffset: {x: -1, y: 1}// 车组号偏移量 trainTargetNumberOffset: {x: -1, y: 1}// 车组号偏移量
}, },
trainHead: { trainHead: {
trainMoreLength: 1, // 列车车头比车身高出的长度,上下相比车体伸出去的边框
trainHeadTriangleFirst: { x: 0, y: 0}, // 列车车头三角坐标1偏移量
trainHeadTriangleSecond: { x: 4, y: 7.5}, // 列车车头三角坐标2偏移量
trainHeadTriangleThird: { x: 0, y: 15}, // 列车车头三角坐标3偏移量
trainHeadRectHeight: 15, // 列车车头矩形高度 trainHeadRectHeight: 15, // 列车车头矩形高度
trainConntWidth: 4, // 列车竖杠的宽度 trainConntWidth: 4, // 列车竖杠的宽度
trainHeadFillColor: '#EF0C08', // 列车车头矩形填充颜色 trainHeadFillColor: '#EF0C08', // 列车车头矩形填充颜色
directionStopType:'normal' // special 西安二号线 停车 列车方向图标不消失 normal 正常 directionStopType:'normal', // special 西安二号线 停车 列车方向图标不消失 normal 正常
trainHeadHeight: 'text', // 列车车头高度取决于trainBox高度
trainHeadArrowWidth: 5, // 列车车头三角宽度
trainHeadArrowOffsetX: 2 // 列车车头三角偏移
}, },
common: { common: {
trainHeight: 17, // 列车高度 trainHeight: 17, // 列车高度

View File

@ -630,14 +630,13 @@ class SkinCode extends defaultStyle {
trainTargetNumberOffset: { x: 5, y: 25 }// 车组号偏移量 trainTargetNumberOffset: { x: 5, y: 25 }// 车组号偏移量
}, },
trainHead: { trainHead: {
trainMoreLength: 1, // 列车车头比车身高出的长度,上下相比车体伸出去的边框
trainHeadTriangleFirst: { x: 0, y: 0 }, // 列车车头三角坐标1偏移量
trainHeadTriangleSecond: { x: 4, y: 7.5 }, // 列车车头三角坐标2偏移量
trainHeadTriangleThird: { x: 0, y: 15 }, // 列车车头三角坐标3偏移量
trainHeadRectHeight: 15, // 列车车头矩形高度 trainHeadRectHeight: 15, // 列车车头矩形高度
trainConntWidth: 0, // 列车竖杠的宽度 trainConntWidth: 0, // 列车竖杠的宽度
trainHeadFillColor: '#EF0C08', // 列车车头矩形填充颜色 trainHeadFillColor: '#EF0C08', // 列车车头矩形填充颜色
directionStopType:'normal' // special 西安二号线 停车 列车方向图标不消失 normal 正常 directionStopType:'normal', // special 西安二号线 停车 列车方向图标不消失 normal 正常
trainHeadHeight: 'trainBox', // 列车车头高度取决于trainBox高度
trainHeadArrowWidth: 5, // 列车车头三角宽度
trainHeadArrowOffsetX: 2 // 列车车头三角偏移
}, },
common: { common: {
hasTravelSigns: true, // 是否有行进标志 hasTravelSigns: true, // 是否有行进标志

View File

@ -581,14 +581,13 @@ class SkinCode extends defaultStyle {
trainTargetNumberOffset: {x: -4, y: 4}// 车组号偏移量 trainTargetNumberOffset: {x: -4, y: 4}// 车组号偏移量
}, },
trainHead: { trainHead: {
trainMoreLength: 1, // 列车车头比车身高出的长度,上下相比车体伸出去的边框
trainHeadTriangleFirst: { x: 4, y: 0}, // 列车车头三角坐标1偏移量
trainHeadTriangleSecond: { x: 9, y: 10}, // 列车车头三角坐标2偏移量
trainHeadTriangleThird: { x: 4, y: 20}, // 列车车头三角坐标3偏移量
trainConntWidth: 2, // 列车竖杠的宽度 trainConntWidth: 2, // 列车竖杠的宽度
trainHeadFillColor: '#000000', // 列车车头矩形填充颜色 trainHeadFillColor: '#000000', // 列车车头矩形填充颜色
trainHeadRectHeight: 20, // 列车车头矩形高度 trainHeadRectHeight: 20, // 列车车头矩形高度
directionStopType:'normal' // special 西安二号线 停车 列车方向图标不消失 normal 正常 directionStopType:'normal', // special 西安二号线 停车 列车方向图标不消失 normal 正常
trainHeadHeight: 'trainBox', // 列车车头高度取决于trainBox高度
trainHeadArrowWidth: 5, // 列车车头三角宽度
trainHeadArrowOffsetX: 2 // 列车车头三角偏移
}, },
common: { common: {
trainHeight: 20, // 列车高度 trainHeight: 20, // 列车高度

View File

@ -503,22 +503,22 @@ class SkinCode extends defaultStyle {
}; };
this[deviceType.StationTurnBack] = { // 站后折返 this[deviceType.StationTurnBack] = { // 站后折返
lamp: { lamp: {
fill: '#FFFF00', // 填充色 fill: '#FFFF00', // 填充色
radiusR: 6, // 控制灯大小 radiusR: 6 // 控制灯大小
}, },
text: { text: {
fontWeight: 'normal', fontWeight: 'normal',
fontSize: 12, fontSize: 12,
distance: 10 distance: 10
}, },
rect: { rect: {
fill: 'rgba(0,0,0,0)', fill: 'rgba(0,0,0,0)',
stroke: '#fff', stroke: '#fff',
lineWidth: 2, lineWidth: 2,
padding: 6 padding: 6
} }
} };
this[deviceType.LimitControl] = { this[deviceType.LimitControl] = {
text: { text: {
fontSize: 10, // 字体大小 fontSize: 10, // 字体大小
@ -635,14 +635,13 @@ class SkinCode extends defaultStyle {
headTypeColor: '#FF0' // 头码车 headTypeColor: '#FF0' // 头码车
}, },
trainHead: { trainHead: {
trainMoreLength: 1, // 列车车头比车身高出的长度,上下相比车体伸出去的边框
trainHeadTriangleFirst: { x: 0, y: 0}, // 列车车头三角坐标1偏移量
trainHeadTriangleSecond: { x: 4, y: 7.5}, // 列车车头三角坐标2偏移量
trainHeadTriangleThird: { x: 0, y: 15}, // 列车车头三角坐标3偏移量
trainHeadRectHeight: 15, // 列车车头矩形高度 trainHeadRectHeight: 15, // 列车车头矩形高度
trainConntWidth: 4, // 列车竖杠的宽度 trainConntWidth: 4, // 列车竖杠的宽度
trainHeadFillColor: '#EF0C08', // 列车车头矩形填充颜色 trainHeadFillColor: '#EF0C08', // 列车车头矩形填充颜色
directionStopType:'normal' // special 西安二号线 停车 列车方向图标不消失 normal 正常 directionStopType:'normal', // special 西安二号线 停车 列车方向图标不消失 normal 正常
trainHeadHeight: 'text', // 列车车头高度取决于trainBox高度
trainHeadArrowWidth: 4, // 列车车头三角宽度
trainHeadArrowOffsetX: 2 // 列车车头三角偏移
}, },
common: { common: {
trainHeight: 17, // 列车高度 trainHeight: 17, // 列车高度

View File

@ -716,14 +716,13 @@ class SkinCode extends defaultStyle {
trainTargetNumberOffset: {x: -4, y: 4}// 车组号偏移量 trainTargetNumberOffset: {x: -4, y: 4}// 车组号偏移量
}, },
trainHead: { trainHead: {
trainMoreLength: 0, // 列车车头比车身高出的长度,上下相比车体伸出去的边框
trainHeadTriangleFirst: { x: -1, y: -1}, // 列车车头三角坐标1偏移量
trainHeadTriangleSecond: { x: 15, y: 10}, // 列车车头三角坐标2偏移量
trainHeadTriangleThird: { x: -1, y: 21}, // 列车车头三角坐标3偏移量
trainConntWidth: 0, // 列车竖杠的宽度 trainConntWidth: 0, // 列车竖杠的宽度
trainHeadFillColor: '#2AA32A', // 列车车头矩形填充颜色 trainHeadFillColor: '#2AA32A', // 列车车头矩形填充颜色
trainHeadRectHeight: 20, // 列车车头矩形高度 trainHeadRectHeight: 20, // 列车车头矩形高度
directionStopType:'special' // special 西安二号线 停车 列车方向图标不消失 normal 正常 directionStopType:'special', // special 西安二号线 停车 列车方向图标不消失 normal 正常
trainHeadHeight: 'trainBox', // 列车车头高度取决于trainBox高度
trainHeadArrowWidth: 16, // 列车车头三角宽度
trainHeadArrowOffsetX: -0.5 // 列车车头三角偏移
}, },
common: { common: {
trainHeight: 20, // 列车高度 trainHeight: 20, // 列车高度

View File

@ -12,16 +12,16 @@ export default class TrainHead extends Group {
create() { create() {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
const baseMargin = (model.drect === -1 ? 1 : 0); const baseMargin = (model.drect === -1 ? -1 : 0);
if (style.Train.trainHead.trainConntWidth) { if (style.Train.trainHead.trainConntWidth) {
this.line = new Rect({ this.line = new Rect({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
shape: { shape: {
x: model.point.x - baseMargin * (style.Train.trainHead.trainConntWidth * model.scale), x: model.point.x + baseMargin * ((style.Train.trainHead.trainConntWidth + style.Train.trainBody.trainBodyLineWidth) * model.scale),
y: model.point.y, y: model.point.y,
width: style.Train.trainHead.trainConntWidth * model.scale, width: style.Train.trainHead.trainConntWidth * model.scale,
height: model.height || style.Train.trainHead.trainHeadRectHeight * model.scale height: style.Train.trainHead.trainHeadHeight === 'trainBox' ? style.Train.common.trainHeight : model.height
}, },
style: { style: {
lineWidth: 0.1, lineWidth: 0.1,
@ -31,12 +31,12 @@ export default class TrainHead extends Group {
}); });
this.add(this.line); this.add(this.line);
} }
const height = model.height / 2; const height = style.Train.trainHead.trainHeadHeight === 'trainBox' ? style.Train.common.trainHeight / 2 : model.height / 2;
const startX = model.point.x + model.drect * (style.Train.trainHead.trainConntWidth * model.scale); const startX = model.point.x + model.drect * (style.Train.trainHead.trainHeadArrowOffsetX * model.scale);
const points = [ const points = [
[startX + model.drect * 2 * model.scale, (model.point.y + height)], [startX + model.drect * style.Train.trainHead.trainHeadArrowWidth * model.scale, (model.point.y + height)],
[startX + model.drect * -2 * model.scale, (model.point.y + height) + height], [startX, (model.point.y + height) + height],
[startX + model.drect * -2 * model.scale, (model.point.y + height) - height] [startX, (model.point.y + height) - height]
]; ];
this.arrow = new Polygon({ this.arrow = new Polygon({
zlevel: model.zlevel, zlevel: model.zlevel,

View File

@ -10,9 +10,6 @@
<el-form-item label="旋转角度" prop="rotate"> <el-form-item label="旋转角度" prop="rotate">
<el-input-number v-model="form.rotate" /> <el-input-number v-model="form.rotate" />
</el-form-item> </el-form-item>
<el-form-item label="颜色" prop="fill">
<el-color-picker v-model="form.fill" />
</el-form-item>
<el-form-item label="X轴坐标" prop="x"> <el-form-item label="X轴坐标" prop="x">
<el-input-number v-model="form.x" controls-position="right" :min="1" /> <el-input-number v-model="form.x" controls-position="right" :min="1" />
</el-form-item> </el-form-item>
@ -41,7 +38,6 @@ export default {
code:'', code:'',
width: 20, width: 20,
rotate: 0, rotate: 0,
fill: '#000',
x: 10, x: 10,
y: 10 y: 10
}, },
@ -76,7 +72,6 @@ export default {
this.form.code = model.code; this.form.code = model.code;
this.form.width = model.width; this.form.width = model.width;
this.form.rotate = model.rotate || 0; this.form.rotate = model.rotate || 0;
this.form.fill = model.fill;
this.form.x = model.point.x; this.form.x = model.point.x;
this.form.y = model.point.y; this.form.y = model.point.y;
} }
@ -97,8 +92,7 @@ export default {
_type: 'Electrically', _type: 'Electrically',
code: this.isUpdate ? this.form.code : getUID('Electrically', this.iscs.electricallyList || []), code: this.isUpdate ? this.form.code : getUID('Electrically', this.iscs.electricallyList || []),
width: this.form.width, width: this.form.width,
rotate: this.form.rotate, rotate: this.form.rotate
fill: this.form.fill
}; };
this.$emit('createDataModel', model); this.$emit('createDataModel', model);
this.initPage(); this.initPage();
@ -128,8 +122,7 @@ export default {
}, },
_type: 'Electrically', _type: 'Electrically',
code: this.form.code, code: this.form.code,
width: this.form.width, width: this.form.width
fill: '#000'
}; };
this.$emit('deleteDataModel', airConditionerModel ); this.$emit('deleteDataModel', airConditionerModel );
this.initPage(); this.initPage();

View File

@ -0,0 +1,132 @@
<template>
<div>
<el-form ref="form" :rules="rules" :model="form" label-width="100px">
<el-form-item v-if="isUpdate" label="编号" prop="code">
<el-input v-model="form.code" :disabled="true" />
</el-form-item>
<el-form-item label="图形宽度" prop="width">
<el-input-number v-model="form.width" :min="10" />
</el-form-item>
<el-form-item label="旋转角度" prop="rotate">
<el-input-number v-model="form.rotate" />
</el-form-item>
<el-form-item label="X轴坐标" prop="x">
<el-input-number v-model="form.x" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="Y轴坐标" prop="y">
<el-input-number v-model="form.y" controls-position="right" :min="1" />
</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>
<el-button v-show="showDeleteButton" @click="initPage">{{ $t('global.cancel') }}</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name:'AirConditioner',
data() {
return {
isUpdate:false,
showDeleteButton: false,
buttonText: '立即创建',
form:{
code:'',
width: 20,
rotate: 0,
x: 10,
y: 10
},
rules: {
code: [
{ required: true, message:'请生成设备图形的编码', trigger: 'blur' }
],
width:[
{ required: true, message:'请输入设备图形宽度', trigger: 'blur' }
],
x: [
{ required: true, message: '请输入设备图形的X轴坐标', trigger: 'blur' }
],
y: [
{ required: true, message: '请输入设备图形的Y轴坐标', trigger: 'blur' }
]
}
};
},
computed:{
...mapGetters('iscs', [
'iscs'
])
},
watch:{
'$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData'];
if (model._type === 'Elevator' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.width = model.width;
this.form.rotate = model.rotate || 0;
this.form.x = model.point.x;
this.form.y = model.point.y;
}
}
},
mounted() {
},
methods:{
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const model = {
point: {
x: this.form.x,
y: this.form.y
},
_type: 'Elevator',
code: this.isUpdate ? this.form.code : getUID('Elevator', this.iscs.elevatorList || []),
width: this.form.width,
rotate: this.form.rotate
};
this.$emit('createDataModel', model);
this.initPage();
} else {
return false;
}
});
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code:'',
width: 20,
x: 10,
y: 10
};
this.$refs.form.resetFields();
},
deleteDevice() {
const airConditionerModel = {
point: {
x: this.form.x,
y: this.form.y
},
_type: 'Elevator',
code: this.form.code,
width: this.form.width
};
this.$emit('deleteDataModel', airConditionerModel );
this.initPage();
}
}
};
</script>

View File

@ -147,6 +147,22 @@
@deleteDataModel="deleteDataModel" @deleteDataModel="deleteDataModel"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="扶梯" name="Stairs">
<stairs
ref="stairs"
style="width: 100%;height: 100%;"
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="电梯" name="Elevator">
<elevator
ref="elevator"
style="width: 100%;height: 100%;"
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="闸机" name="FasBrakeMachine"> <el-tab-pane label="闸机" name="FasBrakeMachine">
<fas-brake-machine <fas-brake-machine
ref="fasBrakeMachine" ref="fasBrakeMachine"
@ -234,6 +250,8 @@ import Electrically from './electrically';
import Escalator from '../iscsOperate/escalator'; // import Escalator from '../iscsOperate/escalator'; //
import FasBrakeMachine from '../iscsOperate/brakeMachine'; // import FasBrakeMachine from '../iscsOperate/brakeMachine'; //
import StateTable from '../iscsCommonElem/stateTable'; import StateTable from '../iscsCommonElem/stateTable';
import Stairs from './stairs';
import Elevator from './elevator';
export default { export default {
name: 'IscsOperate', name: 'IscsOperate',
@ -261,7 +279,10 @@ export default {
Escalator, Escalator,
Electrically, Electrically,
FasBrakeMachine, FasBrakeMachine,
StateTable StateTable,
Stairs,
Elevator
}, },
mixins: [ mixins: [
], ],

View File

@ -0,0 +1,132 @@
<template>
<div>
<el-form ref="form" :rules="rules" :model="form" label-width="100px">
<el-form-item v-if="isUpdate" label="编号" prop="code">
<el-input v-model="form.code" :disabled="true" />
</el-form-item>
<el-form-item label="图形宽度" prop="width">
<el-input-number v-model="form.width" :min="10" />
</el-form-item>
<el-form-item label="旋转角度" prop="rotate">
<el-input-number v-model="form.rotate" />
</el-form-item>
<el-form-item label="X轴坐标" prop="x">
<el-input-number v-model="form.x" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="Y轴坐标" prop="y">
<el-input-number v-model="form.y" controls-position="right" :min="1" />
</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>
<el-button v-show="showDeleteButton" @click="initPage">{{ $t('global.cancel') }}</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name:'AirConditioner',
data() {
return {
isUpdate:false,
showDeleteButton: false,
buttonText: '立即创建',
form:{
code:'',
width: 20,
rotate: 0,
x: 10,
y: 10
},
rules: {
code: [
{ required: true, message:'请生成设备图形的编码', trigger: 'blur' }
],
width:[
{ required: true, message:'请输入设备图形宽度', trigger: 'blur' }
],
x: [
{ required: true, message: '请输入设备图形的X轴坐标', trigger: 'blur' }
],
y: [
{ required: true, message: '请输入设备图形的Y轴坐标', trigger: 'blur' }
]
}
};
},
computed:{
...mapGetters('iscs', [
'iscs'
])
},
watch:{
'$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData'];
if (model._type === 'Stairs' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.width = model.width;
this.form.rotate = model.rotate || 0;
this.form.x = model.point.x;
this.form.y = model.point.y;
}
}
},
mounted() {
},
methods:{
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const model = {
point: {
x: this.form.x,
y: this.form.y
},
_type: 'Stairs',
code: this.isUpdate ? this.form.code : getUID('Stairs', this.iscs.stairsList || []),
width: this.form.width,
rotate: this.form.rotate
};
this.$emit('createDataModel', model);
this.initPage();
} else {
return false;
}
});
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code:'',
width: 20,
x: 10,
y: 10
};
this.$refs.form.resetFields();
},
deleteDevice() {
const airConditionerModel = {
point: {
x: this.form.x,
y: this.form.y
},
_type: 'Stairs',
code: this.form.code,
width: this.form.width
};
this.$emit('deleteDataModel', airConditionerModel );
this.initPage();
}
}
};
</script>

View File

@ -98,12 +98,12 @@ export default {
}; };
this.iscsDestroy(); this.iscsDestroy();
this.loading = true; this.loading = true;
const data = parser(iscsData[deviceCode], {width: this.canvasWidth, height: this.canvasHeight}); const data = parser(iscsData[deviceCode], {width: this.widthCanvas, height: this.canvasHeight});
this.$iscs = new Iscs({ this.$iscs = new Iscs({
dom: document.getElementById(this.iscsId), dom: document.getElementById(this.iscsId),
config: { config: {
renderer: 'canvas', renderer: 'canvas',
width: this.canvasWidth, width: this.widthCanvas,
height: this.canvasHeight height: this.canvasHeight
}, },
options: { options: {

View File

@ -14,8 +14,9 @@
<el-row style="font-size: 14px;color: #6F49FE; height: 30px; line-height: 30px;"> <el-row style="font-size: 14px;color: #6F49FE; height: 30px; line-height: 30px;">
<el-col :span="4"><div>设备名称</div></el-col> <el-col :span="4"><div>设备名称</div></el-col>
<el-col :span="4"><div style="width: 100%; background: #FFF; padding-left: 5px;">{{ modeName }}</div></el-col> <el-col :span="4"><div style="width: 100%; background: #FFF; padding-left: 5px;">{{ modeName }}</div></el-col>
<el-col :span="8"><div style="width: 100%; background: #FFF;">{{ stationName }}</div></el-col> <el-col :span="6"><div style="width: 100%; background: #FFF;">{{ stationName }}</div></el-col>
<el-col :span="8"><div style="width: 100%; background: #FFF;">{{ deviceType }}</div></el-col> <el-col :span="6"><div style="width: 100%; background: #FFF;">{{ deviceType }}</div></el-col>
<el-col :span="4"><div style="width: 100%; background: #FFF;">{{ deviceCode|| '&nbsp;' }}</div></el-col>
</el-row> </el-row>
<el-row v-if="operation==='home'" style="margin-top: 10px;font-size: 14px;color: #6F49FE; height: 30px; line-height: 30px;"> <el-row v-if="operation==='home'" style="margin-top: 10px;font-size: 14px;color: #6F49FE; height: 30px; line-height: 30px;">
<el-col :span="4"><div>状态</div></el-col> <el-col :span="4"><div>状态</div></el-col>
@ -92,11 +93,20 @@ export default {
modeName: '', modeName: '',
status: '', status: '',
operation: 'home', operation: 'home',
deviceCode: '',
deviceMap: { deviceMap: {
ManualAlarmButton:'手动报警按钮', ManualAlarmButton:'手动报警按钮',
SmokeDetector: '消火栓按钮', SmokeDetector: '消火栓按钮',
FireHydranAlarmButton: '点型火灾探测器', FireHydranAlarmButton: '点型火灾探测器',
GasFireControl:'气体灭火控制器' GasFireControl:'气体灭火控制器',
LightingGroup: '照明',
Electrically: '',
VolumeControlDamper: '电动风阀',
SmookExhaustFd: '排烟防火阀',
Ventilator: '普通风机',
AirConditioner: '组合式空调机组',
FireDamper: '防火阀',
SmookProofFd: '防烟防火阀'
}, },
modeMap: { modeMap: {
standFAS: '火灾报警', standFAS: '火灾报警',
@ -142,17 +152,21 @@ export default {
}, },
methods: { methods: {
doShow(device) { doShow(device) {
this.deviceCode = '';
this.deviceType = this.deviceMap[device._type]; this.deviceType = this.deviceMap[device._type];
this.modeName = this.modeMap[this.$route.params.mode]; this.modeName = this.modeMap[this.$route.params.mode];
this.stationName = this.$route.query.stationName; this.stationName = this.$route.query.stationName;
this.dialogShow = true; this.dialogShow = true;
if (device._type === 'LightingGroup') {
this.deviceCode = device.topContext.split(/[(\r\n)\r\n]+/)[0];
}
}, },
doClose() { doClose() {
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
}, },
clickEvent(type) { clickEvent(type) {
this.operation = type; this.operation = type;
} }
} }
}; };

View File

@ -23,11 +23,15 @@ export default {
const device = this.$store.state.iscs.selected; const device = this.$store.state.iscs.selected;
if (device && device._type === 'IscsButton' && device.function === 'PublicArea') { if (device && device._type === 'IscsButton' && device.function === 'PublicArea') {
this.width = 1520; this.width = 1520;
this.$refs.iscsPlate.show('12'); this.$nextTick(() => {
this.$refs.iscsPlate.show('12');
});
console.log(this.width); console.log(this.width);
} else if (device && device._type === 'IscsButton' && device.function === 'GoBack') { } else if (device && device._type === 'IscsButton' && device.function === 'GoBack') {
this.width = 1100; this.width = 1100;
this.$refs.iscsPlate.show('14'); this.$nextTick(() => {
this.$refs.iscsPlate.show('14');
});
} }
} }
}, },

View File

@ -45,6 +45,21 @@ export default {
{graphicEle: 'smokeDetector', deviceType: '点型火灾探测器'}, {graphicEle: 'smokeDetector', deviceType: '点型火灾探测器'},
{graphicEle: 'gasFireControl', deviceType: '气体灭火控制器'} {graphicEle: 'gasFireControl', deviceType: '气体灭火控制器'}
], ],
basData: [
{graphicEle: 'AirConditioner', deviceType: '组合式空调机组、空调器'},
{graphicEle: 'Ventilator', deviceType: '普通风机'},
{graphicEle: '', deviceType: '隧道风机'},
{graphicEle: '', deviceType: '排热风机'},
{graphicEle: 'FireDamper', deviceType: '防火阀'},
{graphicEle: 'SmookExhaustFd', deviceType: '排烟防火阀'},
{graphicEle: 'VolumeControlDamper', deviceType: '电动风阀'},
{graphicEle: 'SmookProofFd', deviceType: '防烟防火阀'},
{graphicEle: '', deviceType: '冷却塔'},
{graphicEle: '', deviceType: '冷水机组'},
{graphicEle: '', deviceType: '电动蝶阀'},
{graphicEle: '', deviceType: '动态平衡电动调节阀'},
{graphicEle: '', deviceType: '冷冻泵、冷却泵'}
],
graphicEleMap: { graphicEleMap: {
manualAlarm: ManualAlarm, manualAlarm: ManualAlarm,
fireHydrant: FireHydrant, fireHydrant: FireHydrant,

View File

@ -1,8 +1,8 @@
<template> <template>
<div style="height: 100%; width: 100%;overflow-y: auto;"> <div style="height: 100%; width: 100%;overflow-y: auto;">
<standFAS v-if="mode == 'standFAS'" /> <standFAS v-if="mode === 'standFAS'" />
<stationHallFAS v-else-if="mode == 'stationHallFAS'" /> <stationHallFAS v-else-if="mode === 'stationHallFAS'" />
<systemFAS v-else-if="mode == 'systemFAS'" /> <systemFAS v-else-if="mode === 'systemFAS'" />
<home-screen v-else-if="mode === 'mainScreenPA'" /> <home-screen v-else-if="mode === 'mainScreenPA'" />
<main-screen v-else-if="mode === 'MainScreen'" /> <main-screen v-else-if="mode === 'MainScreen'" />
<lcd-control v-else-if="mode === 'LCDcontrol'" /> <lcd-control v-else-if="mode === 'LCDcontrol'" />
@ -28,10 +28,10 @@
<small-system v-else-if="mode==='smallSystem'" /> <small-system v-else-if="mode==='smallSystem'" />
<water-system v-else-if="mode==='waterSystem'" /> <water-system v-else-if="mode==='waterSystem'" />
<lighting-system v-else-if="mode === 'lighting'" /> <lighting-system v-else-if="mode === 'lighting'" />
<graphic-ele v-else-if="mode === 'graphicEle'" />
<device-control v-else-if="mode === 'deviceControl'" />
<electric-escalator v-else-if="mode === 'electricEscalator'" /> <electric-escalator v-else-if="mode === 'electricEscalator'" />
<water-supply v-else-if="mode === 'waterSupply'" /> <water-supply v-else-if="mode === 'waterSupply'" />
<graphic-ele ref="graphicEle" />
<device-control ref="deviceControl" />
</div> </div>
</template> </template>
@ -107,7 +107,20 @@ export default {
data() { data() {
return { return {
mode: 'standFAS', mode: 'standFAS',
deviceList: ['ManualAlarmButton', 'SmokeDetector', 'FireHydranAlarmButton', 'GasFireControl'] deviceList: [
'ManualAlarmButton',
'SmokeDetector',
'FireHydranAlarmButton',
'GasFireControl',
'LightingGroup',
'Electrically',
'VolumeControlDamper',
'SmookExhaustFd',
'Ventilator',
'AirConditioner',
'FireDamper',
'SmookProofFd'
]
}; };
}, },
watch: { watch: {
@ -116,9 +129,10 @@ export default {
}, },
'$store.state.iscs.selectedCount': function() { '$store.state.iscs.selectedCount': function() {
const device = this.$store.state.iscs.selected; const device = this.$store.state.iscs.selected;
if (device._type === 'IscsButton' && device.function === 'GraphicEle') { console.log(device, '11111111111111');
if (device && device._type === 'IscsButton' && device.function === 'GraphicEle') {
this.$refs.graphicEle.doShow(); this.$refs.graphicEle.doShow();
} else if (this.deviceList.includes(device._type)) { } else if (device && this.deviceList.includes(device._type)) {
this.$refs.deviceControl.doShow(device); this.$refs.deviceControl.doShow(device);
} }
} }

View File

@ -117,7 +117,8 @@ export default {
countdownTime: '00:00:00', countdownTime: '00:00:00',
practicalTime: 0, practicalTime: 0,
countdown: null, countdown: null,
questionList: [] questionList: [],
practicalExamTime: 0
}; };
}, },
computed: { computed: {
@ -392,15 +393,14 @@ export default {
const paperResp = await getTestPaperDatail(this.$route.query.raceId); const paperResp = await getTestPaperDatail(this.$route.query.raceId);
if (paperResp.data && paperResp.data.practicalQuestions) { if (paperResp.data && paperResp.data.practicalQuestions) {
this.questionList = []; this.questionList = [];
this.practicalExamTime = paperResp.data.practicalExamTime;
const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'practical'; const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'practical';
const startTime = localStore.get(storeKey); const startTime = localStore.get(storeKey);
if (startTime) { if (startTime) {
const dt = new Date().getTime() - startTime; const dt = new Date().getTime() - startTime;
this.practicalTime = paperResp.data.practicalExamTime * 60 - Math.floor(dt / 1000); this.practicalTime = paperResp.data.practicalExamTime * 60 - Math.floor(dt / 1000);
} else { } else {
this.practicalTime = paperResp.data.practicalExamTime * 60; this.practicalTime = this.practicalExamTime * 60;
const storeValue = new Date().getTime();
localStore.set(storeKey, storeValue);
} }
this.countdownTime = this.computationTime(this.practicalTime); this.countdownTime = this.computationTime(this.practicalTime);
paperResp.data.practicalQuestions.forEach(elem => { paperResp.data.practicalQuestions.forEach(elem => {
@ -436,6 +436,12 @@ export default {
} }
}, },
startCounting() { startCounting() {
const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'practical';
const startTime = localStore.get(storeKey);
if (!startTime) {
const storeValue = new Date().getTime();
localStore.set(storeKey, storeValue);
}
this.countdown = setInterval(() => { this.countdown = setInterval(() => {
if (this.practicalTime <= 0) { if (this.practicalTime <= 0) {
if (this.countdown) { if (this.countdown) {