pass elt error to rows
This commit is contained in:
parent
79924d41c0
commit
fdf795b47d
@ -18,7 +18,7 @@ export const PolicyTable = observer(
|
||||
x: true,
|
||||
}}
|
||||
rowSelection={{
|
||||
getCheckboxProps: (record) => ({ disabled: !record.sum || record.isFetching }),
|
||||
getCheckboxProps: (record) => ({ disabled: !record.sum || record.status }),
|
||||
hideSelectAll: true,
|
||||
onSelect: (record) => {
|
||||
if (record.sum > 0) setSelectedKey(record.key);
|
||||
|
||||
@ -37,7 +37,7 @@ export function Osago() {
|
||||
});
|
||||
|
||||
async function handleOnClick() {
|
||||
const fetchingRows = rows.map((x) => ({ ...x, isFetching: true }));
|
||||
const fetchingRows = rows.map((x) => ({ ...x, status: 'fetching', sum: 0 }));
|
||||
$tables.elt.osago.setRows(fetchingRows);
|
||||
|
||||
queries.forEach(({ refetch }) => {
|
||||
@ -45,11 +45,11 @@ export function Osago() {
|
||||
if (res.data) {
|
||||
const { key, numCalc, premiumSum, message, skCalcId, error } = res.data;
|
||||
$tables.elt.osago.setRow({
|
||||
isFetching: false,
|
||||
key,
|
||||
message: message || error,
|
||||
numCalc,
|
||||
skCalcId,
|
||||
status: error ? 'error' : null,
|
||||
sum: premiumSum,
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { RowSchema } from '@/config/schema/elt';
|
||||
import { LoadingOutlined } from 'ui/elements/icons';
|
||||
import { CloseOutlined, LoadingOutlined } from 'ui/elements/icons';
|
||||
import type { ColumnsType } from 'ui/elements/table';
|
||||
import type { z } from 'zod';
|
||||
|
||||
@ -28,8 +28,13 @@ export const columns: ColumnsType<Row> = [
|
||||
title: 'Франшиза',
|
||||
},
|
||||
{
|
||||
dataIndex: 'isFetching',
|
||||
render: (value) => value && <LoadingOutlined spin />,
|
||||
dataIndex: 'status',
|
||||
render: (value) => {
|
||||
if (value === 'fetching') return <LoadingOutlined spin />;
|
||||
if (value === 'error') return <CloseOutlined />;
|
||||
|
||||
return false;
|
||||
},
|
||||
title: undefined,
|
||||
},
|
||||
];
|
||||
|
||||
@ -267,13 +267,13 @@ export const ResultEltOsagoSchema = z.record(
|
||||
|
||||
export const RowSchema = z.object({
|
||||
id: z.string(),
|
||||
isFetching: z.boolean(),
|
||||
key: z.string(),
|
||||
message: z.string().nullable(),
|
||||
name: z.string(),
|
||||
numCalc: z.number(),
|
||||
requestId: z.string(),
|
||||
skCalcId: z.string(),
|
||||
status: z.string().nullable(),
|
||||
sum: z.number(),
|
||||
totalFranchise: z.number(),
|
||||
});
|
||||
|
||||
@ -41,13 +41,13 @@ export default function helper({ apolloClient, store }: ProcessContext) {
|
||||
['6', '9', '10'].includes(evo_leasingobject_type?.evo_id)
|
||||
? x?.evo_id_elt_smr
|
||||
: x?.evo_id_elt,
|
||||
isFetching: false,
|
||||
key: x?.value,
|
||||
message: null,
|
||||
name: x?.label,
|
||||
numCalc: 0,
|
||||
requestId: '',
|
||||
skCalcId: '',
|
||||
status: null,
|
||||
sum: 0,
|
||||
totalFranchise: 0,
|
||||
})) || []) as Row[],
|
||||
@ -55,13 +55,13 @@ export default function helper({ apolloClient, store }: ProcessContext) {
|
||||
?.filter((x) => x?.evo_type_ins_policy?.includes(100_000_001) && x?.evo_id_elt_osago)
|
||||
.map((x) => ({
|
||||
id: x?.evo_id_elt_osago,
|
||||
isFetching: false,
|
||||
key: x?.value,
|
||||
message: null,
|
||||
name: x?.label,
|
||||
numCalc: 0,
|
||||
requestId: '',
|
||||
skCalcId: '',
|
||||
status: null,
|
||||
sum: 0,
|
||||
totalFranchise: 0,
|
||||
})) || []) as Row[],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user