Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
a37628ec
提交
a37628ec
编写于
1月 06, 2022
作者:
zhangkang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update ui-service
上级
76a929ed
变更
18
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
809 行增加
和
55 行删除
+809
-55
AppEntityModel.java
...rc/main/java/cn/ibizlab/codegen/model/AppEntityModel.java
+11
-0
viewBaseConfig.hbs
.../templ/r7/@macro/front-end/view/common/viewBaseConfig.hbs
+5
-3
app-view-config.ts.hbs
...mpl/r7/app_{{apps}}/src/app/config/app-view-config.ts.hbs
+1
-0
i-open-view-service.ts
...{apps}}/src/core/interface/service/i-open-view-service.ts
+2
-2
app-global-action-service.ts
...s}}/src/core/logic/app-logic/app-global-action-service.ts
+98
-0
index.ts
...s/templ/r7/app_{{apps}}/src/core/logic/app-logic/index.ts
+2
-1
app-action-base.ts
..._{{apps}}/src/core/logic/app-ui-action/app-action-base.ts
+169
-0
app-backend-action.ts
...apps}}/src/core/logic/app-ui-action/app-backend-action.ts
+131
-8
app-front-action.ts
...{{apps}}/src/core/logic/app-ui-action/app-front-action.ts
+103
-8
app-sys-action.ts
...p_{{apps}}/src/core/logic/app-ui-action/app-sys-action.ts
+13
-14
index.ts
...mpl/r7/app_{{apps}}/src/core/logic/app-ui-action/index.ts
+3
-1
main-view-state.ts
...pps}}/src/core/modules/views/main-view/main-view-state.ts
+8
-0
ui-service-base.ts
...p_{{apps}}/src/core/service/ui-service/ui-service-base.ts
+21
-1
index.ts
...esources/templ/r7/app_{{apps}}/src/core/utils/ui/index.ts
+3
-1
uiaction-tool.ts
.../templ/r7/app_{{apps}}/src/core/utils/ui/uiaction-tool.ts
+85
-0
view-util.ts
...rces/templ/r7/app_{{apps}}/src/core/utils/ui/view-util.ts
+117
-0
{{appEntities}}-ui-service-base.ts.hbs
...ce/{{appEntities}}/{{appEntities}}-ui-service-base.ts.hbs
+30
-10
open-view-service.ts
.../r7/app_{{apps}}/src/utils/open-view/open-view-service.ts
+7
-6
未找到文件。
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/AppEntityModel.java
浏览文件 @
a37628ec
...
...
@@ -77,6 +77,17 @@ public class AppEntityModel extends BaseModel{
actionJson
.
put
(
"UIActionMode"
,
appDEUIAction
.
getUIActionMode
());
actionJson
.
put
(
"actionTarget"
,
appDEUIAction
.
getActionTarget
());
actionJson
.
put
(
"caption"
,
appDEUIAction
.
getCaption
());
actionJson
.
put
(
"frontProcessType"
,
appDEUIAction
.
getFrontProcessType
());
actionJson
.
put
(
"htmlPageUrl"
,
appDEUIAction
.
getHtmlPageUrl
());
actionJson
.
put
(
"refreshMode"
,
appDEUIAction
.
getRefreshMode
());
actionJson
.
put
(
"uILogicAttachMode"
,
appDEUIAction
.
getUILogicAttachMode
());
if
(
appDEUIAction
.
getPSAppDEMethod
()
!=
null
){
actionJson
.
put
(
"methodCodeName"
,
appDEUIAction
.
getPSAppDEMethod
().
getCodeName
());
}
// 后续行为标识拿不到
// if(appDEUIAction.getNextPSUIAction() != null){
// actionJson.put("nextActionCodeName",appDEUIAction.getNextPSUIAction().getCodeName());
// }
if
(
appDEUIAction
.
getFrontPSAppView
()
!=
null
){
actionJson
.
put
(
"frontPSAppView"
,
appDEUIAction
.
getFrontPSAppView
().
getCodeName
());
}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/@macro/front-end/view/common/viewBaseConfig.hbs
浏览文件 @
a37628ec
...
...
@@ -3,15 +3,17 @@
viewCaption: '
{{
page
.
caption
}}
',
height: '
{{
page
.
height
}}
',
width: '
{{
page
.
width
}}
',
viewMsgGroup: '
{{
page
.
psAppViewMsgGroup
}}
',
viewUIActions: '
{{
page
.
psAppViewUIActions
}}
',
"appEntityName":"
{{
page
.
appEntity
.
codeName
}}
",
{{!-- viewMsgGroup: '{{page.psAppViewMsgGroup}}', --}}
{{!-- viewUIActions: '{{page.psAppViewUIActions}}', --}}
viewSysCss: '
{{
page
.
psSysCss
}}
',
viewSysImage: '
{{
page
.
psSysImage
}}
',
{{!-- viewSysImage: '{{page.psSysImage}}', --}}
subCaption: '
{{
page
.
subCaption
}}
',
viewType: '
{{
page
.
viewType
}}
',
viewStyle: '
{{
page
.
viewStyle
}}
',
showCaptionBar: '
{{
page
.
viewStyle
}}
',
xDataControlName:'
{{
page
.
xDataControlName
}}
',
openDataViewName:'ExampleEditorEditView',
viewToolbarModel: [
{{#
page
.
viewToolBarItems
}}
{{#
items
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/app/config/app-view-config.ts.hbs
浏览文件 @
a37628ec
...
...
@@ -5,6 +5,7 @@ export const AppViewConfig:IParam = {
"
{{
appView
.
codeName
}}
":{
"name": "
{{
appView
.
name
}}
",
"codeName": "
{{
appView
.
codeName
}}
",
"appEntityName":"
{{
appView
.
appEntity
.
codeName
}}
",
"openMode": "
{{#if
appView
.
openMode
}}{{
appView
.
openMode
}}{{else}}
INDEXVIEWTAB
{{/if}}
",
"redirectView":
{{
appView
.
redirectView
}}
,
"deResPaths": [
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/interface/service/i-open-view-service.ts
浏览文件 @
a37628ec
import
{
IParam
,
ViewDetail
}
from
"@core"
;
import
{
Subject
}
from
'rxjs'
;
/**
* @description 打开视图服务接口
* @export
...
...
@@ -14,5 +14,5 @@ export interface IOpenViewService {
* @return {*} {*}
* @memberof IOpenViewService
*/
openView
(
view
:
ViewDetail
,
params
:
IParam
):
any
;
openView
(
view
:
ViewDetail
,
params
:
IParam
):
Subject
<
any
>
|
undefined
;
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/logic/app-logic/app-global-action-service.ts
0 → 100644
浏览文件 @
a37628ec
import
{
IContext
,
IParam
,
ViewUtil
}
from
"@core"
;
/**
* 全局界面行为服务
*
* @export
* @class AppGlobalActionService
*/
export
class
AppGlobalActionService
{
/**
* 单例变量声明
*
* @private
* @static
* @type {AppGlobalActionService}
* @memberof AppGlobalActionService
*/
private
static
AppGlobalActionService
:
AppGlobalActionService
;
/**
* 获取 AppGlobalActionService 单例对象
*
* @static
* @returns {AppGlobalActionService}
* @memberof AppGlobalActionService
*/
public
static
getInstance
():
AppGlobalActionService
{
if
(
!
AppGlobalActionService
.
AppGlobalActionService
)
{
AppGlobalActionService
.
AppGlobalActionService
=
new
AppGlobalActionService
();
}
return
this
.
AppGlobalActionService
;
}
/**
* 执行全局界面行为
*
* @param {IParam} uiAction
* @param {{ context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment: IParam }} params
* @memberof AppGlobalActionService
*/
public
executeGlobalAction
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
})
{
const
tag
=
uiAction
.
uIActionTag
;
switch
(
tag
)
{
case
"Edit"
:
this
.
Edit
(
params
);
break
;
case
"New"
:
this
.
New
(
params
);
break
;
default
:
console
.
log
(
`未支持
${
tag
}
`
);
}
}
/**
* 编辑
*
* @param {{ context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment: IParam }} params
* @return {*}
* @memberof AppGlobalActionService
*/
public
Edit
(
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
})
{
const
{
actionEnvironment
}
=
params
if
(
!
actionEnvironment
?.
viewState
?.
editDataViewName
)
{
return
;
}
const
viewName
=
actionEnvironment
?.
viewState
?.
editDataViewName
;
const
view
=
App
.
getViewInfo
(
viewName
);
if
(
!
view
)
{
return
;
}
ViewUtil
.
openData
(
view
,
params
);
}
/**
* 新建
*
* @param {{ context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment: IParam }} params
* @return {*}
* @memberof AppGlobalActionService
*/
public
New
(
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
})
{
const
{
actionEnvironment
}
=
params
if
(
!
actionEnvironment
?.
viewState
?.
openDataViewName
)
{
return
;
}
const
viewName
=
actionEnvironment
?.
viewState
?.
openDataViewName
;
const
view
=
App
.
getViewInfo
(
viewName
);
if
(
!
view
)
{
return
;
}
ViewUtil
.
newData
(
view
,
params
);
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/logic/app-logic/index.ts
浏览文件 @
a37628ec
export
*
from
'./app-func-service'
;
\ No newline at end of file
export
*
from
'./app-func-service'
;
export
*
from
'./app-global-action-service'
;
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/logic/app-ui-action/app-action-base.ts
0 → 100644
浏览文件 @
a37628ec
import
{
IContext
,
IParam
}
from
"@core"
;
import
{
AppUIAction
}
from
"."
;
export
interface
ActionParams
{
/**
* 行为上下文
*
* @type {IParam}
* @memberof ActionParams
*/
context
:
IParam
,
/**
* 行为视图参数
*
* @type {IParam}
* @memberof ActionParams
*/
viewParams
:
IParam
,
/**
* 行为数据
*
* @type {IParam}
* @memberof ActionParams
*/
data
:
any
}
export
interface
UIActionResult
{
/**
* 是否成功
*
* @type {*}
* @memberof UIActionResult
*/
ok
:
boolean
;
/**
* 返回数据对象
*
* @type {*}
* @memberof UIActionResult
*/
result
:
any
;
}
/**
* 前台界面行为
*
* @export
* @class AppFrontAction
*/
export
class
AppActionBase
{
/**
* 获取界面服务
*
* @static
* @param {IParam} actionEnvironment
* @return {*}
* @memberof AppActionBase
*/
public
static
async
getUIService
(
actionEnvironment
:
IParam
)
{
const
entityName
=
actionEnvironment
?.
viewState
?.
appEntityName
;
if
(
!
entityName
)
{
console
.
log
(
"实体名称不存在"
);
return
;
}
const
UIService
=
await
App
.
getUIService
(
entityName
.
toLowerCase
());
if
(
!
UIService
)
{
console
.
log
(
"界面服务不存在"
);
return
}
return
UIService
;
}
/**
* 根据数据目标处理行为参数
*
* @param {string} ActionTarget
* @param { context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment: IParam } params
* @memberof AppFrontAction
*/
public
static
handleActionTarget
(
ActionTarget
:
string
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
}):
IParam
{
// todo
return
{};
}
/**
* 处理行为参数 导航参数
*
* @static
* @param {IParam} uiAction
* @param { context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment: IParam } params
* @memberof AppFrontAction
*/
public
static
handleActionParam
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
},
data
:
IParam
):
ActionParams
{
// todo
return
{
context
:
{},
viewParams
:
{},
data
:
{}
};
}
/**
* 执行界面逻辑
*
* @static
* @param {IParam} uiAction
* @param { context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment: IParam } params
* @memberof AppFrontAction
*/
public
static
async
executeUILogic
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
})
{
// todo
}
/**
* 执行后附加操作
*
* @static
* @param {IParam} uiAction
* @param { context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment: IParam } params
* @memberof AppFrontAction
*/
public
static
async
afterAction
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
},
data
:
IParam
)
{
const
{
actionEnvironment
}
=
params
;
// 刷新视图
if
(
uiAction
.
reloadData
&&
actionEnvironment
&&
actionEnvironment
.
refresh
&&
actionEnvironment
.
refresh
instanceof
Function
)
{
actionEnvironment
.
refresh
(
data
);
}
// 关闭视图
if
(
uiAction
.
closeEditView
)
{
actionEnvironment
.
closeView
(
null
);
}
// 执行界面逻辑
if
(
Object
.
is
(
uiAction
?.
uILogicAttachMode
,
'AFTER'
))
{
this
.
executeUILogic
(
uiAction
,
params
);
}
// 后续界面行为 todo
if
(
!
uiAction
.
nextActionCodeName
)
{
return
;
}
const
UIService
=
await
this
.
getUIService
(
actionEnvironment
);
if
(
!
UIService
.
getUIActionModel
||
!
(
UIService
.
getUIActionModel
instanceof
Function
))
{
return
;
}
const
actionModel
=
UIService
.
getUIActionModel
(
uiAction
.
nextActionCodeName
);
if
(
!
actionModel
)
{
console
.
log
(
"后续行为Model获取失败"
);
return
;
}
// 参数合并 todo
AppUIAction
.
execute
(
actionModel
,
params
);
}
/**
* 执行界面行为
*
* @static
* @param {IParam} uiAction 界面行为对象
* @param { context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment:IParam} params { context: 上下文对象, viewParams: 视图参数, data: 当前激活数据, event: 事件源对象, actionEnvironment:操作环境}
* @memberof AppBackendAction
*/
public
static
async
execute
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
})
{
const
{
actionEnvironment
}
=
params
;
const
UIService
=
await
this
.
getUIService
(
actionEnvironment
);
const
actionName
=
uiAction
.
codeName
;
if
(
UIService
[
actionName
]
&&
typeof
UIService
[
actionName
]
===
'function'
)
{
UIService
[
actionName
](
params
);
}
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/logic/app-ui-action/app-backend-action.ts
浏览文件 @
a37628ec
import
{
IContext
,
IParam
}
from
"@core"
;
import
{
IContext
,
IParam
,
UIActionTool
}
from
"@core"
;
import
{
ActionParams
,
AppActionBase
,
UIActionResult
}
from
"./app-action-base"
;
/**
* 后台界面行为
...
...
@@ -6,19 +7,141 @@ import { IContext, IParam } from "@core";
* @export
* @class AppBackendAction
*/
export
class
AppBackendAction
{
export
class
AppBackendAction
extends
AppActionBase
{
/**
* 执行后台界面行为
* 调用后台接口
*
* @memberof AppBackendAction
*/
public
static
async
doBackendAction
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
},
actionParams
:
ActionParams
):
Promise
<
UIActionResult
>
{
try
{
const
{
context
,
actionEnvironment
}
=
params
;
const
entityName
=
actionEnvironment
?.
viewState
?.
appEntityName
;
if
(
!
entityName
)
{
console
.
log
(
"实体名称不存在"
);
return
{
ok
:
false
,
result
:
null
};
}
const
methodCodeName
:
string
=
uiAction
.
methodCodeName
;
if
(
!
methodCodeName
)
{
console
.
log
(
"实体行为不存在"
);
return
{
ok
:
false
,
result
:
null
};
}
// 获取实体服务
const
dataService
=
await
App
.
getDataService
(
entityName
.
toLowerCase
(),
context
)
// 获取实体行为名称
const
response
=
await
dataService
[
methodCodeName
](
context
,
actionParams
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
if
(
response
&&
response
.
ok
)
{
this
.
doSuccessMessage
(
uiAction
);
resolve
({
ok
:
true
,
result
:
response
.
data
});
}
else
{
reject
({
ok
:
false
,
result
:
response
.
data
});
}
})
}
catch
(
error
)
{
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
reject
({
ok
:
false
,
result
:
error
});
})
}
}
/**
* 打开视图
*
* @static
* @param {IParam} uiAction 界面行为对象
* @param {context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment:IParam} params { context: 上下文对象, viewParams: 视图参数, data: 当前激活数据, event: 事件源对象, actionEnvironment:操作环境}
* @param {IUIAction} actionModel
* @param {ViewDetail} view
* @memberof AppFrontAction
*/
public
static
openSelectView
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
},
actionParams
:
ActionParams
):
Promise
<
UIActionResult
>
{
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
const
{
context
,
viewParams
}
=
params
;
const
{
frontPSAppView
}
=
uiAction
;
if
(
!
frontPSAppView
)
{
console
.
log
(
"模型视图名称不存在"
);
return
resolve
({
ok
:
false
,
result
:
null
});
}
// 根据视图名称 获取视图详情
const
view
=
App
.
getViewInfo
(
frontPSAppView
);
if
(
!
view
)
{
console
.
log
(
"视图不存在"
);
return
resolve
({
ok
:
false
,
result
:
null
});
}
//打开视图
const
subject
=
App
.
getOpenViewService
().
openView
(
view
,
{
context
:
context
,
viewParams
:
viewParams
,
})
subject
?.
subscribe
((
result
:
any
)
=>
{
if
(
!
result
||
!
Object
.
is
(
result
.
ret
,
'OK'
))
{
reject
({
ok
:
false
,
result
:
null
});
return
;
}
return
resolve
({
ok
:
true
,
result
:
result
.
data
});
});
})
}
/**
* 自定义确认消息
*
* @param {IParam} uiAction
* @memberof AppBackendAction
*/
public
static
async
execute
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
})
{
// TODO 执行后台界面行为
console
.
log
(
uiAction
,
params
);
public
static
doConfirmMessage
(
uiAction
:
IParam
)
{
if
(
uiAction
.
enableConfirm
&&
uiAction
.
confirmMsg
)
{
// TODO
}
}
/**
* 成功提示消息
*
* @static
* @param {IParam} uiAction
* @memberof AppBackendAction
*/
public
static
doSuccessMessage
(
uiAction
:
IParam
)
{
if
(
uiAction
.
showBusyIndicator
&&
uiAction
.
successMsg
)
{
// TODO
}
}
/**
* 执行前台行为
*
* @param {IParam} uiAction
* @memberof AppFrontAction
*/
public
static
async
doAction
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
})
{
if
(
Object
.
is
(
uiAction
?.
uILogicAttachMode
,
'REPLACE'
))
{
// 界面逻辑替换当前行为
return
this
.
executeUILogic
(
uiAction
,
params
);
}
// 消息确认提示
this
.
doConfirmMessage
(
uiAction
);
// 根据行为目标 合并行为参数
const
data
=
this
.
handleActionTarget
(
uiAction
.
actionTarget
,
params
);
// 处理行为参数 导航参数、数据项、信息项、参数项
const
actionParams
=
this
.
handleActionParam
(
uiAction
,
params
,
data
);
// 执行行为
let
result
:
UIActionResult
|
undefined
=
undefined
;
if
(
uiAction
.
frontPSAppView
)
{
const
{
ok
,
result
:
_result
}
=
await
this
.
openSelectView
(
uiAction
,
params
,
actionParams
);
if
(
ok
)
{
// 处理参数 todo
result
=
await
this
.
doBackendAction
(
uiAction
,
params
,
_result
);
}
}
else
{
result
=
await
this
.
doBackendAction
(
uiAction
,
params
,
actionParams
);
}
// 后续行为 ok为true 则行为执成功
if
(
result
?.
ok
)
{
this
.
afterAction
(
uiAction
,
params
,
result
);
}
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/logic/app-ui-action/app-front-action.ts
浏览文件 @
a37628ec
import
{
IContext
,
IParam
}
from
"@core"
;
import
{
ActionParams
,
AppActionBase
,
UIActionResult
}
from
"./app-action-base"
;
/**
* 前台界面行为
*
* @export
* @class AppFrontAction
*/
export
class
AppFrontAction
{
export
class
AppFrontAction
extends
AppActionBase
{
/**
*
执行前台界面行为
*
打开视图
*
* @static
* @param {I
Param} uiAction 界面行为对象
* @param {
context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment:IParam} params { context: 上下文对象, viewParams: 视图参数, data: 当前激活数据, event: 事件源对象, actionEnvironment:操作环境}
* @memberof App
Backend
Action
* @param {I
UIAction} actionModel
* @param {
ViewDetail} view
* @memberof App
Front
Action
*/
public
static
async
execute
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
})
{
// TODO 前台界面行为
console
.
log
(
uiAction
,
params
);
public
static
openView
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
},
actionParams
:
ActionParams
):
Promise
<
UIActionResult
>
{
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
const
{
context
,
viewParams
}
=
params
;
const
{
frontPSAppView
}
=
uiAction
;
if
(
!
frontPSAppView
)
{
console
.
log
(
"模型视图名称不存在"
);
return
reject
({
ok
:
false
,
result
:
null
});
}
// 根据视图名称 获取视图详情
const
view
=
App
.
getViewInfo
(
frontPSAppView
);
if
(
!
view
)
{
console
.
log
(
"视图不存在"
);
return
reject
({
ok
:
false
,
result
:
null
});
}
//打开视图
const
subject
=
App
.
getOpenViewService
().
openView
(
view
,
{
context
:
context
,
viewParams
:
viewParams
,
})
if
(
subject
)
{
subject
.
subscribe
((
result
:
any
)
=>
{
if
(
!
result
||
!
Object
.
is
(
result
.
ret
,
'OK'
))
{
reject
({
ok
:
false
,
result
:
null
})
return
;
}
return
resolve
({
ok
:
true
,
result
:
result
.
data
});
});
}
else
{
return
resolve
({
ok
:
true
,
result
:
null
});
}
})
}
/**
* 打开URL
*
* @param {IParam} uiAction
* @param { context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment: IParam } params
* @memberof AppFrontAction
*/
public
static
openHTMLPage
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
}):
UIActionResult
{
const
{
htmlPageUrl
}
=
uiAction
;
if
(
!
htmlPageUrl
)
{
return
{
ok
:
false
,
result
:
null
};
}
window
.
open
(
htmlPageUrl
,
'_blank'
)
return
{
ok
:
true
,
result
:
null
}
}
/**
* 根据行为类型执行对应行为
*
* @param {IParam} uiAction
* @memberof AppFrontAction
*/
public
static
async
doActionByFrontProcessType
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
},
actionParams
:
ActionParams
):
Promise
<
UIActionResult
>
{
switch
(
uiAction
.
frontProcessType
)
{
case
'WIZARD'
:
case
'TOP'
:
return
this
.
openView
(
uiAction
,
params
,
actionParams
)
case
'OPENHTMLPAGE'
:
return
this
.
openHTMLPage
(
uiAction
,
params
);
case
'OTHER'
:
console
.
log
(
"暂不支持用户自定义"
);
return
{
ok
:
false
,
result
:
null
};
default
:
return
{
ok
:
false
,
result
:
null
};
}
}
/**
* 执行前台行为
*
* @param {IParam} uiAction
* @memberof AppFrontAction
*/
public
static
async
doAction
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
})
{
if
(
Object
.
is
(
uiAction
?.
uILogicAttachMode
,
'REPLACE'
))
{
// 界面逻辑替换当前行为
return
this
.
executeUILogic
(
uiAction
,
params
);
}
// 根据行为目标 合并行为参数
const
data
=
this
.
handleActionTarget
(
uiAction
.
actionTarget
,
params
);
// 处理行为参数 导航参数、数据项、信息项、参数项
const
actionParams
=
this
.
handleActionParam
(
uiAction
,
params
,
data
);
// 执行行为
const
{
ok
,
result
}
=
await
this
.
doActionByFrontProcessType
(
uiAction
,
params
,
actionParams
);
// 后续行为 ok为true 则行为执成功
if
(
ok
)
{
this
.
afterAction
(
uiAction
,
params
,
result
);
}
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/logic/app-ui-action/app-sys-action.ts
浏览文件 @
a37628ec
import
{
IContext
,
IParam
}
from
"@core"
;
import
{
AppGlobalActionService
,
IContext
,
IParam
}
from
"@core"
;
/**
* 系统预置界面行为
...
...
@@ -8,17 +8,16 @@ import { IContext, IParam } from "@core";
*/
export
class
AppSysAction
{
/**
* 执行预置界面行为
*
* @static
* @param {IParam} uiAction 界面行为对象
* @param { context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment:IParam} params { context: 上下文对象, viewParams: 视图参数, data: 当前激活数据, event: 事件源对象, actionEnvironment:操作环境}
* @memberof AppBackendAction
*/
public
static
async
execute
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
})
{
// TODO 预置界面行为
console
.
log
(
uiAction
,
params
);
}
/**
* 执行预置界面行为
*
* @static
* @param {IParam} uiAction 界面行为对象
* @param { context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment:IParam} params { context: 上下文对象, viewParams: 视图参数, data: 当前激活数据, event: 事件源对象, actionEnvironment:操作环境}
* @memberof AppBackendAction
*/
public
static
async
execute
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
})
{
console
.
log
(
uiAction
,
params
);
AppGlobalActionService
.
getInstance
().
executeGlobalAction
(
uiAction
,
params
)
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/logic/app-ui-action/index.ts
浏览文件 @
a37628ec
export
*
from
'./app-ui-action'
;
\ No newline at end of file
export
*
from
'./app-ui-action'
;
export
*
from
'./app-front-action'
;
export
*
from
'./app-backend-action'
;
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/views/main-view/main-view-state.ts
浏览文件 @
a37628ec
...
...
@@ -14,4 +14,12 @@ export interface MainViewState extends ViewStateBase {
* @memberof MainViewState
*/
controlsAction
:
Record
<
string
,
ControlAction
>
;
/**
* 视图实体名称
*
* @type {string}
* @memberof MainViewState
*/
appEntityName
:
string
;
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/service/ui-service/ui-service-base.ts
浏览文件 @
a37628ec
...
...
@@ -18,7 +18,6 @@ export class UIServiceBase {
protected
context
:
IParam
;
/**
* Creates an instance of UIServiceBase.
*
* @param {*} [opts={}]
* @memberof UIServiceBase
...
...
@@ -27,4 +26,25 @@ export class UIServiceBase {
this
.
context
=
context
;
}
/**
* 界面行为模型对象
*
* @type {*}
* @memberof UIServiceBase
*/
public
uiActionModes
:
any
=
{};
/**
*
* 获取界面行为模型对象
*
* @param {string} actionName
* @memberof UIServiceBase
*/
public
getUIActionModel
(
actionName
:
string
)
{
if
(
!
actionName
)
{
return
;
}
return
this
.
uiActionModes
[
actionName
]
?
this
.
uiActionModes
[
actionName
]
:
null
;
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/utils/ui/index.ts
浏览文件 @
a37628ec
export
{
RouteUtil
}
from
'./route-util'
;
export
{
UIUtil
}
from
'./ui-util'
;
\ No newline at end of file
export
{
UIUtil
}
from
'./ui-util'
;
export
{
UIActionTool
}
from
'./uiaction-tool'
;
export
{
ViewUtil
}
from
'./view-util'
;
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/utils/ui/uiaction-tool.ts
0 → 100644
浏览文件 @
a37628ec
export
class
UIActionTool
{
/**
* 格式化数据
*
* @private
* @static
* @param {*} actionTarget
* @param {*} args
* @param parentContext
* @param parentParams
* @param {*} _params
* @returns {*}
* @memberof UIActionTool
*/
public
static
formatDataActionData
(
actionTarget
:
any
,
args
:
any
,
parentContext
:
any
,
parentParams
:
any
,
_params
:
any
):
any
{
const
_data
:
any
=
{};
if
(
Object
.
is
(
actionTarget
,
'SINGLEKEY'
)
||
Object
.
is
(
actionTarget
,
'NONE'
)
||
Object
.
is
(
actionTarget
,
'SINGLEDATA'
)
)
{
const
[
arg
]
=
args
;
Object
.
keys
(
_params
).
forEach
((
name
:
string
)
=>
{
let
hasProperty
=
true
;
if
(
!
name
)
{
return
;
}
let
value
:
string
|
null
=
_params
[
name
];
if
(
value
&&
typeof
value
===
'string'
&&
value
.
startsWith
(
'%'
)
&&
value
.
endsWith
(
'%'
))
{
const
key
=
value
.
substring
(
1
,
value
.
length
-
1
);
if
(
arg
&&
arg
.
hasOwnProperty
(
key
)
&&
(
Object
.
is
(
actionTarget
,
'SINGLEKEY'
)
||
Object
.
is
(
actionTarget
,
'SINGLEDATA'
)
||
Object
.
is
(
actionTarget
,
'NONE'
))
)
{
value
=
arg
[
key
]
!==
null
&&
arg
[
key
]
!==
undefined
?
arg
[
key
]
:
null
;
}
else
if
(
parentContext
&&
parentContext
.
hasOwnProperty
(
key
))
{
value
=
parentContext
[
key
]
!==
null
&&
parentContext
[
key
]
!==
undefined
?
parentContext
[
key
]
:
null
;
}
else
if
(
parentParams
&&
parentParams
.
hasOwnProperty
(
key
))
{
value
=
parentParams
[
key
]
!==
null
&&
parentParams
[
key
]
!==
undefined
?
parentParams
[
key
]
:
null
;
}
else
{
hasProperty
=
false
;
}
}
if
(
hasProperty
)
{
Object
.
assign
(
_data
,
{
[
name
.
toLowerCase
()]:
value
});
}
});
}
else
if
(
Object
.
is
(
actionTarget
,
'MULTIKEY'
))
{
Object
.
keys
(
_params
).
forEach
((
name
:
string
)
=>
{
let
noPropertyNum
=
0
;
if
(
!
name
)
{
return
;
}
let
value
:
string
|
null
=
_params
[
name
];
const
values
:
any
[]
=
[];
if
(
value
&&
typeof
value
===
'string'
&&
value
.
startsWith
(
'%'
)
&&
value
.
endsWith
(
'%'
))
{
const
key
=
value
.
substring
(
1
,
value
.
length
-
1
);
args
.
forEach
((
arg
:
any
)
=>
{
if
(
arg
&&
arg
.
hasOwnProperty
(
key
))
{
value
=
arg
[
key
]
!==
null
&&
arg
[
key
]
!==
undefined
?
arg
[
key
]
:
null
;
}
else
if
(
parentContext
&&
parentContext
.
hasOwnProperty
(
key
))
{
value
=
parentContext
[
key
]
!==
null
&&
parentContext
[
key
]
!==
undefined
?
parentContext
[
key
]
:
null
;
}
else
if
(
parentParams
&&
parentParams
.
hasOwnProperty
(
key
))
{
value
=
parentParams
[
key
]
!==
null
&&
parentParams
[
key
]
!==
undefined
?
parentParams
[
key
]
:
null
;
}
else
{
value
=
null
;
noPropertyNum
++
;
}
values
.
push
(
value
);
});
}
if
(
values
.
length
!==
noPropertyNum
)
{
Object
.
assign
(
_data
,
{
[
name
.
toLowerCase
()]:
values
.
length
>
0
?
values
.
join
(
','
)
:
value
});
}
});
}
return
_data
;
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/utils/ui/view-util.ts
0 → 100644
浏览文件 @
a37628ec
import
{
IContext
,
IParam
,
ViewDetail
}
from
"@core"
;
export
class
ViewUtil
{
/**
* 打开新建数据视图
*
* @param {any[]} args 数据参数
* @param {*} actionEnvironment 视图容器对象
* @param {*} fullargs 全量数据
* @param {*} params 额外参数
* @param {*} $event 事件源对象
* @param {*} actionEnvironment 数据部件
*/
public
static
async
newData
(
view
:
ViewDetail
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
})
{
const
{
context
,
viewParams
,
data
,
event
,
actionEnvironment
}
=
params
if
(
view
)
{
const
_data
:
any
=
{};
// if (data[0].srfsourcekey) {
// data.srfsourcekey = args[0].srfsourcekey;
// }
// if (fullargs && (fullargs as any).copymode) {
// Object.assign(data, { copymode: (fullargs as any).copymode });
// }
// 删除上下文引用视图主键 todo
// if (
// view.getPSAppDataEntity() &&
// tempContext[(view.getPSAppDataEntity() as IPSAppDataEntity)?.codeName.toLowerCase()]
// ) {
// delete tempContext[(view.getPSAppDataEntity() as IPSAppDataEntity)?.codeName.toLowerCase()];
// }
// if (args.length > 0) {
// Object.assign(tempContext, args[0]);
// }
// 导航参数 todo
// if (
// newviewRef.getPSNavigateContexts() &&
// (newviewRef.getPSNavigateContexts() as IPSNavigateContext[]).length > 0
// ) {
// const localContext = Util.formatNavParam(newviewRef.getPSNavigateContexts());
// const _context: any = Util.computedNavData(
// fullargs[0],
// actionEnvironment.context,
// actionEnvironment.viewParam,
// localContext,
// );
// Object.assign(tempContext, _context);
// }
// if (newviewRef.getPSNavigateParams() && (newviewRef.getPSNavigateParams() as IPSNavigateParam[]).length > 0) {
// const localViewParam = Util.formatNavParam(newviewRef.getPSNavigateParams());
// const _param: any = Util.computedNavData(
// fullargs[0],
// actionEnvironment.context,
// actionEnvironment.viewParam,
// localViewParam,
// );
// Object.assign(data, _param);
// }
// 关闭视图回调
const
callback
:
Function
=
(
result
:
any
,
actionEnvironment
:
any
)
=>
{
if
(
!
result
||
!
Object
.
is
(
result
.
ret
,
'OK'
))
{
return
;
}
if
(
!
actionEnvironment
||
!
(
actionEnvironment
.
refresh
instanceof
Function
))
{
return
;
}
actionEnvironment
.
refresh
(
result
.
datas
);
};
const
subject
=
App
.
getOpenViewService
().
openView
(
view
,
{
context
:
context
,
viewParams
:
viewParams
})
subject
?.
subscribe
((
result
)
=>
{
if
(
!
result
||
!
Object
.
is
(
result
.
ret
,
'OK'
))
{
return
;
}
callback
(
result
,
actionEnvironment
);
})
}
}
/**
*
*
* @static
* @param {ViewDetail} view
* @memberof ViewUtil
*/
public
static
async
openData
(
view
:
ViewDetail
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
})
{
const
{
context
,
viewParams
,
data
,
event
,
actionEnvironment
}
=
params
if
(
view
)
{
// const _data: any = {};
const
callback
:
Function
=
(
result
:
any
,
actionEnvironment
:
any
)
=>
{
if
(
!
result
||
!
Object
.
is
(
result
.
ret
,
'OK'
))
{
return
;
}
if
(
!
actionEnvironment
||
!
(
actionEnvironment
.
refresh
instanceof
Function
))
{
return
;
}
actionEnvironment
.
refresh
(
result
.
datas
);
};
const
subject
=
App
.
getOpenViewService
().
openView
(
view
,
{
context
:
context
,
viewParams
:
viewParams
});
subject
?.
subscribe
((
result
)
=>
{
if
(
!
result
||
!
Object
.
is
(
result
.
ret
,
'OK'
))
{
return
;
}
callback
(
result
,
actionEnvironment
);
})
}
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ui-service/{{appEntities}}/{{appEntities}}-ui-service-base.ts.hbs
浏览文件 @
a37628ec
import { IParam, UIServiceBase } from '@core';
import { AppFrontAction, AppBackendAction } from '@core';
/**
*
{{
appEntity
.
logicName
}}
UI服务对象基类
*
...
...
@@ -22,7 +22,27 @@ export class {{pascalCase appEntity.codeName}}UIServiceBase extends UIServiceBas
{{!-- 遍历界面行为 --}}
{{
~#
each
appEntity
.
appDEUIActions
as
|
appDEUIAction
|
~
}}
public uiActionModes = {
{{
~#
each
appEntity
.
appDEUIActions
as
|
appDEUIAction
|
}}
"
{{
appDEUIAction
.
codeName
}}
":{
codeName:'
{{
appDEUIAction
.
codeName
}}
',
uIActionMode:'
{{
appDEUIAction
.
UIActionMode
}}
',
actionTarget:'
{{
upperCase
appDEUIAction
.
actionTarget
}}
',
uIActionTag:'
{{
upperCase
appDEUIAction
.
uIActionTag
}}
',
frontPSAppView:'
{{
appDEUIAction
.
frontPSAppView
}}
',
caption:'
{{
appDEUIAction
.
caption
}}
',
entityCodeName:'
{{
appDEUIAction
.
entityCodeName
}}
',
methodCodeName:'
{{
appDEUIAction
.
methodCodeName
}}
',
frontProcessType:'
{{
appDEUIAction
.
frontProcessType
}}
',
refreshMode:'
{{
appDEUIAction
.
refreshMode
}}
',
htmlPageUrl:'
{{
appDEUIAction
.
htmlPageUrl
}}
',
uILogicAttachMode:'
{{
appDEUIAction
.
uILogicAttachMode
}}
',
nextActionCodeName:'
{{
appDEUIAction
.
nextActionCodeName
}}
',
},
{{/
each
}}
};
{{
~#
each
appEntity
.
appDEUIActions
as
|
appDEUIAction
|
}}
/**
*
{{
appDEUIAction
.
caption
}}
*
...
...
@@ -30,15 +50,15 @@ export class {{pascalCase appEntity.codeName}}UIServiceBase extends UIServiceBas
* @memberof
{{
pascalCase
appEntity
.
codeName
}}
UIServiceBase
*/
public async
{{
appDEUIAction
.
codeName
}}
(params:any){
const actionModel = {
codeName:'
{{
appDEUIAction
.
codeName
}}
',
uIActionMode:'
{{
upperCase
appDEUIAction
.
UIActionMode
}}
',
actionTarget:'
{{
upperCase
appDEUIAction
.
actionTarget
}}
',
uIActionTag:'
{{
upperCase
appDEUIAction
.
uIActionTag
}}
',
frontPSAppView:'
{{
appDEUIAction
.
frontPSAppView
}}
'
};
AppUIAction.execute(actionModel, params);
const actionModel = this.getUIActionModel('
{{
appDEUIAction
.
codeName
}}
');
{{#
eq
appDEUIAction
.
UIActionMode
'FRONT'
}}
AppFrontAction.doAction(actionModel, params);
{{/
eq
}}
{{#
eq
appDEUIAction
.
UIActionMode
'BACKEND'
}}
AppBackendAction.doAction(actionModel, params);
{{/
eq
}}
}
{{/
each
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/utils/open-view/open-view-service.ts
浏览文件 @
a37628ec
import
{
IContext
,
IOpenViewService
,
IParam
,
RouteUtil
,
ViewDetail
}
from
'@core'
;
import
router
from
'@/router'
;
import
{
AppModal
}
from
'@/utils'
;
import
{
Subject
}
from
'rxjs'
;
interface
Params
extends
IParam
{
...
...
@@ -13,7 +14,7 @@ interface Params extends IParam {
* @export
* @class OpenViewService
*/
export
class
OpenViewService
implements
IOpenViewService
{
export
class
OpenViewService
implements
IOpenViewService
{
/**
* 唯一实例
*
...
...
@@ -40,7 +41,7 @@ export class OpenViewService implements IOpenViewService{
* @param view 视图信息
* @param params 相关参数
*/
public
openView
(
view
:
ViewDetail
,
params
:
Params
)
{
public
openView
(
view
:
ViewDetail
,
params
:
Params
)
:
Subject
<
any
>
|
undefined
{
// 获取详细视图信息
let
_view
:
ViewDetail
|
undefined
=
App
.
getViewInfo
(
view
.
codeName
);
if
(
!
_view
)
{
...
...
@@ -51,12 +52,11 @@ export class OpenViewService implements IOpenViewService{
if
(
view
.
openMode
)
{
_view
.
openMode
=
view
.
openMode
;
}
// 重定向视图走重定向逻辑,其他根据openMode打开
if
(
_view
.
redirectView
)
{
this
.
openRedirectView
(
_view
,
params
);
}
else
{
this
.
openByOpenMode
(
_view
,
params
);
return
this
.
openByOpenMode
(
_view
,
params
);
}
}
...
...
@@ -66,7 +66,7 @@ export class OpenViewService implements IOpenViewService{
* @param view 视图信息
* @param params 相关参数
*/
public
openByOpenMode
(
view
:
ViewDetail
,
params
:
Params
)
{
public
openByOpenMode
(
view
:
ViewDetail
,
params
:
Params
)
:
Subject
<
any
>
|
undefined
{
const
{
openMode
}
=
view
;
const
{
viewParams
,
context
}
=
params
;
// 路由打开视图
...
...
@@ -78,8 +78,9 @@ export class OpenViewService implements IOpenViewService{
}
else
{
window
.
open
(
'./#'
+
routePath
,
'_blank'
);
}
return
;
}
else
if
(
openMode
==
'POPUPMODAL'
)
{
AppModal
.
getInstance
().
openModal
(
view
,
params
);
return
AppModal
.
getInstance
().
openModal
(
view
,
params
);
}
else
if
(
openMode
?.
indexOf
(
'DRAWER'
)
!==
-
1
)
{
// TODO PMS上面抽屉DRAWER_TOP
}
else
if
(
openMode
==
'POPOVER'
)
{
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录