import PageContent from '@/components/PageContent'; import TabsContent from '@/components/TabsContent'; import { getNotificationList } from '@/services/message'; import { UnityAction } from '@/utils/utils'; import { useParams, useRequest, useSearchParams } from '@umijs/max'; import { Button, Spin } from 'antd'; import dayjs from 'dayjs'; import { useState } from 'react'; import styles from './index.less'; const icon1 = require('@/assets/message/work.png'); const icon2 = require('@/assets/message/check.png'); const icon3 = require('@/assets/message/warning.png'); const MessageCenter = () => { const { projectId } = useParams(); const [searchParams] = useSearchParams(); const [tab, setTab] = useState('2'); //, msgType: 工况:11, 自检:12, 预警:13 const { data, run, loading } = useRequest(() => getNotificationList({ projectId, msgType: 11 }, { manual: true }), ); const { data: dataWarning, run: runWarning, loading: loadingWarning, } = useRequest(() => getNotificationList({ projectId, msgType: 13 }, { manual: true }), ); const { data: dataSelf, run: runSelf, loading: loadingSelf, } = useRequest(() => getNotificationList({ projectId, msgType: 12 })); const handleTabsChange = (tab) => { setTab(tab); switch (tab) { case '1': run(); break; case '2': runSelf(); break; case '3': runWarning(); break; } }; const handleReadClick = () => { UnityAction.sendMsg('notiReadAll', ''); }; const handlerSeeClick = (item) => { if (tab === '1') { // if (item?.MandateId) { UnityAction.sendMsg('OpenTaskModal', `mandate_id=${item.MandateId}`); // } } else { UnityAction.sendMsg('notiZiJian', item.PatrolId); } }; const RenderContent = ({ loading, data, icon }) => { return (
{data?.map((item) => { const time = item?.CreatedOn ? dayjs(item.CreatedOn).format('YYYY-MM-DD HH:mm') : ''; return (
{item.MsgBody}
{time}
); })}
); }; return ( ), }, { label: `预警数据`, key: '3', children: ( ), }, { label: `水厂工况`, key: '1', children: ( ), }, ]} />
全部已读
); }; export default MessageCenter;