Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
a1af18f0
提交
a1af18f0
编写于
2月 07, 2022
作者:
tony001
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:调整uiservice
上级
59fc6e29
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
163 行增加
和
38 行删除
+163
-38
entity-ui-service-base.ts
.../core/service/entity-ui-service/entity-ui-service-base.ts
+106
-11
{{appEntities}}-ui-service-base.ts.hbs
...ce/{{appEntities}}/{{appEntities}}-ui-service-base.ts.hbs
+57
-27
未找到文件。
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/service/entity-ui-service/entity-ui-service-base.ts
浏览文件 @
a1af18f0
import
{
IParam
}
from
"@core"
;
import
{
Environment
}
from
"@/environments/environment"
;
/**
* 界面服务基类
...
...
@@ -17,6 +18,36 @@ export class UIServiceBase {
*/
protected
context
:
IParam
;
/**
* 应用实体主键属性
*
* @protected
* @type {string}
* @memberof UIServiceBase
*/
protected
appDeKeyFieldName
:
string
=
''
;
/**
* 主状态属性集合
*
* @memberof UIServiceBase
*/
protected
mainStateFields
:
Array
<
string
>
=
[];
/**
* 主状态集合Map
*
* @memberof UIServiceBase
*/
protected
allDeMainStateMap
:
Map
<
string
,
string
>
=
new
Map
();
/**
* 主状态操作标识Map
*
* @memberof UIServiceBase
*/
protected
allDeMainStateOPPrivsMap
:
Map
<
string
,
any
>
=
new
Map
();
/**
*
* @param {*} [opts={}]
...
...
@@ -27,24 +58,88 @@ export class UIServiceBase {
}
/**
*
界面行为模型对象
*
获取数据对象所有的操作标识
*
* @type {*}
* @memberof UIServiceBase
* @param data 当前数据
* @param dataaccaction 数据操作标识
* @memberof UIServiceBase
*/
public
uiActionModes
:
any
=
{};
protected
getAllOPPrivs
(
data
:
any
,
dataaccaction
:
string
)
{
if
(
!
Environment
.
enablePermissionValid
)
{
return
1
;
}
if
(
data
&&
(
Object
.
keys
(
data
).
length
>
0
))
{
const
curActiveKey
:
string
=
`
${
data
[
this
.
appDeKeyFieldName
?.
toLowerCase
()]}
`;
//const result = this.authService.getOPPrivs(curActiveKey, dataaccaction, this.getDEMainStateOPPrivs(data));
return 1;
} else {
// const result = this.authService.getOPPrivs(undefined, dataaccaction, undefined);
return 1;
}
}
/**
* 获取数据对象当前操作标识
*
* 获取界面行为模型对象
* @param data 当前数据
* @memberof UIServiceBase
*/
protected getDEMainStateOPPrivs(data: any) {
const mainStateTag = this.getDEMainStateTag(data);
if (mainStateTag) {
return this.allDeMainStateOPPrivsMap.get(mainStateTag);
} else {
return null;
}
}
/**
* 获取数据对象的主状态标识
*
* @param
{string} actionName
* @memberof UIServiceBase
* @param
data 当前数据
* @memberof
UIServiceBase
*/
public
getUIActionModel
(
actionName
:
string
)
{
if
(
!
actionName
)
{
return
;
protected getDEMainStateTag(data: IParam) {
const mainStateFields: string[] = [];
if (mainStateFields.length === 0) return null;
mainStateFields.forEach((singleMainField: any) => {
if (!(singleMainField in data)) {
console.warn(
`
当前数据对象不包含属性「
$
{
singleMainField
}
」,根据「
$
{
singleMainField
}
」属性进行的主状态计算默认为空值
`,
);
}
});
for (let i = 0; i <= 1; i++) {
let strTag: string =
data[mainStateFields[0]] != null && data[mainStateFields[0]] !== ''
? i == 0
? `
$
{
data
[
mainStateFields
[
0
]]}
`
: ''
: '';
if (mainStateFields.length >= 2) {
for (let j = 0; j <= 1; j++) {
let strTag2: string =
data[mainStateFields[1]] != null && data[mainStateFields[1]] !== ''
? `
$
{
strTag
}
__$
{
j
==
0
?
`
${
data
[
mainStateFields
[
1
]]}
`
:
''
}
`
: strTag;
if (mainStateFields.length >= 3) {
for (let k = 0; k <= 1; k++) {
let strTag3: string =
data[mainStateFields[2]] != null && data[mainStateFields[2]] !== ''
? `
$
{
strTag2
}
__$
{
k
==
0
?
`
${
data
[
mainStateFields
[
2
]]}
`
:
''
}
`
: strTag2;
// 判断是否存在
return this.allDeMainStateMap.get(strTag3);
}
} else {
return this.allDeMainStateMap.get(strTag2);
}
}
} else {
return this.allDeMainStateMap.get(strTag);
}
}
return
this
.
uiActionModes
[
actionName
]
?
this
.
uiActionModes
[
actionName
]
:
null
;
return null;
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ui-service/{{appEntities}}/{{appEntities}}-ui-service-base.ts.hbs
浏览文件 @
a1af18f0
...
...
@@ -9,22 +9,64 @@ import { AppFrontAction, AppBackendAction } from '@core';
*/
export class
{{
pascalCase
appEntity
.
codeName
}}
UIServiceBase extends UIServiceBase {
/**
* Creates an instance of
{{
pascalCase
appEntity
.
codeName
}}
UIServiceBase
*
* @param {*} [opts={}]
* @memberof
{{
pascalCase
appEntity
.
codeName
}}
UIServiceBase
*/
constructor(opts: IParam = {}) {
super(opts);
}
/**
* Creates an instance of
{{
pascalCase
appEntity
.
codeName
}}
UIServiceBase
*
* @param {*} [opts={}]
* @memberof
{{
pascalCase
appEntity
.
codeName
}}
UIServiceBase
*/
constructor(opts: IParam = {}) {
super(opts);
this.initBasicData();
}
{{!-- 遍历界面行为 --}}
/**
* 初始化基础数据
*
* @memberof
{{
pascalCase
appEntity
.
codeName
}}
UIServiceBase
*/
public initBasicData() {
// 应用实体主键属性
this.appDeKeyFieldName = '
{{
lowerCase
appEntity
.
pSDataEntity
.
keyPSDEField
.
codeName
}}
';
{{#if
appEntity
.
pSDataEntity
.
dEMainStateDEFields
}}
// 主状态属性集合
this.mainStateFields = [
{{
~#
each
appEntity
.
pSDataEntity
.
dEMainStateDEFields
as
|
mainStateDEField
|~
}}
'
{{
lowerCase
mainStateDEField
.
codeName
}}
'
{{#
unless
@last
}}
,
{{/
unless
}}
{{
~
/
each
~
}}
];
{{/if}}
{{#if
appEntity
.
allPSDEMainStates
}}
// 主状态集合Map
{{#
each
appEntity
.
allPSDEMainStates
as
|
mainState
|
}}
this.allDeMainStateMap.set('
{{
mainState
.
mSTag
}}
', '
{{
mainState
.
mSTag
}}
');
{{/
each
}}
// 主状态操作标识Map
{{#
each
appEntity
.
allPSDEMainStates
as
|
mainState
|
}}
this.allDeMainStateOPPrivsMap.set('
{{
mainState
.
mSTag
}}
', Object.assign({
{{
~#
each
appEntity
.
allPSDEOPPrivs
as
|
deOPPriv
|~
}}
'${deOPPriv.name}':
{{#if
deOPPriv
.
isOPPrivAllowMode
}}
1
{{else}}
0
{{/if}}{{#
unless
@last
}}
,
{{/
unless
}}
{{
~
/
each
~
}}
},
{
{{
~#
each
mainState
.
pSDEMainStateOPPrivs
as
|
deMainStateOPPriv
|~
}}
'${deMainStateOPPriv.name}':
{{#if
deMainStateOPPriv
.
isOPPrivAllowMode
}}
1
{{else}}
0
{{/if}}{{#
unless
@last
}}
,
{{/
unless
}}
{{
~
/
each
~
}}
}));
{{/
each
}}
{{/if}}
}
public uiActionModes = {
{{
~#
each
appEntity
.
appDEUIActions
as
|
appDEUIAction
|
}}
"
{{
appDEUIAction
.
codeName
}}
":{
{{!-- 遍历界面行为 --}}
{{
~#
each
appEntity
.
appDEUIActions
as
|
appDEUIAction
|
}}
/**
*
{{
appDEUIAction
.
caption
}}
*
* @param {*} params
* @memberof
{{
pascalCase
appEntity
.
codeName
}}
UIServiceBase
*/
public async
{{
appDEUIAction
.
codeName
}}
(uiAction:any, params:any){
const actionModel = {
codeName:'
{{
appDEUIAction
.
codeName
}}
',
uIActionMode:'
{{
appDEUIAction
.
UIActionMode
}}
',
actionTarget:'
{{
upperCase
appDEUIAction
.
actionTarget
}}
',
...
...
@@ -40,19 +82,7 @@ export class {{pascalCase appEntity.codeName}}UIServiceBase extends UIServiceBas
nextActionCodeName:'
{{
appDEUIAction
.
nextActionCodeName
}}
',
navContexts:
{{
appDEUIAction
.
navContexts
}}
,
navParams:
{{
appDEUIAction
.
navParams
}}
},
{{/
each
}}
};
{{
~#
each
appEntity
.
appDEUIActions
as
|
appDEUIAction
|
}}
/**
*
{{
appDEUIAction
.
caption
}}
*
* @param {*} params
* @memberof
{{
pascalCase
appEntity
.
codeName
}}
UIServiceBase
*/
public async
{{
appDEUIAction
.
codeName
}}
(uiAction:any, params:any){
const actionModel = this.getUIActionModel('
{{
appDEUIAction
.
codeName
}}
');
};
{{#
eq
appDEUIAction
.
UIActionMode
'FRONT'
}}
AppFrontAction.doAction(actionModel, params);
{{/
eq
}}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录