todo: trade data

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

@ -25,22 +25,37 @@
"key": "@increment" "key": "@increment"
} }
}, },
"get|/service-web/QueryData/GetYJ": { "get|/service-web/QueryData/GetTradeByMonth": {
"errcode": 0, "errcode": 0,
"errmsg": "", "errmsg": "",
"data": null,
"loading": false, "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", "COLI_Department": "1,2,28,7",
"OPI_SN": "@id", "month|+1": -11,
"OPI_Name": "@cname",
"COLI_YJLY|999-99999": 215493,
"groups": "2023-05-01~2023-05-31",
"key": "@increment" "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() { fetchTradeDataByMonth() {
this.yearlyData.loading = true; this.sideData.loading = true;
req.fetchJSON('/service-web/QueryData/GetYJ').then((json) => { req.fetchJSON('/service-web/QueryData/GetTradeByMonth').then((json) => {
if (json.errcode === 0) { if (json.errcode === 0) {
runInAction(() => { 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 }; summaryData = { loading: false };
yearlyData = { loading: false }; sideData = { loading: false };
} }
export default Trade; export default Trade;

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

Loading…
Cancel
Save