From d5ad7522bec4d9b084d76b3575bb18f1912181d6 Mon Sep 17 00:00:00 2001 From: lvxiaojiao Date: Thu, 21 Nov 2024 13:11:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8Dcrud=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E4=B8=8A=E4=B8=8B=E6=96=87event=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84ajax=E8=AF=B7=E6=B1=82=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis/src/renderers/CRUD.tsx | 33 ++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/packages/amis/src/renderers/CRUD.tsx b/packages/amis/src/renderers/CRUD.tsx index 6983c43dd..2fbd86004 100644 --- a/packages/amis/src/renderers/CRUD.tsx +++ b/packages/amis/src/renderers/CRUD.tsx @@ -2,7 +2,13 @@ import React from 'react'; import isEqual from 'lodash/isEqual'; import pickBy from 'lodash/pickBy'; import omitBy from 'lodash/omitBy'; -import {Renderer, RendererProps, filterTarget, mapTree} from 'amis-core'; +import { + Renderer, + RendererProps, + createObjectFromChain, + filterTarget, + mapTree +} from 'amis-core'; import {SchemaNode, Schema, ActionObject, PlainObject} from 'amis-core'; import {CRUDStore, ICRUDStore, getMatchedEventTargets} from 'amis-core'; import { @@ -885,16 +891,21 @@ export default class CRUD extends React.Component { .filter(item => item) .join(','); - const ctx = createObject(store.mergedData, { - ...selectedItems[0], - currentPageData: (store.mergedData?.items || []).concat(), - rows: selectedItems, - items: selectedItems, - selectedItems, - unSelectedItems: unSelectedItems, - ids, - event: e // 固定事件数据从event.data中获取,方便批量操作按钮绑定动作时获取动作产生的数据 - }); + const ctx = createObjectFromChain([ + store.mergedData, + { + event: e // 固定事件数据从event.data中获取,方便批量操作按钮绑定动作时获取动作产生的数据 + }, + { + ...selectedItems[0], + currentPageData: (store.mergedData?.items || []).concat(), + rows: selectedItems, + items: selectedItems, + selectedItems, + unSelectedItems: unSelectedItems, + ids + } + ]); let fn = () => { if (action.actionType === 'dialog') {