import React, { useContext } from 'react'; import { Row, Col, Table, Select, Space, Typography, Progress, Spin } from 'antd'; import { stores_Context } from '../config'; import { observer } from 'mobx-react'; import * as comm from '../utils/commons'; import SearchForm from './../components/search/SearchForm'; import { dataFieldAlias } from '../libs/ht'; import Donut from './../components/Donut'; import LineWithKPI from '../components/LineWithKPI'; const { Text } = Typography; const Sale_KPI = () => { const { sale_store, date_picker_store: searchFormStore } = useContext(stores_Context); const { formValues } = searchFormStore; 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 = async (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 { title: `${index + 1}月`, dataIndex: `M${index + 1}Percent`, valueType: 'digit', width: '7.5em', render: (_, row) => ( {/* 目标 */}
{dataFieldAlias.SumML.formatter(row.mData[`month_${String(index + 1).padStart(2, '0')}`]?.MLKPIvalue || 0)}
{/* 完成 */}
{dataFieldAlias.SumML.formatter(row.mData[`month_${String(index + 1).padStart(2, '0')}`]?.SumML || 0)}
{row.mData[`month_${String(index + 1).padStart(2, '0')}`]?.MLKPIrates || 0 ? ( `${row.mData[`month_${String(index + 1).padStart(2, '0')}`]?.MLKPIrates || 0}%`} status={ row.mData[`month_${String(index + 1).padStart(2, '0')}`].MLKPIrates < 80 ? 'exception' : row.mData[`month_${String(index + 1).padStart(2, '0')}`].MLKPIrates < 100 ? 'normal' : 'success' } /> ) : ( '-' )}
), }; }); const columns = [ { title: ``, dataIndex: 'groupsLabel', editable: false, width: '7.5em', fixed: 'left', }, { title: '年度', dataIndex: 'yearValue', width: '10em', fixed: 'left', render: (_, row) => (
目标 {dataFieldAlias.SumML.formatter(row.yData?.MLKPIvalue || 0)}
完成 {dataFieldAlias.SumML.formatter(row.yData?.SumML || 0)}
{row.yData?.MLKPIrates || 0 ? ( `${row.yData?.MLKPIrates || 0}%`} status={row.yData.MLKPIrates < 80 ? 'exception' : row.yData.MLKPIrates < 100 ? 'normal' : 'success'} /> ) : ( '-' )}
), }, ...monthCol, ]; const lineConfig = { appendPadding: 10, xField: 'groupDateVal', yField: 'SumML', seriesField: 'groupsLabel', isGroup: true, smooth: true, meta: comm.cloneDeep(dataFieldAlias), }; return (
{ pageRefresh(obj); }} />

年度业绩组成和走势

({ ...row, SumML: row.yearML }))} />

顾问业绩走势

); }; export default observer(Sale_KPI);