Ver código fonte

fix: 修改切换楼层设备数目显示问题

venshine 2 anos atrás
pai
commit
df08d06ecc

+ 1 - 0
src/pages/Equipment/components/topNavRight/index.less

@@ -29,6 +29,7 @@
     margin-left: 10px;
     color: #000;
     font-size: 28px;
+    width:30px;
   }
   .moreWrap {
     display: flex;

+ 12 - 2
src/pages/Equipment/components/topNavRight/index.tsx

@@ -1,5 +1,5 @@
 // 设备管理 导航条的右侧
-import React, { useState, useEffect } from 'react';
+import React, { useState, useEffect,useMemo } from 'react';
 import { Dropdown, Menu, Modal, message } from 'antd';
 import Icon from '@/tenants-ui/SgIcon';
 import { EllipsisOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
@@ -25,6 +25,8 @@ const TopNavRight: React.FC<topNavRightProps> = ({ selNavObj, navigatorList, map
     setDeviceList(navigatorList.slice(1));
   }, [navigatorList]);
 
+ 
+
   const allOpenClick = (key) => {
     //debugger;
     console.log('key', key);
@@ -153,7 +155,15 @@ const TopNavRight: React.FC<topNavRightProps> = ({ selNavObj, navigatorList, map
       {selNavObj.id !== 'all' && (
         <div className={styles.right}>
           {selNavObj.id !== 'curtain' && <div className={styles.title}>运行中的设备</div>}
-          {selNavObj.id !== 'curtain' && <div className={styles.onlyNum}>{selNavObj.num}</div>}
+          {selNavObj.id !== 'curtain' && <div className={styles.onlyNum}>{
+            deviceList.map(function(ditem,dindex){
+              if(ditem.id==selNavObj.id ){
+                return (<span key={'dnum' + dindex}>{ditem.num}</span>);
+              }else{
+                return ;
+              }
+            })
+          }</div>}
           <div
             className={styles.closeButton}
             onClick={allCloseClick}

+ 3 - 3
src/pages/Equipment/index.tsx

@@ -67,7 +67,7 @@ const Environment: React.FC = () => {
       name: '空调',
       id: 'airConditioner',
       src: equip_air,
-      num: 0,
+      num: '--',
       color: '#5E8BCF',
       colorStr: '94,139,207,',
     },
@@ -75,7 +75,7 @@ const Environment: React.FC = () => {
       name: '照明',
       id: 'light',
       src: equip_lamp,
-      num: 0,
+      num: '--',
       color: '#FFE823',
       colorStr: '255,232,35,',
     },
@@ -83,7 +83,7 @@ const Environment: React.FC = () => {
       name: '窗帘',
       id: 'curtain',
       src: envir_curtain,
-      num: 0,
+      num: '--',
       color: '#E89E32',
       colorStr: '232, 158, 50,',
     },