获取明细
parent
47609219fb
commit
2587b50c5e
@ -0,0 +1,42 @@
|
|||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { observer } from 'mobx-react';
|
||||||
|
import { sortBy, merge } from '../utils/commons';
|
||||||
|
import { dataFieldAlias } from '../libs/ht';
|
||||||
|
import { Mix, Scatter } from '@ant-design/plots';
|
||||||
|
|
||||||
|
export default observer((props) => {
|
||||||
|
const { dataSource, ...extProps } = props;
|
||||||
|
const config = merge(
|
||||||
|
{
|
||||||
|
appendPadding: 10,
|
||||||
|
// xField: 'Revenue (Millions)',
|
||||||
|
// yField: 'Rating',
|
||||||
|
shape: 'circle',
|
||||||
|
// colorField: 'Genre',
|
||||||
|
size: 4,
|
||||||
|
yAxis: {
|
||||||
|
nice: true,
|
||||||
|
line: {
|
||||||
|
style: {
|
||||||
|
stroke: '#aaa',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
min: -100,
|
||||||
|
grid: {
|
||||||
|
line: {
|
||||||
|
style: {
|
||||||
|
stroke: '#eee',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
line: {
|
||||||
|
style: {
|
||||||
|
stroke: '#aaa',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, extProps);
|
||||||
|
return <Scatter {...config} data={dataSource} />;
|
||||||
|
});
|
@ -0,0 +1,80 @@
|
|||||||
|
import { useContext, useEffect, useMemo } from 'react';
|
||||||
|
import { observer } from "mobx-react";
|
||||||
|
import { stores_Context } from '../config';
|
||||||
|
import { Row, Col, Spin, Space, Radio, Tabs, Table } from 'antd';
|
||||||
|
import { empty } from '../utils/commons';
|
||||||
|
import { dataFieldAlias } from '../libs/ht';
|
||||||
|
import Scatter from './../components/Scatter';
|
||||||
|
import SearchForm from './../components/search/SearchForm';
|
||||||
|
|
||||||
|
export default observer((props) => {
|
||||||
|
const { date_picker_store: searchFormStore, DistributionStore } = useContext(stores_Context);
|
||||||
|
const { formValues, formValuesToSub } = searchFormStore;
|
||||||
|
const { curTab, scatterDays, detailData } = DistributionStore;
|
||||||
|
|
||||||
|
const detailRefresh = (obj) => {
|
||||||
|
DistributionStore.getDetailData({
|
||||||
|
...(obj || formValuesToSub),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (empty(detailData.dataSource)) {
|
||||||
|
detailRefresh();
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const ScatterConfig = {
|
||||||
|
xField: 'startDate',
|
||||||
|
yField: 'tourdays',
|
||||||
|
colorField: 'country',
|
||||||
|
size: 4,
|
||||||
|
// xAxis: {
|
||||||
|
// min: 0,
|
||||||
|
// max: 30,
|
||||||
|
// },
|
||||||
|
yAxis: {
|
||||||
|
min: 0,
|
||||||
|
max: 10,
|
||||||
|
},
|
||||||
|
// quadrant: {
|
||||||
|
// xBaseline: 15,
|
||||||
|
// yBaseline: 5,
|
||||||
|
// },
|
||||||
|
tooltip: false,
|
||||||
|
legend: {
|
||||||
|
position: 'right-top',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Row gutter={16} style={{ margin: '-16px -8px' }}>
|
||||||
|
{/* style={{ margin: '-16px -8px', padding: 0 }} */}
|
||||||
|
<Col className="gutter-row" span={24}>
|
||||||
|
<SearchForm
|
||||||
|
defaultValue={{
|
||||||
|
initialValue: {
|
||||||
|
...formValues,
|
||||||
|
},
|
||||||
|
shows: ['DateType', 'DepartmentList', 'WebCode', 'IncludeTickets', 'dates', 'country'],
|
||||||
|
fieldProps: {
|
||||||
|
DepartmentList: { show_all: true },
|
||||||
|
WebCode: { show_all: true },
|
||||||
|
dates: { hide_vs: true },
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
onSubmit={(_err, obj, form, str) => {
|
||||||
|
detailRefresh(obj);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<Spin spinning={detailData.loading}>
|
||||||
|
<Scatter {...ScatterConfig} dataSource={scatterDays} />
|
||||||
|
</Spin>
|
||||||
|
</section>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
});
|
Loading…
Reference in New Issue