统计所有站点订单,并计算总数
parent
12b8f250c0
commit
c7019a36db
@ -1 +1,5 @@
|
||||
@import '~antd/dist/antd.css';
|
||||
|
||||
.align_right{
|
||||
text-align: right;
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
import React, {Component} from 'react';
|
||||
import {Row, Col, Button, Tabs, Table, Space} from 'antd';
|
||||
import {
|
||||
ContainerOutlined, CarryOutOutlined,
|
||||
SmileOutlined, TagsOutlined, GlobalOutlined,
|
||||
SearchOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import {stores_Context} from '../config'
|
||||
import {Line} from "@ant-design/charts";
|
||||
import SiteSelect from "./SiteSelect";
|
||||
import {observer} from 'mobx-react';
|
||||
import DatePickerCharts from './DatePickerCharts'
|
||||
|
||||
class Orders extends Component {
|
||||
|
||||
static contextType = stores_Context;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
// componentDidMount() {
|
||||
// const {orders_store} = this.context;
|
||||
// orders_store.getOrderCount();
|
||||
// orders_store.onChange_Tabs(orders_store.active_tab_key);
|
||||
// }
|
||||
|
||||
render() {
|
||||
const {dashboard_store} = this.context;
|
||||
const orders_data = dashboard_store.orders_data;
|
||||
const line_config = {
|
||||
data: orders_data.data,
|
||||
padding: 'auto',
|
||||
xField: 'ApplyDate',
|
||||
yField: 'orderCount',
|
||||
seriesField: 'WebCode',
|
||||
xAxis: {
|
||||
type: 'timeCat',
|
||||
},
|
||||
smooth: true,
|
||||
legend: {
|
||||
position: 'right-top',
|
||||
title: {
|
||||
text: '网站合计 ' + orders_data.data.reduce((a, b) => a + b.orderCount, 0),
|
||||
},
|
||||
itemMarginBottom: 12,//垂直间距
|
||||
itemValue: {
|
||||
formatter: (text, item) => {
|
||||
const items = orders_data.data.filter((d) => d.WebCode === item.value);//按站点筛选
|
||||
return items.length ? items.reduce((a, b) => a + b.orderCount, 0) : '';//计算总数
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2>全网站订单数统计</h2>
|
||||
<div>
|
||||
<Space>
|
||||
<DatePickerCharts hide_vs={true}/>
|
||||
<Button type="primary" icon={<SearchOutlined/>} loading={orders_data.loading} onClick={() => {
|
||||
orders_data.getOrderCount_all();
|
||||
}}>统计</Button>
|
||||
</Space>
|
||||
</div>
|
||||
<br/>
|
||||
<Line {...line_config}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default observer(Orders);
|
Loading…
Reference in New Issue