На подобии DividentOperation.ts написать ручки для получения списка сделок и сохранения при принятии изменений
GET /operations-to-match
Zero-based page index (0..N)
integer
(query)
Default value: 0
size
integer
The size of the page to be returned
(query)
Default value: 20
sort
array[string]
Sorting criteria in the format: property, (asc|desc). Default sort order is ascending. Multiple sort criteria are supported.
(query)
search
Filtering criteria in the format: key(==, !=, >, <, >=, <=, ~)value. Several filtering criteria are supported, where the delimiter is ',' - operator AND, 'I' - operator OR.
string
(query)
Responses
Code
200
Description
OK
Media type
/
Controls Accept header.
Example Value | Schema
{
"content": [
{}
],
"pageInfo": {
"last": true,
"totalElements": 9007199254740991,
"totalPages": 1073741824,
"size": 1073741824,
"number": 1073741824,
"sumperPage": {}
}
}
GET /operations-to-match/{id}
Parameters
Name
Description
id * required
string
(path)
Responses
Code
Description
200
OK
Media type
/
Controls Accept header.
Example Value Schema
{
"cftPaydocId": "string",
"cftPaydocNumber": "string",
"cftPaydocAccountDebit": "string",
"cftPaydocAccountDebitOld": "string",
"cftPaydocAccountCredit": "string",
"cftPaydocAccountCreditOld": "string",
"cftPaydocAmount": "string",
"cftPaydocAmountOld": "string",
"cftPaydocDate": "2025-06-03",
"cftPaydocDateOld": "2025-06-03",
"cftPaydocDetails": "string"
}
src/api/DividentOperation.ts
const dividendOperation = api.injectEndpoints({
endpoints: (builder) => ({
getOperationList: builder.query<
PaginatedResponse<DividendOperation[]>,
{
filters: Record<string, TEMPORARY_ANY>;
pageSize: number;
sort: Record<string, string | undefined>;
page: number;
}
({
query: ({ pageSize, filters, sort, page }) => ({
url: /operations?${makeFiltrationAndSortString(page, pageSize, sort, filters, BASE_TEMPLATE)},
}),
merge: (current, newItems, arg) => {
arg.arg.page > 0 ? current.content.push(...newItems.content): (current.content = newItems.content);
current.pageInfo = newItems.pageInfo;
},
serializeQueryArgs: ({ endpointName }) => endpointName,
forceRefetch({ currentArg, previousArg }) {
},
return !isEqual(currentArg, previousArg);
providesTags: (res) =>
res
? res.content
.map((deposit) => ({
type: ApiTagTypesEnum.OPERATION,
id: deposit.id,
.concat([
}))
{
type: ApiTagTypesEnum.OPERATION,
id: 'OPERATION-LIST',
},
])
: [{ type: ApiTagTypesEnum.OPERATION, id: 'OPERATION-LIST' }],
confirmOperation: builder.mutation<void, string>({
query: (id) => ({
url: /operations/{id}/for-confirmation`,
payload: {
method: 'POST'
}
getDividendOperationById: builder.query<DividendOperation, string | undefined>({
query: (id = '') -> ({
url: `/operations/{id}, }), providesTags: (res) => [{ type: ApiTagTypesEnum.OPERATION, id: res?.id }], }), createOverrideOperation: builder.mutation< DividendCreateOperation, { date: string; operationType: string; details?: string; withTax?: boolean; period: string; } ({ query: (overrideOperationData) => ({ url: /operations/creating-operation, payload: { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(overrideOperationData), } }), invalidatesTags: () => [{ type: ApiTagTypesEnum.OPERATION, id: 'OPERATION-LIST' }], }), getMailFileById: builder.query<void, { id: string }>({ query: ({ id }) => ({ payload: { method: 'GET' }, url: /operations/${id}/mail-file`,
cache: 'no-cache',
})
transformResponse: async (response: TEMPORARY_ANY) => {
getFile(await response.data, response.header);
return;
},
}),
}),
});
export const {
useGetOperationListQuery,
useConfirmoperationMutation,
useGetDividendOperationByIdQuery,
useCreateOverrideOperationMutation,
useLazyGetMailFileByIdQuery,
} = dividendOperation;
src/models/operation.ts
export type OperationCFT = {
cftPaydocId: string;
cftPaydocNumber: string;
cftPaydocAccountDebit: string;
cftPaydocAccountDebitold: string;
cftPaydocAccountCredit: string;
cftPaydocAccountCreditold: string;
cftPaydocAmount: string;
cftPaydocAmountold: string;
cftPaydocDate: string;
cftPaydocDateOld: string;
cftPaydocDetails: string;
};
src/pages/DifferenceOperations/utils.ts
export const COLUMN_NAMES: Record<keyof OperationCFT, string> = {
cftPaydocId: '№',
cftPaydocNumber: 'Номер док.",
cftPaydocAccountDebit: 'Счет дебет ЦФТ',
cftPaydocAccountDebitOld: 'Счет дебет',
cftPaydocAccountCredit: 'Счет кредит ЦФТ',
cftPaydocAccountCreditOld: 'Счет кредит',
cftPaydocAmount: 'Сумма ЦФТ (руб.)',
cftPaydocAmountold: 'Сумма (руб.)',
cftPaydocDate: 'Дата операции в ЦФТ',
cftPaydocDateOld: 'Дата операции',
cftPaydocDetails: 'Назначение платежа',
};
const getBaseParams = (id: string) => ({
resizable: true,
maxWidth: 500,
key: id,
datakey: id,
title: COLUMN_NAMES[id],
width: +(localStorage.getItem(${APP_KEY}-differenceOperations-width-${id}) ?? 140),
});
flexGrow: 1,
sortable: true,
minWidth: 50,
filterType: FormInputTypeEnum.DEFAULT,
});
export const COLUMNS_TEMPLATE: Record<keyof OperationCFT, ColumnShape> = {
cftPaydocId: {
},
...getBaseParams('cftPaydocId'),
width: +(localStorage.getItem(${APP_KEY}-differenceOperations-width-${'id'}) ?? 100),
filterType: FormInputTypeEnum.INT_NUMBER,
cftPaydocNumber: {
...getBaseParams('cftPaydocNumber'),
width: +(localStorage.getItem(${APP_KEY}-differenceOperations-width-${'state'}) ?? 100),
filterType: FormInputTypeEnum.STATUS,
cftPaydocAccountDebit: {
},
...getBaseParams('cftPaydocAccountDebit'),
filterType: FormInputTypeEnum.OPERATION_TYPE,
cftPaydocAccountCredit: {
},
...getBaseParams('cftPaydocAccountCredit'),
filterType: FormInputTypeEnum.ACCOUNT_TYPE,
cftPaydocAccountDebitold: {
},
...getBaseParams('cftPaydocAccountDebitold'),
filterType: FormInputTypeEnum.INT_NUMBER,
cftPaydocAccountCreditold: {
},
...getBaseParams('cftPaydocAccountCreditold'),
filterType: FormInputTypeEnum.INT_NUMBER,
cftPaydocAmount: {
},
...getBaseParams('cftPaydocAmount'),
width: +(localStorage.getItem(${APP_KEY}-differenceOperations-width-${'state'}) ?? 300),
cftPaydocAmountold: {
},
...getBaseParams('cftPaydocAmountOld'),
filterType: FormInputTypeEnum.DATE_RANGE,
cftPaydocDate: {
},
...getBaseParams('cftPaydocDate'),
filterType: FormInputTypeEnum.OPERATION_TYPE,
cftPaydocDateOld: {
},
...getBaseParams('cftPaydocDateOld'),
filterType: FormInputTypeEnum.INT_NUMBER,
type: 'number',
};
cftPaydocDetails: {
},
...getBaseParams('cftResponseDetails'),
filterType: FormInputTypeEnum.NUMBER,
type: 'number',
},
};
export const INITIAL_COLS: (keyof OperationCFT)[] = [
'cftPaydocId',
'cftPaydocNumber',
'cftPaydocAccountDebit',
'cftPaydocAccountDebitOld',
'cftPaydocAccountCredit',
'cftPaydocAccountCreditOld',
'cftPaydocAmount',
'cftPaydocAmountold',
'cftPaydocDateOld',
'cftPaydocDate',
];
export const BASE_TEMPLATE = Object.entries(COLUMN_NAMES)
.map(([key, label]) => ({
name: key,
label,
type: COLUMNS_TEMPLATE[key]?.filterType ?? FormInputTypeEnum.DEFAULT,
}))
.sort((a, b) => a.label.localeCompare(b.label));
export const COLUMNS_LIST = Object.entries(COLUMN_NAMES)
.map(([key, name]) => ({
label: name,
name: key,
}))
.sort((a, b) => a.label.localeCompare(b.label));