2019-07-29 16:03:14 +08:00
|
|
|
class ThemeFactory {
|
|
|
|
constructor() {
|
2019-07-30 09:48:14 +08:00
|
|
|
this._default = '02';
|
2019-07-29 16:03:14 +08:00
|
|
|
this._mapMenu = {
|
2019-07-30 09:48:14 +08:00
|
|
|
// '01': 'default',
|
2019-07-29 16:03:14 +08:00
|
|
|
'02': 'fuzhou_01',
|
|
|
|
'03': 'beijing_01',
|
|
|
|
'04': 'chengdou_03',
|
|
|
|
'05': 'batong_01'
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
// 加载菜单组件
|
|
|
|
loadMenusComponent(code) {
|
|
|
|
return Object.assign({}, require(`./${this._mapMenu[code || this._default]}/menus/index`).default);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 加载运行图计划表组件
|
|
|
|
loadPlanScheduleComponent(code) {
|
|
|
|
return Object.assign({}, require(`./${this._mapMenu[code || this._default]}/planSchedule/index`).default);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 加载运行图解析和转化函数
|
|
|
|
loadPlanConvert(code) {
|
|
|
|
return require(`./${this._mapMenu[code || this._default]}/convert`).default;
|
|
|
|
}
|
|
|
|
|
|
|
|
// model字段转换器
|
|
|
|
modelConvert(code) {
|
|
|
|
const convert = require(`./${this._mapMenu[code || this._default]}/model`) || {};
|
|
|
|
if (!convert.hasOwnProperty('InitPublicProperties')) {
|
|
|
|
convert.InitPublicProperties = (model) => { return model; };
|
|
|
|
}
|
|
|
|
if (!convert.hasOwnProperty('InitPrivateProperties')) {
|
|
|
|
convert.InitPrivateProperties = (model) => { return model; };
|
|
|
|
}
|
|
|
|
|
|
|
|
return convert;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default new ThemeFactory();
|