From 33bb19826aab2d3088be3cfa87c80b7a89f7dcad Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 10 Jul 2024 16:37:33 +0800 Subject: [PATCH] up --- src/pages/Dashboard/BusinessViews.tsx | 3 + src/pages/Dashboard/ChannelStatistics.tsx | 3 + src/pages/Dashboard/ScanDetail.tsx | 3 + src/pages/Dashboard/index.tsx | 67 ++++++++++++------- .../OperationsDashboard/BusinessDetail.tsx | 3 + .../OperationsDashboard/ProductDetail.tsx | 3 + src/utils/utils.ts | 9 +++ 7 files changed, 68 insertions(+), 23 deletions(-) diff --git a/src/pages/Dashboard/BusinessViews.tsx b/src/pages/Dashboard/BusinessViews.tsx index d687583..3cf5adb 100644 --- a/src/pages/Dashboard/BusinessViews.tsx +++ b/src/pages/Dashboard/BusinessViews.tsx @@ -96,6 +96,9 @@ const TableList: React.FC<{}> = () => { title: '注册日期', dataIndex: 'pbcCreateAt', hideInTable: true, + fieldProps:{ + maxDate: moment() + }, valueType: 'dateRange' }, { diff --git a/src/pages/Dashboard/ChannelStatistics.tsx b/src/pages/Dashboard/ChannelStatistics.tsx index e0b4811..31892b8 100644 --- a/src/pages/Dashboard/ChannelStatistics.tsx +++ b/src/pages/Dashboard/ChannelStatistics.tsx @@ -77,6 +77,9 @@ import moment from 'moment'; title: '访问时间', dataIndex: 'pbcCreateAt', hideInTable: true, + fieldProps:{ + maxDate: moment() + }, valueType: 'dateRange' }, ]; diff --git a/src/pages/Dashboard/ScanDetail.tsx b/src/pages/Dashboard/ScanDetail.tsx index fea9dd5..d6f0cec 100644 --- a/src/pages/Dashboard/ScanDetail.tsx +++ b/src/pages/Dashboard/ScanDetail.tsx @@ -73,6 +73,9 @@ const TableList: React.FC<{}> = () => { title: '扫码时间', dataIndex: 'pbcCreateAt', valueType: 'dateRange', + fieldProps:{ + maxDate: moment() + }, hideInTable: true }, ]; diff --git a/src/pages/Dashboard/index.tsx b/src/pages/Dashboard/index.tsx index 128db45..b08c3e4 100644 --- a/src/pages/Dashboard/index.tsx +++ b/src/pages/Dashboard/index.tsx @@ -2,11 +2,11 @@ import { dashboardUsingPost, exportDashboardDetailUsingPost } from '@/services/p import { Bar, Pie, WordCloud, WordCloudConfig } from '@ant-design/plots'; import dayjs from 'dayjs'; import { PageContainer, ProCard, ProForm, ProFormDateRangePicker, ProFormGroup, ProFormInstance, ProFormRadio } from '@ant-design/pro-components'; -import { Button, Card, Col, DatePickerProps, message, Row, Spin, Statistic } from 'antd'; +import { Button, Card, Col, message, Row, Spin, Statistic } from 'antd'; import React, { useEffect, useRef, useState } from 'react'; -import { querySearchKeyRankUsingPost } from '@/services/pop-b2b2c/pbcSearchKeyController'; import { history, Link } from '@umijs/max'; import Constants from '@/constants'; +import { disabledDate } from '@/utils/utils'; const handleExport = async (values?: API.PbcDashBoardDTO) => { @@ -52,6 +52,7 @@ const Welcome: React.FC = () => { }); const [pbcInteractStatical, setPbcInteractStatical] = useState({ pbcColectNumber: 0, + pbcNewGoodsViewNumber: 0, pbcViewTotalNumber: 0 }); @@ -116,6 +117,7 @@ const Welcome: React.FC = () => { setData1((res.data.pbcBusinessViewStaticalVO.pbcBusinessRankList || []).map((e: any) => { return { label: e.pbcBusinessName, + pbcBusinessId: e.pbcBusinessId, value: e.pbcBusinessVisitCount } })) @@ -136,13 +138,15 @@ const Welcome: React.FC = () => { setData2(arr) setData3((res.data.pbcProductViewStaticalVO.pbcProductViewRank || []).map((e: any) => { return { - label: e.pbcProductName, + label: e.businessName + '-' + e.pbcProductName, + pbcProductId: e.pbcProductId, value: e.pbcProductVisitCount } })) setData4((res.data.pbcProductCollectStaticalVO.pbcProductCollectViewRank || []).map((e: any) => { return { - label: e.pbcProductName, + label: e.businessName + '-' + e.pbcProductName, + pbcProductId: e.pbcProductId, value: e.pbcProductCollectCount } })) @@ -151,23 +155,9 @@ const Welcome: React.FC = () => { }).catch(() => { handleLoadChange(true) }) - - querySearchKeyRankUsingPost(param).then(res => { - if (res.retcode) { - - } - }) } } - const disabledDate: DatePickerProps['disabledDate'] = (current, { from }) => { - if (from) { - return Math.abs(current.diff(from, 'months')) >= 3; - } - - return false; - }; - useEffect(() => { getData() }, []) @@ -271,8 +261,9 @@ const Welcome: React.FC = () => { - - + + + @@ -281,7 +272,17 @@ const Welcome: React.FC = () => { {'更多>>'} } bordered={false}> - + { + plot.on('plot:click', (evt: { x: any; y: any; }) => { + const { x, y } = evt; + const tooltipData = plot.chart.getTooltipItems({ x, y }); + let id = "" + if (tooltipData && tooltipData.length > 0) { + id = tooltipData[0].data.pbcBusinessId + } + history.push(`/business/detail/${id}?isEdit=0`) + }); + }} /> @@ -312,12 +313,32 @@ const Welcome: React.FC = () => { - + { + plot.on('plot:click', (evt: { x: any; y: any; }) => { + const { x, y } = evt; + const tooltipData = plot.chart.getTooltipItems({ x, y }); + let id = "" + if (tooltipData && tooltipData.length > 0) { + id = tooltipData[0].data.pbcProductId + } + history.push('/product/detail/' + id) + }); + }} /> - + { + plot.on('plot:click', (evt: { x: any; y: any; }) => { + const { x, y } = evt; + const tooltipData = plot.chart.getTooltipItems({ x, y }); + let id = "" + if (tooltipData && tooltipData.length > 0) { + id = tooltipData[0].data.pbcProductId + } + history.push('/product/detail/' + id) + }); + }} /> diff --git a/src/pages/OperationsDashboard/BusinessDetail.tsx b/src/pages/OperationsDashboard/BusinessDetail.tsx index 36c6851..f0dd5a1 100644 --- a/src/pages/OperationsDashboard/BusinessDetail.tsx +++ b/src/pages/OperationsDashboard/BusinessDetail.tsx @@ -103,6 +103,9 @@ const TableList: React.FC<{}> = () => { { title: '创建日期', dataIndex: 'pbcCreateAt', + fieldProps:{ + maxDate: moment() + }, valueType: 'dateRange', }, { diff --git a/src/pages/OperationsDashboard/ProductDetail.tsx b/src/pages/OperationsDashboard/ProductDetail.tsx index 4592633..1d01497 100644 --- a/src/pages/OperationsDashboard/ProductDetail.tsx +++ b/src/pages/OperationsDashboard/ProductDetail.tsx @@ -82,6 +82,9 @@ const TableList: React.FC<{}> = () => { title: '创建日期', dataIndex: 'pbcCreateAt', hideInTable: true, + fieldProps:{ + maxDate: moment() + }, valueType: 'dateRange' }, { diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 341af86..71a1c6c 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,3 +1,4 @@ +import { DatePickerProps } from 'antd'; import { parse } from 'querystring'; const reg = @@ -19,6 +20,14 @@ export const removeUndefinedKey = (obj: any) => { return obj; }; +export const disabledDate: DatePickerProps['disabledDate'] = (current, { from }) => { + if (from) { + return Math.abs(current.diff(from, 'months')) >= 3; + } + + return false; +}; + /* *乘法函数,用来得到精确的乘法结果 *说明:javascript的乘法结果会有误差,在两个浮点数相乘的时候会比较明显。这个函数返回较为精确的乘法结果。