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

增加计算面板按钮权限状态逻辑

上级 397ede00
......@@ -50,24 +50,20 @@ import CodeListService from "@service/app/codelist-service";
@Prop() public inputData?: any;
/**
* 代码表服务对象
* UI数据对象
*
* @type {CodeListService}
* @type {*}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public codeListService:CodeListService = new CodeListService({ $store:this.$store });
public data:any = {};
/**
* 详情模型集合
* 面板数据对象
*
* @type {*}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public detailsModel: any = {
<#list ctrl.getAllPSPanelItems() as panelItem>
${panelItem.name}: ${P.getPartCode(panelItem, 'ITEM_MODEL').code},
</#list>
};
public panelData:any = null;
/**
* 数据模型对象
......@@ -78,20 +74,34 @@ import CodeListService from "@service/app/codelist-service";
public dataModel:${srfclassname('${ctrl.codeName}')}Model = new ${srfclassname('${ctrl.codeName}')}Model();
/**
* UI数据对象
* 代码表服务对象
*
* @type {*}
* @type {CodeListService}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public data:any = {};
public codeListService:CodeListService = new CodeListService({ $store:this.$store });
<#if appde??>
/**
* 面板数据对象
* 界面UI服务对象
*
* @type {${srfclassname('${appde.getCodeName()}')}UIService}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public appUIService:${srfclassname('${appde.getCodeName()}')}UIService = new ${srfclassname('${appde.getCodeName()}')}UIService(this.$store);
</#if>
/**
* 详情模型集合
*
* @type {*}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public panelData:any = null;
public detailsModel: any = {
<#list ctrl.getAllPSPanelItems() as panelItem>
${panelItem.name}: ${P.getPartCode(panelItem, 'ITEM_MODEL').code},
</#list>
};
/**
* 值规则对象
......@@ -122,6 +132,7 @@ import CodeListService from "@service/app/codelist-service";
if(newVal){
this.computedUIData(newVal);
this.panelData = Util.deepCopy(newVal);
this.computeButtonState(newVal);
this.panelLogic({ name: '', newVal: null, oldVal: null });
this.$forceUpdate();
}
......@@ -141,6 +152,31 @@ import CodeListService from "@service/app/codelist-service";
}
}
/**
* 计算面板按钮权限状态
*
* @param {*} [data] 传入数据
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public computeButtonState(data:any){
// 若为项布局面板,存在parentRef
if(this.parentRef){
let targetData:any = this.parentRef.transformData(data);
if(this.detailsModel && Object.keys(this.detailsModel).length >0){
Object.keys(this.detailsModel).forEach((name:any) =>{
if(this.detailsModel[name] && this.detailsModel[name].uiaction && this.detailsModel[name].uiaction.dataaccaction && Object.is(this.detailsModel[name].itemType,"BUTTON")){
this.detailsModel[name].isPower = true;
let tempUIAction:any = JSON.parse(JSON.stringify(this.detailsModel[name].uiaction));
let result: any[] = ViewTool.calcActionItemAuthState(targetData,[tempUIAction],this.appUIService?this.appUIService:null);
this.detailsModel[name].visible = tempUIAction.visabled;
this.detailsModel[name].disabled = tempUIAction.disabled;
this.detailsModel[name].isPower = result[0] === 1 ? true : false;
}
})
}
}
}
/**
* 界面行为
*
......@@ -203,7 +239,7 @@ import CodeListService from "@service/app/codelist-service";
* 刷新
*
* @param {*} [opt={}]
* @memberof Main
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public refresh(opt: any = {}) {
if (this.parentRef.refresh && this.parentRef.refresh instanceof Function) {
......@@ -211,7 +247,6 @@ import CodeListService from "@service/app/codelist-service";
}
}
/**
* 设置变更面板编辑项的值
*
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册