fix: export action missing data scope filter (#4476)

This commit is contained in:
Katherine 2024-05-24 09:08:43 +08:00 committed by GitHub
parent bbbb409565
commit bdde49ee84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,27 +9,27 @@
import { useFieldSchema } from '@formily/react';
import {
useAPIClient,
useBlockRequestContext,
useCollection_deprecated,
useCollectionManager_deprecated,
useCompile,
mergeFilter,
} from '@nocobase/client';
import lodash from 'lodash';
import { saveAs } from 'file-saver';
import { App } from 'antd';
import { useExportTranslation } from './locale';
import React from 'react';
export const useExportAction = () => {
const { service, resource } = useBlockRequestContext();
const apiClient = useAPIClient();
const { service, resource, props } = useBlockRequestContext();
const defaultFilter = props?.params.filter;
const actionSchema = useFieldSchema();
const compile = useCompile();
const { getCollectionJoinField } = useCollectionManager_deprecated();
const { name, title, getField } = useCollection_deprecated();
const { name, title } = useCollection_deprecated();
const { t } = useExportTranslation();
const { modal } = App.useApp();
const filters = service.params?.[1]?.filters || {};
return {
async onClick() {
const confirmed = await modal.confirm({
@ -61,7 +61,7 @@ export const useExportAction = () => {
{
title: compile(title),
appends: service.params[0]?.appends?.join(),
filter: JSON.stringify(service.params[0]?.filter),
filter: mergeFilter([...Object.values(filters), defaultFilter]),
sort: service.params[0]?.sort,
},
{