Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:修复crud批量操作上下文event导致的ajax请求报错问题 #11241

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions packages/amis/src/renderers/CRUD.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -885,16 +891,21 @@ export default class CRUD extends React.Component<CRUDProps, any> {
.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') {
Expand Down
Loading