import { formatByDecimalPlaces, getFormattedValue } from '../../../utils/utils'; import { Table as AntTable } from 'antd'; import { MsgDataType } from '../../../common/type'; import { CLS_PREFIX } from '../../../common/constants'; import ApplyAuth from '../ApplyAuth'; type Props = { data: MsgDataType; onApplyAuth?: (domain: string) => void; }; const Table: React.FC = ({ data, onApplyAuth }) => { const { entityInfo, queryColumns, queryResults } = data; const prefixCls = `${CLS_PREFIX}-table`; const tableColumns: any[] = queryColumns.map( ({ name, nameEn, showType, dataFormatType, dataFormat, authorized }) => { return { dataIndex: nameEn, key: nameEn, title: name, render: (value: string | number) => { if (!authorized) { return ( ); } if (dataFormatType === 'percent') { return (
{`${formatByDecimalPlaces( dataFormat?.needmultiply100 ? +value * 100 : value, dataFormat?.decimalPlaces || 2 )}%`}
); } if (showType === 'NUMBER') { return (
{getFormattedValue(value as number)}
); } if (nameEn.includes('photo')) { return (
); } return value; }, }; } ); return (
); }; export default Table;