From 33b68690af036898e5d2c19e6ae6388f14039e15 Mon Sep 17 00:00:00 2001 From: wuyize Date: Thu, 5 Jan 2023 14:53:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=8F=91=E7=A5=A8=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=8D=A2=E9=A1=B5=E4=B8=8D=E4=BF=9D=E7=95=99=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Invoice/management/InvoiceManagement.tsx | 2 +- src/pages/stat/StatView.tsx | 93 +++++++++---------- 2 files changed, 44 insertions(+), 51 deletions(-) diff --git a/src/pages/Invoice/management/InvoiceManagement.tsx b/src/pages/Invoice/management/InvoiceManagement.tsx index 4f43ecf..49e1245 100644 --- a/src/pages/Invoice/management/InvoiceManagement.tsx +++ b/src/pages/Invoice/management/InvoiceManagement.tsx @@ -319,7 +319,7 @@ function InvoiceManagement(props: {}) { const navigate = useNavigate() const handleInvoiceSearchInfo = (invoiceSearch: InvoiceSearchOption) => { - //setInvoiceSearchOption(invoiceSearch) + setInvoiceSearchOption(invoiceSearch) searchInvoiceContent(invoiceSearch) } const searchInvoiceContent = (invoiceSearch: InvoiceSearchOption) => { diff --git a/src/pages/stat/StatView.tsx b/src/pages/stat/StatView.tsx index 98d5c7a..5204bd8 100644 --- a/src/pages/stat/StatView.tsx +++ b/src/pages/stat/StatView.tsx @@ -84,7 +84,6 @@ function HorizontalBarChart(props: { title: string, values: number[], labels: st }, series: [ { - name: 'Direct', type: 'bar', colorBy: 'data', emphasis: { @@ -96,46 +95,9 @@ function HorizontalBarChart(props: { title: string, values: number[], labels: st }} notMerge={true} lazyUpdate={true}/> } -var mMapData = - [ - {from: '青海省', to: '青海省', value: 90}, - {from: '青海省', to: '安徽省', value: 80}, - {from: '青海省', to: '甘肃省', value: 70}, - {from: '青海省', to: '宁夏省', value: 60}, - {from: '青海省', to: '山西省', value: 50}, - {from: '青海省', to: '陕西省', value: 40}, - {from: '青海省', to: '广东省', value: 30}, - {from: '青海省', to: '重庆省', value: 20}, - {from: '青海省', to: '西藏省', value: 10} - ]; - -var convertLineData = function (data: { from: string, to: string, value: number }[]) { - var res = []; - - for (var i = 0; i < data.length; i++) { - var dataItem = data[i]; - // @ts-ignore - var fromCoord = GeoCoordMap[dataItem.from]; - // @ts-ignore - var toCoord = GeoCoordMap[dataItem.to]; - - if (fromCoord && toCoord) { - res.push( - { - fromName: dataItem.from, - toName: dataItem.to, - coords: [fromCoord, toCoord], - value: dataItem.value, - }); - } - } - - return res; -}; - function StatView() { const { - token: {colorBgContainer, colorPrimary, colorSuccess}, + token: {colorBgContainer, colorPrimary, colorSuccess, colorBorder}, } = theme.useToken(); const [type, setType] = useState('month'); @@ -400,7 +362,11 @@ function StatView() { return geoCoordMap.find(([name,]) => name.includes(placeName)) } - let mapDataTemp: { fromName: string, toName: string, coords: any[], value: number }[] = [] + let maxValue = 0 + for (const item of statResponse.reimbursementPlaceStats) { + maxValue = Math.max(maxValue, item.reimbursementLaunchCount) + } + let mapDataTemp: any[] = [] let departures = new Map() let destinations = new Map() for (const item of statResponse.reimbursementPlaceStats) { @@ -421,10 +387,13 @@ function StatView() { if (fromCoords && toCoords) { mapDataTemp.push({ - "fromName": fromCoords[0], - "toName": toCoords[0], - "coords": [fromCoords[1], toCoords[1]], - "value": item.reimbursementLaunchCount, + fromName: fromCoords[0], + toName: toCoords[0], + coords: [fromCoords[1], toCoords[1]], + value: item.reimbursementLaunchCount, + lineStyle: { + width: item.reimbursementLaunchCount / maxValue * 10 + } }) } } @@ -676,6 +645,19 @@ function StatView() { text: '差旅去向', left: 'center', }, + tooltip: { + trigger: 'item', + formatter: function (params: any) { + let returnStr = ''; + if (params.componentSubType == 'lines') { + returnStr += params.marker; + returnStr += params.data.fromName + ' → ' + params.data.toName; + returnStr += ':' + params.data.value; + } + + return returnStr; + } + }, geo: { map: 'china', emphasis: { @@ -685,8 +667,8 @@ function StatView() { disabled: true }, itemStyle: { - areaColor: '#d4e2fd', - borderColor: '#8c8c8c' + areaColor: colorBorder, + borderColor: colorBgContainer } }, series: [ @@ -695,10 +677,21 @@ function StatView() { zlevel: 2, lineStyle: { normal: { - color: '#', - width: 3, - opacity: 0.2, - curveness: .3 + color: { + type: 'linear', + x: 0, + y: 0, + x2: 1, + y2: 1, + colorStops: [{ + offset: 0, color: '#6395f9' + }, { + offset: 1, color: '#62daab' + }], + }, + opacity: 0.5, + curveness: .3, + cap: 'round' } }, data: mapData