Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
1bf03e3f
提交
1bf03e3f
编写于
12月 30, 2021
作者:
WodahsOrez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add: 关系路径
上级
7669dc2f
变更
14
显示空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
510 行增加
和
422 行删除
+510
-422
AppEntityModel.java
...rc/main/java/cn/ibizlab/codegen/model/AppEntityModel.java
+52
-0
AppModel.java
...core/src/main/java/cn/ibizlab/codegen/model/AppModel.java
+0
-39
views.json.hbs
...s/templ/r7/app_{{apps}}/public/assets/json/views.json.hbs
+28
-0
App.vue
...core/src/main/resources/templ/r7/app_{{apps}}/src/App.vue
+8
-0
index.ts
...rces/templ/r7/app_{{apps}}/src/ibiz-core/service/index.ts
+1
-2
singleton.ts
.../templ/r7/app_{{apps}}/src/ibiz-core/service/singleton.ts
+0
-28
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
+319
-308
app.ts
...in/resources/templ/r7/app_{{apps}}/src/service/app/app.ts
+46
-0
index.ts
...main/resources/templ/r7/app_{{apps}}/src/service/index.ts
+2
-0
open-view-service.ts
...7/app_{{apps}}/src/service/open-view/open-view-service.ts
+50
-37
app-modal.ts
...es/templ/r7/app_{{apps}}/src/utils/app-modal/app-modal.ts
+0
-1
app-modal.vue
...s/templ/r7/app_{{apps}}/src/utils/app-modal/app-modal.vue
+0
-4
{{ctrls@FORM}}-form-config.ts.hbs
...s}}/{{ctrls@FORM}}-form/{{ctrls@FORM}}-form-config.ts.hbs
+3
-3
未找到文件。
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/AppEntityModel.java
浏览文件 @
1bf03e3f
package
cn
.
ibizlab
.
codegen
.
model
;
import
cn.ibizlab.codegen.utils.Inflector
;
import
cn.ibizlab.codegen.utils.StringAdvUtils
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
...
...
@@ -23,6 +26,49 @@ public class AppEntityModel extends BaseModel{
this
.
setName
(
appDataEntity
.
getName
());
this
.
setId
(
String
.
format
(
"%1$s-%2$s"
,
app
.
getCodeName
(),
appDataEntity
.
getCodeName
()));
// 初始化应用实体资源数据
if
(
getAppDataEntity
().
getMinorPSAppDERSs
()
!=
null
){
// 遍历多个主从关系
getAppDataEntity
().
getMinorPSAppDERSs
().
forEach
(
appDERS
->{
JSONObject
appEntityResource
=
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
();
appEntityResource
.
put
(
"majorCodeName"
,
majorCodeName
.
toLowerCase
());
appEntityResource
.
put
(
"curCodeName"
,
minorCodeName
.
toLowerCase
());
appEntityResource
.
put
(
"path"
,
path
);
// 实体关系路径集合
List
deResPaths
=
new
JSONArray
();
// 主关系路径节点
JSONObject
majorResNode
=
new
JSONObject
();
majorResNode
.
put
(
"pathName"
,
Inflector
.
getInstance
().
pluralize
(
majorCodeName
).
toLowerCase
());
majorResNode
.
put
(
"parameterName"
,
majorCodeName
.
toLowerCase
());
deResPaths
.
add
(
majorResNode
);
// 从关系路径节点
JSONObject
minorResNode
=
new
JSONObject
();
minorResNode
.
put
(
"pathName"
,
Inflector
.
getInstance
().
pluralize
(
minorCodeName
).
toLowerCase
());
minorResNode
.
put
(
"parameterName"
,
minorCodeName
.
toLowerCase
());
deResPaths
.
add
(
minorResNode
);
appEntityResource
.
put
(
"deResPaths"
,
deResPaths
);
appEntityResources
.
add
(
appEntityResource
);
});
}
else
{
// 没有主从关系,路径就只有自己本身一个
JSONObject
appEntityResource
=
new
JSONObject
();
appEntityResource
.
put
(
"curCodeName"
,
appDataEntity
.
getCodeName
().
toLowerCase
());
appEntityResource
.
put
(
"path"
,
String
.
format
(
"%1$s/:%2$s?"
,
Inflector
.
getInstance
().
pluralize
(
appDataEntity
.
getCodeName
()),
appDataEntity
.
getCodeName
()).
toLowerCase
());
// 路由关系路径集合
List
deResPaths
=
new
JSONArray
();
// 实体本身关系路径节点
JSONObject
curResNode
=
new
JSONObject
();
curResNode
.
put
(
"pathName"
,
Inflector
.
getInstance
().
pluralize
(
appDataEntity
.
getCodeName
()).
toLowerCase
());
curResNode
.
put
(
"parameterName"
,
appDataEntity
.
getCodeName
().
toLowerCase
());
deResPaths
.
add
(
curResNode
);
appEntityResource
.
put
(
"deResPaths"
,
deResPaths
);
appEntityResource
.
put
(
"deResPathsString"
,
deResPaths
.
toString
());
appEntityResources
.
add
(
appEntityResource
);
}
}
public
IPSAppDataEntity
getAppDataEntity
()
...
...
@@ -64,4 +110,10 @@ public class AppEntityModel extends BaseModel{
return
ctrlsMap
.
values
();
}
/**
* 应用实体资源数据
*/
private
List
<
JSONObject
>
appEntityResources
=
new
ArrayList
<>();
}
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/AppModel.java
浏览文件 @
1bf03e3f
...
...
@@ -61,40 +61,6 @@ 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
);
});
}
}
...
...
@@ -145,11 +111,6 @@ 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/service/open-view
/views.json.hbs
→
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/
public/assets/json
/views.json.hbs
浏览文件 @
1bf03e3f
{{!-- {
{{#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
|
}}
{{#
each
app
.
pages
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
}}
"deResPaths": [
{{#
each
appView
.
appEntity
.
appEntityResources
as
|
appEntityResource
|
}}
{{
appEntityResource
.
deResPaths
}}{{#
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
}}
...
...
@@ -58,7 +24,5 @@
"viewType": "
{{
appView
.
viewType
}}
",
"fileDir": "@page/
{{#if
psAppDataEntity
}}{{
spinalCase
psAppDataEntity
.
codeName
}}{{else}}
default
{{/if}}
/
{{
spinalCase
appView
.
codeName
}}
"
}
{{#
unless
(
and
@last
..
/
@last
)
}}
,
{{/
unless
}}
{{/
each
}}
{{/if}}
{{/
each
}}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/App.vue
浏览文件 @
1bf03e3f
<
script
setup
lang=
"ts"
>
// This starter template is using Vue 3
<
script
setup
>
SFCs
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
import
{
App
}
from
'@service'
onMounted
(
async
()
=>
{
await
App
.
init
();
// App.openViewService.openView({codeName: 'ExampleEditorEditView'},{context: {},viewParams:{}})
})
</
script
>
<
template
>
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/service/index.ts
浏览文件 @
1bf03e3f
export
*
from
'./control-service'
export
*
from
'./entity'
\ No newline at end of file
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
已删除
100644 → 0
浏览文件 @
7669dc2f
/**
* 单例基类
*
* @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
浏览文件 @
1bf03e3f
export
*
from
'./util'
;
export
*
from
'./view-util'
;
export
*
from
'./route-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
浏览文件 @
1bf03e3f
import
{
useRoute
}
from
'vue-router'
;
import
{
notEmpty
}
from
'@ibiz-core'
;
import
qs
from
'qs'
;
...
...
@@ -9,14 +8,13 @@ import qs from 'qs';
* @class RouteTool
*/
export
class
RouteTool
{
/**
* 处理路由路径
*
* @static
* @param {Route} route 路由
* @param {*} [viewParam={}]
* @param {any[]} deResParameter
s 关系实体参数对象
* @param {any[]} deResPath
s 关系实体参数对象
* @param {any[]} parameters 当前应用视图参数对象
* @param {any[]} args 多项数据
* @param {*} data 行为参数
...
...
@@ -31,12 +29,10 @@ export class RouteTool {
* @param viewParams 视图参数
* @return {*}
*/
public
static
buildUpRoutePath
(
view
:
any
,
context
:
any
,
viewParams
:
any
):
string
{
const
route
=
useRoute
()
const
{
deResLinks
,
parameters
}
=
view
;
const
deResParameters
=
deResLinks
[
0
];
public
static
buildUpRoutePath
(
view
:
any
,
context
:
any
,
viewParams
:
any
,
route
:
any
):
string
{
const
{
deResPaths
,
parameters
}
=
view
;
const
indexRoutePath
=
this
.
getIndexRoutePath
(
route
);
const
deResRoutePath
=
this
.
getDeResRoutePath
(
context
,
deResParameter
s
);
const
deResRoutePath
=
this
.
getDeResRoutePath
(
context
,
deResPath
s
);
const
deRoutePath
=
this
.
getActiveRoutePath
(
parameters
,
context
,
viewParams
);
return
`
${
indexRoutePath
}${
deResRoutePath
}${
deRoutePath
}
`
;
}
...
...
@@ -50,13 +46,12 @@ export class RouteTool {
* @memberof RouteTool
*/
public
static
getIndexRoutePath
(
route
:
any
):
string
{
const
{
parameters
:
_parameters
}:
{
parameters
:
any
[]
}
=
route
.
meta
;
const
{
pathName
:
_pathName
,
parameterName
:
_parameterName
}:
{
pathName
:
string
,
parameterName
:
string
}
=
_parameters
[
0
];
const
param
=
route
.
params
[
_parameterName
];
const
parameterName
=
route
.
meta
?.
parameters
?.[
0
]
||
"apps"
;
const
param
=
route
.
params
[
parameterName
];
if
(
notEmpty
(
param
))
{
return
`/
${
_
parameterName
}
/
${
param
}
`
;
return
`/
${
parameterName
}
/
${
param
}
`
;
}
return
`/
${
_
parameterName
}
`
;
return
`/
${
parameterName
}
`
;
}
/**
...
...
@@ -64,21 +59,48 @@ export class RouteTool {
*
* @static
* @param {*} [viewParam={}] 视图上下文
* @param {any[]} deResParameter
s 关系实体参数对象数组
* @param {any[]} deResPath
s 关系实体参数对象数组
* @returns {string}
* @memberof RouteTool
*/
public
static
getDeResRoutePath
(
context
:
any
=
{},
deResParameter
s
:
any
[]):
string
{
public
static
getDeResRoutePath
(
context
:
any
=
{},
deResPath
s
:
any
[]):
string
{
let
routePath
:
string
=
''
;
if
(
deResParameters
&&
deResParameters
.
length
>
0
)
{
deResParameters
.
forEach
(({
pathName
,
parameterName
}:
{
pathName
:
string
,
parameterName
:
string
})
=>
{
let
value
:
any
=
null
;
if
(
context
[
parameterName
]
&&
!
Object
.
is
(
context
[
parameterName
],
''
)
&&
!
Object
.
is
(
context
[
parameterName
],
'null'
))
{
value
=
context
[
parameterName
];
// 首先给deResPaths排序,关系多的排前面。
deResPaths
.
sort
((
a
:
any
[],
b
:
any
[])
=>
a
.
length
-
b
.
length
);
// 最多匹配路径节点数
let
maxMatch
:
number
=
0
;
// 开始匹配,先遍历关系路径,在遍历关系路径的每个节点
deResPaths
.
some
((
deResPath
:
any
[])
=>
{
// 如果节点个数小于最大匹配,则后面都无需在计算了。
if
(
maxMatch
>
deResPath
.
length
)
{
return
true
;
}
// 当前匹配路径节点数
let
curMatch
:
number
=
0
;
let
curRoutPath
:
string
=
''
;
deResPath
.
some
((
deResNode
:
any
,
index
:
number
)
=>
{
let
value
:
any
=
context
[
deResNode
.
parameterName
];
if
(
notEmpty
(
value
))
{
curMatch
++
;
curRoutPath
+=
`/
${
deResNode
.
pathName
}
/
${
value
}
`
;
}
else
if
(
curMatch
!=
0
||
index
==
deResPath
.
length
)
{
// 如果前面一个路径节点已经匹配则前一段路径作废,继续匹配后面的。
// 如果最后一个节点也没值,则整个路径作废。
curMatch
=
0
;
curRoutPath
=
''
;
}
routePath
=
`
${
routePath
}
/
${
pathName
}
`
+
(
notEmpty
(
value
)
?
`/
${
value
}
`
:
''
);
});
// 当前匹配个数大于最大匹配时,修改最大匹配和最终结果
if
(
curMatch
>
maxMatch
)
{
maxMatch
=
curMatch
;
routePath
=
curRoutPath
;
}
});
return
routePath
;
}
...
...
@@ -93,25 +115,11 @@ export class RouteTool {
*/
public
static
getActiveRoutePath
(
parameters
:
any
[],
context
:
any
,
viewParams
:
any
=
{}):
string
{
let
routePath
:
string
=
''
;
if
(
parameters
&&
parameters
.
length
>
0
)
{
// 不存在应用实体
if
(
parameters
.
length
===
1
)
{
const
[{
parameterName
}]
=
parameters
;
routePath
=
`/views/
${
parameterName
}
`
;
if
(
Object
.
keys
(
viewParams
).
length
>
0
)
{
routePath
=
`
${
routePath
}
?
${
qs
.
stringify
(
viewParams
,
{
delimiter
:
';'
})}
`
;
}
}
else
if
(
parameters
.
length
===
2
)
{
let
[
arg
]
=
args
;
arg
=
arg
?
arg
:
{};
const
[{
pathName
:
_pathName
,
parameterName
:
_parameterName
},
{
pathName
:
_pathName2
,
parameterName
:
_parameterName2
}]
=
parameters
;
const
_value
:
any
=
context
[
_parameterName
]
||
null
;
routePath
=
`/
${
_pathName
}${
notEmpty
(
_value
)
?
`/
${
_value
}
`
:
''
}
/views/
${
_parameterName2
}
`
;
if
(
Object
.
keys
(
viewParams
).
length
>
0
)
{
routePath
=
`
${
routePath
}
?
${
qs
.
stringify
(
viewParams
,
{
delimiter
:
';'
})}
`
;
}
}
}
return
routePath
;
}
...
...
@@ -136,13 +144,13 @@ export class RouteTool {
Object
.
assign
(
context
,
{
[
key
]:
param
});
}
});
if
(
route
&&
route
.
fullPath
&&
route
.
fullPath
.
indexOf
(
"?"
)
>
-
1
)
{
const
_viewparams
:
any
=
route
.
fullPath
.
slice
(
route
.
fullPath
.
indexOf
(
"?"
)
+
1
);
const
_viewparamArray
:
Array
<
string
>
=
decodeURIComponent
(
_viewparams
).
split
(
";"
)
if
(
route
&&
route
.
fullPath
&&
route
.
fullPath
.
indexOf
(
'?'
)
>
-
1
)
{
const
_viewparams
:
any
=
route
.
fullPath
.
slice
(
route
.
fullPath
.
indexOf
(
'?'
)
+
1
);
const
_viewparamArray
:
Array
<
string
>
=
decodeURIComponent
(
_viewparams
).
split
(
';'
);
if
(
_viewparamArray
.
length
>
0
)
{
_viewparamArray
.
forEach
((
item
:
any
)
=>
{
Object
.
assign
(
viewparams
,
qs
.
parse
(
item
));
})
});
}
}
}
...
...
@@ -165,7 +173,7 @@ export class RouteTool {
* @memberof RouteTool
*/
public
static
setIndexParameters
(
parameters
:
any
[]):
void
{
this
.
indexParameters
=
[...
parameters
]
this
.
indexParameters
=
[...
parameters
];
}
/**
...
...
@@ -221,8 +229,7 @@ export class RouteTool {
*/
public
static
calcActionItemAuthState
(
data
:
any
,
ActionModel
:
any
,
UIService
:
any
)
{
let
result
:
any
[]
=
[];
if
(
!
UIService
)
return
;
if
(
!
UIService
)
return
;
for
(
const
key
in
ActionModel
)
{
if
(
!
ActionModel
.
hasOwnProperty
(
key
))
{
return
result
;
...
...
@@ -230,7 +237,7 @@ export class RouteTool {
const
_item
=
ActionModel
[
key
];
let
dataActionResult
:
any
;
if
(
_item
&&
_item
[
'dataAccessAction'
])
{
if
(
Object
.
is
(
_item
[
'actionTarget'
],
"NONE"
)
||
Object
.
is
(
_item
[
'actionTarget'
],
""
))
{
if
(
Object
.
is
(
_item
[
'actionTarget'
],
'NONE'
)
||
Object
.
is
(
_item
[
'actionTarget'
],
''
))
{
dataActionResult
=
UIService
.
getAllOPPrivs
(
undefined
,
_item
[
'dataAccessAction'
]);
}
else
{
if
(
data
&&
Object
.
keys
(
data
).
length
>
0
)
{
...
...
@@ -246,7 +253,7 @@ export class RouteTool {
if
(
_item
.
getNoPrivDisplayMode
===
1
)
{
_item
.
disabled
=
true
;
}
if
((
_item
.
getNoPrivDisplayMode
===
2
)
||
(
_item
.
getNoPrivDisplayMode
===
6
)
)
{
if
(
_item
.
getNoPrivDisplayMode
===
2
||
_item
.
getNoPrivDisplayMode
===
6
)
{
_item
.
visabled
=
false
;
}
else
{
_item
.
visabled
=
true
;
...
...
@@ -274,15 +281,14 @@ export class RouteTool {
*/
public
static
calcTreeActionItemAuthState
(
data
:
any
,
ActionModel
:
any
,
UIService
:
any
)
{
let
result
:
any
[]
=
[];
if
(
!
UIService
)
return
;
if
(
!
UIService
)
return
;
for
(
const
key
in
ActionModel
)
{
if
(
!
ActionModel
.
hasOwnProperty
(
key
))
{
return
result
;
}
const
_item
=
ActionModel
[
key
];
let
dataActionResult
:
any
;
if
(
Object
.
is
(
_item
[
'actiontarget'
],
"NONE"
)
||
Object
.
is
(
_item
[
'actiontarget'
],
""
))
{
if
(
Object
.
is
(
_item
[
'actiontarget'
],
'NONE'
)
||
Object
.
is
(
_item
[
'actiontarget'
],
''
))
{
dataActionResult
=
UIService
.
getAllOPPrivs
(
undefined
,
_item
[
'dataaccaction'
]);
}
else
{
if
(
_item
&&
_item
[
'dataaccaction'
]
&&
UIService
.
isEnableDEMainState
)
{
...
...
@@ -297,7 +303,7 @@ export class RouteTool {
if
(
_item
.
noprivdisplaymode
===
1
)
{
_item
.
disabled
=
true
;
}
if
((
_item
.
noprivdisplaymode
===
2
)
||
(
_item
.
noprivdisplaymode
===
6
)
)
{
if
(
_item
.
noprivdisplaymode
===
2
||
_item
.
noprivdisplaymode
===
6
)
{
_item
.
visabled
=
false
;
}
else
{
_item
.
visabled
=
true
;
...
...
@@ -324,7 +330,11 @@ export class RouteTool {
* @memberof RouteTool
*/
public
static
async
calcRedirectContext
(
tempContext
:
any
,
data
:
any
,
redirectAppEntity
:
any
)
{
if
(
redirectAppEntity
&&
redirectAppEntity
.
getMinorPSAppDERSs
()
&&
((
redirectAppEntity
.
getMinorPSAppDERSs
()
as
[]).
length
>
0
))
{
if
(
redirectAppEntity
&&
redirectAppEntity
.
getMinorPSAppDERSs
()
&&
(
redirectAppEntity
.
getMinorPSAppDERSs
()
as
[]).
length
>
0
)
{
for
(
const
item
of
redirectAppEntity
.
getMinorPSAppDERSs
())
{
const
parentPSAppDEFieldCodeName
:
string
=
item
.
M
.
getParentPSAppDEField
?.
codeName
;
if
(
parentPSAppDEFieldCodeName
)
{
...
...
@@ -333,12 +343,13 @@ export class RouteTool {
const
majorAppEntity
:
any
=
item
.
getMajorPSAppDataEntity
();
await
majorAppEntity
.
fill
();
if
(
!
tempContext
[
majorAppEntity
.
codeName
.
toLowerCase
()])
{
Object
.
assign
(
tempContext
,
{
[
majorAppEntity
.
codeName
.
toLowerCase
()]:
curData
[
parentPSAppDEFieldCodeName
.
toLowerCase
()]
});
Object
.
assign
(
tempContext
,
{
[
majorAppEntity
.
codeName
.
toLowerCase
()]:
curData
[
parentPSAppDEFieldCodeName
.
toLowerCase
()],
});
}
}
}
}
}
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/service/app/app.ts
0 → 100644
浏览文件 @
1bf03e3f
import
{
AppModal
}
from
'@/utils'
;
import
{
Http
,
deepCopy
}
from
'@ibiz-core'
;
import
{
OpenViewService
}
from
'@service'
;
export
class
App
{
/**
* 打开视图服务
* @static
*/
public
static
openViewService
:
OpenViewService
=
OpenViewService
.
getInstance
();
/**
* 打开视图服务
* @static
*/
public
static
modalService
:
AppModal
=
AppModal
.
getInstance
();
/**
* 所有视图信息
*
* @static
*/
public
static
allViewInfos
:
any
;
/**
* 获取视图信息
*
* @static
* @param codeName 视图codeName
* @return {*}
*/
public
static
getViewInfo
(
codeName
:
string
){
return
App
.
allViewInfos
[
codeName
]
?
deepCopy
(
App
.
allViewInfos
[
codeName
])
:
undefined
;
}
/**
* 初始化
*
* @static
*/
public
static
async
init
(){
const
response
=
await
Http
.
getInstance
().
get
(
'./assets/json/views.json'
)
App
.
allViewInfos
=
response
.
data
;
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/service/index.ts
0 → 100644
浏览文件 @
1bf03e3f
export
*
from
'./open-view/open-view-service'
;
export
*
from
'./app/app'
;
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/service/open-view/open-view-service.ts
浏览文件 @
1bf03e3f
import
{
deepCopy
,
IParam
,
Singleton
,
RouteTool
}
from
"@ibiz-core"
;
import
{
useRouter
}
from
"vue-router"
;
const
allViews
=
require
(
'./views.json'
)
import
{
deepCopy
,
IParam
,
RouteTool
}
from
'@ibiz-core'
;
import
{
App
}
from
'@service'
;
import
router
from
'@/router'
;
interface
View
extends
IParam
{
codeName
:
string
,
openMode
?:
string
,
interface
View
extends
IParam
{
codeName
:
string
;
openMode
?:
string
;
}
interface
Params
extends
IParam
{
context
:
any
,
viewParams
:
any
,
interface
Params
extends
IParam
{
context
:
any
;
viewParams
:
any
;
}
/**
...
...
@@ -17,7 +17,26 @@ interface Params extends IParam{
* @export
* @class OpenViewService
*/
export
class
OpenViewService
extends
Singleton
{
export
class
OpenViewService
{
/**
* 唯一实例
*
* @private
* @static
* @memberof OpenViewService
*/
private
static
readonly
instance
=
new
OpenViewService
();
/**
* 获取唯一实例
*
* @static
* @return {*} {OpenViewService}
* @memberof OpenViewService
*/
public
static
getInstance
():
OpenViewService
{
return
OpenViewService
.
instance
;
}
/**
* 打开视图
...
...
@@ -25,26 +44,24 @@ interface Params extends IParam{
* @param view 视图信息
* @param params 相关参数
*/
public
openView
(
view
:
View
,
params
:
Params
){
public
openView
(
view
:
View
,
params
:
Params
)
{
// 获取详细视图信息
let
_view
:
any
=
allViews
[
view
.
codeName
]
;
if
(
!
_view
)
{
let
_view
:
any
=
App
.
getViewInfo
(
view
.
codeName
)
;
if
(
!
_view
)
{
console
.
error
(
`应用中不存在
${
view
.
codeName
}
视图`
);
return
return
;
}
// 拷贝防污染,view的openMode覆盖配置的
_view
=
deepCopy
(
_view
);
if
(
view
.
openMode
){
// view的openMode覆盖配置的
if
(
view
.
openMode
)
{
_view
.
openMode
=
view
.
openMode
;
}
// 重定向视图走重定向逻辑,其他根据openMode打开
if
(
_view
.
redirectView
)
{
if
(
_view
.
redirectView
)
{
this
.
openRedirectView
(
_view
,
params
);
}
else
{
this
.
openByOpenMode
(
_view
,
params
)
}
else
{
this
.
openByOpenMode
(
_view
,
params
)
;
}
}
/**
...
...
@@ -53,30 +70,26 @@ interface Params extends IParam{
* @param view 视图信息
* @param params 相关参数
*/
public
openByOpenMode
(
view
:
any
,
params
:
Params
){
public
openByOpenMode
(
view
:
any
,
params
:
Params
)
{
const
{
openMode
}
=
view
;
const
{
viewParams
,
context
}
=
params
const
{
viewParams
,
context
}
=
params
;
// 路由打开视图
if
(
openMode
==
'INDEXVIEWTAB'
||
openMode
==
'POPUPAPP'
)
{
if
(
openMode
==
'INDEXVIEWTAB'
||
openMode
==
'POPUPAPP'
)
{
// TODO 视图关系参数处理
const
router
=
useRouter
();
const
routePath
=
RouteTool
.
buildUpRoutePath
(
view
,
context
,
viewParams
);
if
(
openMode
==
'INDEXVIEWTAB'
){
const
routePath
=
RouteTool
.
buildUpRoutePath
(
view
,
context
,
viewParams
,
router
.
currentRoute
.
value
);
if
(
openMode
==
'INDEXVIEWTAB'
)
{
router
.
push
(
routePath
);
}
else
{
}
else
{
window
.
open
(
'./#'
+
routePath
,
'_blank'
);
}
}
else
if
(
openMode
==
'POPUPMODAL'
){
}
else
if
(
openMode
.
indexOf
(
'DRAWER'
)
!==
-
1
){
}
else
if
(
openMode
==
'POPUPMODAL'
)
{
}
else
if
(
openMode
.
indexOf
(
'DRAWER'
)
!==
-
1
)
{
// TODO PMS上面抽屉DRAWER_TOP
}
else
if
(
openMode
==
'POPOVER'
){
}
else
if
(
openMode
==
'POPOVER'
)
{
// TODO 打开气泡卡片
}
else
{
}
else
{
console
.
error
(
`未支持
${
openMode
}
打开方式`
);
}
}
/**
...
...
@@ -85,7 +98,7 @@ interface Params extends IParam{
* @param view 视图信息
* @param params 相关参数
*/
public
openRedirectView
(
view
:
any
,
params
:
Params
){
public
openRedirectView
(
view
:
any
,
params
:
Params
)
{
// TODO 重定向视图处理
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/utils/app-modal/app-modal.ts
浏览文件 @
1bf03e3f
...
...
@@ -4,7 +4,6 @@ import Antd from 'ant-design-vue';
// import { AppServiceBase, LogUtil } from 'ibiz-core';
import
AppModalComponent
from
"./app-modal.vue"
;
import
IbizLoading
from
'@components/render/IbizLoading.vue'
;
import
'./app-modal.scss'
;
export
class
AppModal
{
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/utils/app-modal/app-modal.vue
浏览文件 @
1bf03e3f
...
...
@@ -234,7 +234,3 @@ const handleShowState = ($event: any) => {
></component>
</a-modal>
</
template
>
<
style
lang=
"scss"
scoped
>
@import
'./app-modal.scss'
;
</
style
>
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@FORM}}-form/{{ctrls@FORM}}-form-config.ts.hbs
浏览文件 @
1bf03e3f
...
...
@@ -56,10 +56,10 @@ export class ControlVO extends ControlVOBase {
{{/
neq
}}
{{/
each
}}
// 表单里没有映射实体属性的字段
// 表单里没有映射实体属性的字段
(srfuf除外)
{{#
each
ctrl
.
psDEFormItems
as
|
formItem
|
}}
{{#
eq
formItem
.
psAppDEField
null
}}
{{#
if
(
and
(
eq
formItem
.
psAppDEField
null
)
(
neq
formItem
.
id
"srfuf"
))
}}
{{
lowerCase
formItem
.
id
}}
: any;
{{/
eq
}}
{{/
if
}}
{{/
each
}}
}
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录