xujunjie 1 年之前
父節點
當前提交
b15a1997ff

+ 5 - 3
src/models/eqSelfInspection.js

@@ -187,12 +187,14 @@ export default {
           data.sensor?.filter(
             (item) => item.Status === 2 || item.Status === 1,
           ) || [];
-        data.sensorWaringNum = data.sensorWaringData.length;
+        data.sensorWaringNum = data.sensorWaringData.filter(
+          (item) => item.Status === 1,
+        ).length;
 
         data.extendWarningAllData = arr;
         data.extendWarningData =
           arr?.filter((item) => item.Status === 2 || item.Status === 1) || [];
-        data.extendWarningNum = data.extendWarningData?.length || 0;
+        data.extendWarningNum = arr?.filter((item) => item.Status === 1)?.length || 0;
 
         let num = 0;
         if (data?.extendWarningData?.length > 0) num += 1;
@@ -201,7 +203,7 @@ export default {
         if (data?.FaultAnalysis?.length > 0) num += 1;
         data.warningTotalNum = num;
 
-        data.patrolStatus = data?.extendWarningData?.length > 0 ? 1 : 0;
+        data.patrolStatus = data?.extendWarningNum?.length > 0 ? 1 : 0;
         data.faultAnalysisStatus = data?.FaultAnalysis?.length > 0 ? 1 : 0;
         // data.secureStatus =
         //   data?.dumuList?.length > 0 || data?.sensorWaringNum > 0 ? 1 : 0;

+ 1 - 1
src/pages/Controller/index.less

@@ -29,7 +29,7 @@
 .item {
   padding: 40px 60px;
   
-  font-size: 36px;
+  font-size: 32px;
   margin-top: 28px;
   display: flex;
   align-items: center;

+ 32 - 23
src/pages/DeviceManager/index.js

@@ -11,34 +11,31 @@ import { RightOutlined } from '@ant-design/icons';
 import { useNavigate, useParams, useRequest } from '@umijs/max';
 import { Collapse, List, Space, Table } from 'antd';
 import dayjs from 'dayjs';
-import { useMemo, useState } from 'react';
+import { useEffect, useMemo, useState } from 'react';
 import styles from './index.less';
+
 const deviceIcon = require('@/assets/deviceManager/deviceIcon.png');
 const spareIcon = require('@/assets/deviceManager/spareIcon.png');
-const chartIcon = require('@/assets/deviceManager/chartIcon.png');
+// const chartIcon = require('@/assets/deviceManager/chartIcon.png');
+
 const DeviceManager = () => {
   const { projectId } = useParams();
-  const year = dayjs().format('YYYY');
-  const params = {
-    project_id: Number(projectId),
-    month: 0,
-    year: Number(year),
-  };
-
-  //请求备品列表
-  const { data, run, loading } = useRequest(() => queryMainChartList(params), {
-    manual: true,
-  });
+  const [defaultActiveKey, setDefaultActiveKey] = useState(
+    localStorage.deviceTab || "1"
+  );
 
   const onChange = (tab) => {
-    if (tab == '2') {
-      run();
-    }
+    setDefaultActiveKey(tab);
   };
+
+  useEffect(() => {
+    // 重置默认显示tab
+    localStorage.deviceTab = '1';
+  }, []);
   return (
     <PageContent tabs>
       <TabsContent
-        defaultActiveKey="1"
+        defaultActiveKey={defaultActiveKey}
         onChange={onChange}
         items={[
           {
@@ -49,9 +46,7 @@ const DeviceManager = () => {
           {
             label: `备品管理`,
             key: '2',
-            children: (
-              <SparePart data={data} loading={loading} projectId={projectId} />
-            ),
+            children: <SparePart projectId={projectId} />,
           },
         ]}
       />
@@ -314,8 +309,17 @@ const Device = ({ projectId }) => {
     </div>
   );
 };
-const SparePart = ({ data, loading, projectId }) => {
+const SparePart = ({ projectId }) => {
   const navigate = useNavigate();
+  const year = dayjs().format('YYYY');
+  const params = {
+    project_id: Number(projectId),
+    month: 0,
+    year: Number(year),
+  };
+  //请求备品列表
+  const { data } = useRequest(() => queryMainChartList(params));
+
   const PageType = {
     in: 0, //入库管理
     out: 1, //出库管理
@@ -325,10 +329,14 @@ const SparePart = ({ data, loading, projectId }) => {
 
   const changePage = (type) => {
     navigate(`/device/detail/${projectId}/${type}`);
+    // 设置默认显示tab为备品管理
+    localStorage.deviceTab = '2';
   };
 
   const handletotalPage = () => {
     navigate(`/device/storage/${projectId}`);
+    // 设置默认显示tab为备品管理
+    localStorage.deviceTab = '2';
   };
 
   const list = useMemo(() => {
@@ -364,11 +372,12 @@ const SparePart = ({ data, loading, projectId }) => {
           <div className={styles.num}>{data?.on_amount || 0}</div>
           <div className={styles.text}>在库数量(个)</div>
         </div>
-        <img
+        {/* <img
           className={styles.rightIcon}
           src={chartIcon}
           onClick={handletotalPage}
-        />
+        /> */}
+        <div onClick={handletotalPage} className={styles.iconFundFilled}></div>
       </div>
       {list.map((item) => (
         <div

+ 12 - 3
src/pages/DeviceManager/index.less

@@ -38,12 +38,16 @@
     color: #4a4a4a;
     line-height: 38px;
   }
-  .rightIcon {
-    width: 44px;
+  .iconFundFilled {
+    width: 37px;
+    height: 41px;
     position: absolute;
     right: 20px;
     top: 20px;
+    cursor: pointer;
+    background: url('@/assets/iconFundFilled.png') no-repeat;
   }
+  
 }
 
 .lineContent {
@@ -59,7 +63,7 @@
   text-align: center;
   .cardItem {
     display: flex;
-    padding: 6px;
+    padding: 36px;
     justify-content: space-between;
     align-items: center;
   }
@@ -126,3 +130,8 @@
     }
   }
 }
+
+.main {
+  padding: 20px;
+  margin-top: 40px;
+}

+ 2 - 81
src/pages/DeviceManager/storage.js

@@ -38,77 +38,6 @@ const StorageOverview = () => {
       key: 'warning_stat',
     },
   ];
-  const colors = ['#E1943A', '#5BE46D', '#FF976F', '#6589FC', '#9863F9'];
-
-  const topTen = [
-    {
-      name: '你好',
-      value: '100',
-    },
-    {
-      name: '进水阀',
-      value: '73',
-    },
-    {
-      name: 'hahah',
-      value: '70',
-    },
-    {
-      name: 'hahah',
-      value: '65',
-    },
-    {
-      name: 'hahah',
-      value: '60',
-    },
-    {
-      name: 'hahah',
-      value: '50',
-    },
-    {
-      name: 'hahah',
-      value: '45',
-    },
-    {
-      name: 'hahah',
-      value: '40',
-    },
-    {
-      name: 'hahah',
-      value: '38',
-    },
-    {
-      name: 'hahah',
-      value: '33',
-    },
-  ];
-
-  const props1 = {
-    yName: '水量(t)',
-    xData: ['00:00', '01:15', '02:30', '03:45', '05:00', '06:15', '07:30'],
-    dataList: [
-      {
-        type: 0,
-        name: '进水水量',
-        data: [820, 932, 901, 934, 1290, 1330, 1320],
-      },
-      {
-        type: 0,
-        name: '进水水量111',
-        data: [420, 932, 601, 934, 1990, 1330, 1520],
-      },
-      {
-        type: 1,
-        name: '预测出水量',
-        data: [720, 832, 601, 834, 1190, 1230, 1220],
-      },
-      {
-        type: 2,
-        name: '实际出水量',
-        data: [820, 632, 501, 534, 1190, 1130, 1120],
-      },
-    ],
-  };
 
   const { data, run, loading } = useRequest(
     () =>
@@ -194,18 +123,10 @@ const StorageOverview = () => {
     },
   );
 
-  const ItemContent = ({ idx, title, value }) => {
-    return (
-      <div className={styles.item} style={{ backgroundColor: colors[idx] }}>
-        <div className={styles.item_title}>{title}</div>
-        <div className={styles.item_num}>{value}</div>
-      </div>
-    );
-  };
   return (
-    <PageContent>
+    <PageContent closeable={false}>
       <PageTitle children="备品统计" returnable />
-      <div className={styles.main}>
+      <div className={`card-box ${styles.main}`}>
         <Spin spinning={loading}>
           <ModuleTitle title="物料种类库存占比" />
           <div style={{ height: '330px' }}>

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

@@ -103,13 +103,11 @@ function Detail(props) {
   return (
     <Spin spinning={loading} wrapperClassName="card-box">
       <div className={styles.card}>
-        <div
-          className={`${styles.orderIcon} ${
-            data.warningTotalNum ? styles.error : ''
-          }`}
-        >
-          {data.warningTotalNum == 0 ? '正常' : '异常'}
-        </div>
+        {data.Status == 0 ? (
+          <div className={`${styles.orderIcon}`}>正常</div>
+        ) : (
+          <div className={`${styles.orderIcon} ${styles.error}`}>异常</div>
+        )}
         <Row>
           <Col span={24} className={styles.cardText}>
             自检时间:{data?.CreatedTime}
@@ -257,7 +255,6 @@ export function DeviceTable(props) {
   const columns = [
     {
       title: '设备名称',
-      width: '25%',
       dataIndex: 'DeviceName',
     },
     {
@@ -348,7 +345,7 @@ export function DeviceTable(props) {
   if (!isSensor) {
     columns.push({
       title: '操作',
-      width: '12%',
+      width: 120,
       render: (record) =>
         record.Status == 1 && (
           <a style={{ color: '#FE5850' }} onClick={() => onClickError(record)}>
@@ -575,7 +572,6 @@ export function WarningTable(props) {
   const columns = [
     {
       title: '设备名称',
-      width: '25%',
       dataIndex: 'DeviceName',
     },
     {
@@ -660,7 +656,7 @@ export function WarningTable(props) {
   if (!isSensor) {
     columns.push({
       title: '操作',
-      width: '12%',
+      width: 120,
       render: (record) =>
         record.Status == 1 && (
           <a style={{ color: '#FE5850' }} onClick={() => onClickError(record)}>

+ 8 - 15
src/pages/EqSelfInspection/index.js

@@ -116,7 +116,7 @@ const EqSelfInspection = (props) => {
           style={{ padding: '15px 24px' }}
         >
           <div style={{ fontSize: 28, color: 'rgb(110, 110, 110)' }}>
-            自检间隔:{autoReport?.RouteInfo?.PlanDur}h
+            自检间隔:{autoReport?.RouteInfo?.PlanDur}分钟
           </div>
 
           <div className={styles.icon}>
@@ -138,19 +138,13 @@ const EqSelfInspection = (props) => {
           <div className={styles.logoInfo}>
             <div className={styles.logo} />
             <div className={styles.logoTitle}>
-              <div>系统自检发现</div>
-              <div
-                style={{
-                  color:
-                    autoReport?.warningTotalNum == 0
-                      ? '#333'
-                      : 'rgba(254, 88, 80, 1)',
-                  margin: '0 6px',
-                }}
-              >
-                {autoReport?.warningTotalNum == 0
-                  ? '暂无'
-                  : autoReport?.warningTotalNum + '项异常'}
+              <div>
+                系统自检&nbsp;
+                {autoReport?.Status == 0 ? (
+                  <span style={{ color: '#39CA74' }}>正常</span>
+                ) : (
+                  <span style={{ color: 'rgba(254, 88, 80, 1)' }}>异常</span>
+                )}
               </div>
             </div>
             <div className={styles.logoTime}>
@@ -165,7 +159,6 @@ const EqSelfInspection = (props) => {
             </div>
             <div className={styles.logoFont}>
               系统自检中
-              <div className={styles.iconSetting}></div>
             </div>
           </div>
         </div>

+ 6 - 1
src/pages/SafetyManagement/doorDetail.js

@@ -15,18 +15,21 @@ const DoorDetail = () => {
       dataIndex: 'created_time',
       key: 'created_time',
       align: 'center',
+      width: 160
     },
     {
       title: '人员',
       dataIndex: 'user_name',
       key: 'user_name',
       align: 'center',
+      width: 110
     },
     {
       title: '门禁名称',
       dataIndex: 'gate_name',
       key: 'gate_name',
       align: 'center',
+      width: 140
     },
     {
       title: '事件',
@@ -39,12 +42,14 @@ const DoorDetail = () => {
       dataIndex: 'check_type',
       key: 'check_type',
       align: 'center',
+      width: 140
     },
     {
       title: '出入状态',
       dataIndex: 'status',
       key: 'status',
       align: 'center',
+      width: 140
     },
   ];
 
@@ -54,7 +59,7 @@ const DoorDetail = () => {
 
       <Table
         loading={loading}
-        style={{ marginTop: '10px' }}
+        style={{ marginTop: '30px' }}
         dataSource={data?.list}
         columns={columns}
         pagination={false}

+ 11 - 3
src/pages/SafetyManagement/index.js

@@ -16,7 +16,7 @@ const videoIcon = require('@/assets/air-conditioner.png');
 const chartIcon = require('@/assets/deviceManager/chartIcon.png');
 const DeviceManager = () => {
   const { projectId } = useParams();
-  const [tab, setTab] = useState('1');
+  const [tab, setTab] = useState(localStorage.safeTab || '1');
 
   //门禁接口
   const { data, run, loading } = useRequest(
@@ -62,10 +62,17 @@ const DeviceManager = () => {
       runOver();
     }
   };
+  useEffect(() => {
+    localStorage.safeTab = '1'
+    if(tab == '2') {
+      run();
+      runOver();
+    }
+  },[])
   return (
     <PageContent tabs>
       <TabsContent
-        defaultActiveKey="1"
+        defaultActiveKey={tab}
         onChange={handleTabChange}
         items={[
           {
@@ -81,7 +88,7 @@ const DeviceManager = () => {
             ),
           },
           {
-            label: `门禁`,
+            label: `门禁监控`,
             key: '2',
             children: (
               <Door
@@ -144,6 +151,7 @@ const Door = ({ data, dataOver, loading, projectId }) => {
   const navigate = useNavigate();
 
   const handleClick = () => {
+    localStorage.safeTab = '2'
     navigate(`/safety/detail/${projectId}`);
   };
 

+ 1 - 1
src/pages/SafetyManagement/index.less

@@ -39,7 +39,7 @@
   padding: 40px 44px 32px;
   align-items: center;
   .name {
-    font-size: 36px;
+    font-size: 32px;
     color: #000000;
   }
 }