desc: 修改代码
This commit is contained in:
parent
deccfc537a
commit
851c0a4a6a
@ -350,12 +350,13 @@ export default class Switch extends Group {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getBoundingRect() {
|
getBoundingRect() {
|
||||||
return this.name.getNameText().getBoundingRect();
|
return this.name.getBoundingRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
getShapeTipPoint() {
|
getShapeTipPoint() {
|
||||||
const rect = this.name.getNameText().getBoundingRect();
|
const text = this.name.getNameText();
|
||||||
if (rect) {
|
if (text) {
|
||||||
|
const rect = text.getBoundingRect();
|
||||||
return {
|
return {
|
||||||
x: rect.x + rect.width / 2,
|
x: rect.x + rect.width / 2,
|
||||||
y: rect.y
|
y: rect.y
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* 车次窗*/
|
/* 车次窗*/
|
||||||
import Polygon from 'zrender/src/graphic/shape/Polygon';
|
import Polygon from 'zrender/src/graphic/shape/Polygon';
|
||||||
import Group from 'zrender/src/container/Group';
|
import Group from 'zrender/src/container/Group';
|
||||||
|
import store from '@/store';
|
||||||
|
|
||||||
class TrainWindow extends Group {
|
class TrainWindow extends Group {
|
||||||
constructor(model, style) {
|
constructor(model, style) {
|
||||||
@ -11,15 +12,13 @@ class TrainWindow extends Group {
|
|||||||
this.model = model;
|
this.model = model;
|
||||||
this.style = style;
|
this.style = style;
|
||||||
this.z = 1;
|
this.z = 1;
|
||||||
|
this.prdType = store.state.training.prdType;
|
||||||
this._create(model);
|
this._create(model);
|
||||||
this.setState(model);
|
this.setState(model);
|
||||||
}
|
}
|
||||||
_create(model) {
|
_create(model) {
|
||||||
const prdType = '02';// store.model.training.prdType;
|
if (this.prdType !== '01') {
|
||||||
if (prdType !== '01') {
|
|
||||||
this.createTrainWindow();
|
this.createTrainWindow();
|
||||||
this.setTrainWindowEventShow(model.trainWindowShow);
|
|
||||||
this.setState(model);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +44,9 @@ class TrainWindow extends Group {
|
|||||||
lineWidth: this.style.TrainWindow.trainWindowLineWidth,
|
lineWidth: this.style.TrainWindow.trainWindowLineWidth,
|
||||||
stroke: this.style.TrainWindow.trainWindowColor,
|
stroke: this.style.TrainWindow.trainWindowColor,
|
||||||
fill: this.style.transparentColor
|
fill: this.style.transparentColor
|
||||||
}
|
},
|
||||||
|
onmouseover: () => { if (this.prdType != '') this.setTrainWindowEventShow(true); },
|
||||||
|
onmouseout: () => { if (this.prdType != '') this.setTrainWindowEventShow(false); }
|
||||||
});
|
});
|
||||||
this.add(this.trainRect);
|
this.add(this.trainRect);
|
||||||
}
|
}
|
||||||
@ -60,7 +61,8 @@ class TrainWindow extends Group {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 设置状态
|
// 设置状态
|
||||||
setState() {
|
setState(model) {
|
||||||
|
this.setTrainWindowEventShow(model.trainWindowShow);
|
||||||
}
|
}
|
||||||
setTrainWindowEventShow(show) {
|
setTrainWindowEventShow(show) {
|
||||||
const lineWidth = show ? 1 : 0;
|
const lineWidth = show ? 1 : 0;
|
||||||
|
@ -26,16 +26,7 @@ class Theme {
|
|||||||
|
|
||||||
// 共有字段转换
|
// 共有字段转换
|
||||||
loadPropConvert(code) {
|
loadPropConvert(code) {
|
||||||
var convert = require(`./${this._mapMenu[code || this._code]}/model`) || {};
|
return require(`./${this._mapMenu[code || this._code]}/model`).default;
|
||||||
|
|
||||||
if (!convert.hasOwnProperty('initPublicProps')) {
|
|
||||||
convert.initPublicProps = (model) => { return model; };
|
|
||||||
}
|
|
||||||
if (!convert.hasOwnProperty('initPrivateProps')) {
|
|
||||||
convert.initPrivateProps = (model) => { return model; };
|
|
||||||
}
|
|
||||||
|
|
||||||
return convert;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,79 +36,78 @@ export function deviceFactory(type, elem) {
|
|||||||
export function parser(data, jmap) {
|
export function parser(data, jmap) {
|
||||||
var mapDevice = {};
|
var mapDevice = {};
|
||||||
var propConvert = Vue.prototype.$theme.loadPropConvert(jmap.skinStyle);
|
var propConvert = Vue.prototype.$theme.loadPropConvert(jmap.skinStyle);
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
zrUtil.each(data.linkList || [], elem => {
|
zrUtil.each(data.linkList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.Link, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.Link, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.sectionList || [], elem => {
|
zrUtil.each(data.sectionList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.Section, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.Section, elem));
|
||||||
|
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.signalList || [], elem => {
|
zrUtil.each(data.signalList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.Signal, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.Signal, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.stationList || [], elem => {
|
zrUtil.each(data.stationList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.Station, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.Station, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.stationStandList || [], elem => {
|
zrUtil.each(data.stationStandList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.StationStand, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.StationStand, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.stationControlList || [], elem => {
|
zrUtil.each(data.stationControlList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.StationControl, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.StationControl, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.counterList || [], elem => {
|
zrUtil.each(data.counterList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.StationCounter, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.StationCounter, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.delayShowList || [], elem => {
|
zrUtil.each(data.delayShowList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.StationDelayUnlock, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.StationDelayUnlock, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.lineList || [], elem => {
|
zrUtil.each(data.lineList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.Line, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.Line, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.textList || [], elem => {
|
zrUtil.each(data.textList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.Text, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.Text, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.zcList || [], elem => {
|
zrUtil.each(data.zcList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.ZcControl, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.ZcControl, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.lcList || [], elem => {
|
zrUtil.each(data.lcList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.LcControl, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.LcControl, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.tempSpeedLimitList || [], elem => {
|
zrUtil.each(data.tempSpeedLimitList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.LimitControl, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.LimitControl, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.resourceList || [], elem => {
|
zrUtil.each(data.resourceList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.ImageControl, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.ImageControl, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.trainList || [], elem => {
|
zrUtil.each(data.trainList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.Train, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.Train, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.trainWindowList || [], elem => {
|
zrUtil.each(data.trainWindowList || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.TrainWindow, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.TrainWindow, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.Line || [], elem => {
|
zrUtil.each(data.Line || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.Line, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.Line, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.Text || [], elem => {
|
zrUtil.each(data.Text || [], elem => {
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.Text, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.Text, elem));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.switchList || [], elem => {
|
zrUtil.each(data.switchList || [], elem => {
|
||||||
@ -147,7 +146,7 @@ export function parser(data, jmap) {
|
|||||||
|
|
||||||
rnodeSection['layer'] = -1;
|
rnodeSection['layer'] = -1;
|
||||||
}
|
}
|
||||||
mapDevice[elem.code] = deviceFactory(deviceType.Switch, propConvert.initPrivateProps(elem));
|
mapDevice[elem.code] = propConvert.initPrivateProps(deviceFactory(deviceType.Switch, elem));
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user