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

update:更新

上级 e44e3ddc
...@@ -56,6 +56,15 @@ export class PanelButtonModel extends PanelDetailModel { ...@@ -56,6 +56,15 @@ export class PanelButtonModel extends PanelDetailModel {
*/ */
public borderStyle: 'NONE' | 'SOLID' | 'DOTTED' | 'DASHED' | 'DOUBLE' = 'NONE'; public borderStyle: 'NONE' | 'SOLID' | 'DOTTED' | 'DASHED' | 'DOUBLE' = 'NONE';
/**
* 数据部件名称
*
* @private
* @type {string}
* @memberof PanelButtonModel
*/
private xDataControlName: string;
/** /**
* Creates an instance of PanelButtonModel. * Creates an instance of PanelButtonModel.
* @param {*} [opts={}] * @param {*} [opts={}]
...@@ -69,6 +78,7 @@ export class PanelButtonModel extends PanelDetailModel { ...@@ -69,6 +78,7 @@ export class PanelButtonModel extends PanelDetailModel {
this.iconAlign = opts.iconAlign || 'LEFT'; this.iconAlign = opts.iconAlign || 'LEFT';
this.disabled = opts.disabled; this.disabled = opts.disabled;
this.borderStyle = opts.borderStyle ? opts.borderStyle : 'NONE'; this.borderStyle = opts.borderStyle ? opts.borderStyle : 'NONE';
this.xDataControlName = opts.xDataControlName;
} }
/** /**
...@@ -124,8 +134,8 @@ export class PanelButtonModel extends PanelDetailModel { ...@@ -124,8 +134,8 @@ export class PanelButtonModel extends PanelDetailModel {
* @private * @private
* @memberof PanelButtonModel * @memberof PanelButtonModel
*/ */
private calcActionItemAuthState() { public computeActionAuthState() {
if (this.uiAction && this.uiAction.dataaccaction && this.data) { if (this.uiAction && this.uiAction.dataaccaction && this.getData()) {
let tempUIAction: any = Util.deepCopy(this.uiAction); let tempUIAction: any = Util.deepCopy(this.uiAction);
ViewTool.calcActionItemAuthState(this.data, [tempUIAction], this.panel.appUIService ? this.panel.appUIService : null); ViewTool.calcActionItemAuthState(this.data, [tempUIAction], this.panel.appUIService ? this.panel.appUIService : null);
this.visible = tempUIAction.visabled; this.visible = tempUIAction.visabled;
...@@ -134,15 +144,14 @@ export class PanelButtonModel extends PanelDetailModel { ...@@ -134,15 +144,14 @@ export class PanelButtonModel extends PanelDetailModel {
} }
/** /**
* 加载数据 * 获取数据
* *
* @private * @private
* @memberof PanelButtonModel * @memberof PanelButtonModel
*/ */
private loadData() { public getData() {
if (this.parentName) { if (this.parentName) {
let parentItem = this.panel.layoutModelDetails[`${this.parentName}_${this.index}`]; let parentItem = this.panel.layoutModelDetails[`${this.parentName}_${this.index}`];
// 尝试找
if (!parentItem) { if (!parentItem) {
parentItem = this.panel.layoutModelDetails[this.parentName]; parentItem = this.panel.layoutModelDetails[this.parentName];
} }
...@@ -150,6 +159,57 @@ export class PanelButtonModel extends PanelDetailModel { ...@@ -150,6 +159,57 @@ export class PanelButtonModel extends PanelDetailModel {
this.data = parentItem.getData(); this.data = parentItem.getData();
} }
} }
return this.data;
}
/**
* 获取数据域
*
* @private
* @memberof PanelButtonModel
*/
public getDataArea() {
let xData = null;
let curLayoutModel = null;
Object.values(this.panel.layoutModelDetails).forEach((layoutModel: any) => {
if (layoutModel.name == this.name) {
curLayoutModel = layoutModel;
}
})
// 获取数据容器
if (curLayoutModel) {
const getDataArea = (cLayoutModel: any): any => {
let dataArea = null;
let parentLayoutModel = null;
Object.values(this.panel.layoutModelDetails).forEach((pLayoutModel: any) => {
if (pLayoutModel.name == cLayoutModel.parentName) {
parentLayoutModel = pLayoutModel;
if (parentLayoutModel.dataRegionType == 'SINGLEDATA' || parentLayoutModel.dataRegionType == 'MULTIDATA') {
dataArea = parentLayoutModel;
}
}
})
if (!dataArea && parentLayoutModel) {
dataArea = getDataArea(parentLayoutModel);
}
return dataArea;
}
xData = getDataArea(curLayoutModel);
// 获取激活部件
if (!xData && this.xDataControlName) {
Object.values(this.panel.layoutModelDetails).forEach((layoutModel: any) => {
if (layoutModel.name.toLowerCase() == this.xDataControlName.toLowerCase()) {
xData = layoutModel;
return
}
})
}
}
// 获取当前面板
if (!xData) {
xData = this.panel;
}
return xData;
} }
/** /**
...@@ -160,7 +220,6 @@ export class PanelButtonModel extends PanelDetailModel { ...@@ -160,7 +220,6 @@ export class PanelButtonModel extends PanelDetailModel {
* @memberof PanelButtonModel * @memberof PanelButtonModel
*/ */
public async load(context: any, viewParams: any) { public async load(context: any, viewParams: any) {
this.loadData(); this.computeActionAuthState();
this.calcActionItemAuthState();
} }
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册