fix build
This commit is contained in:
parent
843b8b5b16
commit
fe2d163cd0
@ -10,7 +10,6 @@ import { useStore } from '@/stores/hooks';
|
||||
import { useApolloClient } from '@apollo/client';
|
||||
import type { QueryFunctionContext } from '@tanstack/react-query';
|
||||
import { useQueries } from '@tanstack/react-query';
|
||||
import { clone } from 'tools';
|
||||
import { Flex } from 'ui/grid';
|
||||
|
||||
const storeSelector: StoreSelector = ({ kasko }) => kasko;
|
||||
@ -118,11 +117,24 @@ export function Kasko() {
|
||||
$calculation.element('tbxInsFranchise').setValue(row.totalFranchise);
|
||||
}
|
||||
|
||||
const kaskoColumns = clone(columns);
|
||||
kaskoColumns[0].title = 'Страховая компания КАСКО';
|
||||
kaskoColumns[3].title = (
|
||||
<ReloadButton storeSelector={storeSelector} onClick={() => handleOnClick()} />
|
||||
);
|
||||
type Column = (typeof columns)[number];
|
||||
const kaskoColumns = columns.map((column: Column) => {
|
||||
if (column.key === 'name') {
|
||||
return {
|
||||
...column,
|
||||
title: 'Страховая компания КАСКО',
|
||||
};
|
||||
}
|
||||
|
||||
if (column.key === 'status') {
|
||||
return {
|
||||
...column,
|
||||
title: <ReloadButton storeSelector={storeSelector} onClick={() => handleOnClick()} />,
|
||||
};
|
||||
}
|
||||
|
||||
return column;
|
||||
});
|
||||
|
||||
return (
|
||||
<Flex flexDirection="column">
|
||||
|
||||
@ -10,7 +10,6 @@ import { useStore } from '@/stores/hooks';
|
||||
import { useApolloClient } from '@apollo/client';
|
||||
import type { QueryFunctionContext } from '@tanstack/react-query';
|
||||
import { useQueries } from '@tanstack/react-query';
|
||||
import { clone } from 'tools';
|
||||
import { Flex } from 'ui/grid';
|
||||
|
||||
const storeSelector: StoreSelector = ({ osago }) => osago;
|
||||
@ -103,11 +102,24 @@ export function Osago() {
|
||||
$tables.insurance.row('osago').column('insCost').setValue(row.sum);
|
||||
}
|
||||
|
||||
const osagoColumns = clone(columns);
|
||||
osagoColumns[0].title = 'Страховая компания ОСАГО';
|
||||
osagoColumns[3].title = (
|
||||
<ReloadButton storeSelector={storeSelector} onClick={() => handleOnClick()} />
|
||||
);
|
||||
type Column = (typeof columns)[number];
|
||||
const osagoColumns = columns.map((column: Column) => {
|
||||
if (column.key === 'name') {
|
||||
return {
|
||||
...column,
|
||||
title: 'Страховая компания ОСАГО',
|
||||
};
|
||||
}
|
||||
|
||||
if (column.key === 'status') {
|
||||
return {
|
||||
...column,
|
||||
title: <ReloadButton storeSelector={storeSelector} onClick={() => handleOnClick()} />,
|
||||
};
|
||||
}
|
||||
|
||||
return column;
|
||||
});
|
||||
|
||||
return (
|
||||
<Flex flexDirection="column">
|
||||
|
||||
@ -14,11 +14,13 @@ const formatter = Intl.NumberFormat('ru', {
|
||||
export const columns: ColumnsType<Row> = [
|
||||
{
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
title: 'Страховая компания',
|
||||
width: '50%',
|
||||
},
|
||||
{
|
||||
dataIndex: 'sum',
|
||||
key: 'sum',
|
||||
render: formatter,
|
||||
sortDirections: ['descend', 'ascend'],
|
||||
sorter: (a, b) => a.sum - b.sum,
|
||||
@ -27,20 +29,22 @@ export const columns: ColumnsType<Row> = [
|
||||
},
|
||||
{
|
||||
dataIndex: 'totalFranchise',
|
||||
key: 'totalFranchise',
|
||||
render: formatter,
|
||||
title: 'Франшиза',
|
||||
width: '20%',
|
||||
},
|
||||
{
|
||||
dataIndex: 'status',
|
||||
render: (value) => {
|
||||
if (value === 'fetching')
|
||||
key: 'status',
|
||||
render: (_, record) => {
|
||||
if (record.status === 'fetching')
|
||||
return (
|
||||
<Flex justifyContent="center">
|
||||
<LoadingOutlined spin />
|
||||
</Flex>
|
||||
);
|
||||
if (value === 'error')
|
||||
if (record.status === 'error')
|
||||
return (
|
||||
<Flex justifyContent="center">
|
||||
<CloseOutlined />
|
||||
|
||||
@ -19,7 +19,3 @@ export function difference<T>(arr1: readonly T[], arr2: readonly T[]) {
|
||||
export function isSorted(arr: number[]) {
|
||||
return arr.every((value, index, array) => !index || array[index - 1] <= value);
|
||||
}
|
||||
|
||||
export function clone<T>(arr: T[]) {
|
||||
return arr.map((x) => ({ ...x })) as T[];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user