Browse Source

灯 窗帘

anxiaoxia 2 years ago
parent
commit
1990939865

+ 2 - 2
src/pages/Equipment/components/deviceModal/index.jsx

@@ -88,8 +88,8 @@ export default ({ onClose, showSpace }) => {
   console.log(showSpace, 'showSpace');
   function showEqCard(type) {
     let flag = false;
-    showSpace.equipStatusList.forEach((item) => {
-      if (item.equipType == type) return (flag = !flag);
+    showSpace.equipList.forEach((item) => {
+      if (item.equipType === type) return (flag = true);
     });
     return flag;
   }

+ 20 - 8
src/pages/Equipment/components/deviceModal/lampEq/index.jsx

@@ -16,15 +16,27 @@ export default ({ spaceId }) => {
   const startLightsStatusTimer = useRef(null);
   const getLamp = () => {
     getLampHttp(spaceId).then((res) => {
+      if (res.result != 'success') return;
       const arr = res.content;
-      if (arr.length > 1) setIsMore(true);
-      arr.forEach((item) => {
-        if (item.runStatus) {
-          setIsOpen(true);
-        } else {
-          setIsOpen(false);
-        }
-      });
+      if (arr.length > 1) {
+        setIsMore(true);
+        let totalIsOpen = false;
+        arr.forEach((item) => {
+          if (item.runStatus) {
+            totalIsOpen = true;
+          }
+        });
+        setIsOpen(totalIsOpen);
+      } else {
+        arr.forEach((item) => {
+          if (item.runStatus) {
+            setIsOpen(true);
+          } else {
+            setIsOpen(false);
+          }
+        });
+      }
+
       setLampArr(arr);
     });
   };

+ 7 - 3
src/services/ant-design-pro/equipment.js

@@ -13,13 +13,14 @@ function getProjectId() {
 
 //窗帘  设置设备
 export const setEquipeHttp = (params)=> {
-  return $http({
-    serverSp: config.brsgServer.duoduoUrl,
-    url: `/server/object/eqp/infocode/set?${commonParams()}`,
+  return request(`/server/object/eqp/infocode/set?${commonParams()}`,{
     method: 'POST',
     isNotShowErrorToast: true,
     errorSave: true,
     data: JSON.stringify(params),
+    headers: {
+        'Content-Type': 'application/json',
+    },
   });
 }
 
@@ -30,6 +31,9 @@ export const getObjectDataEqpGroupHttp = (params) => {
     isNotShowErrorToast: true,
     errorSave: true,
     data: JSON.stringify(params),
+    headers: {
+        'Content-Type': 'application/json',
+    },
   });
 }