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 { 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 MixYnQ from './../components/MixYnQ'; import './kpi.css'; const { Text } = Typography; const apartOptions = [ { key: 'tourDays', value: 'tourDays', label: '团天数' }, { key: 'PML', value: 'PML', label: '单团毛利' }, { key: 'ConfirmDays', value: 'ConfirmDays', label: '成团周期' }, { key: 'ApplyDays', value: 'ApplyDays', label: '预定周期' }, { key: 'PersonNum', value: 'PersonNum', label: '人等' }, { key: 'destination', value: 'destination', label: '国内目的地' }, { key: 'GlobalDestination', value: 'GlobalDestination', label: '海外目的地' }, { key: 'destinationCountry', value: 'destinationCountry', label: '目的地国籍' }, { key: 'guestCountry', value: 'guestCountry', label: '客人国籍' }, ]; export default observer(() => { const { date_picker_store: searchFormStore, DistributionStore } = useContext(stores_Context); const { formValues, formValuesToSub } = searchFormStore; const { curTab, dateStringQ, dateStringY } = DistributionStore; const pageRefresh = (obj) => { DistributionStore.getApartData({ ...(obj || formValuesToSub), }); }; useEffect(() => { if (empty(DistributionStore[curTab].dataSource)) { pageRefresh(); } }, [curTab]); useEffect(() => { DistributionStore.setFormDates(formValuesToSub); DistributionStore.resetData(); return () => {}; }, [formValuesToSub]); const onTabsChange = (tab) => { DistributionStore.setCurTab(tab); }; const RingProgressConfig = { height: 60, width: 60, autoFit: false, color: ['#5B8FF9', '#E8EDF3'], }; const RingProgressConfigY = { height: 50, width: 50, autoFit: false, // color: ['#f6bd16', '#E8EDF3'], color: ['#61ddaa', '#E8EDF3'], // #7cb305 innerRadius: 0.90, }; const RingProgressConfigQ = { height: 50, width: 50, autoFit: false, color: ['#f6bd16', '#E8EDF3'], innerRadius: 0.90, }; const columns = [ { title: '', dataIndex: 'label' }, { title: '团数', dataIndex: 'ConfirmOrder', render: (v, r) => ( <> {v} 同比: 环比: ), }, { title: '业绩', dataIndex: 'SumML', render: (v, r) => ( <> {dataFieldAlias.SumML.formatter(v)} 同比: 环比: ), }, { title: '团数占比', dataIndex: 'ConfirmOrderPercent', render: (v, r) => v ? : '-', }, { title: '业绩占比', dataIndex: 'SumMLPercent', render: (v, r) => v ? : '-', }, { title: () => <>
去年同期
{dateStringY}
, align: 'center', children: [ { title: '团数占比', width: 90, dataIndex: 'ConfirmOrderPercent', render: (v, r) => r.resultToY.ConfirmOrderPercent ? : '-', }, { title: '业绩占比', width: 90, dataIndex: 'SumMLPercent', render: (v, r) => r.resultToY.SumMLPercent ? : '-', }, ], }, { title: () => <>
上个时间段
{dateStringQ}
, align: 'center', children: [ { title: '团数占比', width: 90, dataIndex: 'ConfirmOrderPercent', render: (v, r) => r.resultToQ.ConfirmOrderPercent ? : '-', }, { title: '业绩占比', width: 90, dataIndex: 'SumMLPercent', render: (v, r) => r.resultToQ.SumMLPercent ? : '-', }, ], }, ]; const chartsConfig = { xField: 'label', yFields: ['ConfirmOrder','SumML'], seriesField: null, }; return ( <> { pageRefresh(obj); }} />
{ return { ...ele, children: ( record.label} loading={DistributionStore[curTab].loading} pagination={false} scroll={{ x: '100%' }} /> ), }; })} /> ); });