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

update:更新

上级 eaa90294
......@@ -31,31 +31,37 @@ export class PanelTabPageModel extends PanelDetailModel {
}
/**
* 加载
* 设置分页是否启用
*
* @param {*} context
* @param {*} viewParams
* @param {boolean} state
* @memberof PanelTabPageModel
*/
public async load(context: any, viewParams: any) {
if (!this.parentName) {
if (this.type == 'VIEWLAYOUT') {
this.data = {};
} else {
this.data = this.panel.data;
public setVisible(state: boolean): void {
this.visible = state;
const tabPanel = this.getTabPanelModel();
if (tabPanel) {
tabPanel.setActiviePage();
}
} 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,31 +46,42 @@ export class PanelTabPanelModel extends PanelDetailModel {
}
/**
* 加载
* 设置激活分页
*
* @param {*} context
* @param {*} viewParams
* @memberof PanelTabPageModel
* @memberof PanelTabPanelModel
*/
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();
public setActiviePage(): void {
if (!this.panel) {
return;
}
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
......@@ -3,7 +3,7 @@ const isServer = Vue.prototype.$isServer;
/* istanbul ignore next */
export const on = (function() {
if (!isServer && document.addEventListener) {
if (!isServer && (document as any).addEventListener) {
return function(element: any, event: any, handler: any) {
if (element && event && handler) {
element.addEventListener(event, handler, false);
......@@ -20,7 +20,7 @@ export const on = (function() {
/* istanbul ignore next */
export const off = (function() {
if (!isServer && document.removeEventListener) {
if (!isServer && (document as any).removeEventListener) {
return function(element: any, event: any, handler: any) {
if (element && event) {
element.removeEventListener(event, handler, false);
......
此差异已折叠。
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册