提交 c3d3c2a3 编写于 作者: tony001's avatar tony001

update:更新

上级 5acd9d07
import qs from 'qs'; import qs from 'qs';
import { Route } from 'vue-router'; import { Route } from 'vue-router';
import Schema from "async-validator"; import Schema from "async-validator";
import { PanelContainerModel, PanelRawitemModel, PanelFieldModel, PanelControlModel, PanelButtonModel, PanelUserControlModel, PanelTabPanelModel, PanelTabPageModel, PanelCtrlPosModel } from '@/model/panel-detail';
/** /**
* 平台工具类 * 平台工具类
* *
...@@ -475,7 +475,7 @@ export class Util { ...@@ -475,7 +475,7 @@ export class Util {
if (!mode) { if (!mode) {
return {}; return {};
} }
if(!style){ if (!style) {
style = 'PX'; style = 'PX';
} }
if (style === "FULL") { if (style === "FULL") {
...@@ -521,4 +521,39 @@ export class Util { ...@@ -521,4 +521,39 @@ export class Util {
return {}; return {};
} }
} }
/**
* 获取布局项实例
*
* @static
* @param {*} layoutModelItem
* @memberof Util
*/
public static getLayoutItemInstance(layoutModelItem: any): any {
if (!layoutModelItem || !layoutModelItem.itemType) {
throw new Error('获取布局项实例异常');
}
switch (layoutModelItem.itemType) {
case 'CONTAINER':
return new PanelContainerModel(layoutModelItem);
case 'RAWITEM':
return new PanelRawitemModel(layoutModelItem);
case 'FIELD':
return new PanelFieldModel(layoutModelItem);
case 'CONTROL':
return new PanelControlModel(layoutModelItem);
case 'BUTTON':
return new PanelButtonModel(layoutModelItem);
case 'USERCONTROL':
return new PanelUserControlModel(layoutModelItem);
case 'TABPANEL':
return new PanelTabPanelModel(layoutModelItem);
case 'CTRLPOS':
return new PanelCtrlPosModel(layoutModelItem);
case 'TABPAGE':
return new PanelTabPageModel(layoutModelItem);
default:
throw new Error(`${layoutModelItem.itemType}暂不支持`);
}
}
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册