|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import React, { useContext, useEffect, useState } from 'react';
|
|
|
|
|
import { Row, Col, Button, Tabs, Table, Divider, Radio, Select, Space, Typography, Progress } from 'antd';
|
|
|
|
|
import { Row, Col, Button, Tabs, Table, Divider, Radio, Select, Space, Typography, Progress, Spin } from 'antd';
|
|
|
|
|
import { ContainerOutlined, SearchOutlined, UserSwitchOutlined } from '@ant-design/icons';
|
|
|
|
|
import { stores_Context } from '../config';
|
|
|
|
|
import { observer } from 'mobx-react';
|
|
|
|
@ -9,6 +9,9 @@ import * as config from '../config';
|
|
|
|
|
import { utils, writeFileXLSX } from 'xlsx';
|
|
|
|
|
import SearchForm from './../components/search/SearchForm';
|
|
|
|
|
import { dataFieldAlias } from '../libs/ht';
|
|
|
|
|
import Donut from './../components/Donut';
|
|
|
|
|
import LineWithKPI from '../components/LineWithKPI';
|
|
|
|
|
import { Line, DualAxes } from '@ant-design/plots';
|
|
|
|
|
|
|
|
|
|
const { Text } = Typography;
|
|
|
|
|
|
|
|
|
@ -18,13 +21,15 @@ const Sale_KPI = () => {
|
|
|
|
|
const { groupType, loading, operator } = sale_store.salesTrade;
|
|
|
|
|
|
|
|
|
|
const dataSource = [].concat(sale_store.salesTrade[groupType], operator);
|
|
|
|
|
|
|
|
|
|
const yearData = Object.values(sale_store.salesTrade[groupType]?.[0]?.mData || {});
|
|
|
|
|
const operatorObjects = operator.map((v) => ({ key: v.groupsKey, value: v.groupsKey, label: v.groupsLabel }));
|
|
|
|
|
const pageRefresh = (queryData) => {
|
|
|
|
|
const overviewFlag = queryData.DepartmentList.toLowerCase() === 'all' || queryData.DepartmentList.toLowerCase().includes(',');
|
|
|
|
|
const _groupType = overviewFlag ? 'overview' : 'dept';
|
|
|
|
|
sale_store.setGroupType(_groupType);
|
|
|
|
|
sale_store.fetchOperatorTradeData(_groupType, { ...queryData, groupDateType: 'year' });
|
|
|
|
|
sale_store.fetchOperatorTradeData('operator', { ...queryData, groupDateType: 'year' });
|
|
|
|
|
sale_store.setPickSales([]);
|
|
|
|
|
};
|
|
|
|
|
const monthCol = new Array(12).fill(1).map((_, index) => {
|
|
|
|
|
return {
|
|
|
|
@ -98,6 +103,7 @@ const Sale_KPI = () => {
|
|
|
|
|
},
|
|
|
|
|
...monthCol,
|
|
|
|
|
];
|
|
|
|
|
const lineConfig = { appendPadding: 10, xField: 'groupDateVal', yField: 'SumML', seriesField: 'groupsLabel', isGroup: true, smooth: true, meta: comm.cloneDeep(dataFieldAlias), };
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<Row gutter={16} style={{ margin: '-16px -8px' }}>
|
|
|
|
@ -120,22 +126,63 @@ const Sale_KPI = () => {
|
|
|
|
|
/>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
<Spin spinning={loading}>
|
|
|
|
|
<h2 style={{ marginTop: '.5em' }}>年度业绩组成和走势</h2>
|
|
|
|
|
<Row>
|
|
|
|
|
<Col className="gutter-row" md={8}>
|
|
|
|
|
<Donut
|
|
|
|
|
{...{ angleField: 'SumML', colorField: 'groupsLabel', label1: { style: { color: '#000000' }, type: 'spider', content: '{name}\n{percentage}' }, legend: false, label2: false }}
|
|
|
|
|
title={formValues.DepartmentList?.label}
|
|
|
|
|
dataSource={operator.map((row) => ({ ...row, SumML: row.yearML }))}
|
|
|
|
|
/>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col className="gutter-row" md={16}>
|
|
|
|
|
<LineWithKPI dataSource={yearData} {...lineConfig} {...{legend: false}} />
|
|
|
|
|
</Col>
|
|
|
|
|
<Col className="gutter-row" md={24}>
|
|
|
|
|
<Space gutter={16} size={'large'}>
|
|
|
|
|
<h2>顾问业绩走势</h2>
|
|
|
|
|
<Select
|
|
|
|
|
labelInValue
|
|
|
|
|
mode={'multiple'}
|
|
|
|
|
style={{ width: '400px' }}
|
|
|
|
|
placeholder={'选择顾问'}
|
|
|
|
|
onChange={sale_store.setPickSales}
|
|
|
|
|
value={sale_store.salesTrade.pickSales}
|
|
|
|
|
maxTagCount={1}
|
|
|
|
|
maxTagPlaceholder={(omittedValues) => ` + ${omittedValues.length} 更多...`}
|
|
|
|
|
allowClear={true}
|
|
|
|
|
>
|
|
|
|
|
{operatorObjects.map((ele) => (
|
|
|
|
|
<Select.Option key={ele.key} value={ele.value}>
|
|
|
|
|
{ele.label}
|
|
|
|
|
</Select.Option>
|
|
|
|
|
))}
|
|
|
|
|
</Select>
|
|
|
|
|
</Space>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col className="gutter-row" md={24}>
|
|
|
|
|
<LineWithKPI dataSource={sale_store.salesTrade.pickSalesData} {...lineConfig} />
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
|
|
<Row>
|
|
|
|
|
<Col className="gutter-row" md={24}>
|
|
|
|
|
<Table
|
|
|
|
|
key={`salesTradeTable`}
|
|
|
|
|
loading={loading}
|
|
|
|
|
columns={columns}
|
|
|
|
|
rowKey="groupsKey"
|
|
|
|
|
scroll={{
|
|
|
|
|
x: 1000,
|
|
|
|
|
}}
|
|
|
|
|
dataSource={dataSource}
|
|
|
|
|
pagination={false}
|
|
|
|
|
/>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
<Row>
|
|
|
|
|
<Col className="gutter-row" md={24}>
|
|
|
|
|
<Table
|
|
|
|
|
sticky
|
|
|
|
|
key={`salesTradeTable`}
|
|
|
|
|
loading={loading}
|
|
|
|
|
columns={columns}
|
|
|
|
|
rowKey="groupsKey"
|
|
|
|
|
scroll={{
|
|
|
|
|
x: 1000,
|
|
|
|
|
}}
|
|
|
|
|
dataSource={dataSource}
|
|
|
|
|
pagination={false}
|
|
|
|
|
/>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
</Spin>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|