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.
dashboard/src/charts/OrdersTempTable.js

101 lines
3.1 KiB
JavaScript

3 years ago
import React, {Component} from 'react';
import {Table, Button, Space, Tooltip} from 'antd';
3 years ago
import {Line} from '@ant-design/charts';
import SiteSelect from './SiteSelect';
import {SearchOutlined} from '@ant-design/icons';
import * as config from '../config' ;
import {stores_Context} from "../config";
import DatePickerCharts from "./DatePickerCharts";
import {observer} from "mobx-react";
3 years ago
class OrdersTempTable extends Component {
static contextType = stores_Context;
3 years ago
constructor(props) {
super(props);
}
// componentDidMount() {
// }
3 years ago
render() {
const {dashboard_store} = this.context;
const ordersTemp_data = dashboard_store.ordersTemp_data;
3 years ago
const columns = [
{
title: '订单号',
dataIndex: 'COLI_ID',
key: 'COLI_ID',
},
{
title: '网站',
dataIndex: 'COLI_WebCode',
key: 'COLI_WebCode',
},
{
title: 'IP',
dataIndex: 'COLI_SenderIP',
key: 'COLI_SenderIP',
},
{
title: '预定时间',
dataIndex: 'COLI_ApplyDate',
key: 'COLI_ApplyDate',
},
{
title: '订单内容',
dataIndex: 'COLI_OrderDetailText',
key: 'COLI_OrderDetailText',
ellipsis: true,
},
Table.EXPAND_COLUMN,
];
const line = {
data: [],
padding: 'auto',
xField: 'order_date',
yField: 'order_count',
seriesField: 'order_sitecode',
xAxis: {
type: 'timeCat',
},
};
3 years ago
return (
3 years ago
<div>
<h2>临时订单数量</h2>
<SiteSelect store={ordersTemp_data}/>
<Space><DatePickerCharts hide_vs={true}/>
<Button type="primary" icon={<SearchOutlined/>} loading={ordersTemp_data.loading}
onClick={() => {
ordersTemp_data.asyncFetch();
}}>统计</Button>
<Button type="primary" icon={<SearchOutlined/>} loading={ordersTemp_data.loading_detail}
onClick={() => {
ordersTemp_data.asyncFetch_detail();
}}>查看详情</Button>
3 years ago
</Space>
{ordersTemp_data.show_table ? (
<Table dataSource={ordersTemp_data.data_detail} columns={columns} size="small"
rowKey={record => record.COLI_ID}
expandable={{
expandedRowRender: (record) => (
<pre>{record.COLI_OrderDetailText}</pre>
),
}}/>
3 years ago
) : (
<Line {...line} data={ordersTemp_data.data}/>
3 years ago
)}
</div>
)
3 years ago
}
}
export default observer(OrdersTempTable);