提交 8f8b6e89 编写于 作者: KK's avatar KK

权限引擎逻辑调整

上级 b2ed0b85
......@@ -93,6 +93,8 @@ export default class MobEditViewEngine extends ViewEngine {
public onFormLoad(arg: any): void {
this.view.$emit('load', arg);
this.view.$emit('viewdataschange', JSON.stringify({ action: 'load', status: 'success', data: arg }));
const newdata: boolean = !Object.is(arg.srfuf, '1');
this.calcToolbarItemState(newdata);
this.calcToolbarItemAuthState(arg);
}
......@@ -105,6 +107,8 @@ export default class MobEditViewEngine extends ViewEngine {
public onFormSave(arg: any): void {
this.view.$emit('save', arg);
this.view.$emit('viewdataschange', JSON.stringify({ action: 'save', status: 'success', data: arg }));
const newdata: boolean = !Object.is(arg.srfuf, '1');
this.calcToolbarItemState(newdata);
this.calcToolbarItemAuthState(arg);
}
......
......@@ -157,15 +157,16 @@ export default class ViewEngine {
*/
public calcToolbarItemState(state: boolean, dataaccaction?: any) {
const _this: any = this;
if (!_this.view.toolBarModels || Object.keys(_this.view.toolBarModels).length === 0) {
_this.view.toolbarModelList.forEach((tool:any) => {
if (!_this.view[tool] || Object.keys(_this.view[tool]).length === 0) {
return;
}
for (const key in _this.view.toolBarModels) {
if (!_this.view.toolBarModels.hasOwnProperty(key)) {
for (const key in _this.view[tool]) {
if (!_this.view[tool].hasOwnProperty(key)) {
return;
}
const _item = _this.view.toolBarModels[key];
const _item = _this.view[tool][key];
if (_item.uiaction && (Object.is(_item.uiaction.target, 'SINGLEKEY') || Object.is(_item.uiaction.target, 'MULTIKEY'))) {
_item.disabled = state;
}
......@@ -174,6 +175,7 @@ export default class ViewEngine {
_item.visabled = false;
}
}
});
}
/**
......@@ -192,7 +194,14 @@ export default class ViewEngine {
}
const _item = _this.view[tool][key];
if(_item && _item['dataaccaction'] && _this.view.appUIService && data && Object.keys(data).length >0){
let dataActionResult:any = _this.view.appUIService.getAllOPPrivs(data)[_item['dataaccaction']];
let dataActionResult:any;
if (_item.uiaction && (Object.is(_item.uiaction.target, 'NONE'))){
dataActionResult = _this.view.appUIService.getResourceOPPrivs(_item['dataaccaction']);
}else{
if(data && Object.keys(data).length >0){
dataActionResult= _this.view.appUIService.getAllOPPrivs(data)[_item['dataaccaction']];
}
}
// 无权限:0;有权限:1
if(dataActionResult === 0){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册