获取大盘统计数据

This commit is contained in:
licuizhu 2023-10-16 21:48:16 +08:00
parent dbb6be176d
commit 8efa4eed57
2 changed files with 26 additions and 6 deletions

View File

@ -31,3 +31,10 @@ export function getLayerPoints( params ) {
params: params
});
}
// 获取大盘统计数据
export function getDashboardData() {
return request('/api/dashboard/getDashboardData', {
method: 'GET',
});
}

View File

@ -1,6 +1,7 @@
import { Layout, Row, Col, Select } from 'antd';
import React, { useEffect } from 'react';
import React, { useEffect, useState } from 'react';
import styles from './Guide.less';
import { getDashboardData } from '../../api';
import { GaodeMap ,Scene } from '@antv/l7';
import { Choropleth } from '@antv/l7plot';
@ -14,7 +15,11 @@ interface Props {
// 脚手架示例组件
const Guide: React.FC<Props> = (props) => {
const { name } = props;
useEffect(() => {
const [registerDays, setRegisterDays] = useState(0);
const [createLayerCount, setCreateLayerCount] = useState(0);
const [createPointCount, setCreatePointCount] = useState(0);
useEffect(() => {debugger
const scene = new Scene({
id: 'map',
map: new GaodeMap({
@ -25,7 +30,6 @@ const Guide: React.FC<Props> = (props) => {
})
});
scene.on('loaded', () => {
const areadata = areaList;
const data = areaList
// .filter(({ level, parent }) => level === 'city' && parent === 330000)
.map((item) => ({ ...item, value: Math.random() * 5000 }));
@ -86,6 +90,15 @@ const Guide: React.FC<Props> = (props) => {
choropleth.addToScene(scene);
});
//大盘统计数据
getDashboardData().then((e) => {
const data = e.data || {};
data.registerDays && setRegisterDays(data.registerDays);
data.createLayerCount && setCreateLayerCount(data.createLayerCount);
data.createPointCount && setCreatePointCount(data.createPointCount);
});
}, []);
let onLayerSelectChange = (e:any) => {
@ -102,9 +115,9 @@ const Guide: React.FC<Props> = (props) => {
{/* 顶部信息 */}
<div className={styles.homepageMsg}>
<div className={styles.homepageMsgItem}><span className={styles.homepageMsgItemSpan}>125</span></div>
<div className={styles.homepageMsgItem}><span className={styles.homepageMsgItemSpan}>125</span></div>
<div className={styles.homepageMsgItem}><span className={styles.homepageMsgItemSpan}>125</span></div>
<div className={styles.homepageMsgItem}><span className={styles.homepageMsgItemSpan}>{registerDays}</span></div>
<div className={styles.homepageMsgItem}><span className={styles.homepageMsgItemSpan}>{createLayerCount}</span></div>
<div className={styles.homepageMsgItem}><span className={styles.homepageMsgItemSpan}>{createPointCount}</span></div>
</div>
{/* 下拉框 全国自定义点位数目图 */}