Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
7dce5820
提交
7dce5820
编写于
12月 29, 2021
作者:
sq3536
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
06232cf0
3ab34835
变更
24
隐藏空白字符变更
内嵌
并排
正在显示
24 个修改的文件
包含
453 行增加
和
193 行删除
+453
-193
AppModel.java
...core/src/main/java/cn/ibizlab/codegen/model/AppModel.java
+43
-1
include-editor.hbs
.../main/resources/templ/r7/@macro/editor/include-editor.hbs
+1
-0
form-details-model.hbs
...ources/templ/r7/@macro/form-detail/form-details-model.hbs
+16
-0
form-item.hbs
.../main/resources/templ/r7/@macro/form-detail/form-item.hbs
+1
-1
include-form.hbs
...in/resources/templ/r7/@macro/form-detail/include-form.hbs
+2
-1
viewBaseConfig.hbs
.../templ/r7/@macro/front-end/view/common/viewBaseConfig.hbs
+14
-0
grid-column-model.hbs
...sources/templ/r7/@macro/grid-detail/grid-column-model.hbs
+5
-4
grid-column.hbs
...ain/resources/templ/r7/@macro/grid-detail/grid-column.hbs
+12
-12
index.ts
...mpl/r7/app_{{apps}}/src/ibiz-core/modules/common/index.ts
+33
-0
main-view.ts
...apps}}/src/ibiz-core/modules/views/main-view/main-view.ts
+8
-1
control-base.ts
...rc/ibiz-core/modules/widgets/control-base/control-base.ts
+8
-0
form-control.ts
...rc/ibiz-core/modules/widgets/form-control/form-control.ts
+21
-7
grid-control-state.ts
...z-core/modules/widgets/grid-control/grid-control-state.ts
+14
-0
grid-control.ts
...rc/ibiz-core/modules/widgets/grid-control/grid-control.ts
+147
-64
index.ts.hbs
...c/page/{{appModules}}/{{pages@APPINDEXVIEW}}/index.ts.hbs
+1
-1
index.ts.hbs
...src/page/{{appModules}}/{{pages@DEEDITVIEW}}/index.ts.hbs
+1
-1
{{pages@DEEDITVIEW}}-config.ts.hbs
...}/{{pages@DEEDITVIEW}}/{{pages@DEEDITVIEW}}-config.ts.hbs
+1
-3
{{pages@DEEDITVIEW}}.vue.hbs
...dules}}/{{pages@DEEDITVIEW}}/{{pages@DEEDITVIEW}}.vue.hbs
+8
-2
index.ts.hbs
...src/page/{{appModules}}/{{pages@DEGRIDVIEW}}/index.ts.hbs
+1
-1
{{pages@DEGRIDVIEW}}.vue.hbs
...dules}}/{{pages@DEGRIDVIEW}}/{{pages@DEGRIDVIEW}}.vue.hbs
+2
-2
index.ts.hbs
...n/resources/templ/r7/app_{{apps}}/src/router/index.ts.hbs
+32
-82
{{ctrls@FORM}}-form-config.ts.hbs
...s}}/{{ctrls@FORM}}-form/{{ctrls@FORM}}-form-config.ts.hbs
+29
-1
{{ctrls@GRID}}-grid-config.ts.hbs
...s}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid-config.ts.hbs
+3
-0
{{ctrls@GRID}}-grid.vue.hbs
...ntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid.vue.hbs
+50
-9
未找到文件。
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/AppModel.java
浏览文件 @
7dce5820
package
cn
.
ibizlab
.
codegen
.
model
;
package
cn
.
ibizlab
.
codegen
.
model
;
import
cn.ibizlab.codegen.utils.Inflector
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.Setter
;
...
@@ -32,6 +34,31 @@ public class AppModel extends BaseModel{
...
@@ -32,6 +34,31 @@ public class AppModel extends BaseModel{
});
});
}
}
// 初始化应用实体资源数据Map
if
(
getApplication
().
getAllPSAppDataEntities
()!=
null
)
{
getApplication
().
getAllPSAppDataEntities
().
forEach
(
appDataEntity
->{
if
(
appDataEntity
.
getMinorPSAppDERSs
()
!=
null
){
appDataEntity
.
getMinorPSAppDERSs
().
forEach
(
appDERS
->{
JSONObject
tempObj
=
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
();
tempObj
.
put
(
"majorCodeName"
,
majorCodeName
.
toLowerCase
());
tempObj
.
put
(
"curCodeName"
,
minorCodeName
.
toLowerCase
());
tempObj
.
put
(
"path"
,
path
);
tempObj
.
put
(
"appDataEntity"
,
appDataEntity
);
appEntityResourceMap
.
put
(
String
.
format
(
"%1$s:%2$s"
,
majorCodeName
,
minorCodeName
),
tempObj
);
});
}
else
{
JSONObject
tempObj
=
new
JSONObject
();
tempObj
.
put
(
"curCodeName"
,
appDataEntity
.
getCodeName
().
toLowerCase
());
tempObj
.
put
(
"path"
,
String
.
format
(
"%1$s/:%2$s?"
,
Inflector
.
getInstance
().
pluralize
(
appDataEntity
.
getCodeName
()),
appDataEntity
.
getCodeName
()).
toLowerCase
());
tempObj
.
put
(
"appDataEntity"
,
appDataEntity
);
appEntityResourceMap
.
put
(
appDataEntity
.
getCodeName
(),
tempObj
);
}
});
}
}
}
...
@@ -42,7 +69,7 @@ public class AppModel extends BaseModel{
...
@@ -42,7 +69,7 @@ public class AppModel extends BaseModel{
return
(
IPSApplication
)
opt
;
return
(
IPSApplication
)
opt
;
}
}
private
Map
<
String
,
AppEntityModel
>
appEntitiesMap
=
new
LinkedHashMap
<>();
;
private
Map
<
String
,
AppEntityModel
>
appEntitiesMap
=
new
LinkedHashMap
<>();
private
Map
<
String
,
PageModel
>
pagesMap
=
new
LinkedHashMap
<>();
private
Map
<
String
,
PageModel
>
pagesMap
=
new
LinkedHashMap
<>();
...
@@ -77,4 +104,19 @@ public class AppModel extends BaseModel{
...
@@ -77,4 +104,19 @@ public class AppModel extends BaseModel{
return
null
;
return
null
;
}
}
/**
* 应用实体资源数据Map
*/
private
Map
<
String
,
JSONObject
>
appEntityResourceMap
=
new
LinkedHashMap
<>();
/**
* 获取应用实体资源数据
* @return
*/
public
Collection
<
JSONObject
>
getAppEntityResources
(){
if
(
appEntityResourceMap
!=
null
)
return
appEntityResourceMap
.
values
();
return
new
ArrayList
<>();
}
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/@macro/editor/include-editor.hbs
浏览文件 @
7dce5820
...
@@ -46,5 +46,6 @@
...
@@ -46,5 +46,6 @@
{{#
*
inline
"FILEUPLOADER_ONE"
}}{{>
@macro
/
editor
/
upload
.
hbs
}}{{/
inline
}}
{{#
*
inline
"FILEUPLOADER_ONE"
}}{{>
@macro
/
editor
/
upload
.
hbs
}}{{/
inline
}}
{{#
*
inline
"PICTURE"
}}{{>
@macro
/
editor
/
upload
.
hbs
}}{{/
inline
}}
{{#
*
inline
"PICTURE"
}}{{>
@macro
/
editor
/
upload
.
hbs
}}{{/
inline
}}
{{#
*
inline
"PICTURE_ONE"
}}{{>
@macro
/
editor
/
upload
.
hbs
}}{{/
inline
}}
{{#
*
inline
"PICTURE_ONE"
}}{{>
@macro
/
editor
/
upload
.
hbs
}}{{/
inline
}}
{{#
*
inline
"PICKUPVIEW"
}}{{>
@macro
/
editor
/
data-picker-view
.
hbs
}}{{/
inline
}}
{{#
*
inline
"PICKEREX_DROPDOWNVIEW"
}}{{>
@macro
/
editor
/
data-picker-view
.
hbs
}}{{/
inline
}}
{{#
*
inline
"PICKEREX_DROPDOWNVIEW"
}}{{>
@macro
/
editor
/
data-picker-view
.
hbs
}}{{/
inline
}}
{{#
*
inline
"PICKEREX_DROPDOWNVIEW_LINK"
}}{{>
@macro
/
editor
/
data-picker-view
.
hbs
}}{{/
inline
}}
{{#
*
inline
"PICKEREX_DROPDOWNVIEW_LINK"
}}{{>
@macro
/
editor
/
data-picker-view
.
hbs
}}{{/
inline
}}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/@macro/form-detail/form-details-model.hbs
0 → 100644
浏览文件 @
7dce5820
{{#
each
items
as
|
formDetail
|
}}
{
caption: '
{{
formDetail
.
caption
}}
',
codeName: '
{{
formDetail
.
codeName
}}
',
name: '
{{
formDetail
.
name
}}
',
{{#if
(
eq
formDetail
.
detailType
"FORMITEM"
)
}}
dataType: '
{{
formDetail
.
dataType
}}
',
detailStyle: '
{{
formDetail
.
detailStyle
}}
',
resetItemName: '
{{
formDetail
.
resetItemName
}}
',
valueItemName: '
{{
formDetail
.
valueItemName
}}
',
{{/if}}
},
{{#if
formDetail
.
psDEFormDetails
}}
{{>
(
lookup
'FORMDETAILSMODEL'
)
items
=
formDetail
.
psDEFormDetails
}}
{{/if}}
{{/
each
}}
modules/ibizlab-generator-core/src/main/resources/templ/r7/@macro/form-detail/form-item.hbs
浏览文件 @
7dce5820
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
<a-col
:span=
"24"
>
<a-col
:span=
"24"
>
<IbizFormItem
name=
"
{{
item
.
codeName
}}
"
label=
"
{{
item
.
caption
}}
"
>
<IbizFormItem
name=
"
{{
item
.
codeName
}}
"
label=
"
{{
item
.
caption
}}
"
>
{{#if
item
.
psEditor
}}
{{#if
item
.
psEditor
}}
{{>
(
lookup
.
'item.psEditor.editorType'
)
item
=
item
}}
{{>
(
lookup
.
'item.psEditor.editorType'
)
item
=
item
controlType
=
"form"
}}
{{/if}}
{{/if}}
</IbizFormItem>
</IbizFormItem>
</a-col>
</a-col>
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/@macro/form-detail/include-form.hbs
浏览文件 @
7dce5820
{{#
*
inline
"FORMPAGE"
}}{{>
@macro
/
form-detail
/
form-page
.
hbs
}}{{/
inline
}}
{{#
*
inline
"FORMPAGE"
}}{{>
@macro
/
form-detail
/
form-page
.
hbs
}}{{/
inline
}}
{{#
*
inline
"GROUPPANEL"
}}{{>
@macro
/
form-detail
/
form-group
.
hbs
}}{{/
inline
}}
{{#
*
inline
"GROUPPANEL"
}}{{>
@macro
/
form-detail
/
form-group
.
hbs
}}{{/
inline
}}
{{#
*
inline
"FORMITEM"
}}{{>
@macro
/
form-detail
/
form-item
.
hbs
}}{{/
inline
}}
{{#
*
inline
"FORMITEM"
}}{{>
@macro
/
form-detail
/
form-item
.
hbs
}}{{/
inline
}}
\ No newline at end of file
{{#
*
inline
"FORMDETAILSMODEL"
}}{{>
@macro
/
form-detail
/
form-details-model
.
hbs
}}{{/
inline
}}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/@macro/front-end/view/common/viewBaseConfig.hbs
0 → 100644
浏览文件 @
7dce5820
viewCodeName: '
{{
page
.
codeName
}}
',
viewName: '
{{
page
.
name
}}
',
viewCaption: '
{{
page
.
caption
}}
',
height: '
{{
page
.
height
}}
',
width: '
{{
page
.
width
}}
',
viewMsgGroup: '
{{
page
.
psAppViewMsgGroup
}}
',
viewUIActions: '
{{
page
.
psAppViewUIActions
}}
',
viewSysCss: '
{{
page
.
psSysCss
}}
',
viewSysImage: '
{{
page
.
psSysImage
}}
',
subCaption: '
{{
page
.
subCaption
}}
',
viewType: '
{{
page
.
viewType
}}
',
viewStyle: '
{{
page
.
viewStyle
}}
',
showCaptionBar: '
{{
page
.
viewStyle
}}
',
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/@macro/grid-detail/grid-column-model.hbs
浏览文件 @
7dce5820
...
@@ -2,16 +2,14 @@
...
@@ -2,16 +2,14 @@
title: "
{{
item
.
caption
}}
",
title: "
{{
item
.
caption
}}
",
columnType: "
{{
item
.
columnType
}}
",
columnType: "
{{
item
.
columnType
}}
",
{{#if
item
.
align
}}
{{#if
item
.
align
}}
align: "
{{
item
.
align
}}
",
align: "
{{
lowerCase
item
.
align
}}
",
{{/if}}
{{/if}}
{{#
neq
lastColumn
true
}}
{{#if
item
.
widthUnit
'PX'
}}
{{#if
item
.
widthUnit
'PX'
}}
width:
{{
item
.
width
}}
,
width:
{{
item
.
width
}}
,
{{else}}
{{else}}
minWidth:
{{
item
.
width
}}
,
minWidth:
{{
item
.
width
}}
,
{{/if}}
{{/if}}
resizable: true,
resizable: true,
{{/
neq
}}
{{#
eq
item
.
columnType
'GROUPGRIDCOLUMN'
}}
{{#
eq
item
.
columnType
'GROUPGRIDCOLUMN'
}}
children: [
children: [
{{#
each
item
.
psDEGridColumns
as
|
column
|
}}
{{#
each
item
.
psDEGridColumns
as
|
column
|
}}
...
@@ -19,7 +17,10 @@
...
@@ -19,7 +17,10 @@
{{/
each
}}
{{/
each
}}
],
],
{{else}}
{{else}}
dataIndex: "
{{
lowerCase
item
.
codeName
}}
",
{{#
eq
item
.
columnType
'UAGRIDCOLUMN'
}}
fixed: "right",
{{/
eq
}}
dataIndex: "
{{#if
item
.
dataItemName
}}{{
lowerCase
item
.
dataItemName
}}{{else}}{{
lowerCase
item
.
codeName
}}{{/if}}
",
ellipsis: true,
ellipsis: true,
enableSort:
{{
item
.
enableSort
}}
,
enableSort:
{{
item
.
enableSort
}}
,
{{#if
item
.
aggMode
}}
{{#if
item
.
aggMode
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/@macro/grid-detail/grid-column.hbs
浏览文件 @
7dce5820
{{#
neq
item
.
columnType
'GROUPGRIDCOLUMN'
}}
{{#
if
(
neq
item
.
columnType
'GROUPGRIDCOLUMN'
)
}}
<div
v-if=
"
column.dataIndex === '
{{
item
.
codeName
}}
'
"
class=
"table-cell"
>
<div
v-if=
"
Object.is(column.dataIndex, '
{{
item
.
codeName
}}
')
"
class=
"table-cell"
>
{{#
eq
item
.
columnType
'DEFGRIDCOLUMN'
}}
{{#
if
(
eq
item
.
columnType
'DEFGRIDCOLUMN'
)
}}
{{#if
item
.
enableRowEdit
}}
{{#if
item
.
enableRowEdit
}}
<div
v-if=
"state.rowEditState"
class=
"editor-cell"
>
<div
v-if=
"state.rowEditState"
class=
"editor-cell"
>
{{#
each
ctrl
.
psDEGridEditItems
as
|
editColumn
|
}}
{{#
each
ctrl
.
psDEGridEditItems
as
|
editColumn
|
}}
{{#
eq
editColumn
.
codeName
(
item
.
codeName
)
}}
{{#
eq
editColumn
.
codeName
(
item
.
codeName
)
}}
{{#if
item
.
psEditor
}}
{{#if
item
.
psEditor
}}
{{>
(
lookup
.
'item.psEditor.editorType'
)
item
=
item
}}
{{>
(
lookup
.
'item.psEditor.editorType'
)
item
=
item
ctrlType
=
"grid"
}}
{{/if}}
{{/if}}
{{/
eq
}}
{{/
eq
}}
{{/
each
}}
{{/
each
}}
...
@@ -20,13 +20,13 @@
...
@@ -20,13 +20,13 @@
<span
class=
"text"
>
\{{text}}
</span>
<span
class=
"text"
>
\{{text}}
</span>
</div>
</div>
{{/if}}
{{/if}}
{{/
eq
}}
{{/
if
}}
{{#
eq
item
.
columnType
'UAGRIDCOLUMN'
}}
{{#
if
(
eq
item
.
columnType
'UAGRIDCOLUMN'
)
}}
{{!-- <ibizToolbar
{{!-- <ibizToolbar
:toolbarModel="state.actionModel"
:toolbarModel="record.{{lowerCase item.codeName}}"
@toolbarEvent="handleToolbarEvent"
:context="state.context"
:context="state.context"
:viewParams="state.viewParams"/> --}}
:viewParams="state.viewParams"
{{/
eq
}}
@toolbarEvent="($event: ) => handleToolbarEvent()"/> --}}
{{/if}}
</div>
</div>
{{/
neq
}}
{{/
if
}}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/modules/common/index.ts
浏览文件 @
7dce5820
...
@@ -87,3 +87,36 @@ export function useContextParams(props: Record<any, any>) {
...
@@ -87,3 +87,36 @@ export function useContextParams(props: Record<any, any>) {
return
{
context
,
viewParams
};
return
{
context
,
viewParams
};
}
}
/**
* @description 值规则校验
* @export
* @param {Record<any, any>} props
*/
export
async
function
verifyRules
(
_rule
:
any
,
value
:
any
,
condition
:
any
)
{
//常规规则
if
(
Object
.
is
(
condition
.
Type
,
'SIMPLE'
))
{
//todo
// 数值范围
}
else
if
(
Object
.
is
(
condition
.
Type
,
'VALUERANGE2'
))
{
if
(
!
value
)
{
return
;
}
if
(
!
Number
.
isInteger
(
value
))
{
return
Promise
.
reject
(
'请输入数值!'
);
}
else
{
if
(
condition
.
includeMinValue
&&
Object
.
is
(
value
,
condition
.
minValue
))
{
return
Promise
.
resolve
();
}
else
if
(
condition
.
includeMaxValue
&&
Object
.
is
(
value
,
condition
.
maxValue
))
{
return
Promise
.
resolve
();
}
else
if
(
value
>
condition
.
minValue
&&
value
<
condition
.
maxValue
)
{
return
Promise
.
resolve
();
}
}
// 正则式
}
else
if
(
Object
.
is
(
condition
.
Type
,
'REGEX'
))
{
// 长度
}
else
if
(
Object
.
is
(
condition
.
Type
,
'STRINGLENGTH'
))
{
// 系统值规则
}
else
if
(
Object
.
is
(
condition
.
Type
,
'SYSVALUERULE'
))
{
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/modules/views/main-view/main-view.ts
浏览文件 @
7dce5820
...
@@ -44,6 +44,12 @@ export class MainView extends ViewBase {
...
@@ -44,6 +44,12 @@ export class MainView extends ViewBase {
//todo
//todo
}
}
public
handleCtrlEvent
(
actionParam
:
IActionParam
)
{
const
{
tag
,
action
,
data
}
=
actionParam
;
// TODO
console
.
log
(
tag
,
action
,
data
);
}
/**
/**
* 安装部件所有功能模块的方法
* 安装部件所有功能模块的方法
* @param props 传入的Props
* @param props 传入的Props
...
@@ -58,7 +64,8 @@ export class MainView extends ViewBase {
...
@@ -58,7 +64,8 @@ export class MainView extends ViewBase {
return
{
return
{
...
superParams
,
...
superParams
,
state
:
this
.
viewState
,
state
:
this
.
viewState
,
handleToolbarEvent
:
this
.
handleToolbarEvent
,
handleToolbarEvent
:
this
.
handleToolbarEvent
.
bind
(
this
),
handleCtrlEvent
:
this
.
handleCtrlEvent
.
bind
(
this
),
};
};
}
}
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/modules/widgets/control-base/control-base.ts
浏览文件 @
7dce5820
...
@@ -29,6 +29,13 @@ export class ControlBase {
...
@@ -29,6 +29,13 @@ export class ControlBase {
*/
*/
public
route
:
RouteLocationNormalizedLoaded
=
useRoute
();
public
route
:
RouteLocationNormalizedLoaded
=
useRoute
();
/**
* @description 事件
* @type {*}
* @memberof ControlBase
*/
public
emit
:
any
;
/**
/**
* Creates an instance of ControlBase.
* Creates an instance of ControlBase.
* @param {*} options 配置参数
* @param {*} options 配置参数
...
@@ -75,6 +82,7 @@ export class ControlBase {
...
@@ -75,6 +82,7 @@ export class ControlBase {
* @memberof ControlBase
* @memberof ControlBase
*/
*/
public
moduleInstall
(
props
:
ControlPropsBase
,
emit
?:
Function
)
{
public
moduleInstall
(
props
:
ControlPropsBase
,
emit
?:
Function
)
{
this
.
emit
=
emit
?.
bind
(
this
);
this
.
setState
(
props
);
this
.
setState
(
props
);
this
.
useControlContextParams
(
props
);
this
.
useControlContextParams
(
props
);
return
{
return
{
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/modules/widgets/form-control/form-control.ts
浏览文件 @
7dce5820
...
@@ -28,12 +28,31 @@ export class FormControl extends MainControl {
...
@@ -28,12 +28,31 @@ export class FormControl extends MainControl {
*/
*/
public
formDataChange
(
name
:
string
,
value
:
any
)
{
public
formDataChange
(
name
:
string
,
value
:
any
)
{
this
.
controlState
.
data
[
name
]
=
value
;
this
.
controlState
.
data
[
name
]
=
value
;
// TODO 重置项逻辑
this
.
resetFormData
(
name
);
// TODO 表单项更新
// TODO 表单项更新
// TODO 动态控制逻辑
// TODO 动态控制逻辑
// TODO 自动保存(可以单独做一个逻辑块,监听data的变化)
// TODO 自动保存(可以单独做一个逻辑块,监听data的变化)
}
}
/**
* @description 表单项重置
* @param {string} name
* @memberof FormControl
*/
public
resetFormData
(
name
:
string
)
{
const
formItems
:
any
[]
=
this
.
controlState
.
itemsModel
;
if
(
formItems
&&
formItems
.
length
>
0
)
{
for
(
const
item
of
formItems
)
{
if
(
item
.
resetItemName
&&
item
.
resetItemName
==
name
)
{
this
.
formDataChange
(
item
.
name
,
null
);
if
(
item
.
valueItemName
)
{
this
.
formDataChange
(
item
.
valueItemName
,
null
);
}
}
}
}
}
/**
/**
* 在表单执行某些行为能力后,表单整体数据发生改变后被调用。会依次执行以下逻辑:
* 在表单执行某些行为能力后,表单整体数据发生改变后被调用。会依次执行以下逻辑:
* 1.
* 1.
...
@@ -301,17 +320,12 @@ export class FormControl extends MainControl {
...
@@ -301,17 +320,12 @@ export class FormControl extends MainControl {
const
{
load
}
=
this
.
useLoad
(
props
);
const
{
load
}
=
this
.
useLoad
(
props
);
const
{
save
}
=
this
.
useSave
(
props
);
const
{
save
}
=
this
.
useSave
(
props
);
const
handleEditorEvent
=
this
.
handleEditorEvent
.
bind
(
this
);
this
.
handleEditorEvent
=
(
actionParam
:
IActionParam
)
=>
{
handleEditorEvent
(
actionParam
);
};
return
{
return
{
...
superParams
,
...
superParams
,
state
:
this
.
controlState
,
state
:
this
.
controlState
,
load
,
load
,
save
,
save
,
handleEditorEvent
:
this
.
handleEditorEvent
,
handleEditorEvent
:
this
.
handleEditorEvent
.
bind
(
this
)
,
};
};
}
}
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/modules/widgets/grid-control/grid-control-state.ts
浏览文件 @
7dce5820
...
@@ -64,6 +64,13 @@ export interface GridControlState extends MainControlState {
...
@@ -64,6 +64,13 @@ export interface GridControlState extends MainControlState {
*/
*/
selectedData
:
IParam
[];
selectedData
:
IParam
[];
/**
* @description 选中行keys
* @type {string[]}
* @memberof GridControlState
*/
selectedRowKeys
:
string
[];
/**
/**
* @description 是否默认选中第一条数据
* @description 是否默认选中第一条数据
* @type {boolean}
* @type {boolean}
...
@@ -71,6 +78,13 @@ export interface GridControlState extends MainControlState {
...
@@ -71,6 +78,13 @@ export interface GridControlState extends MainControlState {
*/
*/
selectFirstDefault
:
boolean
;
selectFirstDefault
:
boolean
;
/**
* @description 当前页
* @type {number}
* @memberof GridControlState
*/
current
:
number
;
/**
/**
* @description 分页大小
* @description 分页大小
* @type {number}
* @type {number}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/modules/widgets/grid-control/grid-control.ts
浏览文件 @
7dce5820
import
{
createUUID
}
from
'qx-util'
;
import
{
calcActionItemAuthState
,
deepCopy
,
GridControlProps
,
GridControlState
,
IActionParam
,
IParam
,
MainControl
}
from
'@ibiz-core'
;
import
{
calcActionItemAuthState
,
deepCopy
,
GridControlProps
,
GridControlState
,
IActionParam
,
IParam
,
MainControl
}
from
'@ibiz-core'
;
/**
/**
...
@@ -22,11 +23,11 @@ export class GridControl extends MainControl {
...
@@ -22,11 +23,11 @@ export class GridControl extends MainControl {
*/
*/
public
setState
(
props
:
GridControlProps
)
{
public
setState
(
props
:
GridControlProps
)
{
super
.
setState
(
props
);
super
.
setState
(
props
);
this
.
controlState
.
multiple
=
toRef
(
props
,
'multiple'
)
as
any
;
this
.
controlState
.
multiple
=
toRef
(
props
,
"multiple"
)
as
any
;
this
.
controlState
.
rowEditState
=
toRef
(
props
,
'rowEditState'
)
as
any
;
this
.
controlState
.
rowEditState
=
toRef
(
props
,
"rowEditState"
)
as
any
;
this
.
controlState
.
rowActiveMode
=
toRef
(
props
,
'rowActiveMode'
)
as
any
;
this
.
controlState
.
rowActiveMode
=
toRef
(
props
,
"rowActiveMode"
)
as
any
;
this
.
controlState
.
selectedData
=
toRef
(
props
,
'selectedData'
)
as
any
;
this
.
controlState
.
selectedData
=
toRef
(
props
,
"selectedData"
)
as
any
;
this
.
controlState
.
selectFirstDefault
=
toRef
(
props
,
'selectFirstDefault'
)
as
any
;
this
.
controlState
.
selectFirstDefault
=
toRef
(
props
,
"selectFirstDefault"
)
as
any
;
}
}
/**
/**
...
@@ -37,7 +38,12 @@ export class GridControl extends MainControl {
...
@@ -37,7 +38,12 @@ export class GridControl extends MainControl {
* @memberof GridControl
* @memberof GridControl
*/
*/
public
gridDataChange
(
rowIndex
:
number
,
name
:
string
,
value
:
any
){
public
gridDataChange
(
rowIndex
:
number
,
name
:
string
,
value
:
any
){
this
.
controlState
.
items
[
rowIndex
][
name
]
=
value
;
if
(
this
.
controlState
.
items
[
rowIndex
][
name
]
!==
value
)
{
this
.
controlState
.
items
[
rowIndex
][
name
]
=
value
;
if
(
!
this
.
controlState
.
items
[
rowIndex
][
"rowDataState"
])
{
this
.
controlState
.
items
[
rowIndex
][
"rowDataState"
]
=
"update"
;
}
}
}
}
/**
/**
...
@@ -61,14 +67,14 @@ export class GridControl extends MainControl {
...
@@ -61,14 +67,14 @@ export class GridControl extends MainControl {
* @memberof GridControl
* @memberof GridControl
*/
*/
public
getGridColumn
(
columns
:
IParam
[],
columnType
:
string
):
any
{
public
getGridColumn
(
columns
:
IParam
[],
columnType
:
string
):
any
{
columns
.
forEach
((
column
:
IParam
)
=>
{
for
(
const
column
of
columns
)
{
if
(
Object
.
is
(
column
.
columnType
,
columnType
))
{
if
(
Object
.
is
(
column
.
columnType
,
columnType
))
{
return
column
;
return
deepCopy
(
column
)
;
}
}
if
(
column
.
children
?.
length
>
0
)
{
if
(
column
.
children
?.
length
>
0
)
{
return
this
.
getGridColumn
(
column
.
children
,
columnType
);
return
this
.
getGridColumn
(
column
.
children
,
columnType
);
}
}
}
)
}
}
}
/**
/**
...
@@ -77,7 +83,7 @@ export class GridControl extends MainControl {
...
@@ -77,7 +83,7 @@ export class GridControl extends MainControl {
*/
*/
public
autoGroup
()
{
public
autoGroup
()
{
const
{
groupField
}
=
this
.
controlState
;
const
{
groupField
}
=
this
.
controlState
;
const
dataRef
=
toRef
(
this
.
controlState
,
'items'
);
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
let
autoGroup
:
string
[]
=
[];
let
autoGroup
:
string
[]
=
[];
dataRef
.
value
.
forEach
((
item
:
IParam
)
=>
{
dataRef
.
value
.
forEach
((
item
:
IParam
)
=>
{
if
(
item
.
hasOwnProperty
(
groupField
))
{
if
(
item
.
hasOwnProperty
(
groupField
))
{
...
@@ -86,10 +92,10 @@ export class GridControl extends MainControl {
...
@@ -86,10 +92,10 @@ export class GridControl extends MainControl {
})
})
autoGroup
=
[...
new
Set
(
autoGroup
)];
autoGroup
=
[...
new
Set
(
autoGroup
)];
if
(
autoGroup
.
length
>
0
)
{
if
(
autoGroup
.
length
>
0
)
{
const
columnsModelRef
=
toRef
(
this
.
controlState
,
'columnsModel'
);
const
columnsModelRef
=
toRef
(
this
.
controlState
,
"columnsModel"
);
const
groupColumn
=
this
.
getGridColumn
(
columnsModelRef
.
value
,
'GROUP'
);
const
groupColumn
=
this
.
getGridColumn
(
columnsModelRef
.
value
,
"GROUP"
);
const
gridData
:
IParam
[]
=
[];
const
gridData
:
IParam
[]
=
[];
autoGroup
.
forEach
((
group
:
string
)
=>
{
autoGroup
.
forEach
((
group
:
string
,
index
:
number
)
=>
{
const
children
:
IParam
[]
=
[];
const
children
:
IParam
[]
=
[];
dataRef
.
value
.
forEach
((
item
:
IParam
)
=>
{
dataRef
.
value
.
forEach
((
item
:
IParam
)
=>
{
if
(
Object
.
is
(
group
,
item
[
groupField
]))
{
if
(
Object
.
is
(
group
,
item
[
groupField
]))
{
...
@@ -97,6 +103,7 @@ export class GridControl extends MainControl {
...
@@ -97,6 +103,7 @@ export class GridControl extends MainControl {
}
}
})
})
gridData
.
push
({
gridData
.
push
({
srfkey
:
createUUID
(),
[
groupColumn
.
dataIndex
]:
group
,
[
groupColumn
.
dataIndex
]:
group
,
children
:
deepCopy
(
children
),
children
:
deepCopy
(
children
),
})
})
...
@@ -111,12 +118,12 @@ export class GridControl extends MainControl {
...
@@ -111,12 +118,12 @@ export class GridControl extends MainControl {
*/
*/
public
async
codeListGroup
()
{
public
async
codeListGroup
()
{
const
{
groupField
}
=
this
.
controlState
;
const
{
groupField
}
=
this
.
controlState
;
const
dataRef
=
toRef
(
this
.
controlState
,
'items'
);
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
// TODO 代码表数据
// TODO 代码表数据
let
codeListGroup
:
IParam
[]
=
[];
let
codeListGroup
:
IParam
[]
=
[];
if
(
codeListGroup
.
length
>
0
)
{
if
(
codeListGroup
.
length
>
0
)
{
const
columnsModelRef
=
toRef
(
this
.
controlState
,
'columnsModel'
);
const
columnsModelRef
=
toRef
(
this
.
controlState
,
"columnsModel"
);
const
groupColumn
=
this
.
getGridColumn
(
columnsModelRef
.
value
,
'GROUP'
);
const
groupColumn
=
this
.
getGridColumn
(
columnsModelRef
.
value
,
"GROUP"
);
const
gridData
:
IParam
[]
=
[];
const
gridData
:
IParam
[]
=
[];
const
otherGroup
:
IParam
[]
=
[];
const
otherGroup
:
IParam
[]
=
[];
codeListGroup
.
forEach
((
group
:
IParam
)
=>
{
codeListGroup
.
forEach
((
group
:
IParam
)
=>
{
...
@@ -127,6 +134,7 @@ export class GridControl extends MainControl {
...
@@ -127,6 +134,7 @@ export class GridControl extends MainControl {
}
}
});
});
gridData
.
push
({
gridData
.
push
({
srfkey
:
createUUID
(),
[
groupColumn
.
dataIndex
]:
group
.
text
,
[
groupColumn
.
dataIndex
]:
group
.
text
,
children
:
deepCopy
(
children
),
children
:
deepCopy
(
children
),
})
})
...
@@ -139,6 +147,7 @@ export class GridControl extends MainControl {
...
@@ -139,6 +147,7 @@ export class GridControl extends MainControl {
});
});
if
(
otherGroup
.
length
>
0
)
{
if
(
otherGroup
.
length
>
0
)
{
gridData
.
push
({
gridData
.
push
({
srfkey
:
createUUID
(),
[
groupColumn
.
dataIndex
]:
"其它"
,
[
groupColumn
.
dataIndex
]:
"其它"
,
children
:
deepCopy
(
otherGroup
),
children
:
deepCopy
(
otherGroup
),
})
})
...
@@ -152,9 +161,9 @@ export class GridControl extends MainControl {
...
@@ -152,9 +161,9 @@ export class GridControl extends MainControl {
* @memberof GridControl
* @memberof GridControl
*/
*/
public
calcGridAuthState
()
{
public
calcGridAuthState
()
{
const
dataRef
=
toRef
(
this
.
controlState
,
'items'
);
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
const
columnsModelRef
=
toRef
(
this
.
controlState
,
'columnsModel'
);
const
columnsModelRef
=
toRef
(
this
.
controlState
,
"columnsModel"
);
let
columnModel
=
this
.
getGridColumn
(
columnsModelRef
.
value
,
'UAGRIDCOLUMN'
);
let
columnModel
=
this
.
getGridColumn
(
columnsModelRef
.
value
,
"UAGRIDCOLUMN"
);
if
(
columnModel
)
{
if
(
columnModel
)
{
dataRef
.
value
.
forEach
((
item
:
IParam
)
=>
{
dataRef
.
value
.
forEach
((
item
:
IParam
)
=>
{
Object
.
assign
(
item
,
{
Object
.
assign
(
item
,
{
...
@@ -164,18 +173,49 @@ export class GridControl extends MainControl {
...
@@ -164,18 +173,49 @@ export class GridControl extends MainControl {
}
}
}
}
/**
* @description 设置表格合并列
* @memberof GridControl
*/
public
setGridColSpan
()
{
const
columnsModelRef
=
toRef
(
this
.
controlState
,
"columnsModel"
);
columnsModelRef
.
value
.
forEach
((
columnModel
:
IParam
)
=>
{
const
customRender
=
({
text
,
record
,
index
,
column
}:
IParam
)
=>
{
const
option
=
{
props
:
{}
as
IParam
,
};
if
(
record
.
children
)
{
if
(
Object
.
is
(
column
.
columnType
,
"GROUP"
))
{
Object
.
assign
(
option
.
props
,{
colSpan
:
columnsModelRef
.
value
.
length
,
});
}
else
{
Object
.
assign
(
option
.
props
,{
colSpan
:
0
});
}
}
return
option
;
}
Object
.
assign
(
columnModel
,{
customRender
:
customRender
,
})
});
}
/**
/**
* @description 处理表格分组
* @description 处理表格分组
* @memberof GridControl
* @memberof GridControl
*/
*/
public
handleGridGroup
()
{
public
handleGridGroup
()
{
const
{
groupMode
,
groupField
}
=
this
.
controlState
;
const
{
groupMode
,
groupField
}
=
this
.
controlState
;
if
(
groupField
)
{
if
(
groupField
&&
!
Object
.
is
(
groupMode
,
"NONE"
)
)
{
if
(
Object
.
is
(
groupMode
,
"AUTO"
))
{
if
(
Object
.
is
(
groupMode
,
"AUTO"
))
{
this
.
autoGroup
();
this
.
autoGroup
();
}
else
if
(
Object
.
is
(
groupMode
,
"CODELIST"
))
{
}
else
if
(
Object
.
is
(
groupMode
,
"CODELIST"
))
{
this
.
codeListGroup
();
this
.
codeListGroup
();
}
}
this
.
setGridColSpan
();
}
}
}
}
...
@@ -198,21 +238,21 @@ export class GridControl extends MainControl {
...
@@ -198,21 +238,21 @@ export class GridControl extends MainControl {
*/
*/
public
getAggValue
(
aggData
:
IParam
[],
column
:
IParam
):
string
{
public
getAggValue
(
aggData
:
IParam
[],
column
:
IParam
):
string
{
switch
(
column
.
aggMode
)
{
switch
(
column
.
aggMode
)
{
case
'NONE'
:
case
"NONE"
:
return
''
;
return
""
;
case
'SUM'
:
case
"SUM"
:
let
sum
:
number
=
0
;
let
sum
:
number
=
0
;
aggData
.
forEach
((
item
:
IParam
)
=>
{
aggData
.
forEach
((
item
:
IParam
)
=>
{
sum
+=
Number
(
item
[
column
.
dataIndex
]
?
item
[
column
.
dataIndex
]
:
0
);
sum
+=
Number
(
item
[
column
.
dataIndex
]
?
item
[
column
.
dataIndex
]
:
0
);
})
})
return
'SUM:'
+
sum
;
return
"SUM:"
+
sum
;
case
'AVG'
:
case
"AVG"
:
let
sum2
:
number
=
0
;
let
sum2
:
number
=
0
;
aggData
.
forEach
((
item
:
IParam
)
=>
{
aggData
.
forEach
((
item
:
IParam
)
=>
{
sum2
+=
Number
(
item
[
column
.
dataIndex
]
?
item
[
column
.
dataIndex
]
:
0
);
sum2
+=
Number
(
item
[
column
.
dataIndex
]
?
item
[
column
.
dataIndex
]
:
0
);
})
})
return
'AVG:'
+
Number
(
sum2
/
(
aggData
.
length
)).
toFixed
(
3
);
return
"AVG:"
+
Number
(
sum2
/
(
aggData
.
length
)).
toFixed
(
3
);
case
'MAX'
:
case
"MAX"
:
let
max
:
number
=
0
;
let
max
:
number
=
0
;
aggData
.
forEach
((
item
:
IParam
)
=>
{
aggData
.
forEach
((
item
:
IParam
)
=>
{
const
value
:
number
=
Number
(
item
[
column
.
dataIndex
]
?
item
[
column
.
dataIndex
]
:
0
);
const
value
:
number
=
Number
(
item
[
column
.
dataIndex
]
?
item
[
column
.
dataIndex
]
:
0
);
...
@@ -220,8 +260,8 @@ export class GridControl extends MainControl {
...
@@ -220,8 +260,8 @@ export class GridControl extends MainControl {
max
=
value
;
max
=
value
;
}
}
})
})
return
'MAX:'
+
max
;
return
"MAX:"
+
max
;
case
'MIN'
:
case
"MIN"
:
let
min
:
number
=
0
;
let
min
:
number
=
0
;
aggData
.
forEach
((
item
:
IParam
)
=>
{
aggData
.
forEach
((
item
:
IParam
)
=>
{
const
value
:
number
=
Number
(
item
[
column
.
dataIndex
]
?
item
[
column
.
dataIndex
]
:
0
);
const
value
:
number
=
Number
(
item
[
column
.
dataIndex
]
?
item
[
column
.
dataIndex
]
:
0
);
...
@@ -229,9 +269,9 @@ export class GridControl extends MainControl {
...
@@ -229,9 +269,9 @@ export class GridControl extends MainControl {
min
=
value
;
min
=
value
;
}
}
})
})
return
'MIN:'
+
min
;
return
"MIN:"
+
min
;
default
:
default
:
return
''
;
return
""
;
}
}
}
}
...
@@ -240,20 +280,27 @@ export class GridControl extends MainControl {
...
@@ -240,20 +280,27 @@ export class GridControl extends MainControl {
* @memberof GridControl
* @memberof GridControl
*/
*/
public
async
handleDataAgg
()
{
public
async
handleDataAgg
()
{
const
{
aggMode
}
=
this
.
controlState
;
const
{
aggMode
,
enablePagingBar
}
=
this
.
controlState
;
if
(
!
Object
.
is
(
aggMode
,
'NONE'
))
{
if
(
!
Object
.
is
(
aggMode
,
"NONE"
))
{
const
dataAggRef
=
toRef
(
this
.
controlState
,
'dataAgg'
);
const
dataAggRef
=
toRef
(
this
.
controlState
,
"dataAgg"
);
let
aggData
:
IParam
[];
const
currentRef
=
toRef
(
this
.
controlState
,
"current"
);
if
(
Object
.
is
(
aggMode
,
'PAGE'
))
{
const
pageSizeRef
=
toRef
(
this
.
controlState
,
"pageSize"
);
const
dataRef
=
toRef
(
this
.
controlState
,
'items'
);
let
aggData
:
IParam
[]
=
[];
if
(
Object
.
is
(
aggMode
,
"PAGE"
))
{
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
aggData
=
[...
dataRef
.
value
];
aggData
=
[...
dataRef
.
value
];
}
else
if
(
Object
.
is
(
aggMode
,
'ALL'
))
{
}
else
if
(
Object
.
is
(
aggMode
,
"ALL"
))
{
aggData
=
await
this
.
remoteAgg
();
aggData
=
await
this
.
remoteAgg
();
}
}
const
columnsModelRef
=
toRef
(
this
.
controlState
,
'columnsModel'
);
if
(
enablePagingBar
)
{
const
start
:
number
=
(
currentRef
.
value
-
1
)
*
pageSizeRef
.
value
>
0
?
(
currentRef
.
value
-
1
)
*
pageSizeRef
.
value
-
1
:
0
;
const
end
:
number
=
currentRef
.
value
*
pageSizeRef
.
value
;
aggData
=
aggData
.
slice
(
start
,
end
);
}
const
columnsModelRef
=
toRef
(
this
.
controlState
,
"columnsModel"
);
const
columnsModel
:
IParam
[]
=
[];
const
columnsModel
:
IParam
[]
=
[];
columnsModelRef
.
value
.
forEach
((
column
:
IParam
)
=>
{
columnsModelRef
.
value
.
forEach
((
column
:
IParam
)
=>
{
if
(
!
Object
.
is
(
column
.
columnType
,
'GROUPGRIDCOLUMN'
))
{
if
(
!
Object
.
is
(
column
.
columnType
,
"GROUPGRIDCOLUMN"
))
{
columnsModel
.
push
(
column
);
columnsModel
.
push
(
column
);
}
}
});
});
...
@@ -265,6 +312,33 @@ export class GridControl extends MainControl {
...
@@ -265,6 +312,33 @@ export class GridControl extends MainControl {
}
}
}
}
/**
* @description 处理默认选中
* @memberof GridControl
*/
public
handleDefaultSelect
()
{
const
{
selectedData
,
selectFirstDefault
,
controlName
}
=
this
.
controlState
;
if
(
selectedData
?.
length
>
0
)
{
const
selectedRowKeys
:
string
[]
=
[];
const
selectedRowKeysRef
=
toRef
(
this
.
controlState
,
"selectedRowKeys"
);
selectedData
.
forEach
((
selected
:
IParam
)
=>
{
if
(
selected
.
srfkey
)
{
selectedRowKeys
.
push
(
selected
.
srfkey
);
}
});
selectedRowKeysRef
.
value
=
selectedRowKeys
;
}
else
if
(
selectFirstDefault
)
{
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
if
(
dataRef
.
value
[
0
])
{
this
.
emit
(
"ctrlEvent"
,
{
tag
:
controlName
,
action
:
"selectionChange"
,
data
:
[
deepCopy
(
dataRef
.
value
[
0
])],
});
}
}
}
/**
/**
* @description 使用加载功能模块
* @description 使用加载功能模块
* @param {GridControlProps} props 传入的props
* @param {GridControlProps} props 传入的props
...
@@ -278,38 +352,52 @@ export class GridControl extends MainControl {
...
@@ -278,38 +352,52 @@ export class GridControl extends MainControl {
const
loadAction
=
this
.
controlState
.
controlAction
.
loadAction
;
const
loadAction
=
this
.
controlState
.
controlAction
.
loadAction
;
const
{
const
{
controlService
,
context
,
viewParams
,
showBusyIndicator
,
noSort
,
minorSortDir
,
minorSortPSDEF
,
controlService
,
context
,
viewParams
,
showBusyIndicator
,
noSort
,
minorSortDir
,
minorSortPSDEF
,
enablePagingBar
,
pageSize
enablePagingBar
}
=
this
.
controlState
;
}
=
this
.
controlState
;
const
dataRef
=
toRef
(
this
.
controlState
,
'items'
);
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
const
paginationRef
=
toRef
(
this
.
controlState
,
'pagination'
);
const
paginationRef
=
toRef
(
this
.
controlState
,
"pagination"
);
if
(
!
loadAction
){
//
if(!loadAction){
return
;
//
return;
}
//
}
let
_context
=
deepCopy
(
context
);
let
_context
=
deepCopy
(
context
?
context
:
{}
);
let
_viewParams
=
deepCopy
(
viewParams
);
let
_viewParams
=
deepCopy
(
viewParams
?
context
:
{}
);
if
(
noSort
&&
minorSortDir
&&
minorSortPSDEF
)
{
if
(
noSort
&&
minorSortDir
&&
minorSortPSDEF
)
{
Object
.
assign
(
_viewParams
,
{
sort
:
`
${
minorSortPSDEF
}
,
${
minorSortDir
}
`
});
Object
.
assign
(
_viewParams
,
{
sort
:
`
${
minorSortPSDEF
}
,
${
minorSortDir
}
`
});
}
}
if
(
enablePagingBar
)
{
if
(
enablePagingBar
)
{
if
(
opt
.
current
&&
opt
.
pageSize
)
{
const
currentRef
=
toRef
(
this
.
controlState
,
"current"
);
Object
.
assign
(
_viewParams
,
{
page
:
opt
.
current
-
1
,
size
:
opt
.
pageSize
});
const
pageSizeRef
=
toRef
(
this
.
controlState
,
"pageSize"
);
}
else
{
Object
.
assign
(
_viewParams
,
{
page
:
currentRef
.
value
-
1
,
size
:
pageSizeRef
.
value
});
Object
.
assign
(
_viewParams
,
{
page
:
0
,
size
:
pageSize
});
}
}
}
const
response
=
await
controlService
.
get
(
loadAction
,
_context
,
{
viewParams
:
_viewParams
},
showBusyIndicator
);
// const response = await controlService.get(loadAction, _context, {viewParams: _viewParams}, showBusyIndicator );
if
(
!
response
.
status
||
response
.
status
!==
200
)
{
// if (!response.status || response.status !== 200) {
return
// return
// }
const
data
=
[];
for
(
let
i
=
0
;
i
<
100
;
i
++
)
{
data
.
push
({
group
:
i
%
2
===
1
?
"分组1"
:
"分组2"
,
srfkey
:
i
,
tefsubjecttypename
:
`Edrward
${
i
}
`
,
nian
:
i
,
testdata
:
i
,
updatedate
:
32
,
description
:
`London Park no.
${
i
}
`
,
});
}
}
dataRef
.
value
=
response
.
data
;
dataRef
.
value
=
data
;
// dataRef.value = response.data;
if
(
enablePagingBar
)
{
if
(
enablePagingBar
)
{
paginationRef
.
value
[
'total'
]
=
response
.
total
;
// paginationRef.value['total'] = response.total;
paginationRef
.
value
[
"total"
]
=
100
;
}
}
this
.
calcGridAuthState
();
this
.
calcGridAuthState
();
this
.
handleDefaultSelect
();
this
.
handleGridGroup
();
this
.
handleGridGroup
();
this
.
handleDataAgg
();
this
.
handleDataAgg
();
}
catch
(
error
)
{
}
catch
(
error
)
{
// todo 错误异常处理
// todo 错误异常处理
console
.
error
(
error
)
}
}
}
}
...
@@ -358,16 +446,11 @@ export class GridControl extends MainControl {
...
@@ -358,16 +446,11 @@ export class GridControl extends MainControl {
const
superParams
=
super
.
moduleInstall
(
props
,
emit
);
const
superParams
=
super
.
moduleInstall
(
props
,
emit
);
const
{
load
}
=
this
.
useLoad
(
props
);
const
{
load
}
=
this
.
useLoad
(
props
);
const
handleEditorEvent
=
this
.
handleEditorEvent
.
bind
(
this
);
this
.
handleEditorEvent
=
(
rowIndex
:
number
,
actionParam
:
IActionParam
)
=>
{
handleEditorEvent
(
rowIndex
,
actionParam
)
}
return
{
return
{
...
superParams
,
...
superParams
,
state
:
this
.
controlState
,
state
:
this
.
controlState
,
load
,
load
,
handleEditorEvent
:
this
.
handleEditorEvent
,
handleEditorEvent
:
this
.
handleEditorEvent
.
bind
(
this
)
,
};
};
}
}
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/page/{{appModules}}/{{pages@APPINDEXVIEW}}/index.ts.hbs
浏览文件 @
7dce5820
import
{{
page
.
codeName
}}
from "./
{{
spinalCase
page
.
codeName
}}
.vue";
import
{{
page
.
codeName
}}
from "./
{{
spinalCase
page
.
codeName
}}
.vue";
export
{
{{
page
.
codeName
}}
};
export
default
{{
page
.
codeName
}
}
;
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/page/{{appModules}}/{{pages@DEEDITVIEW}}/index.ts.hbs
浏览文件 @
7dce5820
import
{{
page
.
codeName
}}
from "./
{{
spinalCase
page
.
codeName
}}
.vue";
import
{{
page
.
codeName
}}
from "./
{{
spinalCase
page
.
codeName
}}
.vue";
export
{
{{
page
.
codeName
}}
};
export
default
{{
page
.
codeName
}
}
;
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/page/{{appModules}}/{{pages@DEEDITVIEW}}/{{pages@DEEDITVIEW}}-config.ts.hbs
浏览文件 @
7dce5820
export const ViewConfig = {
export const ViewConfig = {
viewCodeName: '
{{
page
.
codeName
}}
',
{{>
@macro
/
front-end
/
view
/
common
/
viewBaseConfig
.
hbs
}}
viewName: '
{{
page
.
name
}}
',
viewCaption: '
{{
page
.
caption
}}
',
{{#
page
.
ctrls
}}
{{#
page
.
ctrls
}}
{{#
eq
controlType
"TOOLBAR"
}}
{{#
eq
controlType
"TOOLBAR"
}}
{{
lowerCase
codeName
}}
:{
{{
lowerCase
codeName
}}
:{
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/page/{{appModules}}/{{pages@DEEDITVIEW}}/{{pages@DEEDITVIEW}}.vue.hbs
浏览文件 @
7dce5820
...
@@ -34,9 +34,15 @@ const { state, handleToolbarEvent } = new EditView(ViewConfig).moduleInstall(pro
...
@@ -34,9 +34,15 @@ const { state, handleToolbarEvent } = new EditView(ViewConfig).moduleInstall(pro
</script>
</script>
<template>
<template>
<IbizDefaultViewLayout
class=
"ibiz-edit-view
"
>
<IbizDefaultViewLayout
:class=
"['ibiz-edit-view', state.viewSysCss]
"
>
<template
v-slot:header-left
>
<template
v-slot:header-left
>
<IbizIconText
class=
"ibiz-view__caption"
size=
"large"
:text=
"state.viewCaption"
/>
<IbizIconText
class=
"ibiz-view__caption"
size=
"large"
:subCaption=
"state.subCaption"
:showCaptionBar=
"state.showCaptionBar"
:text=
"state.viewCaption"
/>
</template>
</template>
{{#
page
.
ctrls
}}
{{#
page
.
ctrls
}}
{{#
eq
controlType
"TOOLBAR"
}}
{{#
eq
controlType
"TOOLBAR"
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/page/{{appModules}}/{{pages@DEGRIDVIEW}}/index.ts.hbs
浏览文件 @
7dce5820
import
{{
page
.
codeName
}}
from "./
{{
spinalCase
page
.
codeName
}}
.vue";
import
{{
page
.
codeName
}}
from "./
{{
spinalCase
page
.
codeName
}}
.vue";
export
{
{{
page
.
codeName
}}
};
export
default
{{
page
.
codeName
}
}
;
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/page/{{appModules}}/{{pages@DEGRIDVIEW}}/{{pages@DEGRIDVIEW}}.vue.hbs
浏览文件 @
7dce5820
...
@@ -29,7 +29,7 @@ interface ViewEmit {
...
@@ -29,7 +29,7 @@ interface ViewEmit {
const
emit
=
defineEmits
<
ViewEmit
>
();
const
emit
=
defineEmits
<
ViewEmit
>
();
// 安装功能模块,提供状态和能力方法
// 安装功能模块,提供状态和能力方法
const
{
state
}
=
new
GridView
(
ViewConfig
).
moduleInstall
(
props
);
const
{
state
,
handleCtrlEvent
}
=
new
GridView
(
ViewConfig
).
moduleInstall
(
props
);
</script>
</script>
...
@@ -45,13 +45,13 @@ const { state } = new GridView(ViewConfig).moduleInstall(props);
...
@@ -45,13 +45,13 @@ const { state } = new GridView(ViewConfig).moduleInstall(props);
{{#
eq
controlType
"GRID"
}}
{{#
eq
controlType
"GRID"
}}
<
{{
codeName
}}
Grid
<
{{
codeName
}}
Grid
:context=
"state.context"
:context=
"state.context"
:multiple=
"false"
:rowEditState=
"state.rowEditState"
:rowEditState=
"state.rowEditState"
:rowActiveMode=
"state.gridRowActiveMode"
:rowActiveMode=
"state.gridRowActiveMode"
:showBusyIndicator=
"true"
:showBusyIndicator=
"true"
:viewParams=
"state.viewParams"
:viewParams=
"state.viewParams"
:controlAction=
"state.controlsAction"
:controlAction=
"state.controlsAction"
:viewSubject=
"state.viewSubject"
:viewSubject=
"state.viewSubject"
@
ctrlEvent=
"handleCtrlEvent"
></
{{
codeName
}}
Grid>
></
{{
codeName
}}
Grid>
{{/
eq
}}
{{/
eq
}}
{{/
page
.
ctrls
}}
{{/
page
.
ctrls
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/router/index.ts.hbs
浏览文件 @
7dce5820
...
@@ -2,7 +2,7 @@ import { createRouter, createWebHashHistory } from 'vue-router';
...
@@ -2,7 +2,7 @@ import { createRouter, createWebHashHistory } from 'vue-router';
const routes = [
const routes = [
{
{
path: "/
{{
lowerCase
app
.
defaultPSAppIndexView
.
codeName
}}
/:
{{
lowerCase
app
.
defaultPSAppIndexView
.
codeName
}}
?",
path: "/
apps/:app
?",
{{!-- beforeEnter: (to: any, from: any, next: any) => {
{{!-- beforeEnter: (to: any, from: any, next: any) => {
next();
next();
}, --}}
}, --}}
...
@@ -10,100 +10,50 @@ const routes = [
...
@@ -10,100 +10,50 @@ const routes = [
captionTag: "
{{#if
app
.
defaultPSAppIndexView
.
capPSLanguageRes
}}{{
app
.
defaultPSAppIndexView
.
capPSLanguageRes
.
lanResTag
}}{{/if}}
",
captionTag: "
{{#if
app
.
defaultPSAppIndexView
.
capPSLanguageRes
}}{{
app
.
defaultPSAppIndexView
.
capPSLanguageRes
.
lanResTag
}}{{/if}}
",
caption: "
{{
app
.
defaultPSAppIndexView
.
caption
}}
",
caption: "
{{
app
.
defaultPSAppIndexView
.
caption
}}
",
viewType: "
{{
app
.
defaultPSAppIndexView
.
viewType
}}
",
viewType: "
{{
app
.
defaultPSAppIndexView
.
viewType
}}
",
dynaModelFilePath: "
{{
app
.
defaultPSAppIndexView
.
dynaModelFilePath
}}
",
{{#if
app
.
defaultPSAppIndexView
.
psSysImage
}}
{{#if
app
.
defaultPSAppIndexView
.
psSysImage
}}
imgPath: "
{{
app
.
defaultPSAppIndexView
.
psSysImage
.
imagePath
}}
",
imgPath: "
{{
app
.
defaultPSAppIndexView
.
psSysImage
.
imagePath
}}
",
iconCls: "
{{
app
.
defaultPSAppIndexView
.
psSysImage
.
cssClass
}}
",
iconCls: "
{{
app
.
defaultPSAppIndexView
.
psSysImage
.
cssClass
}}
",
{{/if}}
{{/if}}
parameters: [
{ pathName: "views", parameterName: "
{{
lowerCase
app
.
defaultPSAppIndexView
.
codeName
}}
" },
],
requireAuth:
{{#
eq
app
.
defaultPSAppIndexView
.
accUserMode
0
}}
false
{{else}}{{#
eq
app
.
defaultPSAppIndexView
.
accUserMode
3
}}
false
{{else}}
true
{{/
eq
}}{{/
eq
}}
,
requireAuth:
{{#
eq
app
.
defaultPSAppIndexView
.
accUserMode
0
}}
false
{{else}}{{#
eq
app
.
defaultPSAppIndexView
.
accUserMode
3
}}
false
{{else}}
true
{{/
eq
}}{{/
eq
}}
,
},
},
component: () => import("@page/
{{#if
app
.
defaultPSAppIndexView
.
psAppDataEntity
}}{{
spinalCase
app
.
defaultPSAppIndexView
.
psAppDataEntity
.
codeName
}}{{else}}
default
{{/if}}
/
{{
spinalCase
app
.
defaultPSAppIndexView
.
codeName
}}
/
{{
spinalCase
app
.
defaultPSAppIndexView
.
codeName
}}
.vue
"),
component: () => import("@page/
default/
{{
spinalCase
app
.
defaultPSAppIndexView
.
codeName
}}
"),
children: [
children: [
{{#
each
app
.
allPSAppViews
as
|
appView
|
}}
{{#
each
app
.
appEntityResources
as
|
appEntityResource
|
}}
{{!-- 实体视图 --}}
{{#if
appEntityResource
.
appDataEntity
.
allPSAppViews
}}
{{#if
appView
.
psAppDataEntity
}}
{{#
each
appEntityResource
.
appDataEntity
.
allPSAppViews
as
|
appView
|
}}
{{!-- 多重路径 --}}
{{#if
(
or
(
eq
appView
.
viewType
'DEEDITVIEW'
)
(
eq
appView
.
viewType
'DEGRIDVIEW'
))
}}
{{#if
appView
.
psAppDataEntity
.
psAppDERSPathCount
}}
{
{{#if
(
or
(
eq
appView
.
viewType
'DEEDITVIEW'
)
(
eq
appView
.
viewType
'DEGRIDVIEW'
))
}}
path: "
{{
appEntityResource
.
path
}}
/views/
{{
lowerCase
appView
.
codeName
}}
",
{
meta: {
path: "
{{
lowerCase
(
pluralize
appView
.
psAppDataEntity
.
codeName
)
}}
/:
{{
lowerCase
appView
.
psAppDataEntity
.
codeName
}}
?/
{{
lowerCase
appView
.
codeName
}}
/:
{{
lowerCase
appView
.
codeName
}}
?",
{{#if
appView
.
capPSLanguageRes
}}
meta: {
captionTag: "
{{
appView
.
capPSLanguageRes
.
lanResTag
}}
",
captionTag: "
{{#if
appView
.
capPSLanguageRes
}}{{
appView
.
capPSLanguageRes
.
lanResTag
}}{{/if}}
",
{{/if}}
caption: "
{{
appView
.
caption
}}
",
caption: "
{{
appView
.
caption
}}
",
viewType: "
{{
appView
.
viewType
}}
",
viewType: "
{{
appView
.
viewType
}}
",
info:'',
{{#if
appView
.
psSysImage
}}
{{#if
appView
.
psSysImage
}}
imgPath: "
{{
appView
.
psSysImage
.
imagePath
}}
",
imgPath: "
{{
appView
.
psSysImage
.
imagePath
}}
",
iconCls: "
{{
appView
.
psSysImage
.
cssClass
}}
",
iconCls: "
{{
appView
.
psSysImage
.
cssClass
}}
",
{{/if}}
parameters: [
{ pathName: "apps", parameterName: "app" },
{{#if
appEntityResource
.
majorCodeName
}}
{ pathName: "
{{
pluralize
appEntityResource
.
majorCodeName
}}
", parameterName: "
{{
appEntityResource
.
majorCodeName
}}
" },
{{/if}}
{ pathName: "
{{
pluralize
appEntityResource
.
curCodeName
}}
", parameterName: "
{{
appEntityResource
.
curCodeName
}}
" }
],
requireAuth: false,
},
component: () => import("@page/
{{#if
psAppDataEntity
}}{{
spinalCase
psAppDataEntity
.
codeName
}}{{else}}
default
{{/if}}
/
{{
spinalCase
appView
.
codeName
}}
"),
},
{{/if}}
{{/if}}
parameters: [
{{/
each
}}
{ pathName: "
{{
lowerCase
app
.
defaultPSAppIndexView
.
codeName
}}
", parameterName: "
{{
lowerCase
app
.
defaultPSAppIndexView
.
codeName
}}
" },
{{/if}}
{ pathName: "
{{
lowerCase
(
pluralize
appView
.
psAppDataEntity
.
codeName
)
}}
", parameterName: "
{{
lowerCase
codeName
}}
" },
{ pathName: "
{{
lowerCase
appView
.
codeName
}}
", parameterName: "
{{
lowerCase
appView
.
codeName
}}
" },
],
resource: "
{{
lowerCase
entity
.
codeName
}}
",
requireAuth: false,
},
component: () => import("@page/
{{#if
appView
.
psAppDataEntity
}}{{
spinalCase
appView
.
psAppDataEntity
.
codeName
}}{{else}}
default
{{/if}}
/
{{
spinalCase
appView
.
codeName
}}
/
{{
spinalCase
appView
.
codeName
}}
.vue"),
},
{{/if}}
{{else}}
{{#if
(
or
(
eq
appView
.
viewType
'DEEDITVIEW'
)
(
eq
appView
.
viewType
'DEGRIDVIEW'
))
}}
{
path: "
{{
lowerCase
(
pluralize
appView
.
psAppDataEntity
.
codeName
)
}}
/:
{{
lowerCase
appView
.
psAppDataEntity
.
codeName
}}
?/
{{
lowerCase
appView
.
codeName
}}
/:
{{
lowerCase
appView
.
codeName
}}
?",
meta: {
captionTag: "
{{#if
appView
.
capPSLanguageRes
}}{{
appView
.
capPSLanguageRes
.
lanResTag
}}{{/if}}
",
caption: "
{{
appView
.
caption
}}
",
viewType: "
{{
appView
.
viewType
}}
",
info:'',
{{#if
appView
.
psSysImage
}}
imgPath: "
{{
appView
.
psSysImage
.
imagePath
}}
",
iconCls: "
{{
appView
.
psSysImage
.
cssClass
}}
",
{{/if}}
parameters: [
{ pathName: "
{{
lowerCase
app
.
defaultPSAppIndexView
.
codeName
}}
", parameterName: "
{{
lowerCase
app
.
defaultPSAppIndexView
.
codeName
}}
" },
{ pathName: "
{{
lowerCase
(
pluralize
appView
.
psAppDataEntity
.
codeName
)
}}
", parameterName: "
{{
lowerCase
appView
.
psAppDataEntity
.
codeName
}}
" },
{ pathName: "
{{
lowerCase
appView
.
codeName
}}
", parameterName: "
{{
lowerCase
appView
.
codeName
}}
" },
],
resource: "
{{
lowerCase
entity
.
codeName
}}
",
requireAuth: false,
},
component: () => import("@page/
{{#if
appView
.
psAppDataEntity
}}{{
spinalCase
appView
.
psAppDataEntity
.
codeName
}}{{else}}
default
{{/if}}
/
{{
spinalCase
appView
.
codeName
}}
/
{{
spinalCase
appView
.
codeName
}}
.vue"),
},
{{/if}}
{{/if}}
{{else}}
{{#
neq
app
.
defaultPSAppIndexView
.
codeName
(
appView
.
codeName
)
}}
{
path: "
{{
lowerCase
appView
.
codeName
}}
/:
{{
lowerCase
appView
.
codeName
}}
?",
meta: {
captionTag: "
{{#if
appView
.
capPSLanguageRes
}}{{
appView
.
capPSLanguageRes
.
lanResTag
}}{{/if}}
",
caption: "
{{
appView
.
caption
}}
",
viewType: "
{{
appView
.
viewType
}}
",
info:'',
{{#if
appView
.
psSysImage
}}
imgPath: "
{{
appView
.
psSysImage
.
imagePath
}}
",
iconCls: "
{{
appView
.
psSysImage
.
cssClass
}}
",
{{/if}}
parameters: [
{ pathName: "
{{
lowerCase
app
.
defaultPSAppIndexView
.
codeName
}}
", parameterName: "
{{
lowerCase
app
.
defaultPSAppIndexView
.
codeName
}}
" },
{ pathName: "
{{
lowerCase
appView
.
codeName
}}
", parameterName: "
{{
lowerCase
appView
.
codeName
}}
" },
],
requireAuth: false,
},
component: () => import("@page/
{{#if
appView
.
psAppDataEntity
}}{{
spinalCase
appView
.
psAppDataEntity
.
codeName
}}{{else}}
default
{{/if}}
/
{{
spinalCase
appView
.
codeName
}}
/
{{
spinalCase
appView
.
codeName
}}
.vue"),
},
{{/
neq
}}
{{/if}}
{{/
each
}}
{{/
each
}}
]
]
},
},
{
{
path: "/",
path: "/",
redirect: "/
{{
lowerCase
app
.
defaultPSAppIndexView
.
codeName
}}
"
redirect: "/
apps/
{{
lowerCase
app
.
codeName
}}
"
},
},
]
]
const router = createRouter({
const router = createRouter({
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@FORM}}-form/{{ctrls@FORM}}-form-config.ts.hbs
浏览文件 @
7dce5820
import { ControlVOBase } from '@ibiz-core';
{{>
@macro
/
form-detail
/
include-form
.
hbs
}}
import { ControlVOBase, verifyRules } from '@ibiz-core';
import { ControlService } from './
{{
spinalCase
ctrl
.
codeName
}}
-form-service';
import { ControlService } from './
{{
spinalCase
ctrl
.
codeName
}}
-form-service';
export const CtrlConfig = {
export const CtrlConfig = {
...
@@ -6,6 +7,33 @@ export const CtrlConfig = {
...
@@ -6,6 +7,33 @@ export const CtrlConfig = {
controlName: '
{{
ctrl
.
name
}}
',
controlName: '
{{
ctrl
.
name
}}
',
controlService: new ControlService(),
controlService: new ControlService(),
data: {},
data: {},
itemsModel: [
{{#
each
ctrl
.
psDEFormPages
as
|
FormPage
|
}}
{{>
(
lookup
'FORMDETAILSMODEL'
)
items
=
FormPage
.
psDEFormDetails
}}
{{/
each
}}
],
rules: {
{{#
each
ctrl
.
psDEFormEditItemVRs
as
|
ruleItem
|
}}
{{#
neq
ruleItem
2
}}
{{#if
ruleItem
.
valueRuleType
'DEFVALUERULE'
}}
{{
psDEFormEditItemName
}}
: [
{{#
each
ruleItem
.
psDEFVRGroupCondition
as
|
condition
|
}}
{trigger: ['change', 'blur'],
validator: (_rule: RuleObject, value: string) => verifyRules(_rule,value,{
{{#
condition
.
condType
}}
type:
{{
condition
.
condType
}}
,
{{/
condition
.
condType
}}
{{#
condition
.
name
}}
name:
{{
condition
.
name
}}
,
{{/
condition
.
name
}}
{{#
condition
.
maxValue
}}
maxValue:
{{
condition
.
maxValue
}}
,
{{/
condition
.
maxValue
}}
{{#
condition
.
minValue
}}
minValue:
{{
condition
.
minValue
}}
,
{{/
condition
.
minValue
}}
{{#
condition
.
ruleInfo
}}
ruleInfo:
{{
condition
.
ruleInfo
}}
,
{{/
condition
.
ruleInfo
}}
{{#
condition
.
includeMaxValue
}}
includeMaxValue:
{{
condition
.
includeMaxValue
}}
,
{{/
condition
.
includeMaxValue
}}
{{#
condition
.
includeMinValue
}}
includeMinValue:
{{
condition
.
includeMinValue
}}
,
{{/
condition
.
includeMinValue
}}
}) }
{{/
each
}}
]
{{/if}}
{{/
neq
}}
{{/
each
}}
},
};
};
/**
/**
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid-config.ts.hbs
浏览文件 @
7dce5820
...
@@ -5,6 +5,7 @@ export const CtrlConfig = {
...
@@ -5,6 +5,7 @@ export const CtrlConfig = {
controlName: "
{{
ctrl
.
name
}}
",
controlName: "
{{
ctrl
.
name
}}
",
items: [],
items: [],
dataAgg: [],
dataAgg: [],
selectedRowKeys: [],
aggMode: "
{{
ctrl
.
aggMode
}}
",
aggMode: "
{{
ctrl
.
aggMode
}}
",
{{#if
(
eq
ctrl
.
aggMode
'ALL'
)
}}
{{#if
(
eq
ctrl
.
aggMode
'ALL'
)
}}
aggEntity: "
{{
ctrl
.
aggPSAppDataEntity
.
codeName
}}
",
aggEntity: "
{{
ctrl
.
aggPSAppDataEntity
.
codeName
}}
",
...
@@ -29,6 +30,7 @@ export const CtrlConfig = {
...
@@ -29,6 +30,7 @@ export const CtrlConfig = {
{{/if}}
{{/if}}
{{#if
ctrl
.
enablePagingBar
}}
{{#if
ctrl
.
enablePagingBar
}}
enablePagingBar: true,
enablePagingBar: true,
current: 1,
pageSize:
{{#if
ctrl
.
pagingSize
}}{{
ctrl
.
pagingSize
}}{{else}}
20
{{/if}}
,
pageSize:
{{#if
ctrl
.
pagingSize
}}{{
ctrl
.
pagingSize
}}{{else}}
20
{{/if}}
,
pagination: {
pagination: {
position: ['bottomRight'],
position: ['bottomRight'],
...
@@ -46,6 +48,7 @@ export const CtrlConfig = {
...
@@ -46,6 +48,7 @@ export const CtrlConfig = {
{{#if
ctrl
.
groupPSAppDEField
}}
{{#if
ctrl
.
groupPSAppDEField
}}
{
{
title: "分组",
title: "分组",
align: "left",
columnType: "GROUP",
columnType: "GROUP",
width: 100,
width: 100,
resizable: true,
resizable: true,
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid.vue.hbs
浏览文件 @
7dce5820
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<script
setup
lang=
"ts"
>
<script
setup
lang=
"ts"
>
import
{
Subject
}
from
'rxjs'
;
import
{
Subject
}
from
'rxjs'
;
import
{
CtrlConfig
}
from
'./
{{
spinalCase
ctrl
.
codeName
}}
-grid-config'
;
import
{
CtrlConfig
}
from
'./
{{
spinalCase
ctrl
.
codeName
}}
-grid-config'
;
import
{
GridControl
,
IActionParam
,
IParam
,
ControlAction
}
from
'@ibiz-core'
;
import
{
GridControl
,
IActionParam
,
IParam
,
ControlAction
,
deepCopy
}
from
'@ibiz-core'
;
interface
Props
{
interface
Props
{
context
:
IParam
;
context
:
IParam
;
...
@@ -32,25 +32,62 @@ interface CtrlEmit {
...
@@ -32,25 +32,62 @@ interface CtrlEmit {
}
}
const
emit
=
defineEmits
<
CtrlEmit
>
();
const
emit
=
defineEmits
<
CtrlEmit
>
();
// 安装功能模块,提供状态和能力方法
// 安装功能模块,提供状态和能力方法
const
{
state
,
handleEditorEvent
}
=
new
GridControl
(
CtrlConfig
).
moduleInstall
(
props
);
const
{
state
,
load
,
handleEditorEvent
}
=
new
GridControl
(
CtrlConfig
).
moduleInstall
(
props
);
// 表格滚动条配置
// 表格滚动条配置
const
gridScrollOption
=
computed
(()
=>
{
const
gridScrollOption
=
computed
(()
=>
{
return
{
return
{
scrollToFirstRowOnChange
:
true
,
scrollToFirstRowOnChange
:
true
,
x
:
'1
0
0%'
,
x
:
'1
1
0%'
,
y
:
'690px'
,
y
:
'690px'
,
}
}
});
});
// 表格行key
const
rowKey
=
(
record
:
IParam
)
=>
{
return
record
.
srfkey
;
}
// 表格行样式(斑马纹)
// 表格行样式(斑马纹)
const
rowClassName
=
(
record
:
IParam
,
index
:
number
)
=>
{
const
rowClassName
=
(
record
:
IParam
,
index
:
number
)
=>
{
return
index
%
2
===
1
?
'table-striped'
:
null
;
return
index
%
2
===
1
?
"table-striped"
:
null
;
}
// 表格行选中
const
customRow
=
(
record
:
IParam
,
index
:
number
)
=>
{
return
{
onClick
:
()
=>
{
if
(
!
props
.
rowEditState
)
{
state
.
selectedRowKeys
=
[
record
.
srfkey
];
if
(
!
record
.
children
)
{
emit
(
"ctrlEvent"
,{
tag
:
state
.
controlName
,
action
:
"selectionChange"
,
data
:
[
deepCopy
(
record
)]
})
if
(
Object
.
is
(
props
.
rowActiveMode
,
1
))
{
emit
(
"ctrlEvent"
,{
tag
:
state
.
controlName
,
action
:
"rowClick"
,
data
:
[
deepCopy
(
record
)]
})
}
}
}
},
onDblclick
:
()
=>
{
if
(
!
record
.
children
&&
Object
.
is
(
props
.
rowActiveMode
,
2
))
{
emit
(
"ctrlEvent"
,{
tag
:
state
.
controlName
,
action
:
"rowDbClick"
,
data
:
[
deepCopy
(
record
)]
})
}
}
};
}
}
// 表格选择功能配置
// 表格选择功能配置
const
rowSelectionOption
=
computed
(()
=>
{
const
rowSelectionOption
=
computed
(()
=>
{
if
(
props
.
rowEditState
||
props
.
selectFirstDefault
)
{
return
false
;
}
return
{
return
{
columnWidth
:
{{#
neq
ctrl
.
aggMode
'NONE'
}}
90
{{else}}
50
{{/
neq
}}
,
columnWidth
:
{{#
neq
ctrl
.
aggMode
'NONE'
}}
90
{{else}}
50
{{/
neq
}}
,
selectedRowKeys
:
state
.
selectedRowKeys
,
checkStrictly
:
props
.
multiple
?
false
:
true
,
onChange
:
(
selectedRowKeys
:
string
[],
selectedRows
:
IParam
[])
=>
{
onChange
:
(
selectedRowKeys
:
string
[],
selectedRows
:
IParam
[])
=>
{
console
.
log
(
`selectedRowKeys:
${
selectedRowKeys
}
`
,
'selectedRows: '
,
selectedRows
);
state
.
selectedRowKeys
=
selectedRowKeys
;
const
selection
:
IParam
[]
=
[];
selectedRows
.
forEach
((
select
:
IParam
)
=>
{
if
(
!
select
.
children
)
{
selection
.
push
(
select
);
}
})
emit
(
"ctrlEvent"
,{
tag
:
state
.
controlName
,
action
:
"selectionChange"
,
data
:
selection
})
},
},
};
};
});
});
...
@@ -61,14 +98,17 @@ const handleResizeColumn = (width: number, column: IParam) => {
...
@@ -61,14 +98,17 @@ const handleResizeColumn = (width: number, column: IParam) => {
// 处理表格变化(分页,过滤,排序)
// 处理表格变化(分页,过滤,排序)
const
handleChange
=
(
pagination
:
IParam
,
filters
:
IParam
,
sorter
:
IParam
,
data
:
IParam
)
=>
{
const
handleChange
=
(
pagination
:
IParam
,
filters
:
IParam
,
sorter
:
IParam
,
data
:
IParam
)
=>
{
const
{
current
,
pageSize
}
=
pagination
;
const
{
current
,
pageSize
}
=
pagination
;
const
{
currentDataSource
}
=
data
;
state
.
current
=
current
;
console
.
log
(
pagination
,
filters
,
sorter
,
currentDataSource
);
state
.
pageSize
=
pageSize
;
load
();
}
}
</script>
</script>
<template>
<template>
<a-table
<a-table
bordered
bordered
class=
"ibiz-grid"
sticky
class=
"ibiz-grid
{{#if
ctrl
.
psSysCss
}}
{{
ctrl
.
psSysCss
.
cssName
}}{{/if}}
"
:rowKey=
"rowKey"
:showHeader=
"
{{#if
ctrl
.
hideHeader
}}
false
{{else}}
true
{{/if}}
"
:showHeader=
"
{{#if
ctrl
.
hideHeader
}}
false
{{else}}
true
{{/if}}
"
:scroll=
"gridScrollOption"
:scroll=
"gridScrollOption"
:sortDirections=
"['ascend', 'descend']"
:sortDirections=
"['ascend', 'descend']"
...
@@ -76,6 +116,7 @@ const handleChange = (pagination: IParam, filters: IParam, sorter: IParam, data:
...
@@ -76,6 +116,7 @@ const handleChange = (pagination: IParam, filters: IParam, sorter: IParam, data:
:row-selection=
"rowSelectionOption"
:row-selection=
"rowSelectionOption"
:columns=
"state.columnsModel"
:columns=
"state.columnsModel"
:pagination=
"state.pagination"
:pagination=
"state.pagination"
:customRow=
"customRow"
:rowClassName=
"rowClassName"
:rowClassName=
"rowClassName"
@
change=
"handleChange"
@
change=
"handleChange"
@
resizeColumn=
"handleResizeColumn"
>
@
resizeColumn=
"handleResizeColumn"
>
...
@@ -91,7 +132,7 @@ const handleChange = (pagination: IParam, filters: IParam, sorter: IParam, data:
...
@@ -91,7 +132,7 @@ const handleChange = (pagination: IParam, filters: IParam, sorter: IParam, data:
{{!-- 快速工具栏 --}}
{{!-- 快速工具栏 --}}
</div>
</div>
</template>
</template>
<template
#
bodyCell=
"{ column, text, record }"
>
<template
#
bodyCell=
"{ column, text, record
, index
}"
>
{{#
each
ctrl
.
psDEGridColumns
as
|
column
|
}}
{{#
each
ctrl
.
psDEGridColumns
as
|
column
|
}}
{{>
(
lookup
'COLUMN'
)
item
=
column
ctrl
=
ctrl
}}
{{>
(
lookup
'COLUMN'
)
item
=
column
ctrl
=
ctrl
}}
{{/
each
}}
{{/
each
}}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录