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

工具栏操作标识权限

上级 43ffbe34
......@@ -106,6 +106,7 @@ export default class EditViewEngine extends ViewEngine {
this.setTabCaption(this.view.model.dataInfo,Object.is(arg.srfuf, '0'));
const newdata: boolean = !Object.is(arg.srfuf, '1');
this.calcToolbarItemState(newdata);
this.calcToolbarItemAuthState(this.transformData(arg));
}
/**
......@@ -120,6 +121,7 @@ export default class EditViewEngine extends ViewEngine {
this.setTabCaption(this.view.model.dataInfo,Object.is(arg.srfuf, '0'));
const newdata: boolean = !Object.is(arg.srfuf, '1');
this.calcToolbarItemState(newdata);
this.calcToolbarItemAuthState(this.transformData(arg));
this.view.$emit('save',arg);
this.view.$emit('viewdataschange',JSON.stringify({action:'save',status:'success',data:arg}));
}
......@@ -144,66 +146,10 @@ export default class EditViewEngine extends ViewEngine {
* @memberof EditViewEngine
*/
public doSysUIAction(tag: string, actionmode?: string): void {
// if (Object.is(tag, 'Help')) {
// this.doHelp();
// return;
// }
// if (Object.is(tag, 'SaveAndStart')) {
// this.doSaveAndStart();
// return;
// }
// if (Object.is(tag, 'SaveAndExit')) {
// this.doSaveAndExit();
// return;
// }
// if (Object.is(tag, 'SaveAndNew')) {
// this.doSaveAndNew();
// return;
// }
if (Object.is(tag, 'Save')) {
this.doSave();
return;
}
// if (Object.is(tag, 'Print')) {
// this.doPrint();
// return;
// }
// if (Object.is(tag, 'Copy')) {
// this.doCopy();
// return;
// }
// if (Object.is(tag, 'RemoveAndExit')) {
// this.doRemoveAndExit();
// return;
// }
// if (Object.is(tag, 'Refresh')) {
// this.doRefresh();
// return;
// }
// if (Object.is(tag, 'New')) {
// this.doNew();
// return;
// }
// if (Object.is(tag, 'FirstRecord')) {
// this.doMoveToRecord('first');
// return;
// }
// if (Object.is(tag, 'PrevRecord')) {
// this.doMoveToRecord('prev');
// return;
// }
// if (Object.is(tag, 'NextRecord')) {
// this.doMoveToRecord('next');
// return;
// }
// if (Object.is(tag, 'LastRecord')) {
// this.doMoveToRecord('last');
// return;
// }
// if (Object.is(tag, 'Exit') || Object.is(tag, 'Close')) {
// this.doExit();
// return;
// }
super.doSysUIAction(tag, actionmode);
}
......@@ -263,4 +209,18 @@ export default class EditViewEngine extends ViewEngine {
}
}
/**
* 转化数据
*
* @memberof EditViewEngine
*/
public transformData(arg:any){
if(!this.getForm() || !(this.getForm().transformData instanceof Function)){
return null;
}
let targetData:any = {};
this.getForm().transformData(arg,targetData);
return targetData;
}
}
\ No newline at end of file
......@@ -150,9 +150,9 @@ export default class ListViewEngine extends MDViewEngine {
arg.srfkeys = keys;
}
const grid: any = this.getMDCtrl();
if (grid) {
grid.remove(arg);
const list: any = this.getMDCtrl();
if (list) {
list.remove(arg);
}
}
......
......@@ -358,6 +358,9 @@ export default class MDViewEngine extends ViewEngine {
}
const state = args.length > 0 && !Object.is(args[0].srfkey, '') ? false : true;
this.calcToolbarItemState(state);
if(args && args.length > 0){
this.calcToolbarItemAuthState(this.transformData(args[0]));
}
}
/**
......@@ -436,4 +439,19 @@ export default class MDViewEngine extends ViewEngine {
return this.propertypanel;
}
/**
* 转化数据
*
* @memberof EditViewEngine
*/
public transformData(arg:any){
if(!this.getMDCtrl() || !(this.getMDCtrl().transformData instanceof Function)){
return null;
}
let targetData:any = {};
this.getMDCtrl().transformData(arg,targetData);
return targetData;
}
}
\ No newline at end of file
......@@ -169,6 +169,39 @@ export default class ViewEngine {
if (_item.uiaction && (Object.is(_item.uiaction.target, 'SINGLEKEY') || Object.is(_item.uiaction.target, 'MULTIKEY'))) {
_item.disabled = state;
}
if(_item.noprivdisplaymode && _item.noprivdisplaymode === 6){
_item.visabled = false;
}
}
}
/**
* 计算工具栏权限状态
*
* @param {boolean} state
* @param {*} [dataaccaction]
* @memberof ViewEngine
*/
public calcToolbarItemAuthState(data:any){
const _this: any = this;
for (const key in _this.view.toolBarModels) {
if (!_this.view.toolBarModels.hasOwnProperty(key)) {
return;
}
const _item = _this.view.toolBarModels[key];
if(_item && _item['dataaccaction'] && _this.view.appAuthService){
let dataActionResult:any = _this.view.appAuthService.getOPPrivs(data)['dataaccaction'];
// 无权限:0;有权限:1
if(!dataActionResult){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6
if(_item.noprivdisplaymode === 1){
_item.disabled = false;
}
if((_item.noprivdisplaymode === 2) || (_item.noprivdisplaymode === 6)){
_item.visabled = false;
}
}
}
}
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册