43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
|
class ThemeFactory {
|
||
|
constructor() {
|
||
|
this._default = '01';
|
||
|
this._mapMenu = {
|
||
|
'01': 'default',
|
||
|
'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();
|