parent
b43fde239c
commit
e34a77c815
@ -1,55 +0,0 @@
|
||||
import { STATUS_LABEL_MAPPER } from "../../config";
|
||||
|
||||
export const columns = [
|
||||
{
|
||||
title: "Адрес",
|
||||
dataIndex: "address",
|
||||
key: "address",
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: "Район",
|
||||
dataIndex: "area",
|
||||
key: "area",
|
||||
width: "120px",
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: "Округ",
|
||||
dataIndex: "district",
|
||||
key: "district",
|
||||
width: "120px",
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: "Название",
|
||||
dataIndex: "name",
|
||||
key: "name",
|
||||
width: "120px",
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: "Категория",
|
||||
dataIndex: "category",
|
||||
key: "category",
|
||||
width: "120px",
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: "Статус",
|
||||
dataIndex: "status",
|
||||
key: "status",
|
||||
width: "120px",
|
||||
ellipsis: true,
|
||||
render: (_, record) => {
|
||||
return STATUS_LABEL_MAPPER[record.status];
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Прогнозный трафик",
|
||||
dataIndex: "prediction_current",
|
||||
key: "prediction_current",
|
||||
width: "120px",
|
||||
ellipsis: true,
|
||||
},
|
||||
];
|
||||
@ -0,0 +1,71 @@
|
||||
import { STATUS_LABEL_MAPPER } from "../../config";
|
||||
import { useMemo } from "react";
|
||||
import { useGetRegions } from "../../components/RegionSelect.jsx";
|
||||
import { getRegionNameById } from "../../Map/Popup/mode-popup/config.js";
|
||||
|
||||
export const useColumns = (fields = []) => {
|
||||
const { data: regions } = useGetRegions();
|
||||
|
||||
return useMemo(() => {
|
||||
return [
|
||||
{
|
||||
title: "Адрес",
|
||||
dataIndex: "address",
|
||||
key: "address",
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: "Район",
|
||||
dataIndex: "area",
|
||||
key: "area",
|
||||
width: "120px",
|
||||
ellipsis: true,
|
||||
render: (_, record) => {
|
||||
return getRegionNameById(record.area, regions?.normalized);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Округ",
|
||||
dataIndex: "district",
|
||||
key: "district",
|
||||
width: "120px",
|
||||
ellipsis: true,
|
||||
render: (_, record) => {
|
||||
return getRegionNameById(record.district, regions?.normalized);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Название",
|
||||
dataIndex: "name",
|
||||
key: "name",
|
||||
width: "120px",
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: "Категория",
|
||||
dataIndex: "category",
|
||||
key: "category",
|
||||
width: "120px",
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: "Статус",
|
||||
dataIndex: "status",
|
||||
key: "status",
|
||||
width: "120px",
|
||||
ellipsis: true,
|
||||
render: (_, record) => {
|
||||
return STATUS_LABEL_MAPPER[record.status];
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Прогнозный трафик",
|
||||
dataIndex: "prediction_current",
|
||||
key: "prediction_current",
|
||||
width: "120px",
|
||||
ellipsis: true,
|
||||
},
|
||||
...fields,
|
||||
];
|
||||
}, [regions?.normalized, fields]);
|
||||
};
|
||||
Loading…
Reference in new issue