|
@@ -105,7 +105,7 @@ const Environment: React.FC = () => {
|
|
|
setSelNav(item);
|
|
|
};
|
|
|
const showModalClick = (item) => {
|
|
|
- console.log('showChart');
|
|
|
+ // console.log('showChart', item);
|
|
|
setShowModal(true);
|
|
|
setShowSpace(item);
|
|
|
};
|
|
@@ -129,7 +129,7 @@ const Environment: React.FC = () => {
|
|
|
} else if (value === 1) {
|
|
|
//1 是开启
|
|
|
return 'rgba(' + colorStr + '1)';
|
|
|
- } else if (value === 0) {
|
|
|
+ } else if (value === 0 || value == 'nostatus') {
|
|
|
//0是关闭
|
|
|
return 'rgba(196, 196, 196, 0.6)';
|
|
|
}
|
|
@@ -139,9 +139,13 @@ const Environment: React.FC = () => {
|
|
|
//单个空间的点击事情
|
|
|
const spaceControl = (item, index: number) => {
|
|
|
//全部设备 或者没有房间类型 则不可以点击
|
|
|
- if (selNav.id == 'all' || !item.roomFuncType) return;
|
|
|
+ if (selNav.id == 'all' || !item.canClick) return;
|
|
|
//没有设备时
|
|
|
- if (item[selNav.id] == 'not') return;
|
|
|
+ if (item[selNav.id] == 'noHave') return;
|
|
|
+ if (item[selNav.id] == 'nostatus') {
|
|
|
+ message.success('该空间设备离线');
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
if (item[selNav.id] === 2) {
|
|
|
//半开时
|
|
@@ -264,19 +268,29 @@ const Environment: React.FC = () => {
|
|
|
var spaceList = res.data.spaceList || [];
|
|
|
spaceList.forEach((item: any) => {
|
|
|
var allType = ['airConditioner', 'light', 'curtain'];
|
|
|
+
|
|
|
allType.forEach((etype) => {
|
|
|
var filterEquip = (item.equipList || []).filter((eItem: any) => {
|
|
|
return eItem.equipType == etype;
|
|
|
});
|
|
|
//有当前设备
|
|
|
if (filterEquip.length > 0) {
|
|
|
+ item.equipStatusList = item.equipStatusList ? item.equipStatusList : [];
|
|
|
var filterRes = (item.equipStatusList || []).filter((eItem: equipStatus) => {
|
|
|
return eItem.equipType == etype;
|
|
|
});
|
|
|
//不存时 赋值not 如果没有设备状态 则说明没有设备 1 是开启 0是关闭
|
|
|
- filterRes.length > 0 ? (item[etype] = filterRes[0].status) : (item[etype] = 0);
|
|
|
+ if (filterRes.length > 0) {
|
|
|
+ item[etype] = filterRes[0].status;
|
|
|
+ } else {
|
|
|
+ item[etype] = 'nostatus';
|
|
|
+ item.equipStatusList.push({
|
|
|
+ equipType: etype,
|
|
|
+ status: 'nostatus',
|
|
|
+ });
|
|
|
+ }
|
|
|
} else {
|
|
|
- item[etype] = 'not';
|
|
|
+ item[etype] = 'noHave';
|
|
|
}
|
|
|
});
|
|
|
});
|
|
@@ -311,6 +325,7 @@ const Environment: React.FC = () => {
|
|
|
queryDeviceManage();
|
|
|
}, 3000);
|
|
|
return () => {
|
|
|
+ console.log('selFloorId', selFloorId);
|
|
|
clearInterval(setTimer.current);
|
|
|
};
|
|
|
}
|
|
@@ -423,7 +438,7 @@ const Environment: React.FC = () => {
|
|
|
>
|
|
|
<div
|
|
|
style={{
|
|
|
- backgroundColor: item.roomFuncType
|
|
|
+ backgroundColor: item.canClick
|
|
|
? selNav.id == 'all'
|
|
|
? 'rgba(196, 196, 196, 0.4)'
|
|
|
: getColorOpacity(item[selNav.id])
|
|
@@ -431,7 +446,7 @@ const Environment: React.FC = () => {
|
|
|
}}
|
|
|
className={cx(mapstyles.house, {
|
|
|
[mapstyles.notclick]:
|
|
|
- !item.roomFuncType || (selNav.id !== 'all' && item[selNav.id] == 'not'),
|
|
|
+ !item.canClick || (selNav.id !== 'all' && item[selNav.id] == 'noHave'),
|
|
|
[mapstyles.searchSel]: item.spaceId && item.spaceId === searchSpace.spaceId,
|
|
|
})}
|
|
|
onClick={(event) => {
|
|
@@ -449,7 +464,7 @@ const Environment: React.FC = () => {
|
|
|
lastTime = new Date().getTime();
|
|
|
}}
|
|
|
>
|
|
|
- {/* {selNav.id !== 'all' && item[selNav.id] == 'not' && (
|
|
|
+ {/* {selNav.id !== 'all' && item[selNav.id] == 'noHave' && (
|
|
|
<div className={mapstyles.noDevice}>
|
|
|
<span className={mapstyles.noText}>无设备</span>
|
|
|
</div>
|
|
@@ -476,7 +491,7 @@ const Environment: React.FC = () => {
|
|
|
})}
|
|
|
</div>
|
|
|
)}
|
|
|
- {item.roomFuncType && (
|
|
|
+ {item.canClick && (
|
|
|
<div
|
|
|
className={mapstyles.showModal}
|
|
|
onClick={(event) => {
|