mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 13:06:31 +00:00
fix: sync table sort to export (#723)
This commit is contained in:
parent
f11c0025c0
commit
538a28d0bd
@ -17,8 +17,8 @@ const InternalTableFieldProvider = (props) => {
|
|||||||
const formBlockCtx = useFormBlockContext();
|
const formBlockCtx = useFormBlockContext();
|
||||||
const formFieldCtx = useFormFieldContext();
|
const formFieldCtx = useFormFieldContext();
|
||||||
|
|
||||||
const fullFieldName = formFieldCtx && formFieldCtx.fieldName ? `${formFieldCtx.fieldName}.${fieldName}` : fieldName;
|
const fullFieldName = formFieldCtx && formFieldCtx.fieldName ? `${formFieldCtx.fieldName}.${fieldName}` : fieldName;
|
||||||
|
|
||||||
if (!formBlockCtx?.updateAssociationValues?.includes(fullFieldName)) {
|
if (!formBlockCtx?.updateAssociationValues?.includes(fullFieldName)) {
|
||||||
formBlockCtx?.updateAssociationValues?.push(fullFieldName);
|
formBlockCtx?.updateAssociationValues?.push(fullFieldName);
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,7 @@ const CollectionResourceActionProvider = (props) => {
|
|||||||
params: {
|
params: {
|
||||||
...others,
|
...others,
|
||||||
...request?.params,
|
...request?.params,
|
||||||
appends: [
|
appends: [...collection?.fields?.filter?.((field) => field.target).map((field) => field.name), ...appends],
|
||||||
...collection?.fields?.filter?.((field) => field.target).map((field) => field.name),
|
|
||||||
...appends,
|
|
||||||
],
|
|
||||||
sort: dragSort ? [collection.sortable === true ? 'sort' : collection.sortable] : request?.params?.sort,
|
sort: dragSort ? [collection.sortable === true ? 'sort' : collection.sortable] : request?.params?.sort,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -66,10 +63,7 @@ const AssociationResourceActionProvider = (props) => {
|
|||||||
...request,
|
...request,
|
||||||
params: {
|
params: {
|
||||||
...request?.params,
|
...request?.params,
|
||||||
appends: [
|
appends: [...collection?.fields?.filter?.((field) => field.target).map((field) => field.name), ...appends],
|
||||||
...collection?.fields?.filter?.((field) => field.target).map((field) => field.name),
|
|
||||||
...appends,
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ uid },
|
{ uid },
|
||||||
|
@ -41,6 +41,7 @@ export const useExportAction = () => {
|
|||||||
columns: JSON.stringify(compile(exportSettings)),
|
columns: JSON.stringify(compile(exportSettings)),
|
||||||
appends: service.params[0]?.appends?.join(),
|
appends: service.params[0]?.appends?.join(),
|
||||||
filter: JSON.stringify(service.params[0]?.filter),
|
filter: JSON.stringify(service.params[0]?.filter),
|
||||||
|
sort: service.params[0]?.sort,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
@ -5,7 +5,7 @@ import render from '../renders';
|
|||||||
import { columns2Appends } from '../utils';
|
import { columns2Appends } from '../utils';
|
||||||
|
|
||||||
export async function exportXlsx(ctx: Context, next: Next) {
|
export async function exportXlsx(ctx: Context, next: Next) {
|
||||||
let { title, columns, filter, fields, except } = ctx.action.params;
|
let { title, columns, filter, sort, fields, except } = ctx.action.params;
|
||||||
const { resourceName, resourceOf } = ctx.action;
|
const { resourceName, resourceOf } = ctx.action;
|
||||||
if (typeof columns === 'string') {
|
if (typeof columns === 'string') {
|
||||||
columns = JSON.parse(columns);
|
columns = JSON.parse(columns);
|
||||||
@ -19,6 +19,7 @@ export async function exportXlsx(ctx: Context, next: Next) {
|
|||||||
fields,
|
fields,
|
||||||
appends,
|
appends,
|
||||||
except,
|
except,
|
||||||
|
sort,
|
||||||
context: ctx,
|
context: ctx,
|
||||||
});
|
});
|
||||||
const collectionFields = columns.map((col) => collection.fields.get(col.dataIndex[0]));
|
const collectionFields = columns.map((col) => collection.fields.get(col.dataIndex[0]));
|
||||||
|
Loading…
Reference in New Issue
Block a user