Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
4bbf7cb6
提交
4bbf7cb6
编写于
1月 17, 2022
作者:
zhangkang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:前后台界面行为细化
上级
0ec8cff4
变更
10
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
163 行增加
和
33 行删除
+163
-33
AppEntityModel.java
...rc/main/java/cn/ibizlab/codegen/model/AppEntityModel.java
+24
-0
app.ts
...e/src/main/resources/templ/r7/app_{{apps}}/src/app/app.ts
+13
-2
app-entity-config.ts.hbs
...l/r7/app_{{apps}}/src/app/config/app-entity-config.ts.hbs
+12
-0
index.ts
...n/resources/templ/r7/app_{{apps}}/src/app/config/index.ts
+2
-1
i-app.ts
...ces/templ/r7/app_{{apps}}/src/core/interface/app/i-app.ts
+12
-1
app-action-base.ts
..._{{apps}}/src/core/logic/app-ui-action/app-action-base.ts
+74
-9
app-backend-action.ts
...apps}}/src/core/logic/app-ui-action/app-backend-action.ts
+6
-6
app-front-action.ts
...{{apps}}/src/core/logic/app-ui-action/app-front-action.ts
+2
-2
uiaction-util.ts
.../templ/r7/app_{{apps}}/src/core/utils/ui/uiaction-util.ts
+14
-10
{{appEntities}}-ui-service-base.ts.hbs
...ce/{{appEntities}}/{{appEntities}}-ui-service-base.ts.hbs
+4
-2
未找到文件。
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/AppEntityModel.java
浏览文件 @
4bbf7cb6
...
...
@@ -69,6 +69,8 @@ public class AppEntityModel extends BaseModel{
}
// 初始化界面行为
keyField
=
getAppDataEntity
().
getPSDataEntity
().
getKeyPSDEField
().
getCodeName
();
majorField
=
getAppDataEntity
().
getPSDataEntity
().
getMajorPSDEField
().
getCodeName
();
if
(
getAppDataEntity
().
getAllPSAppDEUIActions
()
!=
null
){
getAppDataEntity
().
getAllPSAppDEUIActions
().
forEach
(
appDEUIAction
->{
JSONObject
actionJson
=
new
JSONObject
();
...
...
@@ -81,6 +83,24 @@ public class AppEntityModel extends BaseModel{
actionJson
.
put
(
"htmlPageUrl"
,
appDEUIAction
.
getHtmlPageUrl
());
actionJson
.
put
(
"refreshMode"
,
appDEUIAction
.
getRefreshMode
());
actionJson
.
put
(
"uILogicAttachMode"
,
appDEUIAction
.
getUILogicAttachMode
());
StringBuffer
navContexts
=
new
StringBuffer
();
navContexts
.
append
(
"{"
);
if
(
appDEUIAction
.
getPSNavigateContexts
()
!=
null
){
appDEUIAction
.
getPSNavigateContexts
().
forEach
(
context
->{
navContexts
.
append
(
context
.
getName
().
toLowerCase
()
+
":'"
+(
context
.
isRawValue
()?
""
:
"%"
)
+
context
.
getValue
()+(
context
.
isRawValue
()?
""
:
"%"
)+
"',"
);
});
}
navContexts
.
append
(
"}"
);
actionJson
.
put
(
"navContexts"
,
navContexts
);
StringBuffer
navParams
=
new
StringBuffer
();
navParams
.
append
(
"{"
);
if
(
appDEUIAction
.
getPSNavigateParams
()
!=
null
){
appDEUIAction
.
getPSNavigateParams
().
forEach
(
param
->{
navParams
.
append
(
param
.
getName
().
toLowerCase
()
+
":'"
+(
param
.
isRawValue
()?
""
:
"%"
)+
param
.
getValue
()+(
param
.
isRawValue
()?
""
:
"%"
)+
"',"
);
});
}
navParams
.
append
(
"}"
);
actionJson
.
put
(
"navParams"
,
navParams
);
if
(
appDEUIAction
.
getPSAppDEMethod
()
!=
null
){
actionJson
.
put
(
"methodCodeName"
,
appDEUIAction
.
getPSAppDEMethod
().
getCodeName
());
}
...
...
@@ -95,6 +115,10 @@ public class AppEntityModel extends BaseModel{
});
}
}
// 主键属性名称
public
String
keyField
=
""
;
// 主信息属性名称
public
String
majorField
=
""
;
public
IPSAppDataEntity
getAppDataEntity
()
{
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/app/app.ts
浏览文件 @
4bbf7cb6
...
...
@@ -2,7 +2,7 @@ import { Environment } from "@/environments/environment";
import
{
OpenViewService
}
from
"@/utils"
;
import
{
AppBase
,
IParam
,
ViewDetail
,
IApp
,
IOpenViewService
,
deepCopy
,
getSessionStorage
,
Http
,
AppUtil
}
from
"@core"
;
import
{
SyncSeriesHook
}
from
"qx-util"
;
import
{
AppFuncConfig
,
AppViewConfig
}
from
'./config'
;
import
{
AppFuncConfig
,
AppViewConfig
,
AppEntityConfig
}
from
'./config'
;
import
{
DataServiceRegister
,
UIServiceRegister
}
from
"./register"
;
export
class
App
extends
AppBase
implements
IApp
{
...
...
@@ -125,10 +125,21 @@ export class App extends AppBase implements IApp {
*
* @static
* @param codeName 视图codeName
* @return {*}
* @return {*}
*/
public
getViewInfo
(
codeName
:
string
):
ViewDetail
|
undefined
{
return
AppViewConfig
[
codeName
]
?
(
deepCopy
(
AppViewConfig
[
codeName
])
as
ViewDetail
)
:
undefined
;;
}
/**
* 获取实体信息
*
* @static
* @param codeName 实体codeName
* @return {*}
*/
public
getEntityInfo
(
codeName
:
string
):
any
{
return
AppEntityConfig
[
codeName
]
?
deepCopy
(
AppEntityConfig
[
codeName
])
:
undefined
;;
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/app/config/app-entity-config.ts.hbs
0 → 100644
浏览文件 @
4bbf7cb6
import { IParam } from "@core";
export const AppEntityConfig:IParam = {
{{#
each
app
.
appEntitiesMap
as
|
appEntity
|
}}
"
{{
appEntity
.
codeName
}}
":{
"name": "
{{
appEntity
.
name
}}
",
"codeName": "
{{
appEntity
.
codeName
}}
",
"majorField":"
{{
appEntity
.
majorField
}}
",
"keyField":"
{{
appEntity
.
keyField
}}
"
}
{{#
unless
@last
}}
,
{{/
unless
}}
{{/
each
}}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/app/config/index.ts
浏览文件 @
4bbf7cb6
export
{
AppFuncConfig
}
from
'./app-func-config'
;
export
{
AppViewConfig
}
from
'./app-view-config'
;
export
{
AppCodeListConfig
}
from
'./app-code-list-config'
;
\ No newline at end of file
export
{
AppCodeListConfig
}
from
'./app-code-list-config'
;
export
{
AppEntityConfig
}
from
'./app-entity-config'
;
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/interface/app/i-app.ts
浏览文件 @
4bbf7cb6
...
...
@@ -72,6 +72,17 @@ export interface IApp {
*/
getViewInfo
(
codeName
:
string
):
ViewDetail
|
undefined
;
/**
* 获取实体信息
*
* @static
* @param codeName 实体codeName
* @return {*}
*/
getEntityInfo
(
codeName
:
string
):
any
;
/**
* 获取应用数据
*
...
...
@@ -86,6 +97,6 @@ export interface IApp {
* @param {IParam} opt
* @memberof IApp
*/
setAppData
(
opt
:
IParam
):
void
;
setAppData
(
opt
:
IParam
):
void
;
}
\ 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
浏览文件 @
4bbf7cb6
import
{
AppActionService
,
IContext
,
IParam
}
from
"@core"
;
import
{
AppActionService
,
IContext
,
IParam
,
UIActionUtil
}
from
"@core"
;
export
interface
ActionParams
{
/**
...
...
@@ -60,7 +60,7 @@ export class AppActionBase {
* @memberof AppActionBase
*/
public
static
async
getUIService
(
actionEnvironment
:
IParam
)
{
const
entityName
=
actionEnvironment
?.
viewS
tate
?.
appEntityName
;
const
entityName
=
actionEnvironment
?.
s
tate
?.
appEntityName
;
if
(
!
entityName
)
{
console
.
log
(
"实体名称不存在"
);
return
;
...
...
@@ -76,13 +76,48 @@ export class AppActionBase {
/**
* 根据数据目标处理行为参数
*
* @param {string}
ActionTarget
* @param {string}
action
* @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
{};
public
static
handleActionTarget
(
action
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
}):
ActionParams
{
const
{
actionTarget
,
entityCodeName
}
=
action
;
const
{
data
}
=
params
;
// 数据目标值
let
resultData
:
ActionParams
=
{
context
:
{},
viewParams
:
{},
data
:
{}
};
switch
(
actionTarget
)
{
case
'SINGLEKEY'
:
case
'MULTIKEY'
:
// 多数据主键和单数据主键,合并实体的主键参数和主信息参数 到上下文 后续统一合并进数据目标值
if
(
!
entityCodeName
)
{
console
.
log
(
"实体名称不存在"
);
break
;
}
const
entity
=
App
.
getEntityInfo
(
entityCodeName
);
if
(
!
entity
)
{
console
.
log
(
"实体不存在"
);
break
;
}
const
entityName
=
entityCodeName
.
toLowerCase
();
const
keyField
=
entity
.
keyField
.
toLowerCase
();
const
majorField
=
entity
.
majorField
.
toLowerCase
();
if
(
data
?.[
0
]?.[
keyField
])
{
Object
.
assign
(
resultData
.
context
,
{
[
entityName
]:
`%
${
keyField
}
%`
});
}
else
{
Object
.
assign
(
resultData
.
context
,
{
[
entityName
]:
`%
${
entityName
}
%`
});
}
Object
.
assign
(
resultData
.
viewParams
,
{
[
keyField
]:
`%
${
keyField
}
%`
});
Object
.
assign
(
resultData
.
viewParams
,
{
[
majorField
]:
`%
${
majorField
}
%`
});
break
;
case
'SINGLEDATA'
:
resultData
.
data
=
data
?.[
0
]?
data
?.[
0
]:{};
break
;
}
return
resultData
;
}
/**
...
...
@@ -93,9 +128,39 @@ export class AppActionBase {
* @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
:
{}
};
public
static
handleActionParam
(
uiAction
:
IParam
,
params
:
{
context
:
IContext
,
viewParams
:
IParam
,
data
:
IParam
,
event
:
MouseEvent
,
actionEnvironment
:
IParam
},
data
:
ActionParams
):
ActionParams
{
const
{
navContexts
,
navParams
,
actionTarget
}
=
uiAction
;
const
{
viewParams
,
context
,
data
:
_data
}
=
params
;
const
{
context
:
tempContext
,
viewParams
:
tempViewParams
,
}
=
data
;
let
{
data
:
resultData
}
=
data
;
// 合并导航参数和导航上下文至数据目标处理后的参数
Object
.
assign
(
tempContext
,
navContexts
);
Object
.
assign
(
tempViewParams
,
navParams
);
// 根据上下文和导航参数,解析参数
const
_context
=
UIActionUtil
.
formatDataActionData
(
actionTarget
,
_data
,
context
,
viewParams
,
tempContext
);
const
_viewParams
=
UIActionUtil
.
formatDataActionData
(
actionTarget
,
_data
,
context
,
viewParams
,
tempViewParams
);
if
(
Object
.
is
(
actionTarget
,
'SINGLEDATA'
))
{
Object
.
assign
(
resultData
,
_viewParams
);
}
else
{
resultData
=
_viewParams
;
}
// 多项数据主键转换数据
if
(
Object
.
is
(
actionTarget
,
'MULTIKEY'
))
{
let
tempDataArray
:
Array
<
any
>
=
[];
if
(
_data
.
length
>
1
&&
Object
.
keys
(
data
).
length
>
0
)
{
for
(
let
i
=
0
;
i
<
_data
.
length
;
i
++
)
{
let
tempObject
:
any
=
{};
Object
.
keys
(
resultData
).
forEach
((
key
:
string
)
=>
{
Object
.
assign
(
tempObject
,
{
[
key
]:
resultData
[
key
].
split
(
','
)[
i
]
});
});
tempDataArray
.
push
(
tempObject
);
}
}
else
{
tempDataArray
.
push
(
data
);
}
resultData
=
tempDataArray
;
}
return
{
context
:
_context
,
viewParams
:
_viewParams
,
data
:
resultData
};
}
/**
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/logic/app-ui-action/app-backend-action.ts
浏览文件 @
4bbf7cb6
...
...
@@ -16,14 +16,14 @@ export class AppBackendAction extends AppActionBase {
*/
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
;
const
{
actionEnvironment
}
=
params
;
const
{
context
}
=
actionParams
;
const
entityName
=
actionEnvironment
?.
state
?.
appEntityName
;
if
(
!
entityName
)
{
console
.
log
(
"实体名称不存在"
);
return
{
ok
:
false
,
result
:
null
};
}
const
methodCodeName
:
string
=
uiAction
.
methodCodeName
;
if
(
!
methodCodeName
)
{
console
.
log
(
"实体行为不存在"
);
return
{
ok
:
false
,
result
:
null
};
...
...
@@ -31,7 +31,7 @@ export class AppBackendAction extends AppActionBase {
// 获取实体服务
const
dataService
=
await
App
.
getDataService
(
entityName
.
toLowerCase
(),
context
)
// 获取实体行为名称
const
response
=
await
dataService
[
methodCodeName
](
context
,
actionParams
);
const
response
=
await
dataService
[
methodCodeName
](
context
,
actionParams
.
data
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
if
(
response
&&
response
.
ok
)
{
this
.
doSuccessMessage
(
uiAction
);
...
...
@@ -112,7 +112,7 @@ export class AppBackendAction extends AppActionBase {
/**
* 执行
前
台行为
* 执行
后
台行为
*
* @param {IParam} uiAction
* @memberof AppFrontAction
...
...
@@ -125,7 +125,7 @@ export class AppBackendAction extends AppActionBase {
// 消息确认提示
this
.
doConfirmMessage
(
uiAction
);
// 根据行为目标 合并行为参数
const
data
=
this
.
handleActionTarget
(
uiAction
.
actionTarget
,
params
);
const
data
=
this
.
handleActionTarget
(
uiAction
,
params
);
// 处理行为参数 导航参数、数据项、信息项、参数项
const
actionParams
=
this
.
handleActionParam
(
uiAction
,
params
,
data
);
// 执行行为
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/logic/app-ui-action/app-front-action.ts
浏览文件 @
4bbf7cb6
...
...
@@ -19,8 +19,8 @@ export class AppFrontAction extends AppActionBase {
*/
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
;
const
{
context
,
viewParams
,
data
}
=
actionParams
;
if
(
!
frontPSAppView
)
{
console
.
log
(
"模型视图名称不存在"
);
return
reject
({
ok
:
false
,
result
:
null
});
...
...
@@ -103,7 +103,7 @@ export class AppFrontAction extends AppActionBase {
return
this
.
executeUILogic
(
uiAction
,
params
);
}
// 根据行为目标 合并行为参数
const
data
=
this
.
handleActionTarget
(
uiAction
.
actionTarget
,
params
);
const
data
=
this
.
handleActionTarget
(
uiAction
,
params
);
// 处理行为参数 导航参数、数据项、信息项、参数项
const
actionParams
=
this
.
handleActionParam
(
uiAction
,
params
,
data
);
// 执行行为
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/utils/ui/uiaction-util.ts
浏览文件 @
4bbf7cb6
import
{
isEmpty
}
from
"ramda"
;
export
class
UIActionUtil
{
/**
* 格式化数据
*
...
...
@@ -17,11 +18,14 @@ export class UIActionUtil {
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'
)
Object
.
is
(
actionTarget
,
'SINGLEKEY'
)
||
Object
.
is
(
actionTarget
,
'NONE'
)
||
Object
.
is
(
actionTarget
,
'SINGLEDATA'
)
)
{
const
[
arg
]
=
args
;
let
arg
:
any
=
{};
if
(
!
isEmpty
(
args
)){
[
arg
]
=
args
;
}
Object
.
keys
(
_params
).
forEach
((
name
:
string
)
=>
{
let
hasProperty
=
true
;
if
(
!
name
)
{
...
...
@@ -31,11 +35,11 @@ export class UIActionUtil {
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'
))
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
))
{
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ui-service/{{appEntities}}/{{appEntities}}-ui-service-base.ts.hbs
浏览文件 @
4bbf7cb6
...
...
@@ -31,13 +31,15 @@ export class {{pascalCase appEntity.codeName}}UIServiceBase extends UIServiceBas
uIActionTag:'
{{
upperCase
appDEUIAction
.
uIActionTag
}}
',
frontPSAppView:'
{{
appDEUIAction
.
frontPSAppView
}}
',
caption:'
{{
appDEUIAction
.
caption
}}
',
entityCodeName:'
{{
app
DEUIAction
.
entityC
odeName
}}
',
entityCodeName:'
{{
app
Entity
.
c
odeName
}}
',
methodCodeName:'
{{
appDEUIAction
.
methodCodeName
}}
',
frontProcessType:'
{{
appDEUIAction
.
frontProcessType
}}
',
refreshMode:'
{{
appDEUIAction
.
refreshMode
}}
',
htmlPageUrl:'
{{
appDEUIAction
.
htmlPageUrl
}}
',
uILogicAttachMode:'
{{
appDEUIAction
.
uILogicAttachMode
}}
',
nextActionCodeName:'
{{
appDEUIAction
.
nextActionCodeName
}}
',
navContexts:
{{
appDEUIAction
.
navContexts
}}
,
navParams:
{{
appDEUIAction
.
navParams
}}
},
{{/
each
}}
};
...
...
@@ -49,7 +51,7 @@ export class {{pascalCase appEntity.codeName}}UIServiceBase extends UIServiceBas
* @param {*} params
* @memberof
{{
pascalCase
appEntity
.
codeName
}}
UIServiceBase
*/
public async
{{
appDEUIAction
.
codeName
}}
(params:any){
public async
{{
appDEUIAction
.
codeName
}}
(
uiAction:any,
params:any){
const actionModel = this.getUIActionModel('
{{
appDEUIAction
.
codeName
}}
');
{{#
eq
appDEUIAction
.
UIActionMode
'FRONT'
}}
AppFrontAction.doAction(actionModel, params);
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录