diff --git a/packages/core/client/src/block-provider/hooks/index.ts b/packages/core/client/src/block-provider/hooks/index.ts
index acbc5d1d5..28d9672c0 100644
--- a/packages/core/client/src/block-provider/hooks/index.ts
+++ b/packages/core/client/src/block-provider/hooks/index.ts
@@ -6,7 +6,7 @@ import { App, message } from 'antd';
import _ from 'lodash';
import get from 'lodash/get';
import omit from 'lodash/omit';
-import { ChangeEvent, useCallback, useContext, useEffect } from 'react';
+import { ChangeEvent, useCallback, useContext, useEffect, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { useReactToPrint } from 'react-to-print';
@@ -826,6 +826,7 @@ export const useUpdateActionProps = () => {
overwriteValues,
skipValidator,
triggerWorkflows,
+ isDeltaChanged,
} = actionSchema?.['x-action-settings'] ?? {};
const assignedValues = {};
@@ -854,6 +855,7 @@ export const useUpdateActionProps = () => {
await form.submit();
}
const fieldNames = fields.map((field) => field.name);
+ const actionFields = getActiveFieldsName?.('form') || [];
const values = getFormValues({
filterByTk,
field,
@@ -861,18 +863,33 @@ export const useUpdateActionProps = () => {
fieldNames,
getField,
resource,
- actionFields: getActiveFieldsName?.('form') || [],
+ actionFields,
});
actionField.data = field.data || {};
actionField.data.loading = true;
+
+ const rawValues = {
+ ...values,
+ ...overwriteValues,
+ ...assignedValues,
+ };
+
+ const filterValues = (srcValues) =>
+ Object.entries(srcValues).reduce((obj, keyValuePair) => {
+ const [key, value] = keyValuePair;
+ if (actionFields.includes(key)) {
+ obj = {
+ ...obj,
+ [key]: value,
+ };
+ }
+ return obj;
+ }, {});
+
try {
await resource.update({
filterByTk,
- values: {
- ...values,
- ...overwriteValues,
- ...assignedValues,
- },
+ values: isDeltaChanged ? filterValues(rawValues) : rawValues,
...data,
updateAssociationValues,
// TODO(refactor): should change to inject by plugin
diff --git a/packages/core/client/src/modules/actions/submit/UpdateSubmitActionInitializer.tsx b/packages/core/client/src/modules/actions/submit/UpdateSubmitActionInitializer.tsx
index 04d25d515..c66463dcc 100644
--- a/packages/core/client/src/modules/actions/submit/UpdateSubmitActionInitializer.tsx
+++ b/packages/core/client/src/modules/actions/submit/UpdateSubmitActionInitializer.tsx
@@ -22,6 +22,7 @@ export const UpdateSubmitActionInitializer = (props) => {
redirecting: false,
successMessage: '{{t("Updated successfully")}}',
},
+ isDeltaChanged: false,
},
};
return ;
diff --git a/packages/plugins/@hera/plugin-core/src/client/index.tsx b/packages/plugins/@hera/plugin-core/src/client/index.tsx
index fb55b38c3..128913c47 100644
--- a/packages/plugins/@hera/plugin-core/src/client/index.tsx
+++ b/packages/plugins/@hera/plugin-core/src/client/index.tsx
@@ -71,6 +71,7 @@ import {
useCustomPresets,
useCustomPresets1,
} from './schema-settings/SchemaSettingsDatePresets';
+import { SchemaSettingsSubmitDataType } from './schema-settings/SchemaSettingsSubmitDataType';
export { usePDFViewerRef } from './schema-initializer';
export * from './components/custom-components/custom-components';
@@ -102,6 +103,10 @@ export class PluginCoreClient extends Plugin {
Component: SchemaSettingsDatePresets,
});
+ this.schemaSettingsManager.addItem('actionSettings:updateSubmit', 'submitDataType', {
+ Component: SchemaSettingsSubmitDataType,
+ });
+
this.schemaSettingsManager.addItem('FormItemSettings', 'hera-divider', {
type: 'divider',
useVisible() {
diff --git a/packages/plugins/@hera/plugin-core/src/client/schema-settings/SchemaSettingsSubmitDataType.tsx b/packages/plugins/@hera/plugin-core/src/client/schema-settings/SchemaSettingsSubmitDataType.tsx
new file mode 100644
index 000000000..fb54a2a3d
--- /dev/null
+++ b/packages/plugins/@hera/plugin-core/src/client/schema-settings/SchemaSettingsSubmitDataType.tsx
@@ -0,0 +1,30 @@
+import React from 'react';
+import { useFieldSchema } from '@nocobase/schema';
+import { SchemaSettingsSwitchItem, useDesignable } from '@nocobase/client';
+import { useTranslation } from '../locale';
+
+// 选择提交数据方式,是否增量提交,默认全量提交
+export const SchemaSettingsSubmitDataType = () => {
+ const { dn } = useDesignable();
+ const { t } = useTranslation();
+ const fieldSchema = useFieldSchema();
+ return (
+ {
+ fieldSchema['x-action-settings'].isDeltaChanged = value;
+ dn.emit('patch', {
+ schema: {
+ ['x-uid']: fieldSchema['x-uid'],
+ 'x-action-settings': {
+ ...fieldSchema['x-action-settings'],
+ },
+ },
+ });
+ }}
+ />
+ );
+};
+
+SchemaSettingsSubmitDataType.displayName = 'SchemaSettingsSubmitDataType';
diff --git a/packages/plugins/@hera/plugin-core/src/locale/en-US.json b/packages/plugins/@hera/plugin-core/src/locale/en-US.json
index 97e05d9f9..1293f9428 100644
--- a/packages/plugins/@hera/plugin-core/src/locale/en-US.json
+++ b/packages/plugins/@hera/plugin-core/src/locale/en-US.json
@@ -27,5 +27,6 @@
"loading...": "loading...",
"preview block": "preview block",
"tabs": "tabs",
- "year": "year"
+ "year": "year",
+ "Select submit data type": "Select submit data type"
}
diff --git a/packages/plugins/@hera/plugin-core/src/locale/zh-CN.json b/packages/plugins/@hera/plugin-core/src/locale/zh-CN.json
index 85f007ae2..74ec269c0 100644
--- a/packages/plugins/@hera/plugin-core/src/locale/zh-CN.json
+++ b/packages/plugins/@hera/plugin-core/src/locale/zh-CN.json
@@ -27,5 +27,6 @@
"loading...": "加载中...",
"preview block": "预览区块",
"tabs": "多标签",
- "year": "年"
+ "year": "年",
+ "Select submit data type": "增量提交"
}