代码调整

This commit is contained in:
joylink_cuiweidong 2022-06-24 16:51:17 +08:00
parent 8b3c7eadc5
commit 6384208d93

View File

@ -0,0 +1,71 @@
import deviceType from '../../constant/deviceType';
class Model {
constructor() {
this.screenLine = 3;
// 公共字段部分默认初始值
this['public'] = {};
this['public'][deviceType.Signal] = {
lampPositionType: '02',
lampPostType: '02'
};
// 私有字段部分默认初始值
this['private'] = {};
this['private'][deviceType.StationControl] = {
indicatorShow: true // 标识灯名称显示
};
this['private'][deviceType.Station] = {
kmPostShow: true // 公里标显示
};
this['private'][deviceType.Switch] = {
nameShow: true
};
this['private'][deviceType.Section] = {
nameShow: true,
borderBorderShow: true, // 区段边界显示
destinationNameShow: true, // 目的地码名称显示
standTrackNameShow: true, // 站台轨名称显示
reentryTrackNameShow: true, // 折返轨名称显示
transferTrackNameShow: true // 转换轨名称显示
};
this['private'][deviceType.Signal] = {
nameShow: true, // 信号机名称显示
linkageAutoRouteShow: true, // 联锁自动进路表示灯显示
atsAutoTriggerShow: true // ATS自动触发表示灯显示
};
this['private'][deviceType.Train] = {
};
this['private'][deviceType.TrainWindow] = {
trainWindowShow: true
};
}
initPublicProps(model) {
if (model) {
var modelInitial = this.public[model._type];
if (modelInitial) {
for (var prop in modelInitial) {
model[prop] = modelInitial[prop];
}
}
}
return model;
}
initPrivateProps(model) {
if (model) {
var modelInitial = this.private[model._type];
if (modelInitial) {
for (var prop in modelInitial) {
model[prop] = modelInitial[prop];
}
}
}
return model;
}
}
export default new Model();