perf:老客户:增加折线虚实颜色

main
ZJYHX 2 months ago
parent 17a85122b1
commit 2fae92fa2a

@ -1,4 +1,4 @@
import React, { useContext } from 'react'; import React, { useContext, useState } from 'react';
import { Row, Col, Divider, Table, Tooltip } from 'antd'; import { Row, Col, Divider, Table, Tooltip } from 'antd';
import { InfoCircleOutlined } from '@ant-design/icons'; import { InfoCircleOutlined } from '@ant-design/icons';
import { utils, writeFileXLSX } from 'xlsx'; import { utils, writeFileXLSX } from 'xlsx';
@ -6,10 +6,12 @@ import { stores_Context } from '../config';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import SearchForm from './../components/search/SearchForm'; import SearchForm from './../components/search/SearchForm';
import LineWithAvg from '../components/LineWithAvg'; import LineWithAvg from '../components/LineWithAvg';
import { flow } from 'mobx';
const Customer_care_regular = () => { const Customer_care_regular = () => {
const { orders_store, date_picker_store, customer_store } = useContext(stores_Context); const { orders_store, date_picker_store, customer_store } = useContext(stores_Context);
const regular_data = customer_store.regular_data; const regular_data = customer_store.regular_data;
const [isCompareLine, setIsCompareLine] = useState(false);
// useEffect(() => {}, []); // useEffect(() => {}, []);
@ -34,6 +36,7 @@ const Customer_care_regular = () => {
customer_store.setSearchValues(obj, form, 'regular_data'); customer_store.setSearchValues(obj, form, 'regular_data');
regular_data.data_compare=[]; regular_data.data_compare=[];
if (obj.DateDiff1 && obj.DateDiff2){ if (obj.DateDiff1 && obj.DateDiff2){
setIsCompareLine(true);
regular_data.showSum=false; regular_data.showSum=false;
await customer_store.regular_customer_order(); await customer_store.regular_customer_order();
customer_store.regular_customer_order(false,true); customer_store.regular_customer_order(false,true);
@ -41,6 +44,7 @@ const Customer_care_regular = () => {
customer_store.regular_customer_order(true,true,true); customer_store.regular_customer_order(true,true,true);
} }
else{ else{
setIsCompareLine(false);
regular_data.showSum=true; regular_data.showSum=true;
customer_store.regular_customer_order(); customer_store.regular_customer_order();
customer_store.regular_customer_order(true); customer_store.regular_customer_order(true);
@ -113,7 +117,7 @@ const Customer_care_regular = () => {
<Col span={24}> <Col span={24}>
<LineWithAvg dataSource={regular_data.pivotData} loading={regular_data.detail_loading} xField={regular_data.pivotX} yField={regular_data.pivotY} <LineWithAvg dataSource={regular_data.pivotData} loading={regular_data.detail_loading} xField={regular_data.pivotX} yField={regular_data.pivotY}
seriesField='_ylabel' showSUM={regular_data.showSum} /> seriesField='_ylabel' showSUM={regular_data.showSum} solidLineTime={regular_data.solidLineTime} solidLineDash={regular_data.solidLineDash} isCompareLine={isCompareLine}/>
</Col> </Col>
<Col span={24}> <Col span={24}>

@ -7,7 +7,7 @@ import DateGroupRadio from '../components/DateGroupRadio';
import { cloneDeep, groupBy, sortBy } from '../utils/commons'; import { cloneDeep, groupBy, sortBy } from '../utils/commons';
export default observer((props) => { export default observer((props) => {
const { dataSource: rawData, showAVG, showSUM, loading, ...config } = props; const { dataSource: rawData, showAVG, showSUM, loading, solidLineTime, solidLineDash, isCompareLine, ...config } = props;
const { xField, yField, yFieldAlias, seriesField } = config; const { xField, yField, yFieldAlias, seriesField } = config;
const [dataBeforeXChange, setDataBeforeXChange] = useState([]); const [dataBeforeXChange, setDataBeforeXChange] = useState([]);
@ -29,6 +29,12 @@ export default observer((props) => {
size: 4, size: 4,
shape: "cicle", shape: "cicle",
}, },
lineStyle: (datum) => {
return {
stroke: isCompareLine?datum._ylabel.includes(solidLineTime) ? 'red' : 'blue':undefined, //
lineDash: isCompareLine?datum._ylabel.includes(solidLineDash) ? [4, 4] : undefined:undefined, // 线
};
},
yAxis: { yAxis: {
min: 0, min: 0,
maxTickInterval: 5, maxTickInterval: 5,
@ -63,6 +69,11 @@ export default observer((props) => {
return () => {}; return () => {};
}, [rawData]); }, [rawData]);
useEffect(() => {
setLineConfig(cloneDeep(line_config));
return () => {};
}, [isCompareLine,solidLineTime]);
useEffect(() => { useEffect(() => {
if (lineChartX === 'day') { if (lineChartX === 'day') {

@ -101,7 +101,7 @@ class CustomerStore {
// 老客户 beign // 老客户 beign
regular_customer_order(get_detail = false, isCompare = false, isRender=false) { regular_customer_order(get_detail = false, isCompare = false, isCompareRender=false) {
let pivotByOrder = 'SumOrder'; let pivotByOrder = 'SumOrder';
let pivotByDate = 'applyDate'; let pivotByDate = 'applyDate';
this.regular_data.loading = true; this.regular_data.loading = true;
@ -145,8 +145,9 @@ class CustomerStore {
if (!isCompare){ if (!isCompare){
this.regular_data.data_detail = json; this.regular_data.data_detail = json;
} }
if (isRender){ if (isCompareRender){
this.regular_data.detail_loading = false; this.regular_data.detail_loading = false;
this.regular_data.solidLineTime=date_picker_store.start_date.format(config.DATE_FORMAT)+ '-' +date_picker_store.end_date.format(config.SMALL_DATETIME_FORMAT);
const dump_l = (json || []).filter(ele => ele.COLI_IsOld !== '' && ele.COLI_IsCusCommend !== '').length; const dump_l = (json || []).filter(ele => ele.COLI_IsOld !== '' && ele.COLI_IsCusCommend !== '').length;
this.regular_data.total_data_tips = dump_l > 0 ? `包含 ${dump_l} 条同时勾选的数据` : ''; this.regular_data.total_data_tips = dump_l > 0 ? `包含 ${dump_l} 条同时勾选的数据` : '';
/** 使用明细数据画图 */ /** 使用明细数据画图 */
@ -288,6 +289,8 @@ class CustomerStore {
data_detail: [], data_detail: [],
data_compare: [], data_compare: [],
showSum:true, showSum:true,
solidLineTime:'',
solidLineDash:'老客户推荐',
total_data_tips: '', total_data_tips: '',
webcode: 'ALL', webcode: 'ALL',
site_select_mode: 'multiple',// 站点是否多选 site_select_mode: 'multiple',// 站点是否多选

Loading…
Cancel
Save