|
@@ -114,7 +114,7 @@ const Environment: React.FC = () => {
|
|
|
|
|
|
//当前设备的状态 all全部开启 part部分开启 close全都关闭 还有类型type 包括airConditioner light curtain
|
|
|
//根据设备状态返回不同的 颜色
|
|
|
- const getColorOpacity = (value: number, type?: string): string => {
|
|
|
+ const getColorOpacity = (value: any, type?: string): string => {
|
|
|
let colorStr = '';
|
|
|
if (selNav.id == 'all') {
|
|
|
//全部设备时 colorStr赋值
|
|
@@ -125,15 +125,24 @@ const Environment: React.FC = () => {
|
|
|
} else {
|
|
|
colorStr = selNav.colorStr;
|
|
|
}
|
|
|
- if (value === 2) {
|
|
|
- //2 是部分开启
|
|
|
- return 'rgba(' + colorStr + '0.4)';
|
|
|
- } else if (value === 1) {
|
|
|
- //1 是开启
|
|
|
- return 'rgba(' + colorStr + '1)';
|
|
|
- } else if (value === 0 || value == 'nostatus') {
|
|
|
- //0是关闭
|
|
|
- return 'rgba(196, 196, 196, 0.6)';
|
|
|
+ if (selNav.id == 'curtain' || type == 'curtain') {
|
|
|
+ if (value == 'noHave') {
|
|
|
+ //没有
|
|
|
+ return 'rgba(196, 196, 196, 0)';
|
|
|
+ } else {
|
|
|
+ return 'rgba(' + colorStr + '1)';
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (value === 2) {
|
|
|
+ //2 是部分开启
|
|
|
+ return 'rgba(' + colorStr + '0.4)';
|
|
|
+ } else if (value === 1) {
|
|
|
+ //1 是开启
|
|
|
+ return 'rgba(' + colorStr + '1)';
|
|
|
+ } else if (value === 0 || value == 'nostatus') {
|
|
|
+ //0是关闭
|
|
|
+ return 'rgba(196, 196, 196, 0.6)';
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
const { confirm } = Modal;
|
|
@@ -236,6 +245,16 @@ const Environment: React.FC = () => {
|
|
|
height: (res.data || {}).height,
|
|
|
};
|
|
|
setMapSize(mapSize);
|
|
|
+ var bodyWidth = document.body.offsetWidth;
|
|
|
+ var mscale = Number((bodyWidth / mapSize.width).toFixed(4));
|
|
|
+ //把地图变成 屏幕大小
|
|
|
+ data.forEach((item, index) => {
|
|
|
+ item.width = item.width * mscale;
|
|
|
+ item.height = item.height * mscale;
|
|
|
+ item.left = item.left * mscale;
|
|
|
+ item.top = item.top * mscale;
|
|
|
+ });
|
|
|
+
|
|
|
setMapList(data);
|
|
|
mapListCopy.current = data;
|
|
|
//setSelNav(navigatorList[0]); //每当重新请求地图时 让选中导航的默认是第一个
|
|
@@ -249,17 +268,18 @@ const Environment: React.FC = () => {
|
|
|
}, [selFloorId]);
|
|
|
|
|
|
const changeMapList = useCallback(
|
|
|
- (scale, moveWidth, moveHeight) => {
|
|
|
- setScale(scale < 1 ? scale : 1);
|
|
|
+ (mscale, moveWidth, moveHeight) => {
|
|
|
+ setScale(mscale < 1 ? mscale : 1);
|
|
|
+ console.log('mscale', mscale);
|
|
|
var mapListTemp = JSON.parse(JSON.stringify(mapListCopy.current));
|
|
|
var mapListTemp2 = mapListTemp.map((item, index) => {
|
|
|
if (index == 0) {
|
|
|
- // console.log('mapListTemp', scale, item.width, item.width * scale);
|
|
|
+ // console.log('mapListTemp', mscale, item.width, item.width * mscale);
|
|
|
}
|
|
|
- item.width = item.width * scale;
|
|
|
- item.height = item.height * scale;
|
|
|
- item.left = item.left * scale - moveWidth;
|
|
|
- item.top = item.top * scale - moveHeight;
|
|
|
+ item.width = item.width * mscale;
|
|
|
+ item.height = item.height * mscale;
|
|
|
+ item.left = item.left * mscale - moveWidth;
|
|
|
+ item.top = item.top * mscale - moveHeight;
|
|
|
return item;
|
|
|
});
|
|
|
setMapList(mapListTemp2);
|
|
@@ -348,7 +368,7 @@ const Environment: React.FC = () => {
|
|
|
queryDeviceManage();
|
|
|
}, 3000);
|
|
|
return () => {
|
|
|
- console.log('selFloorId', selFloorId);
|
|
|
+ //console.log('selFloorId', selFloorId);
|
|
|
clearInterval(setTimer.current);
|
|
|
setTimer.current = null;
|
|
|
};
|
|
@@ -415,7 +435,7 @@ const Environment: React.FC = () => {
|
|
|
selParamObj={selNav}
|
|
|
></TopNavigator>
|
|
|
<div className={styles.maptop}>
|
|
|
- {selNav.id !== 'all' && (
|
|
|
+ {selNav.id !== 'all' && selNav.id !== 'curtain' && (
|
|
|
<div className={styles.right}>
|
|
|
<div>
|
|
|
<span
|
|
@@ -440,6 +460,21 @@ const Environment: React.FC = () => {
|
|
|
</div>
|
|
|
</div>
|
|
|
)}
|
|
|
+ {selNav.id == 'curtain' && (
|
|
|
+ <div className={styles.right}>
|
|
|
+ <div>
|
|
|
+ <span
|
|
|
+ className={styles.circle}
|
|
|
+ style={{ backgroundColor: 'rgba(' + selNav.colorStr + '1)' }}
|
|
|
+ ></span>
|
|
|
+ <span>有</span>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <span className={cx(styles.circle, styles.noCurtain)}></span>
|
|
|
+ <span>无</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
</div>
|
|
|
<Spin spinning={loading} wrapperClassName={mapstyles.spinnclass}>
|
|
|
{mapCombineList.length > 0 && (
|
|
@@ -470,8 +505,7 @@ const Environment: React.FC = () => {
|
|
|
: '',
|
|
|
}}
|
|
|
className={cx(mapstyles.house, {
|
|
|
- [mapstyles.notclick]:
|
|
|
- !item.canClick || (selNav.id !== 'all' && item[selNav.id] == 'noHave'),
|
|
|
+ [mapstyles.notclick]: !item.canClick || item[selNav.id] == 'noHave',
|
|
|
[mapstyles.searchSel]: item.spaceId && item.spaceId === searchSpace.spaceId,
|
|
|
})}
|
|
|
onClick={(event) => {
|
|
@@ -523,12 +557,12 @@ const Environment: React.FC = () => {
|
|
|
})}
|
|
|
</div>
|
|
|
)}
|
|
|
- {item.canClick && (
|
|
|
+ {item.canClick && item[selNav.id] != 'noHave' && (
|
|
|
<div
|
|
|
className={mapstyles.showModal}
|
|
|
onClick={(event) => {
|
|
|
event.stopPropagation();
|
|
|
- if (lastTime - firtTime < 200) {
|
|
|
+ if (lastTime - firtTime < 400) {
|
|
|
showModalClick(item);
|
|
|
}
|
|
|
}}
|
|
@@ -553,7 +587,7 @@ const Environment: React.FC = () => {
|
|
|
className=""
|
|
|
type={getSpaceFunc(item.roomFuncType)}
|
|
|
style={{
|
|
|
- fontSize: 20,
|
|
|
+ fontSize: 18,
|
|
|
display: item.width > 40 && item.height > 40 ? 'block' : 'none',
|
|
|
}}
|
|
|
></Icon>
|