You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.2 KiB
React
84 lines
2.2 KiB
React
2 years ago
|
import React, { Component } from 'react';
|
||
|
import { Row, Col, Button, Tabs, Table, Space } from 'antd';
|
||
3 years ago
|
import {
|
||
2 years ago
|
ContainerOutlined,
|
||
|
CarryOutOutlined,
|
||
|
SmileOutlined,
|
||
|
TagsOutlined,
|
||
|
GlobalOutlined,
|
||
|
SearchOutlined,
|
||
3 years ago
|
} from '@ant-design/icons';
|
||
2 years ago
|
import { stores_Context } from '../config';
|
||
|
import { Line } from '@ant-design/charts';
|
||
|
import SiteSelect from './SiteSelect';
|
||
|
import { observer } from 'mobx-react';
|
||
|
import DatePickerCharts from './DatePickerCharts';
|
||
3 years ago
|
|
||
|
class Orders extends Component {
|
||
2 years ago
|
static contextType = stores_Context;
|
||
3 years ago
|
|
||
2 years ago
|
constructor(props) {
|
||
|
super(props);
|
||
|
}
|
||
3 years ago
|
|
||
2 years ago
|
// componentDidMount() {
|
||
|
// const {orders_store} = this.context;
|
||
|
// orders_store.getOrderCount();
|
||
|
// orders_store.onChange_Tabs(orders_store.active_tab_key);
|
||
|
// }
|
||
3 years ago
|
|
||
2 years ago
|
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) : ''; // 计算总数
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
};
|
||
3 years ago
|
|
||
2 years ago
|
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>
|
||
|
);
|
||
|
}
|
||
3 years ago
|
}
|
||
|
|
||
|
export default observer(Orders);
|