From 5638800381f27692203a1fd576726f0c3a6d68af Mon Sep 17 00:00:00 2001 From: wenlele Date: Mon, 3 Jul 2023 14:00:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/homepage/index.js | 7 ++++--- web/client/src/sections/auth/containers/login.js | 2 +- .../src/sections/homePage/components/abnormalMonitoring.js | 1 - web/client/src/sections/homePage/components/accessData.js | 4 ++-- web/client/src/sections/homePage/components/alarmList.js | 2 +- web/client/src/sections/homePage/components/centerTop.js | 2 +- web/client/src/sections/homePage/components/dataShare.js | 4 ++-- web/client/src/sections/homePage/components/hotspotData.js | 6 +++--- .../sections/homePage/components/public/carousel-list.js | 2 -- web/client/src/sections/homePage/components/style.less | 2 +- web/client/src/sections/homePage/nav-item.js | 4 ++-- 11 files changed, 17 insertions(+), 19 deletions(-) diff --git a/api/app/lib/controllers/homepage/index.js b/api/app/lib/controllers/homepage/index.js index 91cb542..18e23c7 100644 --- a/api/app/lib/controllers/homepage/index.js +++ b/api/app/lib/controllers/homepage/index.js @@ -156,6 +156,7 @@ function getClusterInfo(opts) { } } +//获取restful统计信息 function getRestfulInfo(opts) { return async function (ctx, next) { const models = ctx.fs.dc.models; @@ -209,11 +210,11 @@ function getRestfulInfo(opts) { } } +//获取接入数据统计 function getAccessData(opts) { return async function (ctx, next) { - const models = ctx.fs.dc.models; try { - const projects = '1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38' + const projects = '2,35,37,45,70,111,170,187,210,275,276,279' const url = 'https://statistics.anxinyun.cn/statistic?projects=' + projects let res = await request.get(url) ctx.status = 200; @@ -221,7 +222,7 @@ function getAccessData(opts) { } catch (error) { ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; - ctx.body = { message: '获取预警列表失败' } + ctx.body = { message: '获取接入数据统计失败' } } } } diff --git a/web/client/src/sections/auth/containers/login.js b/web/client/src/sections/auth/containers/login.js index bf4f1a9..e1cabcb 100644 --- a/web/client/src/sections/auth/containers/login.js +++ b/web/client/src/sections/auth/containers/login.js @@ -36,7 +36,7 @@ const Login = props => { useEffect(() => { if (user && user.authorized) { - dispatch(push('/homePage')); + user?.role == '数据消费者' ? dispatch(push('/metadataManagement/latestMetadata')) : dispatch(push('/homePage')); } }, [user]) diff --git a/web/client/src/sections/homePage/components/abnormalMonitoring.js b/web/client/src/sections/homePage/components/abnormalMonitoring.js index ecb5206..e2107ed 100644 --- a/web/client/src/sections/homePage/components/abnormalMonitoring.js +++ b/web/client/src/sections/homePage/components/abnormalMonitoring.js @@ -40,7 +40,6 @@ function AbnormalMonitoring(props) { height={100} multiellipsis marginTop={-50} - // columnWidth={[200, 170, 120, 120]} /> } diff --git a/web/client/src/sections/homePage/components/accessData.js b/web/client/src/sections/homePage/components/accessData.js index 71a117e..2d37d29 100644 --- a/web/client/src/sections/homePage/components/accessData.js +++ b/web/client/src/sections/homePage/components/accessData.js @@ -1,8 +1,8 @@ -import React, { useEffect, useState } from 'react' +import React from 'react' import Box from './public/table-card'; import { useFsRequest } from '$utils'; import { mathRound } from './util' -function AccessData(props) { +function AccessData() { const { data: accessdata = [] } = useFsRequest({ url: 'homepage/accessdata', diff --git a/web/client/src/sections/homePage/components/alarmList.js b/web/client/src/sections/homePage/components/alarmList.js index 07ac796..55181b5 100644 --- a/web/client/src/sections/homePage/components/alarmList.js +++ b/web/client/src/sections/homePage/components/alarmList.js @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react' +import React from 'react' import Box from './public/table-card'; import CarouselList from './public/carousel-list'; import { Tooltip } from 'antd'; diff --git a/web/client/src/sections/homePage/components/centerTop.js b/web/client/src/sections/homePage/components/centerTop.js index 3e5f32a..a70d656 100644 --- a/web/client/src/sections/homePage/components/centerTop.js +++ b/web/client/src/sections/homePage/components/centerTop.js @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react' +import React from 'react' import './style.less' function CenterTop(props) { diff --git a/web/client/src/sections/homePage/components/dataShare.js b/web/client/src/sections/homePage/components/dataShare.js index 8ae17a4..c8f2b08 100644 --- a/web/client/src/sections/homePage/components/dataShare.js +++ b/web/client/src/sections/homePage/components/dataShare.js @@ -1,6 +1,6 @@ -import React, { useEffect, useState } from 'react' +import React from 'react' import Box from './public/table-card'; -import { ApiTable, useFsRequest } from '$utils'; +import { useFsRequest } from '$utils'; import { mathRound } from './util'; function DataShare(props) { diff --git a/web/client/src/sections/homePage/components/hotspotData.js b/web/client/src/sections/homePage/components/hotspotData.js index 0f1d7ea..f8a7240 100644 --- a/web/client/src/sections/homePage/components/hotspotData.js +++ b/web/client/src/sections/homePage/components/hotspotData.js @@ -17,18 +17,18 @@ function HotspotData(props) {
- {top3[0].name?.length > 6 ? top3[0].name.substring(0, 6) + '...' : top3[0].name} + {top3[0].name?.length > 8 ? top3[0].name.substring(0, 8) + '...' : top3[0].name}
{top3[0].count}
{top3?.length > 2 && <> - {top3[2].name?.length > 6 ? top3[2].name.substring(0, 6) + '...' : top3[2].name} + {top3[2].name?.length > 8 ? top3[2].name.substring(0, 8) + '...' : top3[2].name}
{top3[2].count}
}
{top3?.length > 1 && <> - {top3[1].name?.length > 6 ? top3[1].name.substring(0, 6) + '...' : top3[1].name} + {top3[1].name?.length > 8 ? top3[1].name.substring(0, 8) + '...' : top3[1].name}
{top3[1].count}
}
diff --git a/web/client/src/sections/homePage/components/public/carousel-list.js b/web/client/src/sections/homePage/components/public/carousel-list.js index a30d13b..8aaf397 100644 --- a/web/client/src/sections/homePage/components/public/carousel-list.js +++ b/web/client/src/sections/homePage/components/public/carousel-list.js @@ -1,7 +1,6 @@ /* 轮播列表组件 */ import React from 'react'; import ScrollBoard from './scrollBoard'; -// import { ScrollBoard } from '@jiaminghi/data-view-react'; import NoData from './noData'; import './index.less'; function CarouselList(props) { @@ -26,7 +25,6 @@ function CarouselList(props) { config={config} style={{ height }} className={multiellipsis ? 'scroll-board-multi' : 'scroll-board'} - // eslint-disable-next-line react/jsx-props-no-spreading {...restProps} /> ) : ; diff --git a/web/client/src/sections/homePage/components/style.less b/web/client/src/sections/homePage/components/style.less index e3274cb..b544be6 100644 --- a/web/client/src/sections/homePage/components/style.less +++ b/web/client/src/sections/homePage/components/style.less @@ -199,7 +199,7 @@ ._top3 { position: absolute; bottom: 34%; - right: 2%; + left: 73%; } } diff --git a/web/client/src/sections/homePage/nav-item.js b/web/client/src/sections/homePage/nav-item.js index 7ca5bfb..5255789 100644 --- a/web/client/src/sections/homePage/nav-item.js +++ b/web/client/src/sections/homePage/nav-item.js @@ -2,9 +2,9 @@ import React from 'react'; import { Link } from 'react-router-dom'; import { Menu } from 'antd'; import { HomeOutlined } from '@ant-design/icons'; -export function getNavItem() { +export function getNavItem(user) { return ( - }> + user?.role == '系统管理员' && }> 数据监控平台 );