Procházet zdrojové kódy

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

Renxy před 1 rokem
rodič
revize
dbd9d0f3a2

+ 19 - 9
.umirc.ts

@@ -83,20 +83,30 @@ export default defineConfig({
       component: './Smart/Simulate',
     },
     {
-      name: '智能控',
-      path: '/hardware-controller/:projectId',
-      component: './HardwareController',
+      name: '智能控',
+      path: '/controller/:projectId',
+      component: './Controller',
     },
     {
-      name: '空调监控',
-      path: '/hardware-controller/air-conditioner/:projectId',
-      component: './HardwareController/AirConditioner',
+      name: '感知监控',
+      path: '/controller/hardware/:projectId',
+      component: './Controller/Hardware',
     },
     {
-      name: '灯光监控',
-      path: '/hardware-controller/light/:projectId',
-      component: './HardwareController/Light',
+      name: '设备定位',
+      path: '/controller/device/:projectId',
+      component: './Controller/Device',
     },
+    // {
+    //   name: '空调监控',
+    //   path: '/hardware-controller/air-conditioner/:projectId',
+    //   component: './Controller/AirConditioner',
+    // },
+    // {
+    //   name: '灯光监控',
+    //   path: '/hardware-controller/light/:projectId',
+    //   component: './Controller/Light',
+    // },
     {
       name: '系统自检',
       path: '/self-inspection/:projectId',

+ 8 - 8
src/components/ManagementPage/chartModule.js

@@ -205,10 +205,10 @@ const defaultOption = {
     boundaryGap: false,
     axisTick: { show: false },
     nameTextStyle: {
-      fontSize: 18,
+      fontSize: 24,
     },
     axisLabel: {
-      fontSize: 18,
+      fontSize: 24,
     },
     data: [
       '00:00',
@@ -227,12 +227,12 @@ const defaultOption = {
       name: '000',
       top: 20,
       nameTextStyle: {
-        fontSize: 18,
+        fontSize: 24,
         // align: 'left',
         padding: [0, 0, 20, 0],
       },
       axisLabel: {
-        fontSize: 18,
+        fontSize: 24,
       },
       axisLine: {
         show: false,
@@ -252,7 +252,7 @@ const defaultOption = {
       top: 20,
       position: 'right',
       nameTextStyle: {
-        fontSize: 18,
+        fontSize: 24,
         // align: 'left',
         padding: [0, 0, 20, 0],
       },
@@ -275,7 +275,7 @@ const defaultOption = {
       position: 'right',
       offset: 80,
       nameTextStyle: {
-        fontSize: 18,
+        fontSize: 24,
         // align: 'left',
         padding: [0, 0, 20, 0],
       },
@@ -401,7 +401,7 @@ const defaultOption = {
       },
       title: {
         offsetCenter: [0, '25%'],
-        fontSize: 18,
+        fontSize: 24,
       },
       detail: {
         show: false,
@@ -417,7 +417,7 @@ const defaultOption = {
     data: ['进水水量', '预测出水量', '实际出水量'],
     lineStyle: {},
     textStyle: {
-      fontSize: 18,
+      fontSize: 24,
     },
   },
   // toolbox: {

+ 6 - 2
src/components/PageContent/index.js

@@ -3,7 +3,7 @@ import { CloseOutlined } from '@ant-design/icons';
 import styles from './index.less';
 
 export default (props) => {
-  const { children, style, closeable = true } = props;
+  const { children, style, closeable = true, tabs = false } = props;
 
   const handleClose = () => {
     UnityAction.sendMsg('closePage');
@@ -12,7 +12,11 @@ export default (props) => {
   return (
     <div className={styles.page} style={style}>
       {closeable && (
-        <CloseOutlined onClick={handleClose} className={styles.close} />
+        <CloseOutlined
+          onClick={handleClose}
+          className={styles.close}
+          style={{ top: tabs ? 65 : '' }}
+        />
       )}
 
       {children}

+ 5 - 2
src/components/PageTitle/index.js

@@ -3,7 +3,7 @@ import { history } from '@umijs/max';
 import styles from './index.less';
 
 export default (props) => {
-  const { children, returnable = false, onReturn } = props;
+  const { tabs = false, children, returnable = false, onReturn } = props;
 
   const handleOnClick = () => {
     if (onReturn) {
@@ -14,7 +14,10 @@ export default (props) => {
   };
 
   return (
-    <div className={styles.titleBox} onClick={handleOnClick}>
+    <div
+      className={`${styles.titleBox} ${tabs ? styles.tabs : ''}`}
+      onClick={handleOnClick}
+    >
       {returnable || onReturn ? (
         <LeftOutlined
           style={{ fontSize: 36, cursor: 'pointer', marginRight: '40px' }}

+ 5 - 0
src/components/PageTitle/index.less

@@ -7,6 +7,7 @@
   height: 26px;
   background: #4a90e2;
   float: left;
+  margin-right: 18px;
 }
 .title {
   font-size: 36px;
@@ -14,3 +15,7 @@
   color: #000000;
   line-height: 50px;
 }
+.tabs {
+  position: absolute;
+  top: 52px;
+}

+ 11 - 11
src/global.less

@@ -109,7 +109,7 @@ input[type='reset'] {
   border-radius: 8px;
   box-shadow: 0px 0px 8px 2px rgba(191, 191, 191, 0.2);
   border: 1px solid #eee;
-  background: rgba(255, 255, 255, 0.6);
+  background: rgba(255, 255, 255);
 }
 
 .password-eye {
@@ -134,8 +134,8 @@ input[type='reset'] {
   }
   .tabs-item {
     flex: 1;
-    padding: 12px 20px;
-    font-size: 18px;
+    padding: 16px 24px;
+    font-size: 24px;
     font-weight: 400;
     color: #4a4a4a;
     border-right: 1px solid #979797;
@@ -152,15 +152,15 @@ input[type='reset'] {
 .section-title {
   display: flex;
   align-items: center;
-  font-size: 22px;
+  font-size: 28px;
   font-weight: 400;
   color: #4a4a4a;
-  line-height: 30px;
+  line-height: 40px;
   .section-line {
-    width: 3px;
-    height: 23px;
+    width: 4px;
+    height: 30px;
     background: #4a90e2;
-    margin-right: 6px;
+    margin-right: 8px;
   }
 }
 
@@ -209,10 +209,10 @@ input[type='reset'] {
 .ant-table-thead > tr > th,
 .ant-table-tbody > tr > td {
   border-radius: 0 !important;
-  padding: 8px 25px !important;
-  font-size: 20px !important;
+  padding: 16px 18px !important;
+  font-size: 24px !important;
   color: #4a4a4a !important;
-  line-height: 28px !important;
+  line-height: 32px !important;
   font-weight: normal !important;
   vertical-align: middle;
   border: none !important;

+ 57 - 0
src/pages/Controller/Device.js

@@ -0,0 +1,57 @@
+import PageContent from '@/components/PageContent';
+import PageTitle from '@/components/PageTitle';
+import { queryDevice } from '@/services/controller';
+import { UnityAction } from '@/utils/utils';
+import { useParams, useRequest } from '@umijs/max';
+import { Spin } from 'antd';
+import styles from './index.less';
+
+function Hardware() {
+  const { projectId } = useParams();
+
+  const { data, loading } = useRequest(queryDevice, {
+    defaultParams: [projectId],
+  });
+
+  const getIconStatus = (status) => {
+    if (status == 1) return '';
+    if (status == 2) return styles.offline;
+    if (status == 3) return styles.error;
+  };
+
+  return (
+    <PageContent closeable={false}>
+      <PageTitle onReturn={() => UnityAction.sendMsg('menuItem', '智能管控')}>
+        设备定位
+      </PageTitle>
+
+      <Spin spinning={loading}>
+        {data?.list?.map((item) => (
+          <div key={item.id} className={`card-box ${styles.item}`}>
+            <i className={`${styles.icon} ${getIconStatus(item.status)}`}></i>
+            {item.name}
+            <div>
+              <div>定位</div>
+              {/* <div>历史轨迹</div> */}
+            </div>
+          </div>
+        ))}
+
+        <div
+          className={`card-box ${styles.item}`}
+          style={{ justifyContent: 'space-between' }}
+        >
+          <div>
+            <i className={`${styles.icon}`}></i>
+            设备1
+          </div>
+          <div>
+            <div>定位</div>
+          </div>
+        </div>
+      </Spin>
+    </PageContent>
+  );
+}
+
+export default Hardware;

+ 39 - 0
src/pages/Controller/Hardware.js

@@ -0,0 +1,39 @@
+import PageContent from '@/components/PageContent';
+import PageTitle from '@/components/PageTitle';
+import TabsContent from '@/components/TabsContent';
+import { UnityAction } from '@/utils/utils';
+import AirConditioner from './components/AirConditioner';
+import Light from './components/Light';
+
+function Hardware() {
+  const handleTabsChange = (tab) => {};
+  return (
+    <PageContent tabs>
+      <PageTitle
+        tabs
+        onReturn={() => UnityAction.sendMsg('menuItem', '智能管控')}
+      >
+        感知监控
+      </PageTitle>
+      <TabsContent
+        defaultActiveKey="1"
+        onChange={handleTabsChange}
+        center={true}
+        items={[
+          {
+            label: `空调控制`,
+            key: '1',
+            children: <AirConditioner />,
+          },
+          {
+            label: `照明控制`,
+            key: '2',
+            children: <Light />,
+          },
+        ]}
+      />
+    </PageContent>
+  );
+}
+
+export default Hardware;

+ 6 - 11
src/pages/HardwareController/AirConditioner.js → src/pages/Controller/components/AirConditioner.js

@@ -1,9 +1,7 @@
-import PageContent from '@/components/PageContent';
-import PageTitle from '@/components/PageTitle';
-import { queryIotList } from '@/services/HardwareController';
+import { queryIotList } from '@/services/controller';
 import { useParams, useRequest } from '@umijs/max';
 import { Spin } from 'antd';
-import styles from './index.less';
+import styles from '../index.less';
 
 const Work = (props) => {
   const { projectId } = useParams();
@@ -19,8 +17,7 @@ const Work = (props) => {
   };
 
   return (
-    <PageContent>
-      <PageTitle>空调控制</PageTitle>
+    <div>
       <div className={`card-box ${styles.top}`}>
         <div className={styles.left}>
           <img
@@ -37,10 +34,8 @@ const Work = (props) => {
             <i className={styles.icon}></i> 在线:{data?.online_count}
           </div>
           <div className={styles.row}>
-            <i className={`${styles.icon} ${styles.error}`}></i> 故障:{data?.fault_count}
-          </div>
-          <div className={styles.row}>
-            <i className={`${styles.icon} ${styles.offline}`}></i> 离线:{data?.offline_count}
+            <i className={`${styles.icon} ${styles.offline}`}></i> 离线:
+            {data?.offline_count}
           </div>
         </div>
       </div>
@@ -52,7 +47,7 @@ const Work = (props) => {
           </div>
         ))}
       </Spin>
-    </PageContent>
+    </div>
   );
 };
 

+ 6 - 11
src/pages/HardwareController/Light.js → src/pages/Controller/components/Light.js

@@ -1,9 +1,7 @@
-import PageContent from '@/components/PageContent';
-import PageTitle from '@/components/PageTitle';
-import { queryLightList } from '@/services/HardwareController';
+import { queryLightList } from '@/services/controller';
 import { useParams, useRequest } from '@umijs/max';
 import { Spin } from 'antd';
-import styles from './index.less';
+import styles from '../index.less';
 
 const Work = (props) => {
   const { projectId } = useParams();
@@ -19,8 +17,7 @@ const Work = (props) => {
   };
 
   return (
-    <PageContent>
-      <PageTitle>照明控制</PageTitle>
+    <div>
       <div className={`card-box ${styles.top}`}>
         <div className={styles.left}>
           <img
@@ -37,10 +34,8 @@ const Work = (props) => {
             <i className={styles.icon}></i> 在线:{data?.online_count}
           </div>
           <div className={styles.row}>
-            <i className={`${styles.icon} ${styles.error}`}></i> 故障:{data?.fault_count}
-          </div>
-          <div className={styles.row}>
-            <i className={`${styles.icon} ${styles.offline}`}></i> 离线:{data?.offline_count}
+            <i className={`${styles.icon} ${styles.offline}`}></i> 离线:
+            {data?.offline_count}
           </div>
         </div>
       </div>
@@ -52,7 +47,7 @@ const Work = (props) => {
           </div>
         ))}
       </Spin>
-    </PageContent>
+    </div>
   );
 };
 

+ 11 - 8
src/pages/HardwareController/index.js → src/pages/Controller/index.js

@@ -1,5 +1,6 @@
 import PageContent from '@/components/PageContent';
 import PageTitle from '@/components/PageTitle';
+import { UnityAction } from '@/utils/utils';
 import { history, useParams } from '@umijs/max';
 import styles from './index.less';
 
@@ -10,22 +11,24 @@ const HardwareController = (props) => {
     <PageContent>
       <PageTitle>智能管控</PageTitle>
 
-      <div className={`card-box ${styles.item}`}>工艺监控</div>
       <div
         className={`card-box ${styles.item}`}
-        onClick={() =>
-          history.push(`/hardware-controller/air-conditioner/${projectId}`)
-        }
+        onClick={() => UnityAction.sendMsg('innerItem', 'scada')}
       >
-        空调监控
+        工艺监控
       </div>
       <div
         className={`card-box ${styles.item}`}
-        onClick={() => history.push(`/hardware-controller/light/${projectId}`)}
+        onClick={() => UnityAction.sendMsg('innerItem', 'sensor')}
       >
-        照明监控
+        感知监控
+      </div>
+      <div
+        className={`card-box ${styles.item}`}
+        onClick={() => UnityAction.sendMsg('innerItem', 'locate')}
+      >
+        室内定位
       </div>
-      <div className={`card-box ${styles.item}`}>室内定位</div>
     </PageContent>
   );
 };

+ 19 - 22
src/pages/HardwareController/index.less → src/pages/Controller/index.less

@@ -1,29 +1,21 @@
-.desc {
-  position: absolute;
-  top: 20px;
-  left: 50%;
-  transform: translateX(-50%);
-  font-size: 22px;
-}
 .top {
   display: flex;
-  margin-top: 40px;
-  padding: 20px;
+  padding: 48px 60px 25px;
   .left {
     width: 50%;
-    font-size: 24px;
+    font-size: 28px;
     display: flex;
     align-items: center;
   }
   .img {
-    width: 200px;
-    margin-right: 30px;
+    width: 152px;
+    margin-right: 45px;
   }
   .number {
-    font-size: 48px;
+    font-size: 80px;
     font-weight: bold;
     margin-bottom: 10px;
-    color: #4a90e2;
+    color: #4A90E2;
   }
   .right {
     display: flex;
@@ -31,22 +23,24 @@
     justify-content: space-around;
   }
   .row {
-    font-size: 24px;
+    font-size: 32px;
   }
 }
 .item {
-  padding: 20px;
-  font-size: 28px;
-  margin-top: 30px;
-  vertical-align: middle;
+  padding: 40px 60px;
+  
+  font-size: 36px;
+  margin-top: 28px;
+  display: flex;
+  align-items: center;
 }
 .icon {
-  width: 12px;
-  height: 12px;
+  width: 20px;
+  height: 20px;
   border-radius: 50%;
   display: inline-block;
   background-color: #12ceb3;
-  margin-right: 10px;
+  margin-right: 44px;
   vertical-align: middle;
   &.error {
     background-color: #fe5850;
@@ -55,3 +49,6 @@
     background-color: #9b9b9b;
   }
 }
+.btns {
+  flex: right;
+}

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

@@ -35,7 +35,7 @@ const DeviceManager = () => {
     }
   };
   return (
-    <PageContent>
+    <PageContent tabs>
       <TabsContent
         defaultActiveKey="1"
         onChange={onChange}

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

@@ -113,9 +113,9 @@ const EqSelfInspection = (props) => {
       <Spin spinning={loading} tip="正在自检中...">
         <div
           className={`${styles.itemMain} card-box`}
-          style={{ padding: '10px 20px' }}
+          style={{ padding: '15px 24px' }}
         >
-          <div style={{ fontSize: 20, color: 'rgba(110, 110, 110, 1)' }}>
+          <div style={{ fontSize: 28, color: 'rgba(110, 110, 110, 1)' }}>
             自检间隔:{autoReport?.RouteInfo?.PlanDur}h
           </div>
 

+ 7 - 4
src/pages/EqSelfInspection/index.less

@@ -1,17 +1,17 @@
 .icon {
   position: absolute;
-  top: 10px;
+  top: 15px;
   right: 18px;
   display: flex;
   .iconDiffFilled,
   .iconFundFilled {
-    width: 28px;
-    height: 31px;
+    width: 37px;
+    height: 41px;
     cursor: pointer;
     background: url('@/assets/iconDiffFilled.png') no-repeat;
   }
   .iconFundFilled {
-    margin-left: 20px;
+    margin-left: 28px;
     background-image: url('@/assets/iconFundFilled.png');
   }
 }
@@ -102,6 +102,9 @@
     font-weight: bold;
   }
 }
+.btns {
+  float: right;
+}
 .warningItem {
   // border-bottom: 2px solid #555;
   height: 60px;

+ 3 - 2
src/pages/Home/ChemCostComparison.js

@@ -229,6 +229,7 @@ const CostComparison = (props) => {
       message.error('获取数据失败');
     });
     setChemList([...list]);
+    setCurrentChem(list[0])
     typeParams.forEach((item) => {
       item.chemical_agents = list[0];
     });
@@ -251,7 +252,7 @@ const CostComparison = (props) => {
   return (
     <PageContent closeable={false}>
       <PageTitle onReturn={() => UnityAction.sendMsg('menuItem', '首页')}>
-        能耗数据
+        药耗监测
         <div
           onClick={(e) => {
             e.stopPropagation();
@@ -262,7 +263,7 @@ const CostComparison = (props) => {
         ></div>
       </PageTitle>
 
-      <div className="card-box" style={{ padding: 20, marginTop: 40 }}>
+      <div className="card-box" style={{ padding: 20, marginTop: 10 }}>
         {/* 使用Tabs来展示所有药的标签 */}
         <div className="tabs">
           {chemList?.map((item) => (

+ 1 - 1
src/pages/Home/QualityMng.js

@@ -107,7 +107,7 @@ function Quality() {
         水质监测
       </PageTitle>
 
-      <div className="card-box" style={{ padding: 20, marginTop: 26 }}>
+      <div className="card-box" style={{ padding: 20, marginTop: 10 }}>
         <div className="tabs" style={{ marginBottom: 20 }}>
           {codeList?.map((item) => (
             <div

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

@@ -62,13 +62,13 @@
     margin-bottom: 14px;
   }
   .grade {
-    font-size: 18px;
+    font-size: 20px;
     margin-top: 10px;
   }
 }
 
 .time {
-  font-size: 18px;
+  font-size: 20px;
   margin-bottom: 20px;
   text-align: center;
 }

+ 4 - 4
src/pages/Home/manage.less

@@ -73,18 +73,18 @@
       justify-content: center;
       align-items: flex-end;
       line-height: 1;
-      margin-bottom: 6px;
+      margin-bottom: 8px;
 
-      font-size: 30px;
+      font-size: 40px;
       font-weight: 500;
       color: #f5a623;
-      line-height: 42px;
+      line-height: 56px;
     }
     .name {
       margin-bottom: 4px;
       max-width: 80%;
 
-      font-size: 18px;
+      font-size: 24px;
       color: #4a4a4a;
       line-height: 26px;
     }

+ 1 - 4
src/pages/Menu/index.js

@@ -38,13 +38,10 @@ const menuList = [
 ];
 
 function Menu() {
-  const { projectId } = useParams();
   const [active, setActive] = useState('首页');
   const handleClick = (item) => {
     setActive(item.name);
-    const path = item?.path(projectId);
-    // history.push(path);
-    console.log(path);
+    
     UnityAction.sendMsg("menuItem", item.name)
   };
 

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

@@ -59,7 +59,7 @@ const MessageCenter = () => {
     );
   };
   return (
-    <PageContent>
+    <PageContent tabs>
       <TabsContent
         center={false}
         defaultActiveKey="1"

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

@@ -63,7 +63,7 @@ const DeviceManager = () => {
     }
   };
   return (
-    <PageContent>
+    <PageContent tabs>
       <TabsContent
         defaultActiveKey="1"
         onChange={handleTabChange}

+ 5 - 0
src/services/HardwareController.js → src/services/controller.js

@@ -10,3 +10,8 @@ export async function queryLightList(project_id) {
     params: { project_id },
   });
 }
+export async function queryDevice(project_id) {
+  return request(`/api/iot/v1/lamp/list`, {
+    params: { project_id },
+  });
+}