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

update:更新

上级 5a7024f6
...@@ -103,6 +103,7 @@ public class PageModel extends BaseModel{ ...@@ -103,6 +103,7 @@ public class PageModel extends BaseModel{
appUIAction.put("uIActionTag",UIAction.getUIActionTag()); appUIAction.put("uIActionTag",UIAction.getUIActionTag());
appUIAction.put("uIActionType",UIAction.getUIActionType()); appUIAction.put("uIActionType",UIAction.getUIActionType());
appUIAction.put("actionTarget",UIAction.getActionTarget()); appUIAction.put("actionTarget",UIAction.getActionTarget());
appUIAction.put("dataAccessAction",UIAction.getDataAccessAction());
toolbarItem.put("uIAction",appUIAction); toolbarItem.put("uIAction",appUIAction);
} }
} }
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
{{#page.viewToolBarItems}} {{#page.viewToolBarItems}}
toolbar: [ toolbar: [
{{#items}} {{#items}}
{ id:'{{id}}',name:'{{name}}',caption:'{{caption}}',groupExtractMode:'{{groupExtractMode}}',itemType:'{{itemType}}',noPrivDisplayMode:'{{noPrivDisplayMode}}',showIcon:{{showIcon}},showCaption:{{showCaption}},tooltip:'{{tooltip}}',disabled: false, visible: true, imgPath: '{{imgPath}}',iconClass: '{{iconClass}}',xDataControlName:'{{xDataControlName}}',{{#if uIAction}}uIAction:{codeName:'{{uIAction.codeName}}',fullCodeName:'{{uIAction.fullCodeName}}',uIActionMode:'{{uIAction.uIActionMode}}',actionTarget:'{{uIAction.actionTarget}}',uIActionTag:'{{uIAction.uIActionTag}}',uIActionType:'{{uIAction.uIActionType}}'}{{/if}} }, { id:'{{id}}',name:'{{name}}',caption:'{{caption}}',groupExtractMode:'{{groupExtractMode}}',itemType:'{{itemType}}',noPrivDisplayMode:'{{noPrivDisplayMode}}',showIcon:{{showIcon}},showCaption:{{showCaption}},tooltip:'{{tooltip}}',disabled: false, visible: true, imgPath: '{{imgPath}}',iconClass: '{{iconClass}}',xDataControlName:'{{xDataControlName}}',{{#if uIAction}}uIAction:{codeName:'{{uIAction.codeName}}',fullCodeName:'{{uIAction.fullCodeName}}',uIActionMode:'{{uIAction.uIActionMode}}',actionTarget:'{{uIAction.actionTarget}}',uIActionTag:'{{uIAction.uIActionTag}}',dataAccessAction:'{{uIAction.dataAccessAction}}',uIActionType:'{{uIAction.uIActionType}}'}{{/if}} },
{{/items}} {{/items}}
], ],
{{/page.viewToolBarItems}} {{/page.viewToolBarItems}}
......
...@@ -72,10 +72,10 @@ export class EditView extends MainView { ...@@ -72,10 +72,10 @@ export class EditView extends MainView {
* 表单事件 * 表单事件
* *
* @param {string} action * @param {string} action
* @param {*} data * @param {IParam[]} data
* @memberof EditView * @memberof EditView
*/ */
public formEvent(action: string, data: IParam): void { public formEvent(action: string, data: IParam[]): void {
if (Object.is(action, 'load')) { if (Object.is(action, 'load')) {
this.onFormLoad(data); this.onFormLoad(data);
} }
...@@ -90,32 +90,34 @@ export class EditView extends MainView { ...@@ -90,32 +90,34 @@ export class EditView extends MainView {
/** /**
* 表单加载完成 * 表单加载完成
* *
* @param {*} data * @param {IParam[]} data
* @memberof EditView * @memberof EditView
*/ */
public onFormLoad(data: IParam): void { public onFormLoad(data: IParam[]): void {
// 抛出数据
this.emit("onViewEvent", { tag: this.state.viewName, action: 'viewLoad', data: data });
// 设置工具栏状态 // 设置工具栏状态
const state: boolean = !Object.is(data.srfuf, '1'); const state: boolean = !Object.is(data[0].srfuf, '1');
this.setToolbarItemState(state); this.setToolbarItemState(state, data[0]);
} }
/** /**
* 表单保存完成 * 表单保存完成
* *
* @param {*} data * @param {IParam[]} data
* @memberof EditView * @memberof EditView
*/ */
public onFormSave(data: IParam): void { public onFormSave(data: IParam[]): void {
} }
/** /**
* 表单删除完成 * 表单删除完成
* *
* @param {*} data * @param {IParam[]} data
* @memberof EditView * @memberof EditView
*/ */
public onFormRemove(data: IParam): void { public onFormRemove(data: IParam[]): void {
} }
/** /**
......
...@@ -19,14 +19,17 @@ export class MainView extends ViewBase { ...@@ -19,14 +19,17 @@ export class MainView extends ViewBase {
* 设置工具栏项状态 * 设置工具栏项状态
* *
* @param {boolean} state 初始化状态 * @param {boolean} state 初始化状态
* @param {IParam} data 数据
* @return {*} * @return {*}
* @memberof MainView * @memberof MainView
*/ */
public setToolbarItemState(state: boolean) { public async setToolbarItemState(state: boolean, data?: IParam) {
if (!this.state.toolbar) { if (!this.state.toolbar) {
return; return;
} }
const appUIService = await this.getUIService();
for (const key in this.state.toolbar) { for (const key in this.state.toolbar) {
// 设置初始化状态
if (!this.state.toolbar.hasOwnProperty(key)) { if (!this.state.toolbar.hasOwnProperty(key)) {
return; return;
} }
...@@ -38,6 +41,43 @@ export class MainView extends ViewBase { ...@@ -38,6 +41,43 @@ export class MainView extends ViewBase {
if (item.noPrivDisplayMode && Object.is(item.noPrivDisplayMode, '6')) { if (item.noPrivDisplayMode && Object.is(item.noPrivDisplayMode, '6')) {
item.visible = false; item.visible = false;
} }
// 设置权限状态
if (item && item.uIAction && item.uIAction.dataAccessAction) {
let dataActionResult: any;
const { actionTarget, uIActionTag, dataAccessAction } = item.uIAction;
// 不需要数据的界面行为
if (item.uIAction && (Object.is(actionTarget, "NONE") || !actionTarget)) {
if (!actionTarget && Object.is(uIActionTag, "Save") && appUIService.isEnableDEMainState) {
if (data && Object.keys(data).length > 0) {
dataActionResult = appUIService.getAllOPPrivs(data, dataAccessAction);
}
} else {
dataActionResult = appUIService.getAllOPPrivs(undefined, dataAccessAction);
}
} else {
if (data && Object.keys(data).length > 0 && appUIService?.isEnableDEMainState) {
dataActionResult = appUIService.getAllOPPrivs(data, dataAccessAction);
} else {
dataActionResult = appUIService.getAllOPPrivs(undefined, dataAccessAction);
}
}
// 无权限:0;有权限:1
if (dataActionResult === 0) {
// 禁用:1;隐藏:2;隐藏且默认隐藏:6
if (item.noPrivDisplayMode === 1) {
item.disabled = true;
}
if ((item.noPrivDisplayMode === 2) || (item.noPrivDisplayMode === 6)) {
item.visible = false;
} else {
item.visible = true;
}
}
if (dataActionResult === 1) {
item.visible = true;
item.visible = false;
}
}
} }
} }
......
...@@ -202,10 +202,12 @@ export class MDView extends MainView { ...@@ -202,10 +202,12 @@ export class MDView extends MainView {
/** /**
* 多数据部件加载完成 * 多数据部件加载完成
* *
* @param {*} args * @param {IParam[]} data
* @memberof MDView * @memberof MDView
*/ */
public MDCtrlLoaded(args: any) { public MDCtrlLoaded(data: IParam[]) {
// 抛出数据
this.emit("onViewEvent", { tag: this.state.viewName, action: 'viewLoad', data: data });
// 设置工具栏状态 // 设置工具栏状态
this.setToolbarItemState(true); this.setToolbarItemState(true);
} }
...@@ -213,13 +215,15 @@ export class MDView extends MainView { ...@@ -213,13 +215,15 @@ export class MDView extends MainView {
/** /**
* 多数据部件选中数据 * 多数据部件选中数据
* *
* @param {*} args * @param {IParam[]} data
* @memberof MDView * @memberof MDView
*/ */
public selectionChange(args: any) { public selectionChange(data: IParam[]) {
// 抛出数据 // 抛出数据
this.emit("onViewEvent", { tag: this.state.viewName, action: 'selectionChange', data: args }); this.emit("onViewEvent", { tag: this.state.viewName, action: 'viewDataChange', data: data });
// 计算按钮权限 todo // 设置工具栏状态
const state: boolean = !Object.is(data[0]?.srfuf, '1');
this.setToolbarItemState(state, data[0]?.$DO);
} }
/** /**
......
...@@ -41,22 +41,6 @@ export class ViewBase { ...@@ -41,22 +41,6 @@ export class ViewBase {
*/ */
public declare xDataControl: IParam; public declare xDataControl: IParam;
/**
* 界面行为服务
*
* @type {(IParam | undefined)}
* @memberof ViewBase
*/
public appUIService: IParam | undefined;
/**
* 数据服务
*
* @type {(IParam | undefined)}
* @memberof ViewBase
*/
public appDataService: IParam | undefined;
/** /**
* Creates an instance of ViewBase. * Creates an instance of ViewBase.
* @param {*} options 配置参数 * @param {*} options 配置参数
...@@ -184,30 +168,26 @@ export class ViewBase { ...@@ -184,30 +168,26 @@ export class ViewBase {
} }
/** /**
*@description 使用UI服务 *@description 获取UI服务
* *
* @memberof ViewBase * @memberof ViewBase
*/ */
public useUIService() { public async getUIService() {
const { appEntityCodeName, context } = this.state; const { appEntityCodeName, context } = this.state;
if (appEntityCodeName) { if (appEntityCodeName) {
App.getUIService(appEntityCodeName.toLowerCase(), context).then((service: IParam) => { return await App.getUIService(appEntityCodeName.toLowerCase(), context);
this.appUIService = service;
})
} }
} }
/** /**
*@description 使用数据服务 *@description 获取数据服务
* *
* @memberof ViewBase * @memberof ViewBase
*/ */
public useDataService() { public async getDataService() {
const { appEntityCodeName, context } = this.state; const { appEntityCodeName, context } = this.state;
if (appEntityCodeName) { if (appEntityCodeName) {
App.getDataService(appEntityCodeName.toLowerCase(), context).then((service: IParam) => { return await App.getDataService(appEntityCodeName.toLowerCase(), context)
this.appDataService = service;
})
} }
} }
...@@ -243,10 +223,6 @@ export class ViewBase { ...@@ -243,10 +223,6 @@ export class ViewBase {
this.useViewContextParams(); this.useViewContextParams();
// 使用计数器服务 // 使用计数器服务
this.useCounterService(); this.useCounterService();
// 使用数据服务
this.useDataService();
// 使用UI服务
this.useUIService();
// 处理视图初始化 // 处理视图初始化
this.useViewInit(); this.useViewInit();
return { return {
......
...@@ -462,7 +462,7 @@ export class FormControl extends MainControl { ...@@ -462,7 +462,7 @@ export class FormControl extends MainControl {
); );
if (response.status && response.status == 200) { if (response.status && response.status == 200) {
this.state.data = response.data; this.state.data = response.data;
this.emit('ctrlEvent', { tag: this.props.name, action: 'load', data: response.data }); this.emit('ctrlEvent', { tag: this.props.name, action: 'load', data: [response.data] });
this.afterFormAction('load'); this.afterFormAction('load');
} }
} catch (error) { } catch (error) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册