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

解决表单动态隐藏和权限控制冲突问题

上级 54d26ae9
...@@ -11,7 +11,7 @@ export class FormButtonModel extends FormDetailModel { ...@@ -11,7 +11,7 @@ export class FormButtonModel extends FormDetailModel {
constructor(opts: any = {}) { constructor(opts: any = {}) {
super(opts); super(opts);
this.disabled = opts.disabled; this.$disabled = opts.disabled;
this.uiaction = opts.uiaction; this.uiaction = opts.uiaction;
} }
...@@ -21,7 +21,7 @@ export class FormButtonModel extends FormDetailModel { ...@@ -21,7 +21,7 @@ export class FormButtonModel extends FormDetailModel {
* @type {boolean} * @type {boolean}
* @memberof FormButtonModel * @memberof FormButtonModel
*/ */
public disabled:boolean = false; private $disabled:boolean = false;
/** /**
* 按钮对应的界面行为 * 按钮对应的界面行为
...@@ -31,4 +31,26 @@ export class FormButtonModel extends FormDetailModel { ...@@ -31,4 +31,26 @@ export class FormButtonModel extends FormDetailModel {
*/ */
public uiaction:any; public uiaction:any;
/**
* 是否启用
*
* @type {boolean}
* @memberof FormButtonModel
*/
public get disabled(): boolean {
return this.$disabled;
}
/**
* 设置是否启用
*
* @memberof FormButtonModel
*/
public set disabled(val: boolean) {
if(this.isPower) {
this.$disabled = val;
}
}
} }
\ No newline at end of file
...@@ -6,6 +6,14 @@ ...@@ -6,6 +6,14 @@
*/ */
export class FormDetailModel { export class FormDetailModel {
/**
* 是否有权限
*
* @type {boolean}
* @memberof FormDetailModel
*/
public isPower: boolean = true;
/** /**
* 成员标题 * 成员标题
* *
...@@ -44,7 +52,7 @@ export class FormDetailModel { ...@@ -44,7 +52,7 @@ export class FormDetailModel {
* @type {boolean} * @type {boolean}
* @memberof FormDetailModel * @memberof FormDetailModel
*/ */
public visible: boolean = true; public $visible: boolean = true;
/** /**
* 成员是否显示(旧) * 成员是否显示(旧)
...@@ -83,12 +91,33 @@ export class FormDetailModel { ...@@ -83,12 +91,33 @@ export class FormDetailModel {
this.detailType = !Object.is(opts.detailType, '') ? opts.detailType : ''; this.detailType = !Object.is(opts.detailType, '') ? opts.detailType : '';
this.form = opts.form ? opts.form : {}; this.form = opts.form ? opts.form : {};
this.name = !Object.is(opts.name, '') ? opts.name : ''; this.name = !Object.is(opts.name, '') ? opts.name : '';
this.visible = opts.visible ? true : false; this.$visible = opts.visible ? true : false;
this.oldVisible = opts.visible ? true : false; this.oldVisible = opts.visible ? true : false;
this.isShowCaption = opts.isShowCaption ? true : false; this.isShowCaption = opts.isShowCaption ? true : false;
this.isControlledContent = opts.isControlledContent ? true : false; this.isControlledContent = opts.isControlledContent ? true : false;
} }
/**
* 设置成员是否隐藏
*
* @memberof FormDetailModel
*/
public set visible(val: boolean) {
if(this.isPower) {
this.$visible = val;
}
}
/**
* 获取成员是否隐藏
*
* @memberof FormDetailModel
*/
public get visible() {
return this.$visible;
}
/** /**
* 设置显示与隐藏 * 设置显示与隐藏
* *
...@@ -96,7 +125,9 @@ export class FormDetailModel { ...@@ -96,7 +125,9 @@ export class FormDetailModel {
* @memberof FormDetailModel * @memberof FormDetailModel
*/ */
public setVisible(state: boolean): void { public setVisible(state: boolean): void {
this.visible = state; if(this.isPower) {
this.visible = state;
}
} }
/** /**
......
...@@ -252,9 +252,10 @@ export class ViewTool { ...@@ -252,9 +252,10 @@ export class ViewTool {
* @memberof ViewTool * @memberof ViewTool
*/ */
public static calcActionItemAuthState(data:any,ActionModel:any,UIService:any){ public static calcActionItemAuthState(data:any,ActionModel:any,UIService:any){
let result: any[] = [];
for (const key in ActionModel) { for (const key in ActionModel) {
if (!ActionModel.hasOwnProperty(key)) { if (!ActionModel.hasOwnProperty(key)) {
return; return result;
} }
const _item = ActionModel[key]; const _item = ActionModel[key];
if(_item && _item['dataaccaction'] && UIService){ if(_item && _item['dataaccaction'] && UIService){
...@@ -282,7 +283,9 @@ export class ViewTool { ...@@ -282,7 +283,9 @@ export class ViewTool {
_item.visabled = true; _item.visabled = true;
_item.disabled = false; _item.disabled = false;
} }
result.push(dataActionResult);
} }
} }
return result;
} }
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册