feat: dispatch quick save submitted event

This commit is contained in:
donglixiaoche 2024-07-31 09:46:29 +08:00
parent 99e40693f7
commit 250503a205
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(() => {