todo: trade data

feature/2.0-sales-trade
Lei OT 2 years ago
parent 4d1e2a2c16
commit 2feca18720

@ -25,22 +25,37 @@
"key": "@increment"
}
},
"get|/service-web/QueryData/GetYJ": {
"get|/service-web/QueryData/GetTradeByMonth": {
"errcode": 0,
"errmsg": "",
"data": null,
"loading": false,
"result1|10": [
"data|24": [
{
"biz_side|1": ["inside", "outside"],
"SumML|999-9999": 27018,
"SumMLKPIrate": "@float(0,70,2,2)",
"COLI_Department": "1,2,28,7",
"month": "@date('MM')",
"key": "@increment"
}
],
"inside|12": [
{
"AvgML|999-9999": 27018,
"SumML|999-9999": 27018,
"SumMLKPIrate": "@float(0,70,2,2)",
"COLI_Department": "1,2,28,7",
"OPI_SN": "@id",
"OPI_Name": "@cname",
"COLI_YJLY|999-99999": 215493,
"groups": "2023-05-01~2023-05-31",
"month|+1": -11,
"key": "@increment"
}
],
"result2": []
"outside|12": [
{
"SumML|999-9999": 27018,
"SumMLKPIrate": "@float(0,70,2,2)",
"COLI_Department": "1,2,28,7",
"month|+1": -11,
"key": "@increment"
}
]
}
}

@ -26,19 +26,24 @@ class Trade {
});
}
fetchTradeData() {
this.yearlyData.loading = true;
req.fetchJSON('/service-web/QueryData/GetYJ').then((json) => {
fetchTradeDataByMonth() {
this.sideData.loading = true;
req.fetchJSON('/service-web/QueryData/GetTradeByMonth').then((json) => {
if (json.errcode === 0) {
runInAction(() => {
this.yearlyData = { loading: false, ...json };
const _sideData = json.data.reduce((r, v) => {
(r[v.biz_side] || (r[v.biz_side] = [])).push(v);
return r;
}, {});
console.log(_sideData);
this.sideData = { loading: false, ...json };
});
}
});
}
summaryData = { loading: false };
yearlyData = { loading: false };
sideData = { loading: false };
}
export default Trade;

@ -4,20 +4,20 @@ import { Row, Col, Spin, Card, Statistic, Progress } from 'antd';
import { stores_Context } from '../config';
import { useNavigate } from 'react-router-dom';
import { SlackOutlined, SketchOutlined, AntCloudOutlined, RedditOutlined, GithubOutlined, ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons';
import { isEmpty } from './../utils/commons';
import { empty } from './../utils/commons';
import './home.css';
const Home = () => {
const navigate = useNavigate();
const { TradeStore } = useContext(stores_Context);
const { yearlyData, summaryData } = TradeStore;
const { sideData, summaryData } = TradeStore;
useEffect(() => {
if (isEmpty(summaryData?.result1)) {
if (empty(summaryData?.errcode)) {
TradeStore.fetchSummaryData();
}
if (isEmpty(yearlyData?.result1)) {
TradeStore.fetchTradeData();
if (empty(sideData?.errcode)) {
TradeStore.fetchTradeDataByMonth();
}
return () => {};
}, []);
@ -67,8 +67,10 @@ const Home = () => {
</Row>
</Spin>
</section>
<h3>市场进度</h3>
<section>
<Spin spinning={yearlyData.loading}></Spin>
<Spin spinning={sideData.loading}></Spin>
</section>
</>
);

Loading…
Cancel
Save