Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
63e0ab96
提交
63e0ab96
编写于
12月 29, 2021
作者:
WodahsOrez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update: open-view-service
上级
9e083037
变更
8
展开全部
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
581 行增加
和
1 行删除
+581
-1
AppModel.java
...core/src/main/java/cn/ibizlab/codegen/model/AppModel.java
+41
-0
index.ts
...rces/templ/r7/app_{{apps}}/src/ibiz-core/service/index.ts
+2
-1
singleton.ts
.../templ/r7/app_{{apps}}/src/ibiz-core/service/singleton.ts
+28
-0
index.ts
...ources/templ/r7/app_{{apps}}/src/ibiz-core/utils/index.ts
+1
-0
route-tool.ts
...s/templ/r7/app_{{apps}}/src/ibiz-core/utils/route-tool.ts
+344
-0
util.ts
...sources/templ/r7/app_{{apps}}/src/ibiz-core/utils/util.ts
+10
-0
open-view-service.ts
...7/app_{{apps}}/src/service/open-view/open-view-service.ts
+91
-0
views.json.hbs
...empl/r7/app_{{apps}}/src/service/open-view/views.json.hbs
+64
-0
未找到文件。
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/AppModel.java
浏览文件 @
63e0ab96
...
...
@@ -38,6 +38,7 @@ public class AppModel extends BaseModel{
if
(
getApplication
().
getAllPSAppDataEntities
()!=
null
)
{
getApplication
().
getAllPSAppDataEntities
().
forEach
(
appDataEntity
->{
if
(
appDataEntity
.
getMinorPSAppDERSs
()
!=
null
){
appDataEntity
.
getMinorPSAppDERSs
().
forEach
(
appDERS
->{
JSONObject
tempObj
=
new
JSONObject
();
...
...
@@ -59,6 +60,41 @@ public class AppModel extends BaseModel{
}
});
}
// 初始化应用实体关系数据Set
if
(
getApplication
().
getAllPSAppDataEntities
()!=
null
){
getApplication
().
getAllPSAppDataEntities
().
forEach
(
appDataEntity
->{
JSONObject
tempObj
=
new
JSONObject
();
tempObj
.
put
(
"appDataEntity"
,
appDataEntity
);
if
(
appDataEntity
.
getMinorPSAppDERSs
()
!=
null
){
List
deResLinks
=
new
ArrayList
<
JSONObject
>();
appDataEntity
.
getMinorPSAppDERSs
().
forEach
(
appDERS
->{
JSONObject
deResLink
=
new
JSONObject
();
String
majorCodeName
=
appDERS
.
getMajorPSAppDataEntity
().
getCodeName
();
String
minorCodeName
=
appDERS
.
getMinorPSAppDataEntity
().
getCodeName
();
String
path
=
String
.
format
(
"%1$s/:%2$s?/%3$s/:%4$s?"
,
Inflector
.
getInstance
().
pluralize
(
majorCodeName
),
majorCodeName
,
Inflector
.
getInstance
().
pluralize
(
minorCodeName
),
minorCodeName
).
toLowerCase
();
deResLink
.
put
(
"majorCodeName"
,
majorCodeName
.
toLowerCase
());
deResLink
.
put
(
"path"
,
path
);
// 路由关系参数数组
List
deResParameters
=
new
ArrayList
();
JSONObject
majorResObj
=
new
JSONObject
();
majorResObj
.
put
(
"pathName"
,
Inflector
.
getInstance
().
pluralize
(
majorCodeName
).
toLowerCase
());
majorResObj
.
put
(
"parameterName"
,
majorCodeName
.
toLowerCase
());
deResParameters
.
add
(
majorResObj
);
JSONObject
minorResObj
=
new
JSONObject
();
minorResObj
.
put
(
"pathName"
,
Inflector
.
getInstance
().
pluralize
(
minorCodeName
).
toLowerCase
());
minorResObj
.
put
(
"parameterName"
,
minorCodeName
.
toLowerCase
());
deResParameters
.
add
(
minorResObj
);
deResLink
.
put
(
"deResParameters"
,
deResParameters
);
deResLinks
.
add
(
deResLink
);
});
tempObj
.
put
(
"deResLinks"
,
deResLinks
);
}
else
{
tempObj
.
put
(
"path"
,
String
.
format
(
"%1$s/:%2$s?"
,
Inflector
.
getInstance
().
pluralize
(
appDataEntity
.
getCodeName
()),
appDataEntity
.
getCodeName
()).
toLowerCase
());
}
appDeResSet
.
add
(
tempObj
);
});
}
}
...
...
@@ -109,6 +145,11 @@ public class AppModel extends BaseModel{
*/
private
Map
<
String
,
JSONObject
>
appEntityResourceMap
=
new
LinkedHashMap
<>();
/**
* 应用实体关系对象Set
*/
private
Set
<
JSONObject
>
appDeResSet
=
new
HashSet
<>();
/**
* 获取应用实体资源数据
* @return
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/service/index.ts
浏览文件 @
63e0ab96
export
*
from
'./control-service'
export
*
from
'./entity'
export
*
from
'./singleton'
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/service/singleton.ts
0 → 100644
浏览文件 @
63e0ab96
/**
* 单例基类
*
* @export
* @class Singleton
*/
export
class
Singleton
{
/**
* 唯一实例
*
* @private
* @static
* @memberof Singleton
*/
private
static
readonly
instance
=
new
Singleton
();
/**
* 获取唯一实例
*
* @static
* @return {*} {Singleton}
* @memberof Singleton
*/
public
static
getInstance
():
Singleton
{
return
Singleton
.
instance
;
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/utils/index.ts
浏览文件 @
63e0ab96
export
*
from
'./util'
;
export
*
from
'./view-util'
;
export
*
from
'./view-tool'
;
export
{
Http
}
from
'./net/http'
;
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/utils/route-tool.ts
0 → 100644
浏览文件 @
63e0ab96
此差异已折叠。
点击以展开。
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/utils/util.ts
浏览文件 @
63e0ab96
...
...
@@ -20,6 +20,16 @@ export function isExist(arg: any): boolean{
return
arg
!==
undefined
&&
arg
!==
null
&&
arg
===
arg
;
}
/**
* @description 除undefined,null,NaN,空字符串以外都为true
* @export
* @param {*} arg
* @return {*} {boolean}
*/
export
function
notEmpty
(
arg
:
any
):
boolean
{
return
isExist
(
arg
)
&&
arg
!=
''
;
}
/**
* @description 是否拥有某个方法
* @param {*} arg 校验对象
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/service/open-view/open-view-service.ts
0 → 100644
浏览文件 @
63e0ab96
import
{
deepCopy
,
IParam
,
Singleton
,
RouteTool
}
from
"@ibiz-core"
;
import
{
useRouter
}
from
"vue-router"
;
const
allViews
=
require
(
'./views.json'
)
interface
View
extends
IParam
{
codeName
:
string
,
openMode
?:
string
,
}
interface
Params
extends
IParam
{
context
:
any
,
viewParams
:
any
,
}
/**
* 视图打开服务
* @export
* @class OpenViewService
*/
export
class
OpenViewService
extends
Singleton
{
/**
* 打开视图
*
* @param view 视图信息
* @param params 相关参数
*/
public
openView
(
view
:
View
,
params
:
Params
){
// 获取详细视图信息
let
_view
:
any
=
allViews
[
view
.
codeName
];
if
(
!
_view
){
console
.
error
(
`应用中不存在
${
view
.
codeName
}
视图`
);
return
}
// 拷贝防污染,view的openMode覆盖配置的
_view
=
deepCopy
(
_view
);
if
(
view
.
openMode
){
_view
.
openMode
=
view
.
openMode
;
}
// 重定向视图走重定向逻辑,其他根据openMode打开
if
(
_view
.
redirectView
){
this
.
openRedirectView
(
_view
,
params
);
}
else
{
this
.
openByOpenMode
(
_view
,
params
)
}
}
/**
* 根据打开方式打开视图
*
* @param view 视图信息
* @param params 相关参数
*/
public
openByOpenMode
(
view
:
any
,
params
:
Params
){
const
{
openMode
}
=
view
;
const
{
viewParams
,
context
}
=
params
// 路由打开视图
if
(
openMode
==
'INDEXVIEWTAB'
||
openMode
==
'POPUPAPP'
){
// TODO 视图关系参数处理
const
router
=
useRouter
();
const
routePath
=
RouteTool
.
buildUpRoutePath
(
view
,
context
,
viewParams
);
if
(
openMode
==
'INDEXVIEWTAB'
){
router
.
push
(
routePath
);
}
else
{
window
.
open
(
'./#'
+
routePath
,
'_blank'
);
}
}
else
if
(
openMode
==
'POPUPMODAL'
){
}
else
if
(
openMode
.
indexOf
(
'DRAWER'
)
!==
-
1
){
// TODO PMS上面抽屉DRAWER_TOP
}
else
if
(
openMode
==
'POPOVER'
){
// TODO 打开气泡卡片
}
else
{
console
.
error
(
`未支持
${
openMode
}
打开方式`
);
}
}
/**
* 重定向视图处理
*
* @param view 视图信息
* @param params 相关参数
*/
public
openRedirectView
(
view
:
any
,
params
:
Params
){
// TODO 重定向视图处理
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/service/open-view/views.json.hbs
0 → 100644
浏览文件 @
63e0ab96
{{!-- {
{{#each app.appEntityResources as |appEntityResource|}}
{{#if appEntityResource.appDataEntity.allPSAppViews}}
{{#each appEntityResource.appDataEntity.allPSAppViews as |appView|}}
"{{appView.codeName}}":{
"name": "{{appView.name}}",
"codeName": "{{appView.codeName}}",
"openMode": "{{#if appView.openMode}}{{appView.openMode}}{{else}}INDEXVIEWTAB{{/if}}",
"redirectView": {{appView.redirectView}},
"path": "{{appEntityResource.path}}/views/{{lowerCase appView.codeName}}",
{{#if appView.capPSLanguageRes}}
"captionTag": "{{appView.capPSLanguageRes.lanResTag}}",
{{/if}}
"caption": "{{appView.caption}}",
{{#if appView.psSysImage}}
"imgPath": "{{appView.psSysImage.imagePath}}",
"iconCls": "{{appView.psSysImage.cssClass}}",
{{/if}}
"viewType": "{{appView.viewType}}",
"fileDir": "@page/{{#if psAppDataEntity}}{{spinalCase psAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase appView.codeName}}"
}{{#unless (and @last ../@last)}},{{/unless}}
{{/each}}
{{/if}}
{{/each}}
} --}}
{
{{#
each
app
.
appDeResSet
as
|
appDeRes
|
}}
{{#if
appDeRes
.
deResLinks
}}
{{#
each
appDeRes
.
appDataEntity
.
allPSAppViews
as
|
appView
|
}}
"
{{
appView
.
codeName
}}
":{
"name": "
{{
appView
.
name
}}
",
"codeName": "
{{
appView
.
codeName
}}
",
"openMode": "
{{#if
appView
.
openMode
}}{{
appView
.
openMode
}}{{else}}
INDEXVIEWTAB
{{/if}}
",
"redirectView":
{{
appView
.
redirectView
}}
,
"deResLinks": [
{{#
each
appDeRes
.
deResLinks
as
|
deResLink
|
}}
[
{{#
each
deResLink
.
deResParameters
as
|
deResParameter
|
}}
{ "pathName": "
{{
deResParameter
.
pathName
}}
", "parameterName": "
{{
deResParameter
.
parameterName
}}
" }
{{#
unless
@last
}}
,
{{/
unless
}}
{{/
each
}}
]
{{#
unless
@last
}}
,
{{/
unless
}}
{{/
each
}}
],
"parameters": [
{{#if
appDeRes
.
appDataEntity
}}
{ "pathName": "
{{
pluralize
appDeRes
.
appDataEntity
.
codeName
}}
", "parameterName": "
{{
appDeRes
.
appDataEntity
.
codeName
}}
" },
{{/if}}
{ "pathName": "views", "parameterName": "
{{
lowerCase
appView
.
codeName
}}
" }
],
{{#if
appView
.
capPSLanguageRes
}}
"captionTag": "
{{
appView
.
capPSLanguageRes
.
lanResTag
}}
",
{{/if}}
"caption": "
{{
appView
.
caption
}}
",
{{#if
appView
.
psSysImage
}}
"imgPath": "
{{
appView
.
psSysImage
.
imagePath
}}
",
"iconCls": "
{{
appView
.
psSysImage
.
cssClass
}}
",
{{/if}}
"viewType": "
{{
appView
.
viewType
}}
",
"fileDir": "@page/
{{#if
psAppDataEntity
}}{{
spinalCase
psAppDataEntity
.
codeName
}}{{else}}
default
{{/if}}
/
{{
spinalCase
appView
.
codeName
}}
"
}
{{#
unless
(
and
@last
..
/
@last
)
}}
,
{{/
unless
}}
{{/
each
}}
{{/if}}
{{/
each
}}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录