Browse Source

fix: 删除记录的时候,设备合并的逻辑处理

chenzhen2 2 năm trước cách đây
mục cha
commit
271fc959d4
1 tập tin đã thay đổi với 29 bổ sung1 xóa
  1. 29 1
      src/views/envmonitor/components/ManualWork/index.vue

+ 29 - 1
src/views/envmonitor/components/ManualWork/index.vue

@@ -1137,7 +1137,14 @@ export default defineComponent({
           } else {
             formTimerArr.map((item: any) => {
               if (item.type == "1") {
-                sceneEquipList.concat(item.sceneEquipList)
+                item.sceneEquipList.map((scene: any) => {
+                  let obj: any = {
+                    projectId: scene.projectId, //类型:String  必有字段  备注:无
+                    objectId: scene.objectId, //类型:String  必有字段  备注:设备id
+                    type: scene.type,
+                  };
+                  sceneEquipList.push(obj);
+                });
               }
             });
           }
@@ -1189,6 +1196,27 @@ export default defineComponent({
             message: "确定删除当前时间吗?",
           })
             .then(() => {
+              console.log("====");
+              console.log(formTimeArr);
+              let sceneEquipList: any = [];
+              formTimeArr.map((item: any) => {
+                if (item.type == "1") {
+                  item.sceneEquipList.map((scene: any) => {
+                    let obj: any = {
+                      projectId: scene.projectId, //类型:String  必有字段  备注:无
+                      objectId: scene.objectId, //类型:String  必有字段  备注:设备id
+                      type: scene.type,
+                    };
+                    sceneEquipList.push(obj);
+                  });
+                }
+              });
+              sceneEquipList = proxyData.removeDuplicateObj(sceneEquipList);
+              formTimeArr.map((item: any) => {
+                if (item.type !== "1") {
+                  item.sceneEquipList = sceneEquipList;
+                }
+              });
               proxyData.saveBatchCustomScene(formTimeArr, 2);
             })
             .catch(() => {