Merge pull request #10701 from donglixiaoche/feat-table2-quickEdit-event

FEAT: 快速编辑成功后 dispatch 事件
This commit is contained in:
hsm-lv 2024-08-07 11:20:21 +08:00 committed by GitHub
commit 9fcf8492f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 1 deletions

View File

@ -3558,6 +3558,7 @@ order: 67
"body": {
"type": "service",
"api": "/api/sample?perPage=5",
"id": "service-container",
"body": [
{
"type": "table2",
@ -3566,6 +3567,25 @@ order: 67
"url": "/api/mock2/sample/bulkUpdate",
"method": "put"
},
"draggable": true,
"onEvent": {
"quickSaveSubmitted": {
"actions": [
{
"actionType": "reload",
"componentId": "service-container"
}
]
},
"orderChange": {
"actions": [
{
"actionType": "reload",
"componentId": "service-container"
}
]
}
},
"columns": [
{
"title": "Engine",

View File

@ -1424,7 +1424,8 @@ export default class Table2 extends React.Component<Table2Props, object> {
keyField,
env,
messages,
reload
reload,
dispatchEvent
} = this.props;
if (Array.isArray(rows)) {
@ -1454,6 +1455,7 @@ export default class Table2 extends React.Component<Table2Props, object> {
errorMessage: messages && messages.saveSuccess
})
.then(() => {
dispatchEvent('quickSaveSubmitted', data);
reload && this.reloadTarget(filterTarget(reload, data), data);
})
.catch(() => {});
@ -1473,6 +1475,7 @@ export default class Table2 extends React.Component<Table2Props, object> {
store
.saveRemote(quickSaveItemApi, sendData)
.then(() => {
dispatchEvent('quickSaveSubmitted', sendData);
reload && this.reloadTarget(filterTarget(reload, data), data);
})
.catch(() => {