提交 eaa90294 编写于 作者: Shine-zwj's avatar Shine-zwj

update:更新面板分页

上级 3c36a0da
......@@ -31,37 +31,31 @@ export class PanelTabPageModel extends PanelDetailModel {
}
/**
* 设置分页是否启用
* 加载
*
* @param {boolean} state
* @param {*} context
* @param {*} viewParams
* @memberof PanelTabPageModel
*/
public setVisible(state: boolean): void {
this.visible = state;
const tabPanel = this.getTabPanelModel();
if (tabPanel) {
tabPanel.setActiviePage();
public async load(context: any, viewParams: any) {
if (!this.parentName) {
if (this.type == 'VIEWLAYOUT') {
this.data = {};
} else {
this.data = this.panel.data;
}
} else {
let parentItem = this.panel.layoutModelDetails[`${this.parentName}_${this.index}`];
if (!parentItem) {
parentItem = this.panel.layoutModelDetails[this.parentName];
}
if (parentItem) {
if (parentItem.dataRegionType === 'MULTIDATA' && parentItem['data'] && parentItem['data'].length > 0) {
this.data = parentItem.getData()[this.getIndex()];
} else {
this.data = parentItem.getData();
}
/**
* 获取分页面板
*
* @returns {(PanelTabPanelModel | null)}
* @memberof PanelTabPageModel
*/
public getTabPanelModel(): PanelTabPanelModel | null {
if (!this.panel) {
return null;
}
const tabPanels: any[] = Object.values(this.panel.detailsModel).filter((model: any) => Object.is(model.itemType, 'TABPANEL'));
let index = tabPanels.findIndex((tabPanel: any) => {
return tabPanel.tabPages.some((tabPag: any) => Object.is(tabPag.name, this.name));
});
if (index === -1) {
return null;
}
const tabPanel: PanelTabPanelModel = tabPanels[index];
return tabPanel;
}
}
\ No newline at end of file
......@@ -46,42 +46,31 @@ export class PanelTabPanelModel extends PanelDetailModel {
}
/**
* 设置激活分页
* 加载
*
* @memberof PanelTabPanelModel
* @param {*} context
* @param {*} viewParams
* @memberof PanelTabPageModel
*/
public setActiviePage(): void {
if (!this.panel) {
return;
public async load(context: any, viewParams: any) {
if (!this.parentName) {
if (this.type == 'VIEWLAYOUT') {
this.data = {};
} else {
this.data = this.panel.data;
}
} else {
let parentItem = this.panel.layoutModelDetails[`${this.parentName}_${this.index}`];
if (!parentItem) {
parentItem = this.panel.layoutModelDetails[this.parentName];
}
if (parentItem) {
if (parentItem.dataRegionType === 'MULTIDATA' && parentItem['data'] && parentItem['data'].length > 0) {
this.data = parentItem.getData()[this.getIndex()];
} else {
this.data = parentItem.getData();
}
const detailsModel: any = this.panel.layoutModelDetails;
// const index = this.tabPages.findIndex((tabpage: any) => Object.is(tabpage.name, this.clickActiviePage) && Object.is(tabpage.name, this.activiedPage) && detailsModel[tabpage.name].visible);
// if (index !== - 1) {
// return;
// }
// this.tabPages.some((tabpage: any) => {
// if (detailsModel[tabpage.name].visible) {
// this.activiedPage = tabpage.name;
// return true;
// }
// return false;
// });
}
/**
* 选中页面
*
* @param {*} $event
* @returns {void}
* @memberof PanelTabPanelModel
*/
public clickPage($event: any): void {
if (!$event) {
return;
}
this.clickActiviePage = $event;
this.activiedPage = $event;
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册