fix: create action reported error when config save mode filterKeys (#2631)

This commit is contained in:
katherinehhh 2023-09-12 10:09:02 +08:00 committed by GitHub
parent adf11bf624
commit cf17d8015f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,8 +134,7 @@ export const useCreateActionProps = () => {
const currentUser = currentUserContext?.data?.data; const currentUser = currentUserContext?.data?.data;
const action = actionField.componentProps.saveMode || 'create'; const action = actionField.componentProps.saveMode || 'create';
const filterKeys = actionField.componentProps.filterKeys || []; const filterKeys = actionField.componentProps.filterKeys?.checked || [];
return { return {
async onClick() { async onClick() {
const fieldNames = fields.map((field) => field.name); const fieldNames = fields.map((field) => field.name);
@ -219,8 +218,12 @@ export const useAssociationCreateActionProps = () => {
return { return {
async onClick() { async onClick() {
const fieldNames = fields.map((field) => field.name); const fieldNames = fields.map((field) => field.name);
const { assignedValues: originalAssignedValues = {}, onSuccess, overwriteValues, skipValidator } = const {
actionSchema?.['x-action-settings'] ?? {}; assignedValues: originalAssignedValues = {},
onSuccess,
overwriteValues,
skipValidator,
} = actionSchema?.['x-action-settings'] ?? {};
const addChild = fieldSchema?.['x-component-props']?.addChild; const addChild = fieldSchema?.['x-component-props']?.addChild;
const assignedValues = parse(originalAssignedValues)({ currentTime: new Date(), currentRecord, currentUser }); const assignedValues = parse(originalAssignedValues)({ currentTime: new Date(), currentRecord, currentUser });
if (!skipValidator) { if (!skipValidator) {
@ -404,8 +407,11 @@ export const useCustomizeUpdateActionProps = () => {
return { return {
async onClick() { async onClick() {
const { assignedValues: originalAssignedValues = {}, onSuccess, skipValidator } = const {
actionSchema?.['x-action-settings'] ?? {}; assignedValues: originalAssignedValues = {},
onSuccess,
skipValidator,
} = actionSchema?.['x-action-settings'] ?? {};
const assignedValues = parse(originalAssignedValues)({ currentTime: new Date(), currentRecord, currentUser }); const assignedValues = parse(originalAssignedValues)({ currentTime: new Date(), currentRecord, currentUser });
if (skipValidator === false) { if (skipValidator === false) {
await form.submit(); await form.submit();
@ -459,8 +465,11 @@ export const useCustomizeBulkUpdateActionProps = () => {
return { return {
async onClick() { async onClick() {
const { assignedValues: originalAssignedValues = {}, onSuccess, updateMode } = const {
actionSchema?.['x-action-settings'] ?? {}; assignedValues: originalAssignedValues = {},
onSuccess,
updateMode,
} = actionSchema?.['x-action-settings'] ?? {};
actionField.data = field.data || {}; actionField.data = field.data || {};
actionField.data.loading = true; actionField.data.loading = true;
const assignedValues = parse(originalAssignedValues)({ currentTime: new Date(), currentUser }); const assignedValues = parse(originalAssignedValues)({ currentTime: new Date(), currentUser });