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