heyang 1 年之前
父节点
当前提交
f810053558
共有 1 个文件被更改,包括 17 次插入7 次删除
  1. 17 7
      src/views/safetyCheck/startInspection/index.vue

+ 17 - 7
src/views/safetyCheck/startInspection/index.vue

@@ -970,14 +970,24 @@
       getHazardInfoByJoinIds(id,joinHazardIds){
         getHazardInfoByJoinIds({joinHazardIds:joinHazardIds}).then(response => {
             if(response.data[0]){
-              response.data.forEach(function(item) {
-                item.lookType=true;
-                item.checkHazardDtoList.forEach(function(item2) {
-                  item2.hazardCheckCode=item2.code
-                })
-              })
+              let dataList=JSON.parse(JSON.stringify(response.data))
+              for(let i=0;i<dataList.length;i++){
+                dataList[i].lookType=true;
+                for(let b=0;b<dataList[i].checkHazardDtoList.length;b++){
+                  //把最外层的code填充到内层
+                  dataList[i].checkHazardDtoList[b].hazardCheckCode=dataList[i].code
+                }
+                //判断新旧数据是否相等,如果相等旧数据填充新数据
+                for(let k=0;k<this.addForm.checkHazardInfoVoList.length;k++){
+                  if(dataList[i].joinHazardId==this.addForm.checkHazardInfoVoList[k].joinHazardId){
+                    dataList[i]=this.addForm.checkHazardInfoVoList[k]
+                  }
+                }
+
+              }
+              this.addForm.checkHazardInfoVoList=dataList
             }
-            this.addForm.checkHazardInfoVoList=response.data
+
         });
       },
       //专项检查选中