mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 05:25:52 +00:00
fix: export action missing data scope filter (#4476)
This commit is contained in:
parent
bbbb409565
commit
bdde49ee84
@ -9,27 +9,27 @@
|
|||||||
|
|
||||||
import { useFieldSchema } from '@formily/react';
|
import { useFieldSchema } from '@formily/react';
|
||||||
import {
|
import {
|
||||||
useAPIClient,
|
|
||||||
useBlockRequestContext,
|
useBlockRequestContext,
|
||||||
useCollection_deprecated,
|
useCollection_deprecated,
|
||||||
useCollectionManager_deprecated,
|
useCollectionManager_deprecated,
|
||||||
useCompile,
|
useCompile,
|
||||||
|
mergeFilter,
|
||||||
} from '@nocobase/client';
|
} from '@nocobase/client';
|
||||||
import lodash from 'lodash';
|
import lodash from 'lodash';
|
||||||
import { saveAs } from 'file-saver';
|
import { saveAs } from 'file-saver';
|
||||||
import { App } from 'antd';
|
import { App } from 'antd';
|
||||||
import { useExportTranslation } from './locale';
|
import { useExportTranslation } from './locale';
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
export const useExportAction = () => {
|
export const useExportAction = () => {
|
||||||
const { service, resource } = useBlockRequestContext();
|
const { service, resource, props } = useBlockRequestContext();
|
||||||
const apiClient = useAPIClient();
|
const defaultFilter = props?.params.filter;
|
||||||
const actionSchema = useFieldSchema();
|
const actionSchema = useFieldSchema();
|
||||||
const compile = useCompile();
|
const compile = useCompile();
|
||||||
const { getCollectionJoinField } = useCollectionManager_deprecated();
|
const { getCollectionJoinField } = useCollectionManager_deprecated();
|
||||||
const { name, title, getField } = useCollection_deprecated();
|
const { name, title } = useCollection_deprecated();
|
||||||
const { t } = useExportTranslation();
|
const { t } = useExportTranslation();
|
||||||
const { modal } = App.useApp();
|
const { modal } = App.useApp();
|
||||||
|
const filters = service.params?.[1]?.filters || {};
|
||||||
return {
|
return {
|
||||||
async onClick() {
|
async onClick() {
|
||||||
const confirmed = await modal.confirm({
|
const confirmed = await modal.confirm({
|
||||||
@ -61,7 +61,7 @@ export const useExportAction = () => {
|
|||||||
{
|
{
|
||||||
title: compile(title),
|
title: compile(title),
|
||||||
appends: service.params[0]?.appends?.join(),
|
appends: service.params[0]?.appends?.join(),
|
||||||
filter: JSON.stringify(service.params[0]?.filter),
|
filter: mergeFilter([...Object.values(filters), defaultFilter]),
|
||||||
sort: service.params[0]?.sort,
|
sort: service.params[0]?.sort,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user