xujunjie 1 年之前
父节点
当前提交
80078cc615

+ 11 - 0
.eslintrc.js

@@ -1,3 +1,14 @@
 module.exports = {
   extends: require.resolve('@umijs/max/eslint'),
+  rules: {
+    'no-var': 0,
+    'vars-on-top': 0,
+    'spaced-comment': 0,
+    'no-else-return': 0,
+    'prefer-const': 0,
+    'eqeqeq': 0,
+    'comma-dangle': 0,
+    'prefer-destructuring': 0,
+    'jsx-a11y/iframe-has-title': 0,
+  }
 };

+ 11 - 7
src/pages/EqSelfInspection/components/Detail.js

@@ -114,7 +114,11 @@ function Detail(props) {
           </Row>
           <Row>
             {result.map((item, index) => (
-              <Col span={index == 0 ? 10 : 7} className={styles.cardText}>
+              <Col
+                span={index == 0 ? 10 : 7}
+                className={styles.cardText}
+                key={item.label}
+              >
                 {index == 0 && '自检结果:'}
                 {item.label}-
                 <span style={{ color: item.color }}>{item.value}</span>
@@ -128,7 +132,7 @@ function Detail(props) {
         onChange={(check) => {
           // 未勾选则认为全部显示
           if (check.length == 0) {
-            setStatusCheck([1, 2, 3]);
+            setStatusCheck([0, 1, 2]);
           } else {
             setStatusCheck(check);
           }
@@ -186,7 +190,7 @@ function DeviceReport(props) {
 
   // 子集全部隐藏的情况下,父级也隐藏
   const show = useMemo(() => {
-    let total = subStatus.reduce((item, total) => (total += item), 0);
+    let total = subStatus.reduce((item, total) => total + item, 0);
     return total > 0;
   }, [subStatus]);
 
@@ -257,7 +261,7 @@ function SecureReport(props) {
 
   // 子集全部隐藏的情况下,父级也隐藏
   const show = useMemo(() => {
-    let total = subStatus.reduce((item, total) => (total += item), 0);
+    let total = subStatus.reduce((item, total) => total + item, 0);
     return total > 0;
   }, [subStatus]);
 
@@ -282,7 +286,7 @@ function SecureReport(props) {
   });
   useEffect(() => {
     setDumuList(data?.dumuList);
-    data?.dumuList?.map((item) => {
+    data?.dumuList?.forEach((item) => {
       detailRun(item.id);
     });
   }, [data?.dumuList]);
@@ -353,8 +357,8 @@ function AalysisTable(props) {
         if (record.fix_plan instanceof Array) {
           return (
             <div>
-              {record.fix_plan.map((item) => (
-                <div style={{ lineHeight: 1.8 }}>
+              {record.fix_plan.map((item, index) => (
+                <div style={{ lineHeight: 1.8 }} key={index}>
                   {item.content}
                   <MandateBtn relationId={record.id} />
                 </div>

+ 2 - 0
src/pages/EqSelfInspection/index.js

@@ -7,6 +7,8 @@ import dayjs from 'dayjs';
 import { useEffect, useMemo, useState } from 'react';
 import styles from './index.less';
 
+const { Option } = Select;
+
 const EqSelfInspection = (props) => {
   const { dispatch, autoReport, patrolList, loading } = props;
   const { projectId } = useParams();

+ 15 - 1
src/pages/Home/index.js

@@ -190,6 +190,7 @@ const SelfInspection = connect(({ eqSelfInspection, loading }) => ({
 }))((props) => {
   const { autoReport, dispatch, loading } = props;
   const { projectId } = useParams();
+  var timer = null;
 
   const renderStatus = () => {
     if (loading) return <LoadingOutlined />;
@@ -207,13 +208,26 @@ const SelfInspection = connect(({ eqSelfInspection, loading }) => ({
     );
   };
 
-  useEffect(() => {
+  const getAutoData = () => {
     dispatch({
       type: 'eqSelfInspection/getAutoPatrol',
       payload: {
         projectId,
       },
     });
+    
+  };
+
+  useEffect(() => {
+    getAutoData();
+    timer = setInterval(() => {
+      getAutoData();
+    }, 60 * 1000);
+    console.log('timer start:', timer);
+    return () => {
+      console.log('timer clear:', timer);
+      clearInterval(timer);
+    };
   }, []);
 
   return (

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

@@ -1,6 +1,6 @@
 import PageContent from '@/components/PageContent';
 import TabsContent from '@/components/TabsContent';
-import { getNotificationList } from '@/services/message';
+import { getNotificationList, readNotification } from '@/services/message';
 import { UnityAction } from '@/utils/utils';
 import { useParams, useRequest, useSearchParams } from '@umijs/max';
 import { Button, Spin } from 'antd';
@@ -14,7 +14,7 @@ const icon3 = require('@/assets/message/warning.png');
 const MessageCenter = () => {
   const { projectId } = useParams();
   const [searchParams] = useSearchParams();
-  const [tab, setTab] = useState(searchParams.get('type') || '2');
+  const [tab, setTab] = useState(searchParams.get('type') || '1');
   //, msgType: 工况:11, 自检:12,  预警:13
   const { data, run, loading } = useRequest(() =>
     getNotificationList({ projectId, msgType: 11 }, { manual: true }),
@@ -54,12 +54,17 @@ const MessageCenter = () => {
   };
 
   const handlerSeeClick = (item) => {
+    readNotification(item.ID);
     if (tab === '3') {
       // if (item?.MandateId) {
       UnityAction.sendMsg('OpenTaskModal', `mandate_id=${item.MandateId}`);
+      run();
       // }
     } else if (tab == '1') {
       UnityAction.sendMsg('notiZiJian', item.PatrolId);
+      runSelf();
+    } else {
+      runWarning();
     }
   };
 
@@ -84,7 +89,7 @@ const MessageCenter = () => {
                 <div className={styles.right}>
                   <div
                     className={
-                      item?.ReadStatus ? styles.redPoint : styles.nonePoint
+                      item.ReadStatus === 0 ? styles.redPoint : styles.nonePoint
                     }
                   />
                   <Button

+ 2 - 2
src/pages/SmartOps/components/VideoAnalysis.js

@@ -490,7 +490,7 @@ function AllContent({ videoData = {}, selectedName, setSelectedName }) {
           scroll={{ y: 400 }}
         />
       </div> */}
-      <div className={styles.box}>
+      {/* <div className={styles.box}>
         <ModuleTitle title="视频识别" />
         <Table
           dataSource={dumu_list}
@@ -503,7 +503,7 @@ function AllContent({ videoData = {}, selectedName, setSelectedName }) {
           pagination={false}
           scroll={{ y: 400 }}
         />
-      </div>
+      </div> */}
     </div>
   );
 }

+ 3 - 2
src/pages/SmartOps/index.less

@@ -1,5 +1,5 @@
 .topContent {
-  padding: 0.08rem 0.12rem;
+  padding: 0.16rem 0.12rem;
   margin: 0.16rem 0;
   color: #1c50b3;
   font-size: 0.26rem;
@@ -10,6 +10,7 @@
     .time {
       // font-size: 0.2rem;
       color: #6e6e6e;
+      margin-left: 0.14rem;
     }
     .iconLeft {
       width: 0.38rem;
@@ -20,12 +21,12 @@
     .iconRight {
       .iconLeft;
       margin-left: 0.2rem;
+      margin-right: 0.14rem;
       background: url('@/assets/smartOps/icon07.png') no-repeat center;
       background-size: 100% 100%;
     }
   }
   .overview {
-    margin: 0.1rem 0;
     display: flex;
     align-items: center;
     justify-content: center;

+ 5 - 1
src/pages/SmartOps/operationManage/CostAnalysis/CostAnalysis.js

@@ -150,7 +150,11 @@ const CostAnalysis = () => {
       <div>
         <SubTitle title={'数据曲线'} fontSize="0.26rem" />
         <div className={styles.timeBtn}>
-          <RangePicker inputReadOnly onChange={handleTimeRangeChange} />
+          <RangePicker
+            inputReadOnly
+            onChange={handleTimeRangeChange}
+            style={{ width: '4rem' }}
+          />
           <Button
             type="primary"
             shape="round"

+ 10 - 0
src/services/message.js

@@ -10,6 +10,16 @@ import { request } from 'umi';
 export async function getNotificationList(params) {
   return request(`/api/v1/notification/list?${stringify(params)}`);
 }
+/**
+ * 消息推送
+ * @param {number} messageId 消息ID
+ * @returns
+ */
+export async function readNotification(messageId) {
+  return request(`/api/v1/notification/read/${messageId}`,{
+    method: "PUT"
+  });
+}
 
 /**
  * 待办事项