From c7019a36db57354d8ac188cd8ac78ad756e73de0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Wed, 7 Sep 2022 17:20:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=89=80=E6=9C=89=E7=AB=99?= =?UTF-8?q?=E7=82=B9=E8=AE=A2=E5=8D=95=EF=BC=8C=E5=B9=B6=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E6=80=BB=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.css | 4 ++ src/App.js | 4 +- src/charts/MobileDeal.js | 4 +- src/charts/Orders.js | 74 +++++++++++++++++++++++++++++++++++ src/charts/OrdersTempTable.js | 21 +++++----- src/charts/SiteSelect.js | 2 +- src/stores/DashboardStore.js | 56 +++++++++++++++++++------- src/stores/OrdersStore.js | 8 ++-- src/views/Dashboard.js | 5 +++ src/views/Orders.js | 3 +- 10 files changed, 148 insertions(+), 33 deletions(-) create mode 100644 src/charts/Orders.js diff --git a/src/App.css b/src/App.css index b562508..cc332be 100644 --- a/src/App.css +++ b/src/App.css @@ -1 +1,5 @@ @import '~antd/dist/antd.css'; + +.align_right{ + text-align: right; +} \ No newline at end of file diff --git a/src/App.js b/src/App.js index d87dcd7..5471c47 100644 --- a/src/App.js +++ b/src/App.js @@ -11,10 +11,10 @@ import {BrowserRouter, Route, Routes, NavLink} from "react-router-dom" import Home from "./views/Home" import Dashboard from "./views/Dashboard" import Orders from "./views/Orders" +import Orders_index from "./charts/Orders" import Logo from './logo.png' - class App extends Component { constructor(props) { @@ -28,7 +28,7 @@ class App extends Component { const menu_items = [ {key: 1, label: 主页, icon: }, - {key: 2, label: 订单数据, icon: }, + {key: 2, label: 订单数据, icon: ,}, {key: 3, label: 仪表盘, icon: }, { key: 4, diff --git a/src/charts/MobileDeal.js b/src/charts/MobileDeal.js index edfcf60..47869a8 100644 --- a/src/charts/MobileDeal.js +++ b/src/charts/MobileDeal.js @@ -15,11 +15,11 @@ class MobileDeal extends Component { render() { const {dashboard_store} = this.context; - const mobile_data=dashboard_store.mobile_data; + const mobile_data = dashboard_store.mobile_data; return (

移动成交

- + diff --git a/src/charts/Orders.js b/src/charts/Orders.js new file mode 100644 index 0000000..8c6d32b --- /dev/null +++ b/src/charts/Orders.js @@ -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 ( +
+

全网站订单数统计

+
+ + + + +
+
+ +
+ ); + } +} + +export default observer(Orders); diff --git a/src/charts/OrdersTempTable.js b/src/charts/OrdersTempTable.js index c23dbc9..e80227f 100644 --- a/src/charts/OrdersTempTable.js +++ b/src/charts/OrdersTempTable.js @@ -22,28 +22,29 @@ class OrdersTempTable extends Component { // } - render() { const {dashboard_store} = this.context; - const ordersTemp_data=dashboard_store.ordersTemp_data; + const ordersTemp_data = dashboard_store.ordersTemp_data; return (

临时订单数量

- + - - + + {ordersTemp_data.show_table ? ( ) : ( - + )} ); diff --git a/src/charts/SiteSelect.js b/src/charts/SiteSelect.js index dd82578..34b0cdf 100644 --- a/src/charts/SiteSelect.js +++ b/src/charts/SiteSelect.js @@ -15,7 +15,7 @@ class SiteSelect extends Component {