feat: 年度业绩: 总数据卡片
parent
81269016a0
commit
06e266c9c6
@ -1,13 +1,19 @@
|
|||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
|
||||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
'Droid Sans', 'Helvetica Neue', sans-serif;
|
||||||
sans-serif;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
code {
|
code {
|
||||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
|
||||||
monospace;
|
}
|
||||||
|
section {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
main section {
|
||||||
|
margin-top: 1em;
|
||||||
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"get|/service-web/QueryData/GetTradeSummary": {
|
||||||
|
"errcode": 0,
|
||||||
|
"errmsg": "",
|
||||||
|
"data": null,
|
||||||
|
"loading": false,
|
||||||
|
"result1": {
|
||||||
|
"SumML|999-9999": 27018,
|
||||||
|
"SumMLrate|-20-100": 23,
|
||||||
|
"SumMLKPIrate|20-100": 23,
|
||||||
|
"SumOrder|999-999": 27018,
|
||||||
|
"SumOrderrate": "@float(-20,20,2,2)",
|
||||||
|
"SumOrderKPIrate|20-100": 25,
|
||||||
|
"SumPersonNum|999-999": 27018,
|
||||||
|
"SumPersonNumrate|-50-1": 33,
|
||||||
|
"SumPersonNumKPIrate|20-100": 33,
|
||||||
|
"groups": "2023-05-01~2023-05-31",
|
||||||
|
"key": "@increment"
|
||||||
|
},
|
||||||
|
"result2": {
|
||||||
|
"SumML|999-9999": 27018,
|
||||||
|
"SumOrder|999-999": 27018,
|
||||||
|
"SumPersonNum|999-999": 27018,
|
||||||
|
"groups": "2022-05-01~2023-05-31",
|
||||||
|
"key": "@increment"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"get|/service-web/QueryData/GetYJ": {
|
||||||
|
"errcode": 0,
|
||||||
|
"errmsg": "",
|
||||||
|
"data": null,
|
||||||
|
"loading": false,
|
||||||
|
"result1|10": [
|
||||||
|
{
|
||||||
|
"AvgML|999-9999": 27018,
|
||||||
|
"COLI_Department": "1,2,28,7",
|
||||||
|
"OPI_SN": "@id",
|
||||||
|
"OPI_Name": "@cname",
|
||||||
|
"COLI_YJLY|999-99999": 215493,
|
||||||
|
"groups": "2023-05-01~2023-05-31",
|
||||||
|
"key": "@increment"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"result2": []
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
import { makeAutoObservable, runInAction } from 'mobx';
|
||||||
|
import * as req from '../utils/request';
|
||||||
|
import { isEmpty } from '../utils/commons';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算变化值
|
||||||
|
*/
|
||||||
|
const calcRate = (r1, r2) => {
|
||||||
|
// 的
|
||||||
|
};
|
||||||
|
|
||||||
|
class Trade {
|
||||||
|
constructor(rootStore) {
|
||||||
|
this.rootStore = rootStore;
|
||||||
|
makeAutoObservable(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchSummaryData() {
|
||||||
|
this.summaryData.loading = true;
|
||||||
|
req.fetchJSON('/service-web/QueryData/GetTradeSummary').then((json) => {
|
||||||
|
if (json.errcode === 0) {
|
||||||
|
runInAction(() => {
|
||||||
|
this.summaryData = { loading: false, ...json };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchTradeData() {
|
||||||
|
this.yearlyData.loading = true;
|
||||||
|
req.fetchJSON('/service-web/QueryData/GetYJ').then((json) => {
|
||||||
|
if (json.errcode === 0) {
|
||||||
|
runInAction(() => {
|
||||||
|
this.yearlyData = { loading: false, ...json };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
summaryData = { loading: false };
|
||||||
|
yearlyData = { loading: false };
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Trade;
|
@ -1,31 +1,77 @@
|
|||||||
import React, {Component, useContext} from 'react';
|
import { useContext, useEffect } from 'react';
|
||||||
import {observer} from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import {Row, Col, Button, Tabs, Table} from 'antd';
|
import { Row, Col, Spin, Card, Statistic, Progress } from 'antd';
|
||||||
import {stores_Context} from '../config';
|
import { stores_Context } from '../config';
|
||||||
import {useNavigate} from "react-router-dom";
|
import { useNavigate } from 'react-router-dom';
|
||||||
import {
|
import { SlackOutlined, SketchOutlined, AntCloudOutlined, RedditOutlined, GithubOutlined, ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons';
|
||||||
SlackOutlined,
|
import { isEmpty } from './../utils/commons';
|
||||||
SketchOutlined,
|
import './home.css';
|
||||||
AntCloudOutlined,
|
|
||||||
RedditOutlined,
|
|
||||||
GithubOutlined
|
|
||||||
} from '@ant-design/icons';
|
|
||||||
|
|
||||||
const Home = () => {
|
const Home = () => {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const { TradeStore } = useContext(stores_Context);
|
||||||
|
const { yearlyData, summaryData } = TradeStore;
|
||||||
|
|
||||||
const navigate = useNavigate();
|
useEffect(() => {
|
||||||
const {auth_store} = useContext(stores_Context);
|
if (isEmpty(summaryData?.result1)) {
|
||||||
|
TradeStore.fetchSummaryData();
|
||||||
|
}
|
||||||
|
if (isEmpty(yearlyData?.result1)) {
|
||||||
|
TradeStore.fetchTradeData();
|
||||||
|
}
|
||||||
|
return () => {};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const StatisticCard = (props) => {
|
||||||
|
const valueStyle = { color: props.VSrate < 0 ? '#cf1322' : '#3f8600' };
|
||||||
|
const VSIcon = () => (props.VSrate < 0 ? <ArrowDownOutlined /> : <ArrowUpOutlined />);
|
||||||
return (
|
return (
|
||||||
<div>
|
<Card>
|
||||||
<SketchOutlined/> <AntCloudOutlined/> <SlackOutlined/> <RedditOutlined/> <GithubOutlined/>
|
<Statistic
|
||||||
<br/>
|
className={'__hn-sta-wrapper'}
|
||||||
这就是一个主页,什么也没写
|
valueStyle={valueStyle}
|
||||||
<br/>
|
suffix={
|
||||||
<SketchOutlined/> <AntCloudOutlined/> <SlackOutlined/> <RedditOutlined/> <GithubOutlined/>
|
props.VSrate && (
|
||||||
</div>
|
<>
|
||||||
|
<VSIcon />
|
||||||
|
<span>{props.VSrate}</span>
|
||||||
|
<span>%</span>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
{props.showProgress !== false && <Progress percent={props.KPIrate} size="small" format={(percent) => `${props.KPIrate}%`} />}
|
||||||
|
</Card>
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h2>年度业绩</h2>
|
||||||
|
<section>
|
||||||
|
<Spin spinning={summaryData.loading}>
|
||||||
|
<Row gutter={16}>
|
||||||
|
<Col span={6}>
|
||||||
|
<StatisticCard title="人数" value={summaryData?.result1?.SumPersonNum} VSrate={summaryData?.result1?.SumPersonNumrate} KPIrate={summaryData?.result1?.SumPersonNumKPIrate} />
|
||||||
|
</Col>
|
||||||
|
<Col span={6}>
|
||||||
|
<StatisticCard title="成团" value={summaryData?.result1?.SumOrder} VSrate={summaryData?.result1?.SumOrderrate} KPIrate={summaryData?.result1?.SumOrderKPIrate} />
|
||||||
|
</Col>
|
||||||
|
<Col span={6}>
|
||||||
|
<StatisticCard title="毛利" value={summaryData?.result1?.SumML} VSrate={summaryData?.result1?.SumMLrate} KPIrate={summaryData?.result1?.SumMLKPIrate} />
|
||||||
|
</Col>
|
||||||
|
<Col span={6}>
|
||||||
|
<StatisticCard title="完成率" value={`${summaryData?.result1?.SumMLKPIrate}%`} showProgress={false} />
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Spin>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<Spin spinning={yearlyData.loading}></Spin>
|
||||||
|
</section>
|
||||||
|
</>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default observer(Home);
|
export default observer(Home);
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
.__hn-sta-wrapper .ant-statistic-content-suffix{
|
||||||
|
float: right;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
Loading…
Reference in New Issue