From c9c7638cf807f845e52e27cc030fb4949fab73d6 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 16 Nov 2023 10:23:37 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E7=BB=9F=E8=AE=A1=E5=88=86=E5=B8=83:?= =?UTF-8?q?=20=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Data.jsx | 2 +- src/views/Distribution.jsx | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/Data.jsx b/src/components/Data.jsx index 35106ff..5d1904d 100644 --- a/src/components/Data.jsx +++ b/src/components/Data.jsx @@ -35,7 +35,7 @@ export const TableExportBtn = (props) => { const output_name = `${props.label}`; const [columnsMap, setColumnsMap] = useState([]); useEffect(() => { - const flatCols = props.columns.flatMap((v, k) => (v.children ? v.children.map((vc) => ({ ...vc, title: `${v.title}-${vc.title || ''}` })) : v)).filter(c => c.title); + const flatCols = props.columns.flatMap((v, k) => (v.children ? v.children.map((vc) => ({ ...vc, title: `${v?.titleX || v.title}-${vc.title || ''}` })) : v)).filter(c => c.title); // console.log('flatCols', flatCols); setColumnsMap(flatCols); diff --git a/src/views/Distribution.jsx b/src/views/Distribution.jsx index 44dddc6..84d7ec3 100644 --- a/src/views/Distribution.jsx +++ b/src/views/Distribution.jsx @@ -1,12 +1,12 @@ import { useContext, useEffect } from 'react'; import { observer } from 'mobx-react'; import { stores_Context } from '../config'; -import { Row, Col, Spin, Tabs, Table, Space, Typography } from 'antd'; +import { Row, Col, Spin, Tabs, Table, Space, Typography, Divider } from 'antd'; import { RingProgress } from '@ant-design/plots'; import SearchForm from './../components/search/SearchForm'; import { empty } from '../utils/commons'; import { dataFieldAlias } from '../libs/ht'; -import { VSTag } from './../components/Data'; +import { VSTag, TableExportBtn } from './../components/Data'; import MixYnQ from './../components/MixYnQ'; import './kpi.css'; @@ -73,7 +73,7 @@ export default observer(() => { innerRadius: 0.90, }; const columns = [ - { title: '', dataIndex: 'label' }, + { title: '#', dataIndex: 'label' }, { title: '团数', dataIndex: 'ConfirmOrder', @@ -132,36 +132,38 @@ export default observer(() => { }, { title: () => <>
去年同期
{dateStringY}
, + titleX: ['去年同期', dateStringY], // 给导出按钮用 align: 'center', children: [ { title: '团数占比', width: 90, - dataIndex: 'ConfirmOrderPercent', + dataIndex: ['resultToY', 'ConfirmOrderPercent'], // 'ConfirmOrderPercent', render: (v, r) => r.resultToY.ConfirmOrderPercent ? : '-', }, { title: '业绩占比', width: 90, - dataIndex: 'SumMLPercent', + dataIndex: ['resultToY', 'SumMLPercent'], // 'SumMLPercent', render: (v, r) => r.resultToY.SumMLPercent ? : '-', }, ], }, { title: () => <>
上个时间段
{dateStringQ}
, + titleX: ['上个时间段', dateStringY], // 给导出按钮用 align: 'center', children: [ { title: '团数占比', width: 90, - dataIndex: 'ConfirmOrderPercent', + dataIndex: ['resultToQ', 'ConfirmOrderPercent'], // 'ConfirmOrderPercent', render: (v, r) => r.resultToQ.ConfirmOrderPercent ? : '-', }, { title: '业绩占比', width: 90, - dataIndex: 'SumMLPercent', + dataIndex: ['resultToQ', 'SumMLPercent'], // 'SumMLPercent', render: (v, r) => r.resultToQ.SumMLPercent ? : '-', }, ], @@ -205,6 +207,9 @@ export default observer(() => { children: ( + + +