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

权限引擎逻辑调整

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