xujunjie 1 ano atrás
pai
commit
86bfd2b81a

+ 1 - 1
src/pages/SmartOps/WorkAnalysisDetail.js

@@ -439,7 +439,7 @@ const ChartContent = (props) => {
           defaultValue={time}
           // value={time}
           onChange={onSearch}
-          format="YYYY-MM-DD HH:mm:ss"
+          format="YYYY-MM-DD HH:mm"
         ></RangePicker>
         <div className={styles.dateTabs}>
           {DateTab.map((item) => (

+ 9 - 13
src/pages/SmartOps/index.js

@@ -15,7 +15,6 @@ import {
   useRequest,
   useSearchParams,
 } from '@umijs/max';
-import { Tabs } from 'antd';
 import dayjs from 'dayjs';
 import { useEffect, useMemo, useRef, useState } from 'react';
 import Analysis from './Analysis';
@@ -26,14 +25,10 @@ import styles from './index.less';
 import OperationManage from './operationManage';
 import PredictionAnalysis from './predictionAnalysis/PredictionAnalysis';
 
-const { TabPane } = Tabs;
-const icon06 = require('@/assets/smartOps/icon06.png');
-const icon07 = require('@/assets/smartOps/icon07.png');
-
 let timer = '';
 
 function SmartOps(props) {
-  const { list, dispatch, loading, loadingDev, autoReport } = props;
+  const { list, dispatch, loading, loadingDev, autoReport, active } = props;
 
   const navigate = useNavigate();
   const { projectId } = useParams();
@@ -42,7 +37,6 @@ function SmartOps(props) {
   const idList = searchParams.get('idList');
   const patrolId = searchParams.get('patrolId');
 
-  const [tab, setTab] = useState('1');
   const [videoNum, setVideoNum] = useState(0);
 
   const signalRef = useRef();
@@ -198,8 +192,6 @@ function SmartOps(props) {
 
   const AnalysisNumber = list?.pagenation?.total || 0;
 
-  const deviceNumber = autoReport?.extendWarningData?.length || 0;
-
   // 利润
   const { data: profitData, run: getProfit } = useRequest(
     () =>
@@ -227,7 +219,10 @@ function SmartOps(props) {
   }, [eTime]);
 
   const onChangeTab = (type) => {
-    setTab(type);
+    dispatch({
+      type: 'smartOps/save',
+      payload: { active: type },
+    });
     UnityAction.sendMsg('SmartAnalysisTab', type);
   };
 
@@ -245,7 +240,7 @@ function SmartOps(props) {
       console.log('--------10分钟刷新数据--------', eTime);
       timer = setInterval(() => {
         getReportData();
-      }, 60000);
+      }, 6000);
     }
 
     dispatch({
@@ -254,7 +249,7 @@ function SmartOps(props) {
     });
 
     // 通知unity当前处于工况分析
-    UnityAction.sendMsg('SmartAnalysisTab', 1);
+    UnityAction.sendMsg('SmartAnalysisTab', active);
 
     const controller = new AbortController();
     signalRef.current = controller;
@@ -332,7 +327,7 @@ function SmartOps(props) {
       </div>
       <div className={styles.tabContent}>
         <TabsContent
-          defaultActiveKey="1"
+          defaultActiveKey={active}
           center={false}
           spacing={2.5}
           small
@@ -402,6 +397,7 @@ export default connect(({ smartOps, eqSelfInspection, loading }) => ({
   list: smartOps.list,
   loading: loading.models.smartOps,
   processList: smartOps.processList,
+  active: smartOps.active,
   autoReport: eqSelfInspection.autoReport,
   loadingDev: loading.effects['eqSelfInspection/getPatrolDataById'],
 }))(SmartOps);

+ 1 - 0
src/pages/SmartOps/models/smartOps.js

@@ -8,6 +8,7 @@ export default {
 
   state: {
     list: [],
+    active: "1",
     processList: [],
   },