diff --git a/src/app.ts b/src/app.ts index 57d6e364ff05b0f6d0936a434f8c6a8f5c887e0f..16593faae61155fdacb6673466ea986fe994d4f8 100644 --- a/src/app.ts +++ b/src/app.ts @@ -12,7 +12,7 @@ import { checkBeforeLogin } from './utils/loginUtil/SSO'; //request 配置 export const request: RequestConfig = { - timeout: 10000, + timeout: 30000, errorConfig, requestInterceptors, responseInterceptors, diff --git a/src/models/regionalIndex.ts b/src/models/regionalIndex.ts index 73951306a94cb8577c527d43d99852188346a74f..517617bdc9e881a60d295d003ea8995ba203046d 100644 --- a/src/models/regionalIndex.ts +++ b/src/models/regionalIndex.ts @@ -41,7 +41,6 @@ const useRegionalIndex = () => { }, ); - return { areaListDto, loading, diff --git a/src/pages/TheOperationOfTheDistrictCityAndCounty/components/Map/index.tsx b/src/pages/TheOperationOfTheDistrictCityAndCounty/components/Map/index.tsx index 2daa00357ab103059beba1cbfb496a3b78da125a..50aac2b5b1d37ab247899d1b6cfa516e605404a6 100644 --- a/src/pages/TheOperationOfTheDistrictCityAndCounty/components/Map/index.tsx +++ b/src/pages/TheOperationOfTheDistrictCityAndCounty/components/Map/index.tsx @@ -1,10 +1,16 @@ -// import BMapView from '@/components/BMapView'; import CooglMap from '@/components/CooglMap'; +import services from '@/services'; import BMapService from '@/utils/mapService'; import { getColorByIndex } from '@/utils/ui'; import { useModel } from '@umijs/max'; import { Space } from 'antd'; -import React, { CSSProperties, Fragment, useRef, useState } from 'react'; +import React, { + CSSProperties, + Fragment, + useEffect, + useRef, + useState, +} from 'react'; import DistrictDetailBar from '../DIstrictDetailBar'; import styles from './index.less'; @@ -14,9 +20,22 @@ const DistrictMap: React.FC = () => { const { selectDistrict, areaListDto } = useModel('regionalIndex'); const MapRef = useRef(); + /** 是否启用百度地图 */ const [isBmap, setIsBmap] = useState(false); + const [data, setData] = useState([]); + + useEffect(() => { + services.Physicalsign.getObjectPolygon({ + physicalSignType: 1, + objectHierarchy: 1, + }).then((res) => { + setData(res.data); + }); + }, []); + + const [selectedData, setSelectedData] = useState({}); /** * @description 设置地图视野 */ @@ -32,83 +51,15 @@ const DistrictMap: React.FC = () => { map.setViewport(points); } }; - console.log(selectDistrict); + console.log(data, selectedData); + useEffect(() => { + const temp = data.find((v) => v?.objectId === selectDistrict?.objectId); + + setSelectedData(temp); + }, [data, selectDistrict]); return (
- {/* {isBmap ? ( - - {!selectDistrict ? ( - - {areaListDto.map((item, index) => { - return ( - - ); - })} - {areaListDto.map((item, index) => { - const point = BMapService.buildPoint( - Number(item.centerX), - Number(item.centerY), - ); - - return ( - -
- {Number(item.qualitySign)} -
-
- ); - })} -
- ) : ( - <> - - -
- {Number(selectDistrict?.qualitySign)} -
-
- - )} -
- ) : ( */} { > {!selectDistrict ? ( - {areaListDto.map((item, index) => { + {data.map((item, index) => { + console.log(item); return ( { > ); })} - {areaListDto.map((item, index) => { + {data.map((item, index) => { const point = [Number(item.centerX), Number(item.centerY)]; return ( @@ -150,42 +102,37 @@ const DistrictMap: React.FC = () => { ) : ( <>
- {Number(selectDistrict?.qualitySign)} + {Number(selectedData?.qualitySign)}
)}
- {/* )} */} {selectDistrict && (
{selectDistrict.objectName}
)}
- {/* - -
启用百度地图
-
*/}
应急态 <60
diff --git a/src/services/Physicalsign.ts b/src/services/Physicalsign.ts index 3cf238138605eca8c39bb796f16183afa51dc434..394434421dfcbaf0d0e5e4cb5d576b63e0cbbe15 100644 --- a/src/services/Physicalsign.ts +++ b/src/services/Physicalsign.ts @@ -70,12 +70,12 @@ export async function getlistTopNItems( } //中观体征地图边界 -export async function getObjectPolygon(): Promise< - PhysicalsignApi.Result -> { - return request( - urlProxyApis(`/middlePhysicalSign/getObjectPolygon?objectId=1`), - ); +export async function getObjectPolygon( + params: any, +): Promise> { + return request(urlProxyApis(`/middlePhysicalSign/getObjectPolygon`), { + params: params, + }); } //中观体征县区体征数据 @@ -96,12 +96,10 @@ export async function getGroupObjectPhysicalSignIndex(data: { /** * @description 获取体征指数对比结果接口 */ -export async function getComparisonIndexInstance( - data: any, -): Promise { +export async function getComparisonIndexInstance(data: any): Promise { return request(urlProxyApis(`/main/getComparisonIndexInstance`), { params: data, - timeout:30000 + timeout: 30000, }); } @@ -162,7 +160,7 @@ export async function getIndexSystem( params: any, ): Promise> { return request(urlProxyApis(`/physicalSignIndex/getIndexSystem`), { - params + params, }); } @@ -206,7 +204,7 @@ export async function getIndexInstanceData( ): Promise> { return request(urlProxyApis(`/main/getIndexInstance`), { params: data, - timeout:30000 + timeout: 30000, }); } @@ -293,12 +291,10 @@ export async function getCityEventGroupBySource(params: { } //获取所有行业情况 -export async function getAllIndutryIndexInstance( - params: { - physicalSignType: string; - objectId: string; - }, -): Promise> { +export async function getAllIndutryIndexInstance(params: { + physicalSignType: string; + objectId: string; +}): Promise> { return request(urlProxyApis(`/zhgl/getAllIndutryIndexInstance`), { method: 'GET', params, @@ -306,12 +302,10 @@ export async function getAllIndutryIndexInstance( } //城市运行情况的行业体征 -export async function getCityRunIndutryIndexInstance( - params: { - physicalSignType: string; - objectId: string; - }, -): Promise> { +export async function getCityRunIndutryIndexInstance(params: { + physicalSignType: string; + objectId: string; +}): Promise> { return request(urlProxyApis(`/zhgl/getCityRunIndutryIndexInstance`), { method: 'GET', params, @@ -320,10 +314,10 @@ export async function getCityRunIndutryIndexInstance( //近三十天体征趋势 export async function TrendAnalysis( - params: any -): Promise> { + params: any, +): Promise> { return request(urlProxyApis(`/physicalsignindexinstance/trendAnalysis`), { method: 'GET', params, }); -} \ No newline at end of file +}