diff --git a/src/charts/Customer_care_regular.jsx b/src/charts/Customer_care_regular.jsx index 2096bd8..a73ca1d 100644 --- a/src/charts/Customer_care_regular.jsx +++ b/src/charts/Customer_care_regular.jsx @@ -1,4 +1,4 @@ -import React, { useContext } from 'react'; +import React, { useContext, useState } from 'react'; import { Row, Col, Divider, Table, Tooltip } from 'antd'; import { InfoCircleOutlined } from '@ant-design/icons'; import { utils, writeFileXLSX } from 'xlsx'; @@ -6,10 +6,12 @@ import { stores_Context } from '../config'; import { observer } from 'mobx-react'; import SearchForm from './../components/search/SearchForm'; import LineWithAvg from '../components/LineWithAvg'; +import { flow } from 'mobx'; const Customer_care_regular = () => { const { orders_store, date_picker_store, customer_store } = useContext(stores_Context); const regular_data = customer_store.regular_data; + const [isCompareLine, setIsCompareLine] = useState(false); // useEffect(() => {}, []); @@ -34,6 +36,7 @@ const Customer_care_regular = () => { customer_store.setSearchValues(obj, form, 'regular_data'); regular_data.data_compare=[]; if (obj.DateDiff1 && obj.DateDiff2){ + setIsCompareLine(true); regular_data.showSum=false; await customer_store.regular_customer_order(); customer_store.regular_customer_order(false,true); @@ -41,6 +44,7 @@ const Customer_care_regular = () => { customer_store.regular_customer_order(true,true,true); } else{ + setIsCompareLine(false); regular_data.showSum=true; customer_store.regular_customer_order(); customer_store.regular_customer_order(true); @@ -113,7 +117,7 @@ const Customer_care_regular = () => { + seriesField='_ylabel' showSUM={regular_data.showSum} solidLineTime={regular_data.solidLineTime} solidLineDash={regular_data.solidLineDash} isCompareLine={isCompareLine}/> diff --git a/src/components/LineWithAvg.jsx b/src/components/LineWithAvg.jsx index 4bc1592..6e11f58 100644 --- a/src/components/LineWithAvg.jsx +++ b/src/components/LineWithAvg.jsx @@ -7,7 +7,7 @@ import DateGroupRadio from '../components/DateGroupRadio'; import { cloneDeep, groupBy, sortBy } from '../utils/commons'; 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 [dataBeforeXChange, setDataBeforeXChange] = useState([]); @@ -29,6 +29,12 @@ export default observer((props) => { size: 4, 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: { min: 0, maxTickInterval: 5, @@ -63,6 +69,11 @@ export default observer((props) => { return () => {}; }, [rawData]); + useEffect(() => { + setLineConfig(cloneDeep(line_config)); + + return () => {}; + }, [isCompareLine,solidLineTime]); useEffect(() => { if (lineChartX === 'day') { diff --git a/src/stores/CustomerStore.js b/src/stores/CustomerStore.js index e561086..8b65fef 100644 --- a/src/stores/CustomerStore.js +++ b/src/stores/CustomerStore.js @@ -101,7 +101,7 @@ class CustomerStore { // 老客户 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 pivotByDate = 'applyDate'; this.regular_data.loading = true; @@ -145,8 +145,9 @@ class CustomerStore { if (!isCompare){ this.regular_data.data_detail = json; } - if (isRender){ + if (isCompareRender){ 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; this.regular_data.total_data_tips = dump_l > 0 ? `包含 ${dump_l} 条同时勾选的数据` : ''; /** 使用明细数据画图 */ @@ -288,6 +289,8 @@ class CustomerStore { data_detail: [], data_compare: [], showSum:true, + solidLineTime:'', + solidLineDash:'老客户推荐', total_data_tips: '', webcode: 'ALL', site_select_mode: 'multiple',// 站点是否多选