|
|
@ -1,29 +1,24 @@
|
|
|
|
import React, { useContext, useEffect, useState } from 'react';
|
|
|
|
import React, { useContext } from 'react';
|
|
|
|
import { Row, Col, Button, Tabs, Table, Divider, Radio, Select, Space, Typography, Progress, Spin } from 'antd';
|
|
|
|
import { Row, Col, Table, Select, Space, Typography, Progress, Spin } from 'antd';
|
|
|
|
import { ContainerOutlined, SearchOutlined, UserSwitchOutlined } from '@ant-design/icons';
|
|
|
|
|
|
|
|
import { stores_Context } from '../config';
|
|
|
|
import { stores_Context } from '../config';
|
|
|
|
import { observer } from 'mobx-react';
|
|
|
|
import { observer } from 'mobx-react';
|
|
|
|
import { NavLink, useParams } from 'react-router-dom';
|
|
|
|
|
|
|
|
import * as comm from '../utils/commons';
|
|
|
|
import * as comm from '../utils/commons';
|
|
|
|
import * as config from '../config';
|
|
|
|
|
|
|
|
import { utils, writeFileXLSX } from 'xlsx';
|
|
|
|
|
|
|
|
import SearchForm from './../components/search/SearchForm';
|
|
|
|
import SearchForm from './../components/search/SearchForm';
|
|
|
|
import { dataFieldAlias } from '../libs/ht';
|
|
|
|
import { dataFieldAlias } from '../libs/ht';
|
|
|
|
import Donut from './../components/Donut';
|
|
|
|
import Donut from './../components/Donut';
|
|
|
|
import LineWithKPI from '../components/LineWithKPI';
|
|
|
|
import LineWithKPI from '../components/LineWithKPI';
|
|
|
|
import { Line, DualAxes } from '@ant-design/plots';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { Text } = Typography;
|
|
|
|
const { Text } = Typography;
|
|
|
|
|
|
|
|
|
|
|
|
const Sale_KPI = () => {
|
|
|
|
const Sale_KPI = () => {
|
|
|
|
const { sale_store, date_picker_store: searchFormStore } = useContext(stores_Context);
|
|
|
|
const { sale_store, date_picker_store: searchFormStore } = useContext(stores_Context);
|
|
|
|
const { formValues } = searchFormStore;
|
|
|
|
const { formValues } = searchFormStore;
|
|
|
|
const { groupType, loading, operator } = sale_store.salesTrade;
|
|
|
|
const { groupType, loading, operator, } = sale_store.salesTrade;
|
|
|
|
|
|
|
|
|
|
|
|
const dataSource = [].concat(sale_store.salesTrade[groupType], operator);
|
|
|
|
const dataSource = [].concat(sale_store.salesTrade[groupType], operator);
|
|
|
|
const yearData = Object.values(sale_store.salesTrade[groupType]?.[0]?.mData || {});
|
|
|
|
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 operatorObjects = operator.map((v) => ({ key: v.groupsKey, value: v.groupsKey, label: v.groupsLabel }));
|
|
|
|
const pageRefresh = (queryData) => {
|
|
|
|
const pageRefresh = async (queryData) => {
|
|
|
|
const overviewFlag = queryData.DepartmentList.toLowerCase() === 'all' || queryData.DepartmentList.toLowerCase().includes(',');
|
|
|
|
const overviewFlag = queryData.DepartmentList.toLowerCase() === 'all' || queryData.DepartmentList.toLowerCase().includes(',');
|
|
|
|
const _groupType = overviewFlag ? 'overview' : 'dept';
|
|
|
|
const _groupType = overviewFlag ? 'overview' : 'dept';
|
|
|
|
sale_store.setGroupType(_groupType);
|
|
|
|
sale_store.setGroupType(_groupType);
|
|
|
@ -39,11 +34,13 @@ const Sale_KPI = () => {
|
|
|
|
width: '7.5em',
|
|
|
|
width: '7.5em',
|
|
|
|
render: (_, row) => (
|
|
|
|
render: (_, row) => (
|
|
|
|
<Space direction={'vertical'}>
|
|
|
|
<Space direction={'vertical'}>
|
|
|
|
|
|
|
|
{/* 目标 */}
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<Text italic type={'secondary'}>
|
|
|
|
<Text italic type={'secondary'}>
|
|
|
|
{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')}`]?.MLKPIvalue || 0)}
|
|
|
|
</Text>
|
|
|
|
</Text>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{/* 完成 */}
|
|
|
|
<div>{dataFieldAlias.SumML.formatter(row.mData[`month_${String(index + 1).padStart(2, '0')}`]?.SumML || 0)}</div>
|
|
|
|
<div>{dataFieldAlias.SumML.formatter(row.mData[`month_${String(index + 1).padStart(2, '0')}`]?.SumML || 0)}</div>
|
|
|
|
{row.mData[`month_${String(index + 1).padStart(2, '0')}`]?.MLKPIrates || 0 ? (
|
|
|
|
{row.mData[`month_${String(index + 1).padStart(2, '0')}`]?.MLKPIrates || 0 ? (
|
|
|
|
<Progress
|
|
|
|
<Progress
|
|
|
|