This commit is contained in:
fan 2020-06-09 14:39:43 +08:00
commit c119d5130f
33 changed files with 810 additions and 723 deletions

View File

@ -3,127 +3,127 @@ import Sector from 'zrender/src/graphic/shape/Sector';
import Rect from 'zrender/src/graphic/shape/Rect'; import Rect from 'zrender/src/graphic/shape/Rect';
export default class AppendageBox extends Group { export default class AppendageBox extends Group {
constructor(device) { constructor(device) {
super(); super();
this.model = device.model; this.model = device.model;
this._type = device.model._type; this._type = device.model._type;
this._code = device.model.code; this._code = device.model.code;
this.zlevel = device.model.zlevel; this.zlevel = device.model.zlevel;
this.z = device.model.z; this.z = device.model.z;
this.create(); this.create();
} }
create() { create() {
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]
}); });
const spaceHeight = (this.model.height-this.model.borderWidth*3)/2; const spaceHeight = (this.model.height - this.model.borderWidth * 3) / 2;
this.rect1 = new Rect({ this.rect1 = new Rect({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
shape: { shape: {
x: 0, x: 0,
y: 0, y: 0,
width: this.model.width - this.model.borderWidth, width: this.model.width - this.model.borderWidth,
height: this.model.borderWidth height: this.model.borderWidth
}, },
style: { style: {
fill: '#34383A' fill: '#34383A'
} }
}); });
this.rect2 = new Rect({ this.rect2 = new Rect({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
shape: { shape: {
x: 0, x: 0,
y: this.model.borderWidth + spaceHeight, y: this.model.borderWidth + spaceHeight,
width: this.model.width - this.model.borderWidth, width: this.model.width - this.model.borderWidth,
height: this.model.borderWidth height: this.model.borderWidth
}, },
style: { style: {
fill: '#34383A' fill: '#34383A'
} }
}); });
this.rect3 = new Rect({ this.rect3 = new Rect({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
shape: { shape: {
x: 0, x: 0,
y: 2*this.model.borderWidth + 2*spaceHeight, y: 2 * this.model.borderWidth + 2 * spaceHeight,
width: this.model.width - this.model.borderWidth, width: this.model.width - this.model.borderWidth,
height: this.model.borderWidth height: this.model.borderWidth
}, },
style: { style: {
fill: '#34383A' fill: '#34383A'
} }
}); });
this.rect4 = new Rect({ this.rect4 = new Rect({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
shape: { shape: {
x: 0, x: 0,
y: 0, y: 0,
width: this.model.borderWidth, width: this.model.borderWidth,
height: this.model.height height: this.model.height
}, },
style: { style: {
fill: '#34383A' fill: '#34383A'
} }
}); });
this.sector1 = new Sector({ this.sector1 = new Sector({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
shape: { shape: {
cx: this.model.width - this.model.borderWidth, cx: this.model.width - this.model.borderWidth,
cy: this.model.borderWidth, cy: this.model.borderWidth,
r: this.model.borderWidth, r: this.model.borderWidth,
startAngle: 1.5*Math.PI, startAngle: 1.5 * Math.PI,
endAngle: 2*Math.PI endAngle: 2 * Math.PI
}, },
style: { style: {
fill: '#34383A' fill: '#34383A'
} }
}); });
this.sector2 = new Sector({ this.sector2 = new Sector({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
shape: { shape: {
cx: this.model.width - this.model.borderWidth, cx: this.model.width - this.model.borderWidth,
cy: 2*this.model.borderWidth + spaceHeight, cy: 2 * this.model.borderWidth + spaceHeight,
r: this.model.borderWidth, r: this.model.borderWidth,
startAngle: 1.5*Math.PI, startAngle: 1.5 * Math.PI,
endAngle: 2*Math.PI endAngle: 2 * Math.PI
}, },
style: { style: {
fill: '#34383A' fill: '#34383A'
} }
}); });
this.sector3 = new Sector({ this.sector3 = new Sector({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
shape: { shape: {
cx: this.model.width - this.model.borderWidth, cx: this.model.width - this.model.borderWidth,
cy: 3*this.model.borderWidth + 2*spaceHeight, cy: 3 * this.model.borderWidth + 2 * spaceHeight,
r: this.model.borderWidth, r: this.model.borderWidth,
startAngle: 1.5*Math.PI, startAngle: 1.5 * Math.PI,
endAngle: 2*Math.PI endAngle: 2 * Math.PI
}, },
style: { style: {
fill: '#34383A' fill: '#34383A'
} }
}); });
this.grouper.add(this.rect1); this.grouper.add(this.rect1);
this.grouper.add(this.rect2); this.grouper.add(this.rect2);
this.grouper.add(this.rect3); this.grouper.add(this.rect3);
this.grouper.add(this.rect4); this.grouper.add(this.rect4);
this.grouper.add(this.sector1); this.grouper.add(this.sector1);
this.grouper.add(this.sector2); this.grouper.add(this.sector2);
this.grouper.add(this.sector3); this.grouper.add(this.sector3);
this.add(this.grouper); this.add(this.grouper);
} }
setModel(dx, dy) { setModel(dx, dy) {
this.model.point.x+=dx; this.model.point.x += dx;
this.model.point.y+=dy; this.model.point.y += dy;
} }
} }

View File

@ -13,106 +13,106 @@ import grayButtonPicOn from '@/assets/ibp_images/gray_button_on.png';
export default class button extends Group { export default class button extends Group {
static colors = new Map([ static colors = new Map([
['red_on', [redButtonPicOn]], ['red_on', [redButtonPicOn]],
['red_off', [redButtonPic]], ['red_off', [redButtonPic]],
['green_on', [greenButtonPicOn]], ['green_on', [greenButtonPicOn]],
['green_off', [greenButtonPic]], ['green_off', [greenButtonPic]],
['blue_on', [blueButtonPicOn]], ['blue_on', [blueButtonPicOn]],
['blue_off', [blueButtonPic]], ['blue_off', [blueButtonPic]],
['yellow_on', [yellowButtonPicOn]], ['yellow_on', [yellowButtonPicOn]],
['yellow_off', [yellowButtonPic]], ['yellow_off', [yellowButtonPic]],
['gray_on', [grayButtonPicOn]], ['gray_on', [grayButtonPicOn]],
['gray_off', [grayButtonPic]] ['gray_off', [grayButtonPic]]
]); ]);
constructor(device) { constructor(device) {
super(); super();
this._type = device.model._type; this._type = device.model._type;
this._code = device.model.code; this._code = device.model.code;
this.model = device.model; this.model = device.model;
this.zlevel = device.model.zlevel; this.zlevel = device.model.zlevel;
this.z = device.model.z; this.z = device.model.z;
this.create(); this.create();
} }
create() { create() {
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.imageBg = new Image({ this.imageBg = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
draggable: false, draggable: false,
style: { style: {
image: this.getImagePic(), image: this.getImagePic(),
x: 0, x: 0,
y: 0, y: 0,
width: 70, width: 70,
height: 80 height: 80
} }
}); });
this.grouper.add(this.imageBg); this.grouper.add(this.imageBg);
this.add(this.grouper); this.add(this.grouper);
this.transformScale(); this.transformScale();
} }
/** 缩放按钮 */ /** 缩放按钮 */
transformScale() { transformScale() {
this.imageBg.origin = [0, 0]; this.imageBg.origin = [0, 0];
this.imageBg.scale =[this.model.width/70, this.model.width/70]; this.imageBg.scale = [this.model.width / 70, this.model.width / 70];
this.imageBg.dirty(); this.imageBg.dirty();
} }
getImagePic() { getImagePic() {
const color = button.colors.get(`${this.model.color}_${this.model.status}`); const color = button.colors.get(`${this.model.color}_${this.model.status}`);
return color[0]; return color[0];
} }
// 设置按钮状态 // 设置按钮状态
setState(model) { setState(model) {
switch (model.status) { switch (model.status) {
case 'on': { case 'on': {
// 开放 // 开放
this.open(); this.open();
this.model.status='on'; this.model.status = 'on';
break; break;
} }
case 'off': { case 'off': {
// 关闭 // 关闭
this.close(); this.close();
this.model.status='off'; this.model.status = 'off';
break; break;
} }
} }
} }
onclick() { onclick() {
// if (!this.model.draggable) { // if (!this.model.draggable) {
// switch (this.model.status) { // switch (this.model.status) {
// case 'off': { // case 'off': {
// this.open(); // this.open();
// this.model.status='on'; // this.model.status='on';
// break; // break;
// } // }
// case 'on': { // case 'on': {
// this.close(); // this.close();
// this.model.status='off'; // this.model.status='off';
// break; // break;
// } // }
// } // }
// } // }
} }
// 关闭 // 关闭
close() { close() {
const color = button.colors.get(`${this.model.color}_off`); const color = button.colors.get(`${this.model.color}_off`);
this.imageBg.setStyle({image: color[0]}); this.imageBg.setStyle({image: color[0]});
} }
// 开放 // 开放
open() { open() {
const color = button.colors.get(`${this.model.color}_on`); const color = button.colors.get(`${this.model.color}_on`);
this.imageBg.setStyle({image: color[0]}); this.imageBg.setStyle({image: color[0]});
} }
setModel(dx, dy) { setModel(dx, dy) {
this.model.point.x+=dx; this.model.point.x += dx;
this.model.point.y+=dy; this.model.point.y += dy;
} }
} }

View File

@ -14,248 +14,248 @@ import clockBg from '@/assets/ibp_images/clock/clock_bg.png';
import clockColon from '@/assets/ibp_images/clock/clock_colon.png'; import clockColon from '@/assets/ibp_images/clock/clock_colon.png';
export default class clock extends Group { export default class clock extends Group {
constructor(device) { constructor(device) {
super(); super();
this._type = device.model._type; this._type = device.model._type;
this._code = device.model.code; this._code = device.model.code;
this.model = device.model; this.model = device.model;
this.zlevel = device.model.zlevel; this.zlevel = device.model.zlevel;
this.z = device.model.z; this.z = device.model.z;
this.initTime = 0; this.initTime = 0;
this.create(); this.create();
} }
create() { create() {
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.clockBg = new Image({ this.clockBg = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
style: { style: {
image: clockBg, image: clockBg,
x: 0, x: 0,
y: 0, y: 0,
width: this.model.width, width: this.model.width,
height: this.model.width/493*156 height: this.model.width / 493 * 156
} }
}); });
this.num1 = new Image({ this.num1 = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
style: { style: {
image: this.getImagePic('0'), image: this.getImagePic('0'),
x: this.model.width*0.098, x: this.model.width * 0.098,
y: this.model.width*0.062, y: this.model.width * 0.062,
width: this.model.width*0.095, width: this.model.width * 0.095,
height: this.model.width*0.095/37*74 height: this.model.width * 0.095 / 37 * 74
} }
}); });
this.num2 = new Image({ this.num2 = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
style: { style: {
image: this.getImagePic('0'), image: this.getImagePic('0'),
x: this.model.width*0.22, x: this.model.width * 0.22,
y: this.model.width*0.062, y: this.model.width * 0.062,
width: this.model.width*0.095, width: this.model.width * 0.095,
height: this.model.width*0.095/37*74 height: this.model.width * 0.095 / 37 * 74
} }
}); });
this.num3 = new Image({ this.num3 = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
style: { style: {
image: this.getImagePic('0'), image: this.getImagePic('0'),
x: this.model.width*0.395, x: this.model.width * 0.395,
y: this.model.width*0.062, y: this.model.width * 0.062,
width: this.model.width*0.095, width: this.model.width * 0.095,
height: this.model.width*0.095/37*74 height: this.model.width * 0.095 / 37 * 74
} }
}); });
this.num4 = new Image({ this.num4 = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
style: { style: {
image: this.getImagePic('0'), image: this.getImagePic('0'),
x: this.model.width*0.52, x: this.model.width * 0.52,
y: this.model.width*0.062, y: this.model.width * 0.062,
width: this.model.width*0.095, width: this.model.width * 0.095,
height: this.model.width*0.095/37*74 height: this.model.width * 0.095 / 37 * 74
} }
}); });
this.num5 = new Image({ this.num5 = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
style: { style: {
image: this.getImagePic('0'), image: this.getImagePic('0'),
x: this.model.width*0.69, x: this.model.width * 0.69,
y: this.model.width*0.062, y: this.model.width * 0.062,
width: this.model.width*0.095, width: this.model.width * 0.095,
height: this.model.width*0.095/37*74 height: this.model.width * 0.095 / 37 * 74
} }
}); });
this.num6 = new Image({ this.num6 = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
style: { style: {
image: this.getImagePic('0'), image: this.getImagePic('0'),
x: this.model.width*0.816, x: this.model.width * 0.816,
y: this.model.width*0.062, y: this.model.width * 0.062,
width: this.model.width*0.095, width: this.model.width * 0.095,
height: this.model.width*0.095/37*74 height: this.model.width * 0.095 / 37 * 74
} }
}); });
this.clockColon1 = new Image({ this.clockColon1 = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
style: { style: {
image: clockColon, image: clockColon,
x: +this.model.width*0.183, x: +this.model.width * 0.183,
y: -this.model.width*0.017, y: -this.model.width * 0.017,
width: this.model.width*0.34, width: this.model.width * 0.34,
height: this.model.width/1*0.34 height: this.model.width / 1 * 0.34
} }
}); });
this.clockColon2 = new Image({ this.clockColon2 = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
style: { style: {
image: clockColon, image: clockColon,
x: +this.model.width*0.48, x: +this.model.width * 0.48,
y: -this.model.width*0.017, y: -this.model.width * 0.017,
width: this.model.width*0.34, width: this.model.width * 0.34,
height: this.model.width/1*0.34 height: this.model.width / 1 * 0.34
} }
}); });
this.grouper.add(this.clockBg); this.grouper.add(this.clockBg);
this.grouper.add(this.num1); this.grouper.add(this.num1);
this.grouper.add(this.num2); this.grouper.add(this.num2);
this.grouper.add(this.num3); this.grouper.add(this.num3);
this.grouper.add(this.num4); this.grouper.add(this.num4);
this.grouper.add(this.num5); this.grouper.add(this.num5);
this.grouper.add(this.num6); this.grouper.add(this.num6);
this.grouper.add(this.clockColon1); this.grouper.add(this.clockColon1);
this.grouper.add(this.clockColon2); this.grouper.add(this.clockColon2);
this.add(this.grouper); this.add(this.grouper);
} }
getImagePic(context) { getImagePic(context) {
let pic = clock0; let pic = clock0;
switch (context) { switch (context) {
case '0': case '0':
pic = clock0; pic = clock0;
break; break;
case '1': case '1':
pic = clock1; pic = clock1;
break; break;
case '2': case '2':
pic = clock2; pic = clock2;
break; break;
case '3': case '3':
pic = clock3; pic = clock3;
break; break;
case '4': case '4':
pic = clock4; pic = clock4;
break; break;
case '5': case '5':
pic = clock5; pic = clock5;
break; break;
case '6': case '6':
pic = clock6; pic = clock6;
break; break;
case '7': case '7':
pic = clock7; pic = clock7;
break; break;
case '8': case '8':
pic = clock8; pic = clock8;
break; break;
case '9': case '9':
pic = clock9; pic = clock9;
break; break;
} }
return pic; return pic;
} }
setClockStart(started) { setClockStart(started) {
const _this = this; const _this = this;
if (started) { if (started) {
this.timer&&clearInterval(this.timer); this.timer && clearInterval(this.timer);
this.timer = setInterval(() => { this.timer = setInterval(() => {
_this.handleClock(_this); _this.handleClock(_this);
}, 1000); }, 1000);
} else { } else {
this.timer&&clearInterval(this.timer); this.timer && clearInterval(this.timer);
} }
} }
handleClock(_this) { handleClock(_this) {
_this.initTime += 1000; _this.initTime += 1000;
const newDate = new Date(); const newDate = new Date();
newDate.setTime(_this.initTime); newDate.setTime(_this.initTime);
let seconds = newDate.getSeconds() +''; let seconds = newDate.getSeconds() + '';
let minutes = newDate.getMinutes() + ''; let minutes = newDate.getMinutes() + '';
let hours = newDate.getHours() + ''; let hours = newDate.getHours() + '';
if (seconds.length<2) { if (seconds.length < 2) {
seconds = '0' + seconds; seconds = '0' + seconds;
} }
if (minutes.length<2) { if (minutes.length < 2) {
minutes = '0' + minutes; minutes = '0' + minutes;
} }
if (hours.length<2) { if (hours.length < 2) {
hours = '0'+ hours; hours = '0' + hours;
} }
_this.setNumPic(6, seconds.charAt(1)); _this.setNumPic(6, seconds.charAt(1));
_this.setNumPic(5, seconds.charAt(0)); _this.setNumPic(5, seconds.charAt(0));
_this.setNumPic(4, minutes.charAt(1)); _this.setNumPic(4, minutes.charAt(1));
_this.setNumPic(3, minutes.charAt(0)); _this.setNumPic(3, minutes.charAt(0));
_this.setNumPic(2, hours.charAt(1)); _this.setNumPic(2, hours.charAt(1));
_this.setNumPic(1, hours.charAt(0)); _this.setNumPic(1, hours.charAt(0));
} }
setNumPic(num, context) { setNumPic(num, context) {
switch (num) { switch (num) {
case 1: case 1:
this.num1.setStyle('image', this.getImagePic(context)); this.num1.setStyle('image', this.getImagePic(context));
break; break;
case 2: case 2:
this.num2.setStyle('image', this.getImagePic(context)); this.num2.setStyle('image', this.getImagePic(context));
break; break;
case 3: case 3:
this.num3.setStyle('image', this.getImagePic(context)); this.num3.setStyle('image', this.getImagePic(context));
break; break;
case 4: case 4:
this.num4.setStyle('image', this.getImagePic(context)); this.num4.setStyle('image', this.getImagePic(context));
break; break;
case 5: case 5:
this.num5.setStyle('image', this.getImagePic(context)); this.num5.setStyle('image', this.getImagePic(context));
break; break;
case 6: case 6:
this.num6.setStyle('image', this.getImagePic(context)); this.num6.setStyle('image', this.getImagePic(context));
} }
} }
setClockTime(initTime) { setClockTime(initTime) {
this.initTime = initTime; this.initTime = initTime;
const newDate = new Date(); const newDate = new Date();
newDate.setTime(initTime); newDate.setTime(initTime);
let seconds = newDate.getSeconds() +''; let seconds = newDate.getSeconds() + '';
let minutes = newDate.getMinutes() + ''; let minutes = newDate.getMinutes() + '';
let hours = newDate.getHours() + ''; let hours = newDate.getHours() + '';
if (seconds.length<2) { if (seconds.length < 2) {
seconds = '0' + seconds; seconds = '0' + seconds;
} }
if (minutes.length<2) { if (minutes.length < 2) {
minutes = '0' + minutes; minutes = '0' + minutes;
} }
if (hours.length<2) { if (hours.length < 2) {
hours = '0'+ hours; hours = '0' + hours;
} }
this.setNumPic(6, seconds.charAt(1)); this.setNumPic(6, seconds.charAt(1));
this.setNumPic(5, seconds.charAt(0)); this.setNumPic(5, seconds.charAt(0));
this.setNumPic(4, minutes.charAt(1)); this.setNumPic(4, minutes.charAt(1));
this.setNumPic(3, minutes.charAt(0)); this.setNumPic(3, minutes.charAt(0));
this.setNumPic(2, hours.charAt(1)); this.setNumPic(2, hours.charAt(1));
this.setNumPic(1, hours.charAt(0)); this.setNumPic(1, hours.charAt(0));
} }
setModel(dx, dy) { setModel(dx, dy) {
this.model.point.x+=dx; this.model.point.x += dx;
this.model.point.y+=dy; this.model.point.y += dy;
} }
} }

View File

@ -1,66 +1,66 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text'; import Text from 'zrender/src/graphic/Text';
import Rect from 'zrender/src/graphic/shape/Rect'; // import Rect from 'zrender/src/graphic/shape/Rect';
export default class ibpText extends Group { export default class ibpText extends Group {
constructor(device) { constructor(device) {
super(); super();
this.model = device.model; this.model = device.model;
this._type = device.model._type; this._type = device.model._type;
this._code = device.model.code; this._code = device.model.code;
this.zlevel = device.model.zlevel; this.zlevel = device.model.zlevel;
this.z = device.model.z; this.z = device.model.z;
this.create(); this.create();
} }
create() { create() {
const model = this.model; 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.textName = new Text({ this.textName = new Text({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
silent: model.silent || false, silent: model.silent || false,
draggable: false, draggable: false,
style: { style: {
x: 0, x: 0,
y: 0, y: 0,
fontWeight: model.fontWeight, fontWeight: model.fontWeight,
fontSize: model.fontSize, fontSize: model.fontSize,
fontFamily: model.fontFamily, fontFamily: model.fontFamily,
text: model.context, text: model.context,
textStrokeWidth: model.textStrokeWidth, textStrokeWidth: model.textStrokeWidth,
textFill: model.textFill, textFill: model.textFill,
textAlign: model.textAlign, textAlign: model.textAlign,
textPosition: model.textPosition || 'inside', textPosition: model.textPosition || 'inside',
textVerticalAlign: model.textVerticalAlign || null, textVerticalAlign: model.textVerticalAlign || null,
textLineHeight: model.fontSize textLineHeight: model.fontSize
} }
}); });
// if ( model.hasRect) { // if ( model.hasRect) {
// this.grouper.add(this.tip); // this.grouper.add(this.tip);
// this.tip = new Rect({ // this.tip = new Rect({
// zlevel: model.zlevel, // zlevel: model.zlevel,
// z: model.z-1, // z: model.z-1,
// draggable: false, // draggable: false,
// shape: { // shape: {
// x: model.textRect.x- model.point.x, // x: model.textRect.x- model.point.x,
// y: model.textRect.x - model.point.y, // y: model.textRect.x - model.point.y,
// width: model.textRect.width, // width: model.textRect.width,
// height: model.textRect.height // height: model.textRect.height
// }, // },
// style: { // style: {
// fill: model.textBackgroundColor // fill: model.textBackgroundColor
// } // }
// }); // });
// } // }
this.grouper.add(this.textName); this.grouper.add(this.textName);
this.add(this.grouper); this.add(this.grouper);
} }
setModel(dx, dy) { setModel(dx, dy) {
this.model.point.x+=dx; this.model.point.x += dx;
this.model.point.y+=dy; this.model.point.y += dy;
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -224,6 +224,17 @@ class Iscs {
return this.iscsDevice[code]; return this.iscsDevice[code];
} }
copySelect(list) {
this.copyList = list.map(item => {
if (item._type != 'CheckBox') {
return item.model;
}
});
}
getCopyList() {
return this.copyList;
}
resize(opt) { resize(opt) {
this.$iscsZr.resize(opt); this.$iscsZr.resize(opt);
this.$painter.updateZrSize(opt); this.$painter.updateZrSize(opt);

View File

@ -7,7 +7,6 @@ class KeyboardController extends Eventful {
this.$iscs = iscs; this.$iscs = iscs;
this.$zr = iscs.getZr(); this.$zr = iscs.getZr();
this.events = iscs.getEvents(); this.events = iscs.getEvents();
this.initData();
this.initHandler(this.$zr); this.initHandler(this.$zr);
} }
@ -32,10 +31,6 @@ class KeyboardController extends Eventful {
} }
} }
initData() {
}
keydown(e) { keydown(e) {
if (this._keyOnDownUp && !e.repeat) { if (this._keyOnDownUp && !e.repeat) {
const currentEvent = keyboardEvents[e.key.toUpperCase()]; const currentEvent = keyboardEvents[e.key.toUpperCase()];

View File

@ -97,8 +97,6 @@ class MouseController extends Eventful {
this.handleMouseDownRight(e); this.handleMouseDownRight(e);
} else if (e.which === 1) { } else if (e.which === 1) {
this.handleMouseDownLeft(e); this.handleMouseDownLeft(e);
} else if (e.which === 2) {
this.handleMouseDownWheel(e);
} }
} }
@ -119,27 +117,11 @@ class MouseController extends Eventful {
} }
mouseup(e) { mouseup(e) {
if (eventTool.notLeftMouse(e) || !this.eventTarget ) { if (e.which === 3) {
return; this.handleMouseUpRight(e);
} else if (e.which === 1) {
this.handleMouseUpLeft(e);
} }
if (this.deviceList.length) {
this.deviceList.forEach(item => {
item.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
});
this.deviceList = [];
this.$iscs.deleteCheckBox('check_box');
this.eventTarget = '';
this._dragging = false;
this.deviceList = [];
return;
}
if (this.isAllowDragging) {
this.eventTarget.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
this.eventTarget.dirty();
}
this.eventTarget = '';
this._dragging = false;
this.deviceList = [];
} }
contextmenu(e) { contextmenu(e) {
@ -195,24 +177,31 @@ class MouseController extends Eventful {
} }
/** 处理鼠标右键按下事件 */ /** 处理鼠标右键按下事件 */
handleMouseDownRight(e) { handleMouseDownRight(e) {
this.deviceList = [];
this.eventTarget = '';
this.$iscs.deleteCheckBox('check_box'); // 清空上次操作
this.$iscs.copySelect(this.deviceList);
this.rightClickPoint.x = e.offsetX; this.rightClickPoint.x = e.offsetX;
this.rightClickPoint.y = e.offsetY; this.rightClickPoint.y = e.offsetY;
} }
/** 处理鼠标左键按下事件 */ /** 处理鼠标左键按下事件 */
handleMouseDownLeft(e) { handleMouseDownLeft(e) {
if (this.eventTarget && this.eventTarget._type === deviceType.CheckBox) { if (this.$iscs.iscsDevice['check_box']) { // 判断点击点是否在 checkBox 范围
this.handleBoundingRect(this.eventTarget); const boundingRect = this.$iscs.iscsDevice['check_box'].instance.getBoundingRect().clone();
const x1 = e.event.zrX + this.$iscs.$options.offsetX;
const y1 = e.event.zrY + this.$iscs.$options.offsetY;
if (!this.contain(boundingRect, x1, y1)) {
this._dragging = false;
this.deviceList = [];
this.eventTarget = '';
this.$iscs.deleteCheckBox('check_box'); // 清空上次操作
this.$iscs.copySelect(this.deviceList);
}
} else { } else {
this.$iscs.deleteCheckBox('check_box'); this.$iscs.deleteCheckBox('check_box');
} }
} }
/** 处理滚轮按下事件 */
handleMouseDownWheel(e) {
this.deviceList = [];
Object.values(this.$iscs.iscsDevice).forEach(item => {
this.deviceList.push(item.instance);
});
}
/** 处理右键拖动事件--- 改变选中区域大小 */ /** 处理右键拖动事件--- 改变选中区域大小 */
handleMouseMoveRight(point2) { handleMouseMoveRight(point2) {
const point1 = this.rightClickPoint; const point1 = this.rightClickPoint;
@ -244,35 +233,80 @@ class MouseController extends Eventful {
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y }); this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
} }
} }
// 右键抬起事件
handleMouseUpRight() {
if (this.$iscs.iscsDevice['check_box']) {
this.handleBoundingRect(this.$iscs.iscsDevice['check_box'].instance);
}
}
// 左键抬起事件
handleMouseUpLeft(e) {
if (this.deviceList.length) {
this.deviceList.forEach(item => {
item.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
});
return;
}
if (this.isAllowDragging && this.eventTarget) {
this.eventTarget.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
this.eventTarget.dirty();
}
}
/** 通过包围盒筛选选中区域的元素 */ /** 通过包围盒筛选选中区域的元素 */
handleBoundingRect(eventTarget) { handleBoundingRect(eventTarget) {
this.deviceList = []; this.deviceList = [];
let boundingRect = eventTarget.grouper.getBoundingRect(); let boundingRect = eventTarget.grouper.getBoundingRect().clone();
boundingRect = this.createFakeBoundingRect(eventTarget, boundingRect); boundingRect = this.createFakeBoundingRect(eventTarget, boundingRect);
const deviceList = Object.values(this.$iscs.iscsDevice); const deviceList = Object.values(this.$iscs.iscsDevice);
const includeDeviceList = []; deviceList.forEach(item =>{
deviceList.forEach( item =>{ let deviceBoundingRect = item.instance.grouper.getBoundingRect().clone();
let deviceBoundingRect = item.instance.grouper.getBoundingRect();
deviceBoundingRect = this.createFakeBoundingRect(item.instance, deviceBoundingRect); deviceBoundingRect = this.createFakeBoundingRect(item.instance, deviceBoundingRect);
if (this.whetherInclude(boundingRect, deviceBoundingRect )) { if (this.whetherInclude(boundingRect, deviceBoundingRect)) {
includeDeviceList.push(item.instance); this.deviceList.push(item.instance);
} }
}); });
this.deviceList = includeDeviceList; this.$iscs.copySelect(this.deviceList);
} }
/** 创建假包围盒对象 */ /** 创建假包围盒对象 */
createFakeBoundingRect(instance, boundingRect) { createFakeBoundingRect(instance, boundingRect) {
const x1 = instance.model.point.x;
const y1 = instance.model.point.y;
return { return {
x1: instance.model.point.x + boundingRect.x, // x: x1 + boundingRect.x,
y1: instance.model.point.y + boundingRect.y, // y: y1 + boundingRect.y,
x2: instance.model.point.x + boundingRect.width, // width: boundingRect.width,
y2: instance.model.point.y + boundingRect.height // height: boundingRect.height
x1: x1 + boundingRect.x,
y1: y1 + boundingRect.y,
x2: x1 + boundingRect.width,
y2: y1 + boundingRect.height
}; };
} }
/** 判断元素包围盒是否在选中区域 */ /** 判断元素包围盒是否在选中区域 */
whetherInclude(boundingRect1, boundingRect2) { whetherInclude(boundingRect1, boundingRect2) {
return boundingRect1.x1 <= boundingRect2.x1 && boundingRect1.y1 <= boundingRect2.y1 && boundingRect1.x2 >= boundingRect2.x2 && boundingRect1.y2 >= boundingRect2.y2; return boundingRect1.x1 <= boundingRect2.x1 && boundingRect1.y1 <= boundingRect2.y1 && boundingRect1.x2 >= boundingRect2.x2 && boundingRect1.y2 >= boundingRect2.y2;
} }
// 判断元素包围盒是否在选中区域
intersect(a, b) {
var ax0 = a.x;
var ax1 = a.x + a.width;
var ay0 = a.y;
var ay1 = a.y + a.height;
var bx0 = b.x;
var bx1 = b.x + b.width;
var by0 = b.y;
var by1 = b.y + b.height;
return !(ax1 < bx0 || bx1 < ax0 || ay1 < by0 || by1 < ay0);
}
contain (rect, x, y) {
return x >= rect.x &&
x <= (rect.x + rect.width) &&
y >= rect.y &&
y <= (rect.y + rect.height);
}
} }
export default MouseController; export default MouseController;

View File

@ -29,7 +29,7 @@ class MouseController extends Eventful {
this.$zr = iscs.getZr(); this.$zr = iscs.getZr();
this.isAllowDragging = iscs.isAllowDragging || false; // 是否在绘图中,仅绘图状态下可拖拽 this.isAllowDragging = iscs.isAllowDragging || false; // 是否在绘图中,仅绘图状态下可拖拽
this.events = iscs.getEvents(); this.events = iscs.getEvents();
// this._dragging = false; // 是否在拖拽状态 this._dragging = false; // 是否在拖拽状态
this.deviceList = []; this.deviceList = [];
this.rightClickPoint = { this.rightClickPoint = {
x: 0, x: 0,
@ -75,7 +75,7 @@ class MouseController extends Eventful {
this.disable(); this.disable();
}; };
// this.isDragging = function () { return this._dragging; }; this.isDragging = function () { return this._dragging; };
} }
} }
@ -92,14 +92,14 @@ class MouseController extends Eventful {
this._offsetY = e.offsetY; this._offsetY = e.offsetY;
this._x = e.offsetX; this._x = e.offsetX;
this._y = e.offsetY; this._y = e.offsetY;
// this._dragging = true; this._dragging = true;
console.log(e, e.which);
if (e.which === 3) { if (e.which === 3) {
this.handleMouseDownRight(e); this.handleMouseDownRight(e);
} else if (e.which === 1) { } else if (e.which === 1) {
this.handleMouseDownLeft(e); this.handleMouseDownLeft(e);
} else if (e.which === 2) {
this.handleMouseDownWheel(e);
} }
console.log(this.deviceList);
} }
mousemove(e) { mousemove(e) {
@ -119,28 +119,27 @@ class MouseController extends Eventful {
} }
mouseup(e) { mouseup(e) {
console.log(e);
if (eventTool.notLeftMouse(e) || !this.eventTarget ) { if (eventTool.notLeftMouse(e) || !this.eventTarget ) {
return; return;
} }
// if (this.deviceList.length) { if (this.deviceList.length) {
// this.deviceList.forEach(item => { this.deviceList.forEach(item => {
// item.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY); item.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
// }); });
// this.deviceList = []; this.deviceList = [];
// this.$iscs.deleteCheckBox('check_box'); this.$iscs.deleteCheckBox('check_box');
// this.eventTarget = ''; this.eventTarget = '';
// // this._dragging = false; this._dragging = false;
// this.deviceList = []; this.deviceList = [];
// return; return;
// } }
// if (this.isAllowDragging) { if (this.isAllowDragging) {
// this.eventTarget.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY); this.eventTarget.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
// this.eventTarget.dirty(); this.eventTarget.dirty();
// } }
// this.eventTarget = ''; this.eventTarget = '';
// // this._dragging = false; this._dragging = false;
// this.deviceList = []; this.deviceList = [];
} }
contextmenu(e) { contextmenu(e) {
@ -196,9 +195,6 @@ class MouseController extends Eventful {
} }
/** 处理鼠标右键按下事件 */ /** 处理鼠标右键按下事件 */
handleMouseDownRight(e) { handleMouseDownRight(e) {
this.deviceList = [];
this.$iscs.deleteCheckBox('check_box'); // 清空上次操作
this.rightClickPoint.x = e.offsetX; this.rightClickPoint.x = e.offsetX;
this.rightClickPoint.y = e.offsetY; this.rightClickPoint.y = e.offsetY;
} }
@ -210,6 +206,13 @@ class MouseController extends Eventful {
this.$iscs.deleteCheckBox('check_box'); this.$iscs.deleteCheckBox('check_box');
} }
} }
/** 处理滚轮按下事件 */
handleMouseDownWheel(e) {
this.deviceList = [];
Object.values(this.$iscs.iscsDevice).forEach(item => {
this.deviceList.push(item.instance);
});
}
/** 处理右键拖动事件--- 改变选中区域大小 */ /** 处理右键拖动事件--- 改变选中区域大小 */
handleMouseMoveRight(point2) { handleMouseMoveRight(point2) {
const point1 = this.rightClickPoint; const point1 = this.rightClickPoint;
@ -221,25 +224,25 @@ class MouseController extends Eventful {
} }
/** 处理左键拖动事件--- 图形移动 */ /** 处理左键拖动事件--- 图形移动 */
handleMouseMoveLeft(e, dx, dy, oldX, oldY) { handleMouseMoveLeft(e, dx, dy, oldX, oldY) {
// if (!this._moveOnMouseMove || !this._dragging || !this.isAllowDragging) { if (!this._moveOnMouseMove || !this._dragging || !this.isAllowDragging) {
// return; return;
// } }
// 选中区域图形移动 // 选中区域图形移动
// if (this.deviceList.length) { if (this.deviceList.length) {
// this.deviceList.forEach(item => { this.deviceList.forEach(item => {
// item.grouper.drift(dx, dy, e); item.grouper.drift(dx, dy, e);
// }); });
// } else if (this._dragging && this.eventTarget) { // 选中元素图形移动 } else if (this._dragging && this.eventTarget) { // 选中元素图形移动
// if (!this.isAllowDragging) { if (!this.isAllowDragging) {
// this._preventDefaultMouseMove && eventTool.stop(e.event); this._preventDefaultMouseMove && eventTool.stop(e.event);
// this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y }); this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
// } else if (this.isAllowDragging) { } else if (this.isAllowDragging) {
// this.eventTarget.grouper.drift(dx, dy, e); this.eventTarget.grouper.drift(dx, dy, e);
// } }
// } else if (this._dragging) { } else if (this._dragging) {
// this._preventDefaultMouseMove && eventTool.stop(e.event); this._preventDefaultMouseMove && eventTool.stop(e.event);
// this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y }); this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
// } }
} }
/** 通过包围盒筛选选中区域的元素 */ /** 通过包围盒筛选选中区域的元素 */
handleBoundingRect(eventTarget) { handleBoundingRect(eventTarget) {

View File

@ -1,5 +1,5 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text'; // import Text from 'zrender/src/graphic/Text';
import Rect from 'zrender/src/graphic/shape/Rect'; import Rect from 'zrender/src/graphic/shape/Rect';
import Line from 'zrender/src/graphic/shape/Line'; import Line from 'zrender/src/graphic/shape/Line';
import PsdClose from './psdClose'; import PsdClose from './psdClose';

View File

@ -19,7 +19,7 @@ export default class StairControl extends Group {
this.path = createPathSvg(this.model); this.path = createPathSvg(this.model);
this.add(this.grouper); this.add(this.grouper);
if (this.model.isRight) { if (this.model.isRight) {
this.grouper.origin = [this.model.width / 2, this.model.width * 0.83 / 2 ]; this.grouper.origin = [this.model.width / 2, this.model.width * 0.83 / 2];
this.grouper.scale = [-1, 1]; this.grouper.scale = [-1, 1];
} }
this.grouper.add(this.path); this.grouper.add(this.path);

View File

@ -49,7 +49,7 @@
</div> </div>
<div class="body_cont"> <div class="body_cont">
<div class="status_text">状态</div> <div class="status_text">状态</div>
<div class="textarea_content" /> <div class="textarea_content">{{ message }}</div>
</div> </div>
<el-button :id="domIdConfirm" class="close_btn" type="primary" @click="commit">关闭</el-button> <el-button :id="domIdConfirm" class="close_btn" type="primary" @click="commit">关闭</el-button>
@ -73,7 +73,7 @@ export default {
dialogShow: false, dialogShow: false,
selected: null, selected: null,
operation: null, operation: null,
message:'',
messageText1: '', messageText1: '',
messageText2: '', messageText2: '',
timeCountConfirm: -1, timeCountConfirm: -1,
@ -124,6 +124,7 @@ export default {
}, },
methods: { methods: {
doShow(operate, selected) { doShow(operate, selected) {
this.message = '';
this.selected = selected; this.selected = selected;
if (!this.dialogShow) { if (!this.dialogShow) {
this.messageText1 = selected.name; this.messageText1 = selected.name;
@ -139,6 +140,7 @@ export default {
this.dialogShow = false; this.dialogShow = false;
this.messageText1 = ''; this.messageText1 = '';
this.messageText2 = ''; this.messageText2 = '';
this.message = '';
this.timeCountConfirm = -1; this.timeCountConfirm = -1;
this.disabledConfirm1 = false; this.disabledConfirm1 = false;
this.disabledConfirm2 = true; this.disabledConfirm2 = true;
@ -147,6 +149,7 @@ export default {
}, },
SelectChange() { SelectChange() {
this.message = '';
const operate = { const operate = {
operation: '', operation: '',
val: this.messageText2 val: this.messageText2
@ -192,35 +195,36 @@ export default {
}); });
}, },
confirm2() { confirm2() {
if (this.selected.code != this.messageText2) { if (this.selected.code == this.messageText2) {
this.$refs.noticeInfo.doShow({}, '请选择正确的道岔'); const operate = {
return false; over: true,
} operation: '',
const operate = { cmdType: ''
operation: '', };
cmdType: '' if (this.operation == OperationEvent.Switch.unlock.menu.operation) {
}; operate.operation = OperationEvent.Switch.unlock.confirm2.operation;
if (this.operation == OperationEvent.Switch.unlock.menu.operation) { operate.cmdType = CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK;
operate.operation = OperationEvent.Switch.unlock.confirm2.operation; } else if (this.operation == OperationEvent.Switch.unblock.menu.operation) {
operate.cmdType = CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK; operate.operation = OperationEvent.Switch.unblock.confirm2.operation;
} else if (this.operation == OperationEvent.Switch.unblock.menu.operation) { operate.cmdType = CMD.Switch.CMD_SWITCH_UNBLOCK;
operate.operation = OperationEvent.Switch.unblock.confirm2.operation;
operate.cmdType = CMD.Switch.CMD_SWITCH_UNBLOCK;
}
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.messageText2 = '*****';
this.disabledConfirm2 = true;
this.timeCountConfirm = -1;
} }
}).catch((error) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
this.$refs.noticeInfo.doShow(operate, error.message); if (valid) {
}); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.messageText2 = '*****';
this.disabledConfirm2 = true;
this.timeCountConfirm = -1;
this.message = '操作成功';
}
}).catch((error) => {
this.$refs.noticeInfo.doShow(operate, error.message);
});
} else {
this.message = '请选择正确的道岔';
}
}, },
commit() { commit() {
const operate = { const operate = {
over: true,
operation: '' operation: ''
}; };
@ -319,6 +323,7 @@ export default {
width: 100%; width: 100%;
border: 2px solid #E9E9E9; border: 2px solid #E9E9E9;
box-shadow: 2px 2px #959595 inset; box-shadow: 2px 2px #959595 inset;
padding:5px;
} }
} }
} }

View File

@ -129,16 +129,14 @@ export const menuOperate = {
}, },
Switch:{ Switch:{
lock:{ lock:{
// 道岔单锁(联锁) // 道岔单锁
operation: OperationEvent.Switch.lock.menu.operation, operation: OperationEvent.Switch.lock.menu.operation,
// cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK_CHAIN
}, },
unlock:{ unlock:{
// 道岔解锁(联锁) // 道岔解锁
operation: OperationEvent.Switch.unlock.menu.operation, operation: OperationEvent.Switch.unlock.menu.operation,
// cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK_CHAIN
}, },
block:{ block:{
// 道岔封锁 // 道岔封锁
@ -150,15 +148,10 @@ export const menuOperate = {
operation: OperationEvent.Switch.unblock.menu.operation, operation: OperationEvent.Switch.unblock.menu.operation,
cmdType: CMD.Switch.CMD_SWITCH_UNBLOCK cmdType: CMD.Switch.CMD_SWITCH_UNBLOCK
}, },
npChain:{ turnout:{
// 道岔定操(联动) // 道岔转动
operation: OperationEvent.Switch.locate.menu.operation, operation: OperationEvent.Switch.turnout.menu.operation,
cmdType:CMD.Switch.CMD_SWITCH_TURN_NP_CHAIN cmdType:CMD.Switch.CMD_SWITCH_TURN
},
rpChain:{
// 道岔反操(联动)
operation: OperationEvent.Switch.reverse.menu.operation,
cmdType:CMD.Switch.CMD_SWITCH_TURN_RP_CHAIN
}, },
split:{ split:{
// 区段切除 // 区段切除

View File

@ -129,16 +129,14 @@ export const menuOperate = {
}, },
Switch:{ Switch:{
lock:{ lock:{
// 道岔单锁(联锁) // 道岔单锁
operation: OperationEvent.Switch.lock.menu.operation, operation: OperationEvent.Switch.lock.menu.operation,
// cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK_CHAIN
}, },
unlock:{ unlock:{
// 道岔解锁(联锁) // 道岔解锁
operation: OperationEvent.Switch.unlock.menu.operation, operation: OperationEvent.Switch.unlock.menu.operation,
// cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK_CHAIN
}, },
block:{ block:{
// 道岔封锁 // 道岔封锁
@ -150,15 +148,15 @@ export const menuOperate = {
operation: OperationEvent.Switch.unblock.menu.operation, operation: OperationEvent.Switch.unblock.menu.operation,
cmdType: CMD.Switch.CMD_SWITCH_UNBLOCK cmdType: CMD.Switch.CMD_SWITCH_UNBLOCK
}, },
npChain:{ locate:{
// 道岔定操(联动) // 道岔定操
operation: OperationEvent.Switch.locate.menu.operation, operation: OperationEvent.Switch.locate.menu.operation,
cmdType:CMD.Switch.CMD_SWITCH_TURN_NP_CHAIN cmdType:CMD.Switch.CMD_SWITCH_NORMAL_POSITION
}, },
rpChain:{ reverse:{
// 道岔反操(联动) // 道岔反操
operation: OperationEvent.Switch.reverse.menu.operation, operation: OperationEvent.Switch.reverse.menu.operation,
cmdType:CMD.Switch.CMD_SWITCH_TURN_RP_CHAIN cmdType:CMD.Switch.CMD_SWITCH_REVERSE_POSITION
}, },
split:{ split:{
// 区段切除 // 区段切除

View File

@ -199,11 +199,11 @@ export default {
}, },
// //
locate() { locate() {
this.sendCommand(menuOperate.Switch.npChain); this.sendCommand(menuOperate.Switch.locate);
}, },
// //
reverse() { reverse() {
this.sendCommand(menuOperate.Switch.rpChain); this.sendCommand(menuOperate.Switch.reverse);
}, },
// //
split() { split() {

View File

@ -180,6 +180,7 @@ export default {
val: this.messageText2 val: this.messageText2
}; };
this.message = '';
if (this.operation == OperationEvent.Switch.unlock.menu.operation) { if (this.operation == OperationEvent.Switch.unlock.menu.operation) {
operate.operation = OperationEvent.Switch.unlock.choose.operation; operate.operation = OperationEvent.Switch.unlock.choose.operation;
} else if (this.operation == OperationEvent.Switch.unblock.menu.operation) { } else if (this.operation == OperationEvent.Switch.unblock.menu.operation) {
@ -221,13 +222,15 @@ export default {
}, },
confirm2() { confirm2() {
if (this.messageText2 == this.switchCode) { if (this.messageText2 == this.switchCode) {
this.message = '';
const operate = { const operate = {
over: true,
operation: '', operation: '',
cmdType: '' cmdType: ''
}; };
if (this.operation == OperationEvent.Switch.unlock.menu.operation) { if (this.operation == OperationEvent.Switch.unlock.menu.operation) {
operate.operation = OperationEvent.Switch.unlock.confirm2.operation; operate.operation = OperationEvent.Switch.unlock.confirm2.operation;
operate.cmdType = CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK_CHAIN; operate.cmdType = CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK;
} else if (this.operation == OperationEvent.Switch.unblock.menu.operation) { } else if (this.operation == OperationEvent.Switch.unblock.menu.operation) {
operate.operation = OperationEvent.Switch.unblock.confirm2.operation; operate.operation = OperationEvent.Switch.unblock.confirm2.operation;
operate.cmdType = CMD.Switch.CMD_SWITCH_UNBLOCK; operate.cmdType = CMD.Switch.CMD_SWITCH_UNBLOCK;
@ -239,17 +242,17 @@ export default {
this.messageText2 = '*****'; this.messageText2 = '*****';
this.disabledConfirm2 = true; this.disabledConfirm2 = true;
this.timeCountConfirm = -1; this.timeCountConfirm = -1;
this.message = '操作成功';
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(); this.$refs.noticeInfo.doShow();
}); });
} else { } else {
this.message = '选择道岔错误'; this.message = '选择正确的道岔';
} }
}, },
commit() { commit() {
const operate = { const operate = {
over: true,
operation: '' operation: ''
}; };
@ -348,6 +351,7 @@ export default {
width: 100%; width: 100%;
border: 2px solid #E9E9E9; border: 2px solid #E9E9E9;
box-shadow: 2px 2px #959595 inset; box-shadow: 2px 2px #959595 inset;
padding:5px;
} }
} }
} }

View File

@ -49,22 +49,22 @@ export default {
{ {
label: '定操', label: '定操',
handler: this.locate, handler: this.locate,
cmdType: CMD.Switch.CMD_SWITCH_TURN_NP_CHAIN cmdType: CMD.Switch.CMD_SWITCH_NORMAL_POSITION
}, },
{ {
label: '反操', label: '反操',
handler: this.reverse, handler: this.reverse,
cmdType: CMD.Switch.CMD_SWITCH_TURN_RP_CHAIN cmdType: CMD.Switch.CMD_SWITCH_REVERSE_POSITION
}, },
{ {
label: '道岔单锁', label: '道岔单锁',
handler: this.lock, handler: this.lock,
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK_CHAIN cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK
}, },
{ {
label: '道岔单解', label: '道岔单解',
handler: this.unlock, handler: this.unlock,
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK_CHAIN cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK
}, },
{ {
label: '道岔封锁', label: '道岔封锁',
@ -81,12 +81,12 @@ export default {
{ {
label: '定操', label: '定操',
handler: this.locate, handler: this.locate,
cmdType: CMD.Switch.CMD_SWITCH_TURN_NP_CHAIN cmdType: CMD.Switch.CMD_SWITCH_NORMAL_POSITION
}, },
{ {
label: '反操', label: '反操',
handler: this.reverse, handler: this.reverse,
cmdType: CMD.Switch.CMD_SWITCH_TURN_RP_CHAIN cmdType: CMD.Switch.CMD_SWITCH_REVERSE_POSITION
}, },
{ {
type: 'separator' type: 'separator'
@ -185,7 +185,7 @@ export default {
}, },
// //
locate() { locate() {
commitOperate(menuOperate.Switch.npChain, {switchCode:this.selected.code}, 0).then(({valid, operate})=>{ commitOperate(menuOperate.Switch.locate, {switchCode:this.selected.code}, 0).then(({valid, operate})=>{
if (valid) { if (valid) {
this.$refs.switchControl.doShow(operate, this.selected); this.$refs.switchControl.doShow(operate, this.selected);
} }
@ -193,7 +193,7 @@ export default {
}, },
// //
reverse() { reverse() {
commitOperate(menuOperate.Switch.rpChain, {switchCode:this.selected.code}, 0).then(({valid, operate})=>{ commitOperate(menuOperate.Switch.reverse, {switchCode:this.selected.code}, 0).then(({valid, operate})=>{
if (valid) { if (valid) {
this.$refs.switchControl.doShow(operate, this.selected); this.$refs.switchControl.doShow(operate, this.selected);
} }

View File

@ -131,14 +131,12 @@ export const menuOperate = {
lock:{ lock:{
// 道岔单锁(联锁) // 道岔单锁(联锁)
operation: OperationEvent.Switch.lock.menu.operation, operation: OperationEvent.Switch.lock.menu.operation,
// cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK_CHAIN
}, },
unlock:{ unlock:{
// 道岔解锁(联锁) // 道岔解锁(联锁)
operation: OperationEvent.Switch.unlock.menu.operation, operation: OperationEvent.Switch.unlock.menu.operation,
// cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK_CHAIN
}, },
block:{ block:{
// 道岔封锁 // 道岔封锁
@ -150,15 +148,15 @@ export const menuOperate = {
operation: OperationEvent.Switch.unblock.menu.operation, operation: OperationEvent.Switch.unblock.menu.operation,
cmdType: CMD.Switch.CMD_SWITCH_UNBLOCK cmdType: CMD.Switch.CMD_SWITCH_UNBLOCK
}, },
npChain:{ locate:{
// 道岔定操(联动) // 道岔定操(联动)
operation: OperationEvent.Switch.locate.menu.operation, operation: OperationEvent.Switch.locate.menu.operation,
cmdType:CMD.Switch.CMD_SWITCH_TURN_NP_CHAIN cmdType:CMD.Switch.CMD_SWITCH_NORMAL_POSITION
}, },
rpChain:{ reverse:{
// 道岔反操(联动) // 道岔反操(联动)
operation: OperationEvent.Switch.reverse.menu.operation, operation: OperationEvent.Switch.reverse.menu.operation,
cmdType:CMD.Switch.CMD_SWITCH_TURN_RP_CHAIN cmdType:CMD.Switch.CMD_SWITCH_REVERSE_POSITION
}, },
split:{ split:{
// 区段切除 // 区段切除

View File

@ -358,7 +358,7 @@ export default {
{ {
maxDuration: 15, maxDuration: 15,
minDuration: 8, minDuration: 8,
operateType: 'Switch_Turn_NP_Chain', operateType: 'Switch_Normal_Position',
skinCode: '06', skinCode: '06',
trainingName: '定操({7})', trainingName: '定操({7})',
trainingRemark: '定操({7})', trainingRemark: '定操({7})',
@ -372,7 +372,7 @@ export default {
{ {
maxDuration: 15, maxDuration: 15,
minDuration: 8, minDuration: 8,
operateType: 'Switch_Turn_RP_Chain', // 0313 新增定位字典 operateType: 'Switch_Reverse_Position', // 0313 新增定位字典
skinCode: '06', skinCode: '06',
trainingName: '反操({7})', trainingName: '反操({7})',
trainingRemark: '反操({7})', trainingRemark: '反操({7})',

View File

@ -218,7 +218,7 @@ export default {
const operate = { const operate = {
over: true, over: true,
operation: OperationEvent.Signal.cancelTrainRoute.confirm.operation, operation: OperationEvent.Signal.cancelTrainRoute.confirm.operation,
cmdType: CMD.Signal.CMD_SIGNAL_FORCE_CANCEL_ROUTE cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE
}; };
this.loading = true; this.loading = true;

View File

@ -127,7 +127,7 @@ export default {
}, },
// //
turnout() { turnout() {
this.sendCommand(menuOperate.Switch.switchTurnout); this.sendCommand(menuOperate.Switch.turnout);
}, },
// //
split() { split() {
@ -144,10 +144,10 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch((error) => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(); this.$refs.noticeInfo.doShow(error.message);
}); });
}, },

View File

@ -59,7 +59,7 @@ export default {
{ {
label: '进路取消', label: '进路取消',
handler: this.cancelTrainRoute, handler: this.cancelTrainRoute,
cmdType: CMD.Signal.CMD_SIGNAL_FORCE_CANCEL_ROUTE cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE
}, },
{ {
label: '信号封锁', label: '信号封锁',
@ -131,7 +131,7 @@ export default {
{ {
label: '进路取消', label: '进路取消',
handler: this.cancelTrainRoute, handler: this.cancelTrainRoute,
cmdType: CMD.Signal.CMD_SIGNAL_FORCE_CANCEL_ROUTE cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE
}, },
{ {
label: '信号封锁', label: '信号封锁',

View File

@ -263,7 +263,7 @@ export default {
}, },
// //
switchTurnout() { switchTurnout() {
commitOperate(menuOperate.Switch.switchTurnout, {switchCode:this.selected.code}, 0).then(({valid, operate})=>{ commitOperate(menuOperate.Switch.turnout, {switchCode:this.selected.code}, 0).then(({valid, operate})=>{
if (valid) { if (valid) {
this.$refs.switchControl.doShow(operate, this.selected); this.$refs.switchControl.doShow(operate, this.selected);
} }

View File

@ -60,7 +60,7 @@ export const menuOperate = {
cancelTrainRoute:{ cancelTrainRoute:{
// 取消进路 // 取消进路
operation: OperationEvent.Signal.cancelTrainRoute.menu.operation, operation: OperationEvent.Signal.cancelTrainRoute.menu.operation,
cmdType: CMD.Signal.CMD_SIGNAL_FORCE_CANCEL_ROUTE cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE
}, },
lock:{ lock:{
// 信号封锁 // 信号封锁
@ -158,7 +158,7 @@ export const menuOperate = {
operation: OperationEvent.Switch.unblock.menu.operation, operation: OperationEvent.Switch.unblock.menu.operation,
cmdType: CMD.Switch.CMD_SWITCH_UNBLOCK cmdType: CMD.Switch.CMD_SWITCH_UNBLOCK
}, },
switchTurnout: { turnout: {
// 道岔转动 // 道岔转动
operation: OperationEvent.Switch.turnout.menu.operation, operation: OperationEvent.Switch.turnout.menu.operation,
cmdType: CMD.Switch.CMD_SWITCH_TURN cmdType: CMD.Switch.CMD_SWITCH_TURN
@ -278,7 +278,7 @@ export const menuOperate = {
// 设置折返策略 // 设置折返策略
operation: OperationEvent.Station.setBackStrategy.menu.operation, operation: OperationEvent.Station.setBackStrategy.menu.operation,
cmdType: CMD.Station.CMD_STATION_SET_TURN_BACK_STRATEGY cmdType: CMD.Station.CMD_STATION_SET_TURN_BACK_STRATEGY
}, }
}, },
TrainWindow: { TrainWindow: {
editTrainId: { editTrainId: {

View File

@ -52,12 +52,12 @@ export default {
{ {
label: '定操', label: '定操',
handler: this.locate, handler: this.locate,
cmdType: CMD.Switch.CMD_SWITCH_TURN_NP_CHAIN cmdType: CMD.Switch.CMD_SWITCH_NORMAL_POSITION
}, },
{ {
label: '反操', label: '反操',
handler: this.reverse, handler: this.reverse,
cmdType: CMD.Switch.CMD_SWITCH_TURN_RP_CHAIN cmdType: CMD.Switch.CMD_SWITCH_REVERSE_POSITION
}, },
{ {
label: '道岔单锁', label: '道岔单锁',
@ -84,12 +84,12 @@ export default {
{ {
label: '道岔定位', label: '道岔定位',
handler: this.locate, handler: this.locate,
cmdType: CMD.Switch.CMD_SWITCH_TURN_NP_CHAIN cmdType: CMD.Switch.CMD_SWITCH_NORMAL_POSITION
}, },
{ {
label: '道岔反位', label: '道岔反位',
handler: this.reverse, handler: this.reverse,
cmdType: CMD.Switch.CMD_SWITCH_TURN_RP_CHAIN cmdType: CMD.Switch.CMD_SWITCH_REVERSE_POSITION
}, },
{ {
label: '道岔单锁', label: '道岔单锁',
@ -256,7 +256,7 @@ export default {
}, },
// //
locate() { locate() {
commitOperate(menuOperate.Switch.npChain, {switchCode:this.selected.code}, 0).then(({valid, operate})=>{ commitOperate(menuOperate.Switch.locate, {switchCode:this.selected.code}, 0).then(({valid, operate})=>{
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/pushRequestList', { this.$store.dispatch('menuOperation/pushRequestList', {
device: this.selected, device: this.selected,
@ -269,7 +269,7 @@ export default {
}, },
// //
reverse() { reverse() {
commitOperate(menuOperate.Switch.rpChain, {switchCode:this.selected.code}, 0).then(({valid, operate})=>{ commitOperate(menuOperate.Switch.reverse, {switchCode:this.selected.code}, 0).then(({valid, operate})=>{
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/pushRequestList', { this.$store.dispatch('menuOperation/pushRequestList', {
device: this.selected, device: this.selected,

View File

@ -144,15 +144,15 @@ export const menuOperate = {
operation: OperationEvent.Switch.unblock.menu.operation, operation: OperationEvent.Switch.unblock.menu.operation,
cmdType: CMD.Switch.CMD_SWITCH_UNBLOCK cmdType: CMD.Switch.CMD_SWITCH_UNBLOCK
}, },
npChain:{ locate:{
// 道岔定操(联动) // 道岔定操
operation: OperationEvent.Switch.locate.menu.operation, operation: OperationEvent.Switch.locate.menu.operation,
cmdType:CMD.Switch.CMD_SWITCH_TURN_NP_CHAIN cmdType:CMD.Switch.CMD_SWITCH_NORMAL_POSITION
}, },
rpChain:{ reverse:{
// 道岔反操(联动) // 道岔反操
operation: OperationEvent.Switch.reverse.menu.operation, operation: OperationEvent.Switch.reverse.menu.operation,
cmdType:CMD.Switch.CMD_SWITCH_TURN_RP_CHAIN cmdType:CMD.Switch.CMD_SWITCH_REVERSE_POSITION
}, },
split:{ split:{
// 区段切除 // 区段切除

View File

@ -358,7 +358,7 @@ export default {
{ {
maxDuration: 15, maxDuration: 15,
minDuration: 8, minDuration: 8,
operateType: 'Switch_Turn_NP_Chain', operateType: 'Switch_Normal_Position',
skinCode: '06', skinCode: '06',
trainingName: '定操({7})', trainingName: '定操({7})',
trainingRemark: '定操({7})', trainingRemark: '定操({7})',
@ -372,7 +372,7 @@ export default {
{ {
maxDuration: 15, maxDuration: 15,
minDuration: 8, minDuration: 8,
operateType: 'Switch_Turn_RP_Chain', // 0313 新增定位字典 operateType: 'Switch_Reverse_Position', // 0313 新增定位字典
skinCode: '06', skinCode: '06',
trainingName: '反操({7})', trainingName: '反操({7})',
trainingRemark: '反操({7})', trainingRemark: '反操({7})',

View File

@ -25,7 +25,9 @@ function isDesignPage(toRoutePath) {
return designPageRegex.some(item => item.test(toRoutePath) ); return designPageRegex.some(item => item.test(toRoutePath) );
} }
for (const val in PermissionParam) { for (const val in PermissionParam) {
whiteList.push(PermissionParam[val].whitePage); if (PermissionParam[val].whitePage) {
whiteList.push(PermissionParam[val].whitePage);
}
} }
const loginPage = whiteList[0]; const loginPage = whiteList[0];
const loginDesignPage = whiteList[1]; const loginDesignPage = whiteList[1];

View File

@ -8,10 +8,10 @@ export default {
CMD_SWITCH_SINGLE_LOCK: {value:'Switch_Single_Lock', label: '单锁'}, CMD_SWITCH_SINGLE_LOCK: {value:'Switch_Single_Lock', label: '单锁'},
/** 单解 */ /** 单解 */
CMD_SWITCH_SINGLE_UNLOCK: {value:'Switch_Single_Unlock', label: '单解'}, CMD_SWITCH_SINGLE_UNLOCK: {value:'Switch_Single_Unlock', label: '单解'},
/** 单锁(联动) */ // /** 单锁(联动) */
CMD_SWITCH_SINGLE_LOCK_CHAIN: {value:'Switch_Single_Lock_Chain', label: '单锁(联动)'}, // CMD_SWITCH_SINGLE_LOCK_CHAIN: {value:'Switch_Single_Lock_Chain', label: '单锁(联动)'},
/** 单解(联动) */ // /** 单解(联动) */
CMD_SWITCH_SINGLE_UNLOCK_CHAIN: {value:'Switch_Single_Unlock_Chain', label: '单解(联动)'}, // CMD_SWITCH_SINGLE_UNLOCK_CHAIN: {value:'Switch_Single_Unlock_Chain', label: '单解(联动)'},
/** 封锁 */ /** 封锁 */
CMD_SWITCH_BLOCK: {value:'Switch_Block', label: '封锁'}, CMD_SWITCH_BLOCK: {value:'Switch_Block', label: '封锁'},
/** 解封 */ /** 解封 */
@ -38,10 +38,10 @@ export default {
CMD_SWITCH_NORMAL_POSITION:{value:'Switch_Normal_Position', label:'单操到定位'}, CMD_SWITCH_NORMAL_POSITION:{value:'Switch_Normal_Position', label:'单操到定位'},
/** 反位(反操) */ /** 反位(反操) */
CMD_SWITCH_REVERSE_POSITION:{value:'Switch_Reverse_Position', label:'单操到反位'}, CMD_SWITCH_REVERSE_POSITION:{value:'Switch_Reverse_Position', label:'单操到反位'},
/** 道岔定操(联动) */ // /** 道岔定操(联动) */
CMD_SWITCH_TURN_NP_CHAIN: {value: 'Switch_Turn_NP_Chain', label: '道岔定操(联动)'}, // CMD_SWITCH_TURN_NP_CHAIN: {value: 'Switch_Turn_NP_Chain', label: '道岔定操(联动)'},
/** 道岔反操(联动)*/ // /** 道岔反操(联动)*/
CMD_SWITCH_TURN_RP_CHAIN: {value: 'Switch_Turn_RP_Chain', label: '道岔反操(联动)'}, // CMD_SWITCH_TURN_RP_CHAIN: {value: 'Switch_Turn_RP_Chain', label: '道岔反操(联动)'},
/** 道岔区段封锁 */ /** 道岔区段封锁 */
CMD_SWITCH_SECTION_BLOCK: {value: 'Switch_Section_Block', label: '道岔区段封锁'}, CMD_SWITCH_SECTION_BLOCK: {value: 'Switch_Section_Block', label: '道岔区段封锁'},
/** 道岔区段解封 */ /** 道岔区段解封 */
@ -78,8 +78,8 @@ export default {
CMD_SIGNAL_SET_ROUTE: {value:'Signal_Set_Route', label: '排列进路'}, CMD_SIGNAL_SET_ROUTE: {value:'Signal_Set_Route', label: '排列进路'},
/** 取消进路 */ /** 取消进路 */
CMD_SIGNAL_CANCEL_ROUTE: {value:'Signal_Cancel_Route', label: '取消进路'}, CMD_SIGNAL_CANCEL_ROUTE: {value:'Signal_Cancel_Route', label: '取消进路'},
/** 强制取消进路 */ // /** 强制取消进路 */
CMD_SIGNAL_FORCE_CANCEL_ROUTE: {value: 'Signal_Force_Cancel_Route', label: '强制取消进路'}, // CMD_SIGNAL_FORCE_CANCEL_ROUTE: {value: 'Signal_Force_Cancel_Route', label: '强制取消进路'},
/** 人解进路 */ /** 人解进路 */
CMD_SIGNAL_HUMAN_RELEASE_ROUTE: {value:'Signal_Human_Release_Route', label: '人解进路'}, CMD_SIGNAL_HUMAN_RELEASE_ROUTE: {value:'Signal_Human_Release_Route', label: '人解进路'},
/** 信号关灯 */ /** 信号关灯 */

View File

@ -165,7 +165,6 @@ const iscs = {
commit('iscsRender', models); commit('iscsRender', models);
resolve(models); resolve(models);
}); });
}, },
setUpdateDeviceData: ({ commit }, models) => { setUpdateDeviceData: ({ commit }, models) => {

View File

@ -45,6 +45,7 @@ export default {
}, },
selected: null, // selected: null, //
copyModel: {}, // copyModel: {}, //
copyList: [],
showBackButton: true, showBackButton: true,
initTime: '', initTime: '',
started: false, started: false,
@ -139,21 +140,41 @@ export default {
if (this.selected && this.selected.code) { if (this.selected && this.selected.code) {
switch (hook) { switch (hook) {
case 'Ctrl_C': { case 'Ctrl_C': {
if (this.selected._type != "CheckBox") { const list = this.getSelectList();
this.copyModel = deepAssign({}, this.selected); if (list.length) {
this.copyModel.point = { this.copyList = [];
x: this.selected.point.x + 10, const mapIscs = {};
y: this.selected.point.y + 10 list.forEach(item => {
}; if (item && item.code) {
const copyModel = this.copyModelInfo(item, 30);
const type1 = item._type.charAt(0).toLowerCase() + item._type.slice(1); // .toLowerCase()
if (!mapIscs[type1 + 'List']) {
mapIscs[type1 + 'List'] = this.iscs[type1 + 'List'] || [];
}
const list = mapIscs[type1 + 'List'] || [];
copyModel.code = getUID(item._type, list);
mapIscs[type1 + 'List'].push(copyModel);
this.copyList.push(copyModel);
}
});
} else if (this.selected._type != 'CheckBox') {
this.copyModel = this.copyModelInfo(this.selected, 10);
const type1 = this.selected._type.charAt(0).toLowerCase() + this.selected._type.slice(1); // .toLowerCase() const type1 = this.selected._type.charAt(0).toLowerCase() + this.selected._type.slice(1); // .toLowerCase()
this.copyModel.code = getUID(this.selected._type, this.iscs[type1 + 'List'] || []); this.copyModel.code = getUID(this.selected._type, this.iscs[type1 + 'List'] || []);
} else { } else {
this.copyModel = {} this.copyModel = {};
}
} break;
case 'Ctrl_V': {
const list = this.getSelectList();
if (list.length) {
this.copyList.forEach(item => {
item.code && this.createDataModel(item);
});
} else {
this.copyModel.code && this.createDataModel(this.copyModel);
} }
} break; } break;
case 'Ctrl_V':
this.copyModel.code && this.createDataModel(this.copyModel);
break;
// case 'Delete': this.$store.dispatch('map/setDeleteCount'); // case 'Delete': this.$store.dispatch('map/setDeleteCount');
// break; // break;
// case 'Update': // case 'Update':
@ -163,6 +184,27 @@ export default {
} }
} }
}, },
copyModelInfo(model, length) { // copy
const copyModel = deepAssign({}, model);
if (copyModel._type == 'IscsLine') {
copyModel.point1 = {
x: model.point1.x + length,
y: model.point1.y + length
};
copyModel.point2 = {
x: model.point2.x + length,
y: model.point2.y + length
};
}
copyModel.point = {
x: model.point.x + length,
y: model.point.y + length
};
return copyModel;
},
getSelectList() {
return this.$iscs.getCopyList() || [];
},
createDataModel(model) { createDataModel(model) {
const newModel = deviceFactory(model._type, model); const newModel = deviceFactory(model._type, model);
this.$store.dispatch('iscs/updateIscsDevices', newModel.model); this.$store.dispatch('iscs/updateIscsDevices', newModel.model);

View File

@ -70,9 +70,9 @@ export default {
height: 800, height: 800,
roadData: [], roadData: [],
focus: false, focus: false,
booleanList: ['lockFirst', 'switchSingleHandle'], booleanList: ['lockFirst', 'switchSingleHandle', 'switchNRTurnChain', 'switchSingleLockChain', 'signalForceCancelRoute'],
selectList: ['upDirection'], selectList: ['upDirection'],
generalConfig: ['lockFirst', 'switchSingleHandle', 'upDirection'], generalConfig: ['lockFirst', 'switchSingleHandle', 'upDirection', 'switchNRTurnChain', 'switchSingleLockChain', 'signalForceCancelRoute'],
numberList: [], numberList: [],
optionsMap: { optionsMap: {
upDirection: [{label: 'right', value: 'right'}, {label: 'left', value: 'left'}] upDirection: [{label: 'right', value: 'right'}, {label: 'left', value: 'left'}]
@ -80,7 +80,10 @@ export default {
remarkMap: { remarkMap: {
lockFirst: '是否先锁闭——办理过程直接先锁闭区段', lockFirst: '是否先锁闭——办理过程直接先锁闭区段',
upDirection: '上行方向', upDirection: '上行方向',
switchSingleHandle: '道岔区段状态改变按单个道岔处理' switchSingleHandle: '道岔区段状态改变按单个道岔处理',
switchNRTurnChain:'道岔正/反操是否联动',
switchSingleLockChain:'道岔单解/锁是否联动',
signalForceCancelRoute:'是否强制取消进路/在接近区段占用时是否依旧强制执行取消进路'
} }
}; };
}, },