diff --git a/src/pages/Common/Event/CommonList/index.tsx b/src/pages/Common/Event/CommonList/index.tsx index 9372450b67824503f0eb754d165576a17e42b3d6..f91ab18b56773c4d54d9ab7de4c7f22b7fcc5e2a 100644 --- a/src/pages/Common/Event/CommonList/index.tsx +++ b/src/pages/Common/Event/CommonList/index.tsx @@ -1,27 +1,24 @@ -import { Flex, Space, useMemo } from 'antd' -import styles from './index.less' -import ListTabs from '@/pages/Common/components/ListTabs' -import ProcessCard from '@/pages/Common/components/ProcessCard' -import BaseCard from '@/pages/Common/components/BaseCard' -import ListView from '@/pages/Common/components/ListView' -import EventPicList from '@/pages/Common/components/EventPicList' -import EventDetail from '@/pages/Common/Event/EventDetail' -import ToggleView from '@/components/ToggleView' -import LineCharts from './LineCharts' -import Tabs from '@/components/Tabs'; -import { useEffect, useState } from 'react' -import { eventList } from '@/mock/event' -import services from '@/services' import Modal from '@/components/HncyModal'; +import Tabs from '@/components/Tabs'; +import ToggleView from '@/components/ToggleView'; +import BaseCard from '@/pages/Common/components/BaseCard'; +import EventPicList from '@/pages/Common/components/EventPicList'; +import ListView from '@/pages/Common/components/ListView'; +import ProcessCard from '@/pages/Common/components/ProcessCard'; +import EventDetail from '@/pages/Common/Event/EventDetail'; +import services from '@/services'; +import { Flex, Space } from 'antd'; +import { useEffect, useState } from 'react'; +import styles from './index.less'; +import LineCharts from './LineCharts'; interface CommonListProps { - type: string, - extra?: any + type: string; + extra?: any; } const CommonList = (props: CommonListProps) => { - - const { type, extra } = props + const { type, extra } = props; // 事件详情弹窗 const [detailModalOpt, setDetailModalOpt] = useState<{ @@ -31,24 +28,24 @@ const CommonList = (props: CommonListProps) => { }>({ open: false, title: '', - eventId: '' - }) + eventId: '', + }); // tabs内容 const defalutTabItems = [ { key: '1', - label: '全部' + label: '全部', }, { key: '2', - label: '处置中' + label: '处置中', }, { key: '3', - label: '已办结' - } - ] + label: '已办结', + }, + ]; // 视图 const [viewType, setViewType] = useState<'list' | 'pic'>('pic'); //展示 @@ -59,7 +56,7 @@ const CommonList = (props: CommonListProps) => { caseStatus: '', eventType: '', isDispose: '1', - } + }; //事件列表 const [listData, setListData] = useState({ @@ -70,13 +67,12 @@ const CommonList = (props: CommonListProps) => { hasNext: false, }); - const [fetchParams, setFetchParams] = useState(params) - - const [eventStatistics, setEventStatistics] = useState({}) - const [categoryStatistics, setCategoryStatistics] = useState([]) - const [areaStatistics, setAreaStatistics] = useState([]) - const [importEventStatistics, setImportEventStatistics] = useState([]) + const [fetchParams, setFetchParams] = useState(params); + const [eventStatistics, setEventStatistics] = useState({}); + const [categoryStatistics, setCategoryStatistics] = useState([]); + const [areaStatistics, setAreaStatistics] = useState([]); + const [importEventStatistics, setImportEventStatistics] = useState([]); // 获取左侧顶部事件相关统计 const getCityStatistics = () => { @@ -84,17 +80,17 @@ const CommonList = (props: CommonListProps) => { eventType: '', type: '', time: '', - singleType: "" + singleType: '', + }; + if (type !== '3') { + params.singleType = type; } - if(type !== '3') { - params.singleType = type - } - services.CityProblemApi.getContentStatisticsApi(params).then(res => { + services.CityProblemApi.getContentStatisticsApi(params).then((res) => { if (res.code === 200) { - setEventStatistics(res.data) + setEventStatistics(res.data); } - }) - } + }); + }; // 高发类别统计 const getCategoryAnalysis = (category = 'mainClass') => { @@ -103,22 +99,22 @@ const CommonList = (props: CommonListProps) => { type: '', time: '', top: 3, - singleType: "" - } - if(type !== '3') { - params.singleType = type + singleType: '', + }; + if (type !== '3') { + params.singleType = type; } - services.CityProblemApi.getCategoryTopAnalysisApi(params).then(res => { + services.CityProblemApi.getCategoryTopAnalysisApi(params).then((res) => { if (res.code === 200) { - setCategoryStatistics(res.data) + setCategoryStatistics(res.data); } - }) - } + }); + }; - const onChangeCategory = (value:string) => { - console.log('onChangeCategory', value) - getCategoryAnalysis(value) - } + const onChangeCategory = (value: string) => { + console.log('onChangeCategory', value); + getCategoryAnalysis(value); + }; // 高发类别统计 const getAreaAnalysis = () => { @@ -127,119 +123,128 @@ const CommonList = (props: CommonListProps) => { type: '', time: '', top: 3, - singleType: "" + singleType: '', + }; + if (type !== '3') { + params.singleType = type; } - if(type !== '3') { - params.singleType = type - } - services.CityProblemApi.getAreaDistribAnalysisApi(params).then(res => { + services.CityProblemApi.getAreaDistribAnalysisApi(params).then((res) => { if (res.code === 200) { - setAreaStatistics(res.data) + setAreaStatistics(res.data); } - }) - } + }); + }; // 事件列表 - const getEventsList = (caseStatus = '', isDispose = '', eventType = '', isOther = '', collectionModel = '') => { + const getEventsList = ( + caseStatus = '', + isDispose = '', + eventType = '', + isOther = '', + collectionModel = '', + ) => { const params = { page: 1, count: 10, - singleType: "", + singleType: '', caseStatus: caseStatus, isDispose: isDispose, eventType: eventType, isOther: isOther, - collectionModel - } - if(type !== '3') { - params.singleType = type + collectionModel, + }; + if (type !== '3') { + params.singleType = type; } - if(extra?.eventType) { - params.eventType = extra.eventType + if (extra?.eventType) { + params.eventType = extra.eventType; } - if(extra?.isOther) { - params.isOther = extra.isOther + if (extra?.isOther) { + params.isOther = extra.isOther; } - if(extra?.collectionModel) { - params.collectionModel = extra.collectionModel + if (extra?.collectionModel) { + params.collectionModel = extra.collectionModel; } services.CityProblemApi.getZzEventListApi(params).then((res) => { if (res.code === 200) { - setListData({ ...res.data, items: res.data.items }) + setListData({ ...res.data, items: res.data.items }); } - }) - } + }); + }; // 事件统计 const getImportEventStatistics = () => { const params = { - singleType: type - } - services.CityProblemApi.getImportEventStatisticsApi(params).then(res => { + singleType: type, + }; + services.CityProblemApi.getImportEventStatisticsApi(params).then((res) => { if (res.code === 200) { - const result = res.data.map(item => { + const result = res.data.map((item) => { return { label: `${item.case_status_name} ${item.total}`, - key: item.case_status - } - }) - setImportEventStatistics(result) - if(type === '3') { - getEventsList() + key: item.case_status, + }; + }); + setImportEventStatistics(result); + if (type === '3') { + getEventsList(); } else { - getEventsList(result[0]?.key) + getEventsList(result[0]?.key); } } - }) - } + }); + }; const changeListTab = (value: string) => { - console.log(value) - getEventsList(value) - } + console.log(value); + getEventsList(value); + }; const changeTab = (value: string) => { - if(value === '1') { - getEventsList() - } else if(value === '2') { - getEventsList('90') - }else if(value === '3') { - getEventsList('', '1') + if (value === '1') { + getEventsList(); + } else if (value === '2') { + getEventsList('90'); + } else if (value === '3') { + getEventsList('', '1'); } - } + }; useEffect(() => { - getCityStatistics() - getCategoryAnalysis() - getAreaAnalysis() - getImportEventStatistics() - },[]) + getCityStatistics(); + getCategoryAnalysis(); + getAreaAnalysis(); + getImportEventStatistics(); + }, []); return ( - - + - - + + - {eventStatistics.disposalNum} + + {eventStatistics.disposalNum} + 处置中 - + - {eventStatistics.caseClosedNum} + + {eventStatistics.caseClosedNum} + 已办结 - + {eventStatistics.ratio} % @@ -250,9 +255,9 @@ const CommonList = (props: CommonListProps) => {
@@ -261,34 +266,34 @@ const CommonList = (props: CommonListProps) => { } @@ -300,7 +305,7 @@ const CommonList = (props: CommonListProps) => { /> { />
- + - { - type === '3' ? : - - } - + {type === '3' ? ( + + ) : ( + + )} + setViewType(type)} /> @@ -324,10 +338,18 @@ const CommonList = (props: CommonListProps) => { listData={listData} listHeight={540} setParams={(data) => { - setFetchParams({ ...fetchParams, page: data.pageNum, count: data.pageSize }) + setFetchParams({ + ...fetchParams, + page: data.pageNum, + count: data.pageSize, + }); }} handleDetail={(details) => { - setDetailModalOpt({ open: true, title: '事件详情', eventId: details.eventId }) + setDetailModalOpt({ + open: true, + title: '事件详情', + eventId: details.eventId, + }); }} /> ) : ( @@ -335,10 +357,14 @@ const CommonList = (props: CommonListProps) => { listData={listData} listHeight={640} setParams={(data) => { - setFetchParams({ ...fetchParams, page: data.page }) + setFetchParams({ ...fetchParams, page: data.page }); }} handleDetail={(details) => { - setDetailModalOpt({ open: true, title: '事件详情', eventId: details.eventId }) + setDetailModalOpt({ + open: true, + title: '事件详情', + eventId: details.eventId, + }); }} /> )} @@ -346,14 +372,16 @@ const CommonList = (props: CommonListProps) => { setDetailModalOpt({ open: false, title: '', eventId: '' })} + onCancel={() => + setDetailModalOpt({ open: false, title: '', eventId: '' }) + } width={'fit-content'} height={950} > - ) -} + ); +}; -export default CommonList; \ No newline at end of file +export default CommonList; diff --git a/src/pages/IndustryOperation/components/Card/index.tsx b/src/pages/IndustryOperation/components/Card/index.tsx index 7d514d28298051f35f89ac6357d1c64c4da9bc01..9047e5b9c57889dd783ae6ddfba0e641ed09ded9 100644 --- a/src/pages/IndustryOperation/components/Card/index.tsx +++ b/src/pages/IndustryOperation/components/Card/index.tsx @@ -12,6 +12,11 @@ interface PropsType { const Card: React.FC> = (props) => { const { title, onMore, children, jumpSystem } = props; + + //跳转其他系统 + const jumpOtherSystem = (url: string) => { + window.open(url, '_blank'); + }; return (
@@ -29,7 +34,7 @@ const Card: React.FC> = (props) => { content={
{jumpSystem?.map((it) => ( - {it.name} + jumpOtherSystem(it.url)}>{it.name} ))}
}