xujunjie 1 年之前
父节点
当前提交
e08ad0aada

二进制
src/assets/message/warning.png


+ 43 - 3
src/pages/MessageCenter/index.js

@@ -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',

+ 5 - 2
src/pages/SafetyManagement/index.js

@@ -137,7 +137,7 @@ const Video = ({ data, dataOnline, loading, selected, setSelected }) => {
           className={item.Online ? styles.onlinePoint : styles.outlinePoint}
         />
         <span className={styles.name}>{item.Name}</span>
-        <div className={styles.redLight}></div>
+        {item.EventPath && <div className={styles.redLight}></div>}
       </div>
     );
   };
@@ -173,7 +173,10 @@ const Video = ({ data, dataOnline, loading, selected, setSelected }) => {
               <div
                 id={item.Name}
                 key={`video_${idx}`}
-                onClick={() => setSelected(idx, item.Name)}
+                onClick={() => {
+                  localStorage.preview = item.EventPath;
+                  setSelected(idx, item.Name);
+                }}
                 className={`card-box ${styles.listItem} ${
                   selected == item.Name || selected == idx ? 'card-select' : ''
                 }`}

+ 5 - 2
src/pages/Smart/OptimizationTasks.js

@@ -55,10 +55,12 @@ const Produce = ({ projectId }) => {
     },
     {
       title: '参数',
+      width: '50%',
       dataIndex: 'Title',
     },
     {
       title: '任务内容',
+      width: '24%',
       dataIndex: 'Content',
     },
   ];
@@ -169,7 +171,7 @@ const Produce = ({ projectId }) => {
             handleLoadData={(current) =>
               run({ project_id: projectId, currentPage: current, class: 1 })
             }
-            height="3rem"
+            height="4rem"
           >
             <Table
               rowKey={'id'}
@@ -205,6 +207,7 @@ const Cost = ({ projectId }) => {
     },
     {
       title: '参数',
+      width: '24%',
       dataIndex: 'Title',
     },
     {
@@ -323,7 +326,7 @@ const Cost = ({ projectId }) => {
           handleLoadData={(current) =>
             run({ project_id: projectId, currentPage: current, class: 2 })
           }
-          height="3rem"
+          height="4rem"
         >
           <Table
             rowKey={'id'}

+ 14 - 31
src/pages/Smart/components/EvaluationReport.js

@@ -1,6 +1,7 @@
-import {  Table, Tooltip } from 'antd';
+import { Table, Tooltip } from 'antd';
 import { useMemo } from 'react';
 import { current, indicators } from './mock';
+import styles from '../OptimizationTasks.less';
 // import styles from './WorkConditionAssessment.less';
 
 /**
@@ -38,7 +39,7 @@ const EvaluationReport = (props) => {
         indicator: '总结',
         delta1: (
           <div>
-            【2023年4月】 <span style={error}>异常</span>
+            【2024年1月】 <span style={error}>异常</span>
             <br />
             (1)生产安全评估: <span style={success}>正常</span>
             <br />
@@ -115,38 +116,20 @@ const EvaluationReport = (props) => {
         };
       },
     },
-  
   ];
   // return null
   return (
-    <div style={{ fontSize: 18, color: '#fff' }}>
-      <Table
-        columns={columns}
-        dataSource={dataSource}
-        pagination={false}
-        // footer={() => (
-        //   <>
-        //     <Table.Row>
-        //       <Table.Cell>总结</Table.Cell>
-        //       <Table.Cell colSpan={3}>
-        //         【2023年4月】异常 <br />
-        //         (1)生产安全评估:正常
-        //         <br />
-        //         实时工况与仿真、最优和标准工况对比皆在偏差范围内,正常
-        //         <br />
-        //         (2)经济评估:异常
-        //         <br />
-        //         实时工况电耗同比增长/下降 ,环比增长/下降 ; 与仿真、最优和标准工况对比
-        //         实施工况药耗同比增长/下降 ,环比增长/下降 ; 与仿真、最优和标准工况对比
-        //       </Table.Cell>
-        //     </Table.Row>
-        //     <Table.Row>
-        //       <Table.Cell>优化建议</Table.Cell>
-        //       <Table.Cell colSpan={3}>根据评估结果,我们建议检查...工艺段</Table.Cell>
-        //     </Table.Row>
-        //   </>
-        // )}
-      />
+    <div className={styles.pageCard}>
+      <h3 className={styles.title} style={{ justifyContent: 'space-between' }}>
+        <div>
+          <i />
+          评估报告
+        </div>
+      </h3>
+
+      <div style={{ fontSize: 18, color: '#fff' }}>
+        <Table columns={columns} dataSource={dataSource} pagination={false} />
+      </div>
     </div>
   );
 };

+ 13 - 1
src/services/safety.js

@@ -11,12 +11,24 @@ export async function queryGateOverView(params = {}) {
 }
 //视频列表
 export async function queryMonitorList(projectId) {
-  return request(`/api/v1/monitor/list/${projectId}`);
+  const res = await queryExceptionList(projectId);
+  const res2 = await request(`/api/v1/monitor/list/${projectId}`);
+  console.log(res, res2);
+  res2.data.list?.forEach((item) => {
+    let err = res.data.find((img) => img.device_name == item.Name);
+    item.EventPath = err?.path || '';
+    item.MandateId = Number('0');
+  });
+  return res2;
 }
 //视频状态
 export async function queryMonitorOnlineCount(projectId) {
   return request(`/api/v1/monitor/online_count/${projectId}`);
 }
+//视频状态
+export async function queryExceptionList(projectId) {
+  return request(`/api/v1/dumu/exception-list?project_id=${projectId}`);
+}
 export const checkPW = async (data) => {
   return await request(`/api/v1/user/check_automationPw`, {
     method: 'POST',