Quellcode durchsuchen

Merge branch 'develop' of http://120.55.44.4:10080/xujunjie/gt_client_pad into develop

xujunjie vor 1 Jahr
Ursprung
Commit
7ad2f8bd13

+ 1 - 1
.umirc.ts

@@ -30,7 +30,7 @@ export default defineConfig({
       // target: 'http://47.96.12.136:8888/',
       target: 'http://47.96.12.136:8788/',
       // target: 'http://120.55.44.4:8903/',
-      // target: 'https://work.greentech.com.cn/',
+      //target: 'https://metawant.greentech.com.cn/',
       changeOrigin: true,
     },
   },

+ 36 - 1
src/models/eqSelfInspection.js

@@ -1,9 +1,12 @@
+import dayjs from 'dayjs';
+
 import {
   analysisResultList,
   getAutoPatrolByRouteId,
   getPatrolDumuList,
   getPatrolRecordMandateInfo,
   getRecentAutoPatrolByRouteId,
+  getRecentGaugeRecord,
   getRouteList,
   patrolRelationList,
   queryAnalysisDict,
@@ -45,6 +48,10 @@ export default {
       const { data } = yield call(queryPatrolRecord, {
         recordId: payload.routeId,
       });
+      const recentGaugeRecord = yield call(getRecentGaugeRecord, {
+        project_id: payload.projectId,
+        e_time: payload.eTime || dayjs().format('YYYY-MM-DD HH:mm:ss'),
+      });
       if (data) {
         const cacheData = yield select(
           (state) => state.eqSelfInspection.autoReport,
@@ -242,12 +249,40 @@ export default {
           sensorStatus = 1;
         }
         secureChild.push({ label: '环境检测', status: sensorStatus });
-        secureChild.push({ label: '电气检测', status: 0 });
+        // secureChild.push({ label: '电气检测', status: 0 });
         secureChild.push({ label: '密闭空间检测', status: 0 });
 
         data.secureChild = secureChild;
 
         callback?.(data);
+
+        if (recentGaugeRecord.code === 200) {
+          data.DrugFlowList = [
+            ...data.DrugFlowList,
+            ...recentGaugeRecord.data.DrugFlowList.map((item) => {
+              return { ...item, history: true };
+            }),
+          ];
+          data.FluidLevelList = [
+            ...data.FluidLevelList,
+            ...recentGaugeRecord.data.FluidLevelList.map((item) => {
+              return { ...item, history: true };
+            }),
+          ];
+          data.PressureCompareList = [
+            ...data.PressureCompareList,
+            ...recentGaugeRecord.data.PressureCompareList.map((item) => {
+              return { ...item, history: true };
+            }),
+          ];
+          data.WaterQualityCompareList = [
+            ...data.WaterQualityCompareList,
+            ...recentGaugeRecord.data.WaterQualityCompareList.map((item) => {
+              return { ...item, history: true };
+            }),
+          ];
+        }
+
         yield put({
           type: 'save',
           payload: { autoReport: data },

+ 1 - 1
src/pages/Center/MyTask/Detail/workOrderDetail.less

@@ -34,7 +34,7 @@
       > .ant-steps-item
       .ant-steps-item-description {
       padding-bottom: 0;
-      padding-top: 0.18rem;
+      // padding-top: 0.18rem;
     }
   }
 }

+ 59 - 38
src/pages/EqSelfInspection/List/index.js

@@ -1,74 +1,95 @@
 import PageContent from '@/components/PageContent';
 import PageTitle from '@/components/PageTitle';
+import ScrollLoading from '@/components/ScrollLoading';
 import { GetTokenFromUrl, UnityAction } from '@/utils/utils';
 import { connect, history, useParams } from '@umijs/max';
 import dayjs from 'dayjs';
-import { useEffect } from 'react';
+import { useEffect, useState } from 'react';
 import styles from './index.less';
 
 function List(props) {
-  const { loading, list, processList = [], dispatch } = props;
-
+  const { loading, processList = [], dispatch } = props;
   const { projectId } = useParams();
+  const [list, setList] = useState([]);
+  const [curPagination, setCurPagination] = useState({
+    pageSize: 50,
+    currentPage: 1,
+  });
+
+  const defaultParam = {
+    projectId: projectId,
+    auto: 1,
+    startDate: dayjs().subtract(10, 'day').format('YYYY-MM-DD 00:00:00'),
+    endDate: dayjs().format('YYYY-MM-DD 23:59:59'),
+    pageSize: 50,
+    currentPage: 1,
+  };
 
   const goToDetail = (record) => {
     UnityAction.sendMsg('reportDetail', '');
     history.push(
       `/self-inspection/detail/${projectId}/${
         record.Id
-      }?JWT-TOKEN=${GetTokenFromUrl()}`,
+      }?JWT-TOKEN=${GetTokenFromUrl()}&eTime=${record.CreatedTime}`,
     );
   };
 
   useEffect(() => {
-    let params = {};
-    params.projectId = projectId;
-    params.auto = 1;
-    params.startDate = dayjs()
-      .subtract(10, 'day')
-      .format('YYYY-MM-DD 00:00:00');
-    params.endDate = dayjs().format('YYYY-MM-DD 23:59:59');
-    params.pageSize = 100;
-    params.currentPage = 1;
+    queryData(1);
+  }, []);
+
+  const queryData = (currentPage) => {
+    const params = { ...defaultParam, currentPage };
     dispatch({
       type: 'patrolArtificialRecord/queryPatrol',
       payload: params,
+      callback: (data) => {
+        setList([...list, ...data.list]);
+        setCurPagination(data.pagination);
+      },
     });
-  }, []);
+  };
   return (
     <PageContent closeable={false}>
       <PageTitle returnable>自检记录</PageTitle>
-      <div className={`content-title ${styles.list}`}>
-        {list.map((item) => (
-          <div className={styles.item} onClick={() => goToDetail(item)}>
-            {item.Status == 0 ? (
-              <div className={`${styles.status}`}>正常</div>
-            ) : (
-              <div className={`${styles.status} ${styles.statusError}`}>
-                异常
-              </div>
-            )}
-            <div className={styles.info}>
-              <div className={styles.time}>
-                <i></i>自检时间:{dayjs(item.CreatedTime).format('MM-DD HH:mm')}
-              </div>
-              <div className={styles.desc}>
-                <i></i>
-                发现异常
-                <span className={styles.number}>{item.Status}</span>
-                <span>项</span>
+      <ScrollLoading
+        loading={loading}
+        pagination={curPagination}
+        handleLoadData={queryData}
+      >
+        <div>
+          {list.map((item) => (
+            <div className={styles.item} onClick={() => goToDetail(item)}>
+              {item.Status == 0 ? (
+                <div className={`${styles.status}`}>正常</div>
+              ) : (
+                <div className={`${styles.status} ${styles.statusError}`}>
+                  异常
+                </div>
+              )}
+              <div className={styles.info}>
+                <div className={styles.time}>
+                  <i></i>自检时间:
+                  {dayjs(item.CreatedTime).format('MM-DD HH:mm')}
+                </div>
+                <div className={styles.desc}>
+                  <i></i>
+                  发现异常
+                  <span className={styles.number}>{item.Status}</span>
+                  <span>项</span>
+                </div>
               </div>
+              <div className={styles.btn}></div>
             </div>
-            <div className={styles.btn}></div>
-          </div>
-        ))}
-      </div>
+          ))}
+        </div>
+      </ScrollLoading>
     </PageContent>
   );
 }
 
 export default connect(({ patrolArtificialRecord, loading }) => ({
-  list: patrolArtificialRecord.list,
+  // list: patrolArtificialRecord.list,
   routeInfoList: patrolArtificialRecord.routeInfoList,
   loading: loading.models.patrolArtificialRecord,
   processList: patrolArtificialRecord.processList,

+ 62 - 65
src/pages/EqSelfInspection/List/index.less

@@ -1,70 +1,67 @@
-.list {
-  margin-top: 0.4rem;
-  .item {
-    padding: 0.28rem 0.75rem 0.28rem 1.24rem;
-    display: flex;
-    justify-content: space-between;
-    margin-bottom: 0.18rem;
-    background: #ffffff;
-    box-shadow: 0rem 0rem 0.08rem 0.14rem rgba(0, 0, 0, 0.03);
-    border-radius: 0.12rem;
-    align-items: center;
-  }
-  .status {
-    width: 1.34rem;
-    height: 1.34rem;
-    font-size: 0.32rem;
-    font-weight: 400;
-    color: #000000;
-    text-align: center;
-    line-height: 1.34rem;
-    background: url('@/assets/circle-success.png') no-repeat center;
-    background-size: 100% 100%;
-  }
-  .statusError {
-    background-image: url('@/assets/circle-error.png');
-  }
-  .info {
-    flex: 1;
-    padding-left: 1rem;
-    i {
-      width: 0.14rem;
-      height: 0.14rem;
-      display: inline-block;
-      vertical-align: middle;
-      border-radius: 50%;
-      margin-right: 0.14rem;
-      background-color: rgba(74, 144, 226, 1);
-    }
+.item {
+  padding: 0.28rem 0.75rem 0.28rem 1.24rem;
+  display: flex;
+  justify-content: space-between;
+  margin-bottom: 0.18rem;
+  background: #ffffff;
+  box-shadow: 0rem 0rem 0.08rem 0.14rem rgba(0, 0, 0, 0.03);
+  border-radius: 0.12rem;
+  align-items: center;
+}
+.status {
+  width: 1.34rem;
+  height: 1.34rem;
+  font-size: 0.32rem;
+  font-weight: 400;
+  color: #000000;
+  text-align: center;
+  line-height: 1.34rem;
+  background: url('@/assets/circle-success.png') no-repeat center;
+  background-size: 100% 100%;
+}
+.statusError {
+  background-image: url('@/assets/circle-error.png');
+}
+.info {
+  flex: 1;
+  padding-left: 1rem;
+  i {
+    width: 0.14rem;
+    height: 0.14rem;
+    display: inline-block;
+    vertical-align: middle;
+    border-radius: 50%;
+    margin-right: 0.14rem;
+    background-color: rgba(74, 144, 226, 1);
   }
-  .time {
-    font-size: 0.24rem;
-    font-weight: 400;
-    color: #4a4a4a;
-    line-height: 0.34rem;
+}
+.time {
+  font-size: 0.24rem;
+  font-weight: 400;
+  color: #4a4a4a;
+  line-height: 0.34rem;
+}
+.desc {
+  font-size: 0.32rem;
+  font-weight: 400;
+  color: #4a4a4a;
+  line-height: 0.44rem;
+  .number {
+    font-size: 0.54rem;
+    font-weight: 500;
+    color: #f5a623;
+    line-height: 0.76rem;
+    margin-left: 0.12rem;
   }
-  .desc {
-    font-size: 0.32rem;
-    font-weight: 400;
-    color: #4a4a4a;
-    line-height: 0.44rem;
-    .number {
-      font-size: 0.54rem;
-      font-weight: 500;
-      color: #f5a623;
-      line-height: 0.76rem;
-      margin-left: 0.12rem;
-    }
 
-    span {
-      font-size: 0.28rem;
-      color: #000000;
-    }
-  }
-  .btn {
-    width: 0.23rem;
-    height: 0.35rem;
-    background: url('@/assets/arr-right.png') no-repeat center;
-    background-size: 100% 100%;
+  span {
+    font-size: 0.28rem;
+    color: #000000;
   }
 }
+.btn {
+  width: 0.23rem;
+  height: 0.35rem;
+  background: url('@/assets/arr-right.png') no-repeat center;
+  background-size: 100% 100%;
+}

+ 5 - 1
src/pages/EqSelfInspection/ReportDetail.js

@@ -1,6 +1,6 @@
 import PageContent from '@/components/PageContent';
 import PageTitle from '@/components/PageTitle';
-import { connect, useParams } from '@umijs/max';
+import { connect, useLocation, useParams } from '@umijs/max';
 import { useEffect } from 'react';
 import Detail from './components/Detail';
 
@@ -8,12 +8,16 @@ const ReportDetail = (props) => {
   const { data, dispatch, loading } = props;
 
   const { projectId, routeId } = useParams();
+  const eTime = new URLSearchParams(useLocation()?.search)?.get('eTime');
+
   useEffect(() => {
     if (routeId) {
       dispatch({
         type: 'eqSelfInspection/getPatrolDataById',
         payload: {
           routeId,
+          projectId,
+          eTime,
         },
       });
     }

+ 73 - 36
src/pages/EqSelfInspection/components/Detail.js

@@ -233,7 +233,7 @@ function Detail(props) {
           <ReportDumCom data={dumuList} title={'安防检测异常'} />
 
           {/* 电器检测异常 */}
-          <ReportCom
+          {/* <ReportCom
             sendMessageToUnity={sendMessageToUnity}
             select={select}
             waringData={[]}
@@ -242,7 +242,7 @@ function Detail(props) {
             type={'extend'}
             userList={userList}
             title={'电气检测异常'}
-          ></ReportCom>
+          ></ReportCom> */}
 
           {/* 密闭空间检测异常 */}
           <ReportCom
@@ -272,6 +272,7 @@ export function DeviceTable(props) {
     userList,
     type,
   } = props;
+  console.log(items);
   const { ProjectId, Id } = data;
   const [loading, setLoading] = useState(false);
   const [visible, setVisible] = useState(false);
@@ -289,7 +290,7 @@ export function DeviceTable(props) {
   };
   const handleError = async (values) => {
     setLoading(true);
-    var res = await changeRecordStatus({
+    let res = await changeRecordStatus({
       ...values,
       Id: currentItem.Id,
       DeviceCode: currentItem.DeviceCode,
@@ -311,7 +312,8 @@ export function DeviceTable(props) {
     },
     {
       title: '巡检项',
-      dataIndex: 'TemplateItem.Name',
+      key: 'TemplateItem.Name',
+      dataIndex: ['TemplateItem', 'Name'],
     },
     // {
     //   title: '设备位号',
@@ -626,22 +628,13 @@ export function WarningTable(props) {
     },
     {
       title: '巡检项',
-      dataIndex: 'TemplateItem.Name',
+      dataIndex: ['TemplateItem', 'Name'],
     },
-    // {
-    //   title: '设备位号',
-    //   width: '16%',
-    //   dataIndex: 'DeviceCode',
-    // },
     {
       title: '设定值范围',
       width: '30%',
       render: (record) => (
-        <ThresholdDetail
-          current={record.Value || 0}
-          data={record || {}}
-          // onClick={() => onClickThreshold(record)}
-        />
+        <ThresholdDetail current={record.Value || 0} data={record || {}} />
       ),
     },
     {
@@ -818,9 +811,19 @@ export function LiquidTable(props) {
   const columns = [
     {
       title: '设备名称',
-      width: '20%',
+      width: '12%',
       dataIndex: 'device_name',
     },
+    {
+      title: '时间',
+      dataIndex: 'record_time',
+      render: (text) => {
+        if (text) {
+          return dayjs(text).format('YYYY.MM.DD HH:mm');
+        }
+        return '-';
+      },
+    },
     {
       title: '类型',
       key: 'template_item_name',
@@ -831,12 +834,12 @@ export function LiquidTable(props) {
       dataIndex: 'origin_value',
     },
     {
-      title: '差值',
+      title: '差值/比值',
       dataIndex: 'value',
     },
     {
       title: '设定值范围',
-      width: '25%',
+      width: '18%',
       render: (record) => (
         <ThresholdDetail
           current={record.value || 0}
@@ -913,7 +916,7 @@ function LiquidLevelCom(props) {
   const [activeKey, setActiveKey] = useState('1');
 
   const errorData = useMemo(() => {
-    const errorData = allData?.filter((item) => item.status);
+    const errorData = allData?.filter((item) => item.status && !item.history);
     return errorData;
   }, [allData]);
 
@@ -936,14 +939,14 @@ function LiquidLevelCom(props) {
             },
             {
               key: '2',
-              label: `全部(${allData?.length || 0})`,
+              label: `历史记录(${allData?.length || 0})`,
               children: <div></div>,
             },
           ]}
         ></TabsContent>
       </div>
 
-      {activeKey == '1' && (
+      {activeKey === '1' && (
         <LiquidTable
           onClickItem={sendMessageToUnity}
           select={select}
@@ -952,7 +955,7 @@ function LiquidLevelCom(props) {
           type={type}
         />
       )}
-      {activeKey == '2' && (
+      {activeKey === '2' && (
         <LiquidTable
           onClickItem={sendMessageToUnity}
           select={select}
@@ -970,12 +973,22 @@ function DosingFlowTable(props) {
   const columns = [
     {
       title: '设备名称',
-      width: '20%',
+      width: '12%',
       dataIndex: 'device_name',
     },
+    {
+      title: '时间',
+      dataIndex: 'record_time',
+      render: (text) => {
+        if (text) {
+          return dayjs(text).format('YYYY.MM.DD HH:mm');
+        }
+        return '-';
+      },
+    },
     {
       title: '类型',
-      width: '1rem',
+      width: '15%',
       key: 'template_item_name',
       dataIndex: 'template_item_name',
     },
@@ -993,7 +1006,7 @@ function DosingFlowTable(props) {
     },
     {
       title: '设定值范围',
-      width: '20%',
+      width: '18%',
       render: (record) => (
         <ThresholdDetail
           current={record.value || 0}
@@ -1007,7 +1020,7 @@ function DosingFlowTable(props) {
     {
       title: '状态',
       dataIndex: 'status',
-      width: '1.25rem',
+      width: '20%',
       render: (status) => {
         switch (status) {
           case -1:
@@ -1072,7 +1085,7 @@ function DosingFlowCom(props) {
   const [activeKey, setActiveKey] = useState('1');
 
   const errorData = useMemo(() => {
-    const errorData = allData?.filter((item) => item.status);
+    const errorData = allData?.filter((item) => item.status && !item.history);
     return errorData;
   }, [allData]);
 
@@ -1095,7 +1108,7 @@ function DosingFlowCom(props) {
             },
             {
               key: '2',
-              label: `全部(${allData?.length || 0})`,
+              label: `历史记录(${allData?.length || 0})`,
               children: <div></div>,
             },
           ]}
@@ -1408,10 +1421,10 @@ function PressureGaugeTable(props) {
 
 function PressureGaugeCom(props) {
   const { sendMessageToUnity, select, allData = [], title } = props;
-  const [activeKey, setActiveKey] = useState('2');
+  const [activeKey, setActiveKey] = useState('1');
 
   const errorData = useMemo(() => {
-    const tempData = allData?.filter((item) => item.status);
+    const tempData = allData?.filter((item) => !item.history);
     return tempData;
   }, [allData]);
 
@@ -1423,18 +1436,30 @@ function PressureGaugeCom(props) {
       <div className={styles.tableTop}>
         {title}
         <TabsContent
-          defaultActiveKey="2"
+          defaultActiveKey="1"
           onChange={handleTabsChange}
           small
           items={[
+            {
+              key: '1',
+              label: `异常/警告(${errorData?.length || 0})`,
+              children: <div></div>,
+            },
             {
               key: '2',
-              label: `异常/警告(${allData?.length || 0})`,
+              label: `历史记录(${allData?.length || 0})`,
               children: <div></div>,
             },
           ]}
         ></TabsContent>
       </div>
+      {activeKey === '1' && (
+        <PressureGaugeTable
+          onClickItem={sendMessageToUnity}
+          select={select}
+          items={errorData}
+        />
+      )}
       {activeKey === '2' && (
         <PressureGaugeTable
           onClickItem={sendMessageToUnity}
@@ -1570,10 +1595,10 @@ function WaterQualityTable(props) {
 
 function WaterQualityCom(props) {
   const { sendMessageToUnity, select, allData = [], title } = props;
-  const [activeKey, setActiveKey] = useState('2');
+  const [activeKey, setActiveKey] = useState('1');
 
   const errorData = useMemo(() => {
-    const tempData = allData?.filter((item) => item.status);
+    const tempData = allData?.filter((item) => !item.history);
     return tempData;
   }, [allData]);
 
@@ -1585,18 +1610,30 @@ function WaterQualityCom(props) {
       <div className={styles.tableTop}>
         {title}
         <TabsContent
-          defaultActiveKey="2"
+          defaultActiveKey="1"
           onChange={handleTabsChange}
           small
           items={[
+            {
+              key: '1',
+              label: `异常/警告(${errorData?.length || 0})`,
+              children: <div></div>,
+            },
             {
               key: '2',
-              label: `异常/警告(${allData?.length || 0})`,
+              label: `历史记录(${allData?.length || 0})`,
               children: <div></div>,
             },
           ]}
         ></TabsContent>
       </div>
+      {activeKey === '1' && (
+        <WaterQualityTable
+          onClickItem={sendMessageToUnity}
+          select={select}
+          items={errorData}
+        />
+      )}
       {activeKey === '2' && (
         <WaterQualityTable
           onClickItem={sendMessageToUnity}

+ 9 - 9
src/pages/EqSelfInspection/index.js

@@ -97,15 +97,14 @@ const EqSelfInspection = (props) => {
       `/self-inspection/detail/${projectId}/${id}?JWT-TOKEN=${GetTokenFromUrl()}`,
     );
   };
-
-  // useEffect(() => {
-  //   UnityAction.on('notiZiJian', (id) => {
-  //     handleJumpDetail(id);
-  //   });
-  //   //自检页面加载完毕
-  //   UnityAction.sendMsg('pageInited');
-  //   return () => UnityAction.off('notiZiJian');
-  // }, []);
+  useEffect(() => {
+    UnityAction.on('notiZiJian', (id) => {
+      if (id) handleJumpDetail(id);
+    });
+    //自检页面加载完毕
+    UnityAction.sendMsg('pageInited');
+    return () => UnityAction.off('notiZiJian');
+  }, []);
 
   useEffect(() => {
     if (routeId) {
@@ -113,6 +112,7 @@ const EqSelfInspection = (props) => {
         type: 'eqSelfInspection/getPatrolDataById',
         payload: {
           routeId: routeId,
+          projectId,
         },
       });
     } else {

+ 5 - 10
src/pages/Home/ChemCostComparison.js

@@ -84,17 +84,12 @@ const CostComparison = (props) => {
     // 大于100,保留一位
     // 大于1000,不保留
     let fixed = 0;
+    if (maxValue === 0) return fixed;
     if (maxValue < 1) {
-      const decimal = maxValue.toFixed(100).toString().split('.')[1];
-      const decimalArr = decimal.split('');
-      for (let index = 0; index < decimalArr.length; index++) {
-        if (decimalArr[index] === '0') {
-          fixed++;
-        } else {
-          break;
-        }
-      }
-      fixed += 2;
+      //maxValue + 1 防止maxValue过小自动转科学计数法
+      const decimal = (maxValue + 1).toString().split('.')[1];
+      const num = decimal.split('').findIndex((num) => num > 0);
+      fixed = num + 3;
     } else if (maxValue < 10) {
       fixed = 3;
     } else if (maxValue < 100) {

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

@@ -323,6 +323,7 @@ const Scada = () => {
               height: '279px',
               borderRadius: '0 0 44px 0',
             }}
+            frameborder="0"
             src={url}
           />
         ))}

+ 2 - 2
src/pages/Home/index.less

@@ -190,8 +190,8 @@
     margin-top: 10px;
   }
   .circle {
-    width: 178px;
-    height: 178px;
+    width: 210px;
+    height: 210px;
     text-align: center;
     display: flex;
     flex-direction: column;

+ 1 - 1
src/pages/MessageCenter/index.js

@@ -39,7 +39,7 @@ const MessageCenter = () => {
       UnityAction.sendMsg('OpenTaskModal', `mandate_id=${item.MandateId}`);
       // }
     } else {
-      UnityAction.sendMsg('notiZiJian', item.ID);
+      UnityAction.sendMsg('notiZiJian', item.PatrolId);
     }
   };
 

+ 0 - 5
src/pages/SmartOps/ChartPage.js

@@ -136,11 +136,6 @@ const ChartPage = (props) => {
     const options = {
       yName: '',
       xData: data.length > 0 && data[0]?.map((item) => item.htime_at),
-      legend: {
-        textStyle: {
-          color: '#ffffff',
-        },
-      },
       dataList: data?.map((item) => {
         return {
           type: 0,

+ 74 - 22
src/pages/SmartOps/components/DeviceAnalysis.js

@@ -114,14 +114,20 @@ const DeviceAnalysis = (props) => {
         type: '1',
         data: autoReport?.extendWarningData,
         FluidLevelList: autoReport?.FluidLevelList?.filter(
-          (item) => item.status,
+          (item) => item.status && !item.history,
+        ),
+        DrugFlowList: autoReport?.DrugFlowList?.filter(
+          (item) => item.status && !item.history,
         ),
-        DrugFlowList: autoReport?.DrugFlowList?.filter((item) => item.status),
         WaterInCheckList: autoReport?.WaterInCheckList?.filter(
           (item) => item.status,
         ),
-        PressureCompareList: autoReport?.PressureCompareList,
-        WaterQualityCompareList: autoReport?.WaterQualityCompareList,
+        PressureCompareList: autoReport?.PressureCompareList.filter(
+          (item) => !item.history,
+        ),
+        WaterQualityCompareList: autoReport?.WaterQualityCompareList.filter(
+          (item) => !item.history,
+        ),
       },
       {
         name: '全部',
@@ -166,6 +172,16 @@ const DeviceAnalysis = (props) => {
     }
   };
 
+  const calculateLength = (params) => {
+    let length = 0;
+    Object.keys(params).forEach((key) => {
+      if (key !== 'name' && key !== 'type') {
+        length += params[key]?.length;
+      }
+    });
+    return length;
+  };
+
   return (
     <Spin spinning={loading}>
       <div style={{ height: 'calc(100vh - 5.6rem)', overflow: 'auto' }}>
@@ -175,7 +191,7 @@ const DeviceAnalysis = (props) => {
           defaultActiveKey="1"
           items={data?.map((item) => {
             return {
-              label: `${item.name}(${item.data?.length || 0})`,
+              label: `${item.name}(${calculateLength(item) || 0})`,
               key: item.type,
               children: (
                 <>
@@ -197,22 +213,40 @@ const DeviceAnalysis = (props) => {
                   )}
                   {(item.type === '1'
                     ? item?.FluidLevelList.length > 0
-                    : true) && <LiquidLevel allData={item?.FluidLevelList} />}
+                    : true) && (
+                    <LiquidLevel
+                      allData={item?.FluidLevelList}
+                      type={item.type}
+                    />
+                  )}
                   {(item.type === '1'
                     ? item?.DrugFlowList.length > 0
-                    : true) && <DosingFlow allData={item?.DrugFlowList} />}
+                    : true) && (
+                    <DosingFlow allData={item?.DrugFlowList} type={item.type} />
+                  )}
                   {(item.type === '1'
                     ? item?.WaterInCheckList.length > 0
-                    : true) && <WaterFlow allData={item?.WaterInCheckList} />}
+                    : true) && (
+                    <WaterFlow
+                      allData={item?.WaterInCheckList}
+                      type={item.type}
+                    />
+                  )}
                   {(item.type === '1'
                     ? item?.PressureCompareList.length > 0
                     : true) && (
-                    <PressureGauge allData={item?.PressureCompareList} />
+                    <PressureGauge
+                      allData={item?.PressureCompareList}
+                      type={item.type}
+                    />
                   )}
                   {(item.type === '1'
                     ? item?.WaterQualityCompareList.length > 0
                     : true) && (
-                    <WaterQuality allData={item?.WaterQualityCompareList} />
+                    <WaterQuality
+                      allData={item?.WaterQualityCompareList}
+                      type={item.type}
+                    />
                   )}
                 </>
               ),
@@ -230,14 +264,23 @@ export default connect(({ eqSelfInspection, loading }) => ({
 }))(DeviceAnalysis);
 
 const LiquidLevel = (props) => {
-  const { allData } = props;
+  const { allData, type } = props;
 
   const columns = [
     {
       title: '设备名称',
-      width: '20%',
+      width: '14%',
       dataIndex: 'device_name',
     },
+    {
+      title: '时间',
+      dataIndex: 'record_time',
+      render: (text) => {
+        if (text) {
+          return dayjs(text).format('YYYY.MM.DD HH:mm');
+        }
+      },
+    },
     {
       title: '类型',
       key: 'template_item_name',
@@ -253,7 +296,7 @@ const LiquidLevel = (props) => {
     },
     {
       title: '设定值范围',
-      width: '25%',
+      width: '20%',
       render: (record) => (
         <ThresholdDetail
           current={record.value || 0}
@@ -318,21 +361,30 @@ const LiquidLevel = (props) => {
 
   return (
     <div>
-      <ModuleTitle title="液位检测" />
+      <ModuleTitle title={`液位检测${type === '1' ? '' : '(历史记录)'}`} />
       <Table dataSource={allData} columns={columns} />
     </div>
   );
 };
 
 const DosingFlow = (props) => {
-  const { allData } = props;
+  const { allData, type } = props;
 
   const columns = [
     {
       title: '设备名称',
-      width: '15%',
+      width: '14%',
       dataIndex: 'device_name',
     },
+    {
+      title: '时间',
+      dataIndex: 'record_time',
+      render: (text) => {
+        if (text) {
+          return dayjs(text).format('YYYY.MM.DD HH:mm');
+        }
+      },
+    },
     {
       title: '类型',
       key: 'template_item_name',
@@ -416,14 +468,14 @@ const DosingFlow = (props) => {
   ];
   return (
     <div>
-      <ModuleTitle title="加药流量校验" />
+      <ModuleTitle title={`加药流量校验${type === '1' ? '' : '(历史记录)'}`} />
       <Table dataSource={allData} columns={columns} />
     </div>
   );
 };
 
 const WaterFlow = (props) => {
-  const { allData } = props;
+  const { allData, type } = props;
   const columns = [
     {
       title: '设备名称',
@@ -534,7 +586,7 @@ const WaterFlow = (props) => {
 };
 
 const PressureGauge = (props) => {
-  const { allData } = props;
+  const { allData, type } = props;
 
   const columns = [
     {
@@ -644,14 +696,14 @@ const PressureGauge = (props) => {
 
   return (
     <div>
-      <ModuleTitle title="压力仪表校验" />
+      <ModuleTitle title={`压力仪表校验${type === '1' ? '' : '(历史记录)'}`} />
       <Table dataSource={allData} columns={columns} />
     </div>
   );
 };
 
 const WaterQuality = (props) => {
-  const { allData } = props;
+  const { allData, type } = props;
 
   const columns = [
     {
@@ -761,7 +813,7 @@ const WaterQuality = (props) => {
 
   return (
     <div>
-      <ModuleTitle title="水质仪表校验" />
+      <ModuleTitle title={`水质仪表校验${type === '1' ? '' : '(历史记录)'}`} />
       <Table dataSource={allData} columns={columns} />
     </div>
   );

+ 8 - 4
src/pages/SmartOps/index.js

@@ -99,6 +99,7 @@ function SmartOps(props) {
       type: 'eqSelfInspection/getPatrolDataById',
       payload: {
         routeId: patrolId || reportData.PatrolId,
+        projectId,
       },
       callback: (data) => {
         // console.log(data);
@@ -265,11 +266,14 @@ function SmartOps(props) {
   const lengthCalculate = () => {
     return (
       autoReport?.extendWarningData?.length +
-      autoReport?.FluidLevelList?.filter((item) => item.status).length +
-      autoReport?.DrugFlowList?.filter((item) => item.status)?.length +
+      autoReport?.FluidLevelList?.filter((item) => item.status && !item.history)
+        .length +
+      autoReport?.DrugFlowList?.filter((item) => item.status && !item.history)
+        ?.length +
       autoReport?.WaterInCheckList?.filter((item) => item.status)?.length +
-      autoReport?.WaterQualityCompareList?.length +
-      autoReport?.PressureCompareList?.length
+      autoReport?.WaterQualityCompareList?.filter((item) => !item.history)
+        ?.length +
+      autoReport?.PressureCompareList?.filter((item) => !item.history)?.length
     );
   };
 

+ 15 - 11
src/pages/SmartReport/index.js

@@ -189,7 +189,7 @@ const SmartReport = () => {
     return (
       <div className={styles.longWhiteBox}>
         <div className={styles.longWhiteBoxIn}>
-          {label}
+          <div>{label}</div>
           <span className={styles.value}>
             {value}
             {unit && <span className={styles.unit}>{unit}</span>}
@@ -314,8 +314,8 @@ const SmartReport = () => {
           <div className={styles.scrollContent}>
             <Box title="概览">
               <div className={styles.content}>
-                <TwoBoxItem label="累计进水" value={in_water} />
-                <TwoBoxItem label="累计出水" value={out_water} />
+                <TwoBoxItem label="累计进水(t)" value={in_water} />
+                <TwoBoxItem label="累计出水(t)" value={out_water} />
 
                 <ThreeBoxContent
                   data={[
@@ -334,12 +334,12 @@ const SmartReport = () => {
                 />
 
                 <TwoBoxItem
-                  label="优化建议"
+                  label="优化建议"
                   value={push_optimize_task}
                   unit="条"
                 />
                 <TwoBoxItem
-                  label="任务完成"
+                  label="任务完成"
                   value={push_complete_task}
                   unit="个"
                 />
@@ -364,8 +364,8 @@ const SmartReport = () => {
             <Box title="水量">
               <CircleContent
                 data={[
-                  { label: '累计进水', value: in_water },
-                  { label: '累计出水', value: out_water },
+                  { label: '累计进水(t)', value: in_water },
+                  { label: '累计出水(t)', value: out_water },
                 ]}
               />
             </Box>
@@ -373,7 +373,11 @@ const SmartReport = () => {
             <Box title="能耗">
               <CircleContent
                 data={[
-                  { label: '吨水能耗', value: water_electricity, unit: '' },
+                  {
+                    label: '吨水能耗',
+                    value: water_electricity,
+                    unit: 'kwh/t',
+                  },
                   { label: '累计耗电量', value: electricity, unit: 'kwh' },
                 ]}
               />
@@ -383,7 +387,7 @@ const SmartReport = () => {
               <CircleContent
                 data={[
                   { label: '吨水药耗', value: water_medicine, unit: 'kg/m³' },
-                  { label: '累计用药量', value: medicine },
+                  { label: '累计用药量', value: medicine, unit: 'kg' },
                 ]}
               />
             </Box>
@@ -394,7 +398,7 @@ const SmartReport = () => {
                 <ThreeContent
                   data={[
                     { label: '自检次数', value: self_inspection_task },
-                    { label: '异常次数', value: self_inspection_abnormal_task },
+                    // { label: '异常次数', value: self_inspection_abnormal_task },
                     { label: '正常次数', value: self_inspection_normal_task },
                   ]}
                 />
@@ -417,7 +421,7 @@ const SmartReport = () => {
             <div className={styles.box}>
               <div className={styles.main_in}>
                 <div className={styles.titleContent}>智慧运营</div>
-                <CircleThreeContent
+                <ThreeContent
                   data={[
                     {
                       label: '优化条数',

+ 5 - 5
src/pages/SmartReport/index.less

@@ -137,7 +137,6 @@
     width: 48%;
     white-space: nowrap;
     padding: 0.02rem;
-    height: 1.05rem;
     box-shadow: 0 0.05rem 0.14rem 0 rgba(141, 141, 141, 0.2);
     border-radius: 0.95rem;
     background-image: linear-gradient(
@@ -147,13 +146,14 @@
     );
   }
   .longWhiteBoxIn {
-    padding: 0 0.4rem;
+    text-align: center;
+    padding: 0.2rem 0.4rem 0;
     background: #ffffff;
     border-radius: 1rem;
     font-size: 0.3rem;
     font-family: Helvetica;
     color: #1755ff;
-    line-height: 0.92rem;
+    // line-height: 0.92rem;
   }
   .blueText {
     font-size: 0.3rem;
@@ -205,8 +205,8 @@
     padding: 0.3rem;
     width: 2.54rem;
     height: 2.54rem;
-    background: url('@/assets/center/circle.png') no-repeat center;
-    background-size: 100% 100%;
+    // background: url('@/assets/center/circle.png') no-repeat center;
+    // background-size: 100% 100%;
     .blueText;
   }
   .circleValue {

+ 9 - 15
src/pages/SystemDaily/index.js

@@ -65,20 +65,14 @@ const SystemDaily = (props) => {
               <div className={styles.text}>
                 推送优化建议:{renderItem(push_optimize_task, '条')}
               </div>
-              <div className={styles.text}>
-                系统自检次数:
-                {renderItem(self_inspection_task, '条')}
-                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-                <br />
-                <div className={styles.textFlex}>
-                  <div className={styles.textItem}>
-                    正常次数:
-                    {renderItem(self_inspection_normal_task, '条')}
-                  </div>
-                  <div className={styles.textItem}>
-                    异常次数:
-                    {renderItem(self_inspection_abnormal_task, '条')}
-                  </div>
+              <div className={styles.textTwo}>
+                <div className={styles.textItem}>
+                  系统自检次数:
+                  {renderItem(self_inspection_task, '条')}
+                </div>
+                <div className={styles.textItem}>
+                  异常次数:
+                  {renderItem(self_inspection_abnormal_task, '条')}
                 </div>
               </div>
               <div className={styles.textTwo}>
@@ -95,7 +89,7 @@ const SystemDaily = (props) => {
                 <div className={styles.textItem}>
                   工单数量:
                   {renderItem(work_order_task, '条')}
-                </div>{' '}
+                </div>
                 <div className={styles.textItem}>
                   工单完成率:
                   {renderItem(work_percent, '%')}

+ 2 - 2
src/pages/TaskManage/Detail/TaskOrder/TaskOrder.tsx

@@ -237,9 +237,9 @@ const TaskOrder: React.FC<IPropsType> = (props) => {
               ? dayjs(temp.actual_end_time).format('YYYY-MM-DD HH:mm')
               : '-',
           Reason: temp.detail,
-          Repairman: '-',
-          DispatchMan:
+          Repairman:
             userList.find((user) => user.ID === temp.operator_id) || '-',
+          DispatchMan: '-',
           OrderStatus:
             OrderStatus.find((status) => status.value === temp.status) || '-',
         };

+ 1 - 1
src/pages/TaskManage/Detail/TaskOrder/taskOrder.less

@@ -27,7 +27,7 @@
       > .ant-steps-item
       .ant-steps-item-description {
       padding-bottom: 0;
-      padding-top: 0.18rem;
+      // padding-top: 0.18rem;
     }
   }
 }

+ 0 - 2
src/pages/TaskManage/Detail/WorkOrderList/WorkOrderList.js

@@ -178,8 +178,6 @@ const WorkOrderList = (props) => {
                   temp = item.Repairman;
                 } else if (order_type === 3) {
                   temp = item.MaintenancePerson;
-                } else if (order_type === 4) {
-                  temp = '-';
                 } else if (order_type === 5) {
                   temp = '-';
                 } else {

+ 41 - 1
src/pages/TaskManage/Popup/WorkOrderModal.js

@@ -1,6 +1,7 @@
 import {
   getCraftRecordList,
   getMaintainRecordList,
+  getPatrolMandateRecord,
   getReagentOrderDetail,
   getRepairRecordList,
   getWorkOrderFlow,
@@ -69,6 +70,7 @@ const WorkOrderModal = (props) => {
                   })
                 : [],
           };
+
           setOrderInfo(tempDetail);
           // 根据不同的工单类型查询工单操作详情
         }
@@ -193,6 +195,35 @@ const WorkOrderModal = (props) => {
     },
   );
 
+  const { run: getPatrolOrderList } = useRequest(getPatrolMandateRecord, {
+    manual: true,
+    formatResult: (result) => {
+      if (result?.data?.list) {
+        const temp = result.data.list[0];
+        console.log(userList);
+        const tempDetail = {
+          ...temp,
+          CreateTime: temp?.CreatedTime
+            ? dayjs(temp.CreatedTime).format('YYYY-MM-DD HH:mm')
+            : '-',
+          PlanTime: temp.plan_end_time
+            ? dayjs(temp.plan_end_time).format('YYYY-MM-DD HH:mm')
+            : '-',
+          RepairTime: temp?.actual_end_time
+            ? dayjs(temp.actual_end_time).format('YYYY-MM-DD HH:mm')
+            : '-',
+          Reason: temp.detail,
+          Repairman:
+            userList.find((user) => user.ID === temp.operator_id) || '-',
+          DispatchMan: '-',
+          OrderStatus:
+            OrderStatus.find((status) => status.value === temp.status) || '-',
+        };
+        setOrderInfo(tempDetail);
+      }
+    },
+  });
+
   useRequest(getWorkOrderFlow, {
     defaultParams: [{ work_type: order_type, work_id: order_id }],
     formatResult(res) {
@@ -246,10 +277,16 @@ const WorkOrderModal = (props) => {
   };
 
   useEffect(() => {
+    if (userList.length === 0) {
+      dispatch({
+        type: 'taskUser/fetchUserList',
+        payload: { project_id: projectID },
+      });
+    }
     switch (order_type) {
       case 1:
-      case 4:
       case 6:
+      case 7:
         getCraftDetail({ project_id: projectID, work_id: order_id });
         break;
       case 2:
@@ -258,6 +295,9 @@ const WorkOrderModal = (props) => {
       case 3:
         getMaintainDetail({ project_id: projectID, id: order_id });
         break;
+      case 4:
+        getPatrolOrderList({ project_id: projectID, id: order_id });
+        break;
       case 5:
         getDosingOrder(order_id);
         break;

+ 13 - 0
src/services/eqSelfInspection.js

@@ -96,3 +96,16 @@ export async function getMandateIDs(params) {
   );
   return res?.data || [];
 }
+
+/**
+ * 获取仪表校验历史数据
+ * @method GET
+ * @param {object} params
+ * @param {string} params.types 不传或【0】代表全查,【1】:压力,【2】:水质,【3】:液位,【4】:加药流量
+ * @param {string} params.project_id 项目ID
+ * @param {string} params.e_time 截至时间
+ * @returns
+ */
+export async function getRecentGaugeRecord(params) {
+  return request(`/api/v1/instrument/compare/recent?${stringify(params)}`);
+}

+ 15 - 9
src/utils/utils.js

@@ -105,6 +105,8 @@ export function getUser(params) {
 export const UnityAction = {
   event: {},
   on(type, callback) {
+    //修改添加unity时间监听时没有vuplex问题
+    addUnityListener();
     if (!UnityAction.event[type]) {
       UnityAction.event[type] = [];
     }
@@ -138,6 +140,7 @@ export const UnityAction = {
   sendMsg(type, message) {
     console.log(`type====${type}`);
     console.log('message====', message);
+
     if (window.vuplex) {
       window.vuplex.postMessage({ type, message });
     } else if (window[type]) {
@@ -145,15 +148,18 @@ export const UnityAction = {
     }
   },
 };
-if (window.vuplex) {
-  window.vuplex.addEventListener('message', (e) => {
-    console.log(
-      '============================getMessageForUnity============================',
-    );
-    const data = JSON.parse(e.data);
-    console.log(data);
-    UnityAction.emit(data.type, data.message);
-  });
+
+function addUnityListener() {
+  if (window.vuplex) {
+    window.vuplex.addEventListener('message', (e) => {
+      console.log(
+        '============================getMessageForUnity============================',
+      );
+      const data = JSON.parse(e.data);
+      console.log(data);
+      UnityAction.emit(data.type, data.message);
+    });
+  }
 }
 
 export function getGlobalData(key) {