显示平均线

显示周几
订单详情添加是否成行
feature/2.0-sales-trade
尹诚诚 3 years ago
parent b2fb6822a2
commit 22778bd78e

@ -24,9 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Hainatravel Dashboard</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>

@ -9,7 +9,7 @@ class AuthStore {
constructor(rootStore) {
this.rootStore = rootStore;
makeAutoObservable(this);
this.get_auth(); //放到钉钉环境才能开启
//this.get_auth(); //放到钉钉环境才能开启
}
auth = ['admin']; //开发时候用,正式环境留空

@ -8,7 +8,6 @@ import * as config from "../config";
import moment from "moment";
import {NavLink} from "react-router-dom";
class OrdersStore {
constructor(rootStore) {
@ -50,7 +49,10 @@ class OrdersStore {
})
}
if (data_source.ordercount2 && end_date) {
let diff_days = start_date.diff(end_date, 'days');
//不能直接用diff计算因为日期是含有时间的会导致计算差一天先转成格式化的日期再比较
let _start_date=moment(start_date.format(config.DATE_FORMAT));
let _end_date=moment(end_date.format(config.DATE_FORMAT));
let diff_days = _start_date.diff(_end_date, 'days');
for (let item of data_source.ordercount2) {
result.push({
'xField': moment(item.ApplyDate).add(diff_days, 'days').format(config.DATE_FORMAT),

@ -5,6 +5,7 @@ import {
CaretUpOutlined,
CaretDownOutlined
} from '@ant-design/icons';
import moment from "moment";
if (!String.prototype.padStart) {
String.prototype.padStart = function padStart(targetLength, padString) {
@ -197,21 +198,42 @@ export function clickUrl(url) {
httpLink.click();
}
export function show_vs_tag(vs,vs_diff, data1, data2) {
export function show_vs_tag(vs, vs_diff, data1, data2) {
let tag = '-';
if (parseInt(vs) < 0) {
tag = <Tag icon={<CaretDownOutlined/>} color="gold">{vs} {vs_diff}</Tag>
} else if (parseInt(vs) > 0) {
tag = <Tag icon={< CaretUpOutlined/>} color="lime">{vs} {vs_diff}</Tag>
} // else {
// return <span>{tag}</span>
// }
}// else {
// tag = <Tag icon={< CaretUpOutlined/>} color="lime">{vs} {vs_diff}</Tag>
// }
return <span><div>{data1} vs {data2}</div>
{tag}</span>
}
//数组去掉重复
export function unique(arr){
export function unique(arr) {
let x = new Set(arr);
return [...x];
}
}
export function getWeek (date) { // 参数时间戳
let week = moment(date).day();
switch (week) {
case 1:
return '周一'
case 2:
return '周二'
case 3:
return '周三'
case 4:
return '周四'
case 5:
return '周五'
case 6:
return '周六'
case 0:
return '周日'
}
}

@ -132,14 +132,6 @@ const Credit_card_bill = () => {
result.dataSource.push(...data.billdate1);
}
result.columns = [
{
title: '项目',
children: [{
title: '',
dataIndex: 'cb_bill',
}],
sorter: (a, b) => a.cb_bill.localeCompare(b.cb_bill),
},
{
title: '项目类型',
children: [{
@ -153,6 +145,14 @@ const Credit_card_bill = () => {
filteredValue: credit_card_data.filteredValue || null,
onFilter: (value, record) => record.cb_billtype.indexOf(value) === 0,
},
{
title: '项目',
children: [{
title: '',
dataIndex: 'cb_bill',
}],
sorter: (a, b) => a.cb_bill.localeCompare(b.cb_bill),
},
{
title: '美金',
children: [{
@ -237,10 +237,10 @@ const Credit_card_bill = () => {
</Col>
<Col span={10}>
<Row>
<Col span={24}><BillTypeSelect store={bill_type_data} show_all={true}/></Col>
<Col span={12}>
<BillTypeSelect store={bill_type_data} show_all={true}/>
<Business_unit store={credit_card_data} show_all={true}/>
<GroupSelect store={credit_card_data} show_all={true}/>
{/*<GroupSelect store={credit_card_data} show_all={true}/>*/}
</Col>
<Col span={12}>
<DatePickerCharts/>

@ -1,7 +1,7 @@
import React, {Component} from 'react';
import {Row, Col, Button, Tabs, Table} from 'antd';
import {
ContainerOutlined, CarryOutOutlined,BlockOutlined,
ContainerOutlined, CarryOutOutlined, BlockOutlined,
SmileOutlined, TagsOutlined, GlobalOutlined,
SearchOutlined,
} from '@ant-design/icons';
@ -49,35 +49,35 @@ class Orders extends Component {
{
title: '数量',
children: [{
title: comm.show_vs_tag(ordercountTotal1.OrderCount_vs, ordercountTotal1.OrderCount, ordercountTotal2.OrderCount),
title: comm.show_vs_tag(ordercountTotal1.OrderCount_vs, ordercountTotal1.OrderCount_diff, ordercountTotal1.OrderCount, ordercountTotal2.OrderCount),
dataIndex: 'OrderCount'
}],
},
{
title: '成交数',
children: [{
title: comm.show_vs_tag(ordercountTotal1.CJCount_vs, ordercountTotal1.CJCount, ordercountTotal2.CJCount),
title: comm.show_vs_tag(ordercountTotal1.CJCount_vs, ordercountTotal1.CJCount_diff, ordercountTotal1.CJCount, ordercountTotal2.CJCount),
dataIndex: 'CJCount'
}],
},
{
title: '成交人数',
children: [{
title: comm.show_vs_tag(ordercountTotal1.CJPersonNum_vs, ordercountTotal1.CJPersonNum, ordercountTotal2.CJPersonNum),
title: comm.show_vs_tag(ordercountTotal1.CJPersonNum_vs, ordercountTotal1.CJPersonNum_diff, ordercountTotal1.CJPersonNum, ordercountTotal2.CJPersonNum),
dataIndex: 'CJPersonNum'
}],
},
{
title: '成交率',
children: [{
title: comm.show_vs_tag(ordercountTotal1.CJrate_vs, ordercountTotal1.CJrate, ordercountTotal2.CJrate),
title: comm.show_vs_tag(ordercountTotal1.CJrate_vs, ordercountTotal1.CJrate_diff, ordercountTotal1.CJrate, ordercountTotal2.CJrate),
dataIndex: 'CJrate'
}],
},
{
title: '成交毛利(预计)',
children: [{
title: comm.show_vs_tag(ordercountTotal1.YJLY_vs, ordercountTotal1.YJLY, ordercountTotal2.YJLY),
title: comm.show_vs_tag(ordercountTotal1.YJLY_vs, ordercountTotal1.YJLY_diff, ordercountTotal1.YJLY, ordercountTotal2.YJLY),
dataIndex: 'YJLY'
}],
},
@ -85,7 +85,7 @@ class Orders extends Component {
{
title: '单个订单价值',
children: [{
title: comm.show_vs_tag(ordercountTotal1.Ordervalue_vs, ordercountTotal1.Ordervalue, ordercountTotal2.Ordervalue),
title: comm.show_vs_tag(ordercountTotal1.Ordervalue_vs, ordercountTotal1.Ordervalue_diff, ordercountTotal1.Ordervalue, ordercountTotal2.Ordervalue),
dataIndex: 'Ordervalue'
}],
},
@ -94,15 +94,15 @@ class Orders extends Component {
for (let item2 of data.ordercount2) {
if (item.OrderType == item2.OrderType) {
result.dataSource.push({
key:item.key,
key: item.key,
OrderType: item.OrderType,
OrderTypeSN: item.OrderTypeSN,
OrderCount: comm.show_vs_tag(item.OrderCount_vs, item.OrderCount, item2.OrderCount),
CJCount: comm.show_vs_tag(item.CJCount_vs, item.CJCount, item2.CJCount),
CJPersonNum: comm.show_vs_tag(item.CJPersonNum_vs, item.CJPersonNum, item2.CJPersonNum),
CJrate: comm.show_vs_tag(item.CJrate_vs, item.CJrate, item2.CJrate),
YJLY: comm.show_vs_tag(item.YJLY_vs, item.YJLY, item2.YJLY),
Ordervalue: comm.show_vs_tag(item.Ordervalue_vs, item.Ordervalue, item2.Ordervalue),
OrderCount: comm.show_vs_tag(item.OrderCount_vs, item.OrderCount_diff, item.OrderCount, item2.OrderCount),
CJCount: comm.show_vs_tag(item.CJCount_vs, item.CJCount_diff, item.CJCount, item2.CJCount),
CJPersonNum: comm.show_vs_tag(item.CJPersonNum_vs, item.CJPersonNum_diff, item.CJPersonNum, item2.CJPersonNum),
CJrate: comm.show_vs_tag(item.CJrate_vs, item.CJrate_diff, item.CJrate, item2.CJrate),
YJLY: comm.show_vs_tag(item.YJLY_vs, item.YJLY_diff, item.YJLY, item2.YJLY),
Ordervalue: comm.show_vs_tag(item.Ordervalue_vs, item.Ordervalue_diff, item.Ordervalue, item2.Ordervalue),
})
}
}
@ -160,8 +160,8 @@ class Orders extends Component {
render() {
const {orders_store} = this.context;
const table_data = orders_store.orderCountData_Form ? this.format_data(orders_store.orderCountData_Form) : [];
const data_source = orders_store.orderCountData ? orders_store.orderCountData : [];
const avg_line_y=data_source.length ? Math.round((data_source.reduce((a, b) => a + b.yField, 0))/data_source.length):0;//平均值,显示一条平均线
const config = {
data: data_source,
padding: 'auto',
@ -175,6 +175,27 @@ class Orders extends Component {
size: 4,
shape: 'cicle',
},
annotations: [
{
type: 'text',
position: ['start', avg_line_y],
content: avg_line_y,
offsetX: -15,
style: {
fill: '#F4664A',
textBaseline: 'bottom',
}
},
{
type: 'line',
start: [-10, avg_line_y],
end: ['max', avg_line_y],
style: {
stroke: '#F4664A',
lineDash: [2, 2],
},
},
],
label: {},//显示标签
legend: {
itemValue: {
@ -184,12 +205,15 @@ class Orders extends Component {
},
},
},
// tooltip: {
// customContent: (title, items) => {
// const data = items[0]?.data || {};
// return `<div>${title}</div><div>${data.seriesField} ${data.yField}</div>`;
// }
// },
tooltip: {
// customContent: (title, items) => {
// const data = items[0]?.data || {};
// return `<div>${title}</div><div>${data.seriesField} ${data.yField}</div>`;
// }
title: (title, datum) => {
return title+' '+ comm.getWeek(datum.xField);//显示周几
},
},
smooth: true,
};
@ -236,7 +260,7 @@ class Orders extends Component {
<Tabs.TabPane tab={<span><GlobalOutlined/>目的地</span>} key="city">
<Table dataSource={table_data.dataSource} columns={table_data.columns} size="small"/>
</Tabs.TabPane>
<Tabs.TabPane tab={<span><BlockOutlined />页面类型</span>} key="LineClass">
<Tabs.TabPane tab={<span><BlockOutlined/>页面类型</span>} key="LineClass">
<Table dataSource={table_data.dataSource} columns={table_data.columns} size="small"/>
</Tabs.TabPane>
</Tabs>
@ -246,6 +270,9 @@ class Orders extends Component {
</div>
);
}
}
}
export
default
export default observer(Orders);
observer(Orders);

@ -24,6 +24,7 @@ const Orders_sub = () => {
}, [])
const data_source = orders_store.orderCountData_type;
const avg_line_y = data_source.length ? Math.round((data_source.reduce((a, b) => a + b.yField, 0)) / data_source.length) : 0;//平均值,显示一条平均线
const line = {
data: data_source,
padding: 'auto',
@ -33,6 +34,32 @@ const Orders_sub = () => {
xAxis: {
type: 'timeCat',
},
annotations: [
{
type: 'text',
position: ['start', avg_line_y],
content: avg_line_y,
offsetX: -15,
style: {
fill: '#F4664A',
textBaseline: 'bottom',
}
},
{
type: 'line',
start: [-10, avg_line_y],
end: ['max', avg_line_y],
style: {
stroke: '#F4664A',
lineDash: [2, 2],
},
},
],
tooltip: {
title: (title, datum) => {
return title+' '+ comm.getWeek(datum.xField);//显示周几
},
},
label: {},//显示标签
legend: {
title: {
@ -87,9 +114,10 @@ const Orders_sub = () => {
key: 'COLI_WebCode',
},
{
title: 'IP',
dataIndex: 'COLI_SenderIP',
key: 'COLI_SenderIP',
title: '成行',
dataIndex: 'COLI_Success',
key: 'COLI_Success',
render: (text, record) => <span>{text == 1 ? '是' : '否'}</span>,
},
{
title: '预定时间',

Loading…
Cancel
Save