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

update:更新

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