Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
d126eec2
提交
d126eec2
编写于
2月 11, 2022
作者:
RedPig97
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update: 表格更新项
上级
c772e4e1
变更
3
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
107 行增加
和
18 行删除
+107
-18
grid-column-model.hbs
...macro/front-end/widgets/grid-detail/grid-column-model.hbs
+16
-0
grid-control.ts
...s}}/src/core/modules/widgets/grid-control/grid-control.ts
+71
-18
grid-service.ts
...{{apps}}/src/core/service/control-service/grid-service.ts
+20
-0
未找到文件。
modules/ibizlab-generator-core/src/main/resources/templ/r7/@macro/front-end/widgets/grid-detail/grid-column-model.hbs
浏览文件 @
d126eec2
...
@@ -41,6 +41,22 @@
...
@@ -41,6 +41,22 @@
{{#if
editColumn
.
valueItemName
}}
{{#if
editColumn
.
valueItemName
}}
valueItemName: "
{{
editColumn
.
valueItemName
}}
",
valueItemName: "
{{
editColumn
.
valueItemName
}}
",
{{/if}}
{{/if}}
{{#
each
ctrl
.
psDEGridEditItemUpdates
as
|
updateItem
|
}}
{{#if
(
eq
updateItem
.
codeName
editColumn
.
codeName
)
}}
updateItem: {
name: "
{{
updateItem
.
name
}}
",
codeName: "
{{
updateItem
.
codeName
}}
",
{{#if
updateItem
.
customCode
}}
customCode:
{{
updateItem
.
customCode
}}
,
scriptCode: `
{{
updateItem
.
scriptCode
}}
`,
{{else}}
showBusyIndicator:
{{
updateItem
.
showBusyIndicator
}}
,
appDEMethod: "
{{
updateItem
.
psAppDEMethod
.
id
}}
",
updateDetails: [
{{#
each
updateItem
.
psDEGEIUpdateDetails
as
|
updateDetails
|
}}
"
{{
updateDetails
.
name
}}
",
{{/
each
}}
],
{{/if}}
},
{{/if}}
{{/
each
}}
{{/if}}
{{/if}}
{{/
each
}}
{{/
each
}}
{{/if}}
{{/if}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/grid-control/grid-control.ts
浏览文件 @
d126eec2
...
@@ -133,6 +133,9 @@ export class GridControl extends MDControl {
...
@@ -133,6 +133,9 @@ export class GridControl extends MDControl {
if
(
pagination
)
{
if
(
pagination
)
{
this
.
load
();
this
.
load
();
}
}
if
(
sorter
)
{
this
.
load
({
sort
:
`
${
sorter
.
field
}
,
${
sorter
.
order
==
'descend'
?
'desc'
:
'asc'
}
`
});
}
}
}
return
{
return
{
useScrollOption
,
useScrollOption
,
...
@@ -154,19 +157,31 @@ export class GridControl extends MDControl {
...
@@ -154,19 +157,31 @@ export class GridControl extends MDControl {
const
{
tag
,
action
,
data
}
=
actionParam
;
const
{
tag
,
action
,
data
}
=
actionParam
;
switch
(
action
)
{
switch
(
action
)
{
case
"valueChange"
:
case
"valueChange"
:
const
{
items
}
=
toRefs
(
this
.
state
);
this
.
handleGridItemValueChange
(
rowIndex
,
tag
,
data
);
if
(
items
.
value
[
rowIndex
][
tag
]
!==
data
)
{
items
.
value
[
rowIndex
][
tag
]
=
data
;
items
.
value
[
rowIndex
][
"rowDataState"
]
=
"update"
;
this
.
resetGridData
(
tag
,
data
,
rowIndex
);
this
.
validateField
(
tag
,
data
,
rowIndex
);
}
break
;
break
;
default
:
default
:
break
;
break
;
}
}
}
}
/**
* @description 表格项值改变
* @param {*} data
* @param {number} rowIndex
* @param {string} tag
* @memberof GridControl
*/
public
handleGridItemValueChange
(
rowIndex
:
number
,
tag
:
string
,
data
:
any
)
{
const
{
items
}
=
toRefs
(
this
.
state
);
if
(
items
.
value
[
rowIndex
][
tag
]
!==
data
)
{
items
.
value
[
rowIndex
][
tag
]
=
data
;
items
.
value
[
rowIndex
][
"rowDataState"
]
=
"update"
;
this
.
resetGridData
(
tag
,
data
,
rowIndex
);
this
.
validateField
(
tag
,
data
,
rowIndex
);
this
.
updateGridEditItem
(
tag
,
data
,
rowIndex
);
}
}
/**
/**
* @description 重置表格数据
* @description 重置表格数据
* @param {string} name
* @param {string} name
...
@@ -175,17 +190,17 @@ export class GridControl extends MDControl {
...
@@ -175,17 +190,17 @@ export class GridControl extends MDControl {
* @memberof GridControl
* @memberof GridControl
*/
*/
public
resetGridData
(
name
:
string
,
data
:
any
,
rowIndex
:
number
)
{
public
resetGridData
(
name
:
string
,
data
:
any
,
rowIndex
:
number
)
{
const
{
columnsModel
}
=
this
.
state
;
const
{
columnsModel
}
=
this
.
state
;
if
(
columnsModel
&&
columnsModel
.
length
>
0
)
{
if
(
columnsModel
&&
columnsModel
.
length
>
0
)
{
columnsModel
.
forEach
((
column
:
any
)
=>
{
columnsModel
.
forEach
((
column
:
any
)
=>
{
if
(
column
.
resetItemName
&&
Object
.
is
(
name
,
column
.
resetItemName
))
{
if
(
column
.
resetItemName
&&
Object
.
is
(
name
,
column
.
resetItemName
))
{
this
.
onEditorEvent
({
tag
:
column
.
dataIndex
,
action
:
'valueChange'
,
data
:
null
},
rowIndex
);
this
.
handleGridItemValueChange
(
rowIndex
,
column
.
dataIndex
,
null
);
if
(
column
.
valueItemName
)
{
if
(
column
.
valueItemName
)
{
this
.
onEditorEvent
({
tag
:
column
.
valueItemName
,
action
:
'valueChange'
,
data
:
null
},
rowIndex
);
this
.
handleGridItemValueChange
(
rowIndex
,
column
.
valueItemName
,
null
);
}
}
}
}
})
})
}
}
}
}
/**
/**
...
@@ -213,6 +228,44 @@ export class GridControl extends MDControl {
...
@@ -213,6 +228,44 @@ export class GridControl extends MDControl {
})
})
}
}
/**
* @description 更新表格编辑项
* @param {string} name
* @param {*} data
* @param {number} rowIndex
* @memberof GridControl
*/
public
async
updateGridEditItem
(
name
:
string
,
data
:
any
,
rowIndex
:
number
)
{
const
{
items
,
columnsModel
,
context
,
viewParams
,
controlService
,
appDeCodeName
,
appDeKeyFieldName
}
=
this
.
state
;
if
(
columnsModel
&&
columnsModel
.
length
>
0
)
{
columnsModel
.
forEach
(
async
(
column
:
any
)
=>
{
if
(
column
.
updateItem
)
{
const
updateItem
:
any
=
column
.
updateItem
;
if
(
updateItem
.
customCode
)
{
if
(
updateItem
.
scriptCode
)
{
eval
(
updateItem
.
scriptCode
);
}
}
else
{
const
arg
=
Object
.
assign
(
deepCopy
(
viewParams
),
items
[
rowIndex
]);
const
tempContext
=
Object
.
assign
(
deepCopy
(
context
),
{
[
appDeCodeName
?.
toLowerCase
()]:
items
[
rowIndex
][
appDeKeyFieldName
]
||
items
[
rowIndex
].
srfkey
});
const
response
=
await
controlService
.
frontLogic
(
tempContext
,
{
viewParams
:
arg
},
{
action
:
updateItem
.
appDEMethod
,
isLoading
:
updateItem
.
showBusyIndicator
},
);
if
(
response
.
status
&&
response
.
status
==
200
)
{
updateItem
.
updateDetails
?.
forEach
((
detailName
:
string
)
=>
{
if
(
detailName
&&
items
[
rowIndex
].
hasOwnProperty
(
detailName
))
{
items
[
rowIndex
][
detailName
]
=
response
.
data
[
detailName
];
}
});
}
}
}
})
}
}
/**
/**
* @description 操作列事件触发
* @description 操作列事件触发
* @param {IActionParam} actionParam
* @param {IActionParam} actionParam
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/service/control-service/grid-service.ts
浏览文件 @
d126eec2
...
@@ -98,4 +98,24 @@ export class GridService<T extends ControlVOBase> extends ControlServiceBase<T>
...
@@ -98,4 +98,24 @@ export class GridService<T extends ControlVOBase> extends ControlServiceBase<T>
response
.
data
=
this
.
newControlVO
(
response
.
data
);
response
.
data
=
this
.
newControlVO
(
response
.
data
);
return
this
.
handleResponse
(
response
,
opts
);
return
this
.
handleResponse
(
response
,
opts
);
}
}
/**
* 前台逻辑
*
* @param [context={}] 上下文参数
* @param [data={}] 视图参数
* @param opts
* @return {*}
*/
public
async
frontLogic
(
context
:
any
,
data
:
any
,
opts
:
{
action
:
string
;
isLoading
?:
boolean
}):
Promise
<
any
>
{
let
_entityService
:
any
=
this
.
entityService
;
const
{
context
:
Context
,
data
:
Data
}
=
this
.
handleRequestData
(
context
,
data
,
opts
);
if
(
hasFunction
(
_entityService
,
opts
.
action
))
{
const
response
=
await
_entityService
[
opts
.
action
](
Context
,
Data
,
opts
.
isLoading
);
response
.
data
=
this
.
newControlVO
(
response
.
data
);
return
this
.
handleResponse
(
response
,
opts
);
}
else
{
return
null
;
}
}
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录