|
@@ -9,15 +9,24 @@ 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 [tab, setTab] = useState('2');
|
|
|
- //, msgType: 工况:11, 自检:12
|
|
|
+ //, 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,
|
|
@@ -26,7 +35,17 @@ const MessageCenter = () => {
|
|
|
|
|
|
const handleTabsChange = (tab) => {
|
|
|
setTab(tab);
|
|
|
- tab == '1' ? run() : runSelf();
|
|
|
+ switch (tab) {
|
|
|
+ case '1':
|
|
|
+ run();
|
|
|
+ break;
|
|
|
+ case '2':
|
|
|
+ runSelf();
|
|
|
+ break;
|
|
|
+ case '3':
|
|
|
+ runWarning();
|
|
|
+ break;
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const handleReadClick = () => {
|
|
@@ -47,10 +66,22 @@ const MessageCenter = () => {
|
|
|
const time = item?.CreatedOn
|
|
|
? dayjs(item.CreatedOn).format('YYYY-MM-DD HH:mm')
|
|
|
: '';
|
|
|
+ let icon = '';
|
|
|
+ switch (tab) {
|
|
|
+ case '1':
|
|
|
+ icon = icon1;
|
|
|
+ break;
|
|
|
+ case '2':
|
|
|
+ icon = icon2;
|
|
|
+ break;
|
|
|
+ case '3':
|
|
|
+ icon = icon3;
|
|
|
+ break;
|
|
|
+ }
|
|
|
return (
|
|
|
<div className={`card-box ${styles.itemContent}`}>
|
|
|
<div className={styles.left}>
|
|
|
- <img className={styles.img} src={tab == '1' ? icon1 : icon2} />
|
|
|
+ <img className={styles.img} src={icon} />
|
|
|
<div>
|
|
|
<div className={styles.text}>{item.MsgBody}</div>
|
|
|
<div className={styles.time}>{time}</div>
|
|
@@ -88,6 +119,15 @@ const MessageCenter = () => {
|
|
|
</Spin>
|
|
|
),
|
|
|
},
|
|
|
+ {
|
|
|
+ label: `预警数据`,
|
|
|
+ key: '3',
|
|
|
+ children: (
|
|
|
+ <Spin spinning={loadingWarning}>
|
|
|
+ {dataWarning?.list?.map((item) => renderItem(item))}
|
|
|
+ </Spin>
|
|
|
+ ),
|
|
|
+ },
|
|
|
{
|
|
|
label: `水厂工况`,
|
|
|
key: '1',
|