seimin 2 年之前
父節點
當前提交
011e9c7689
共有 1 個文件被更改,包括 21 次插入8 次删除
  1. 21 8
      assets/js/controllers/inspect/inspectionScopeCtrl.js

+ 21 - 8
assets/js/controllers/inspect/inspectionScopeCtrl.js

@@ -866,14 +866,27 @@ app.directive("zTree", function () {
866 866
       }
867 867
       // 点击复选框-common
868 868
       function zTreeOnCheckCommon(result, nodes) {
869
-        result = result.map((v) => ({
870
-          id: v.inspectionType,
871
-          name: v.inspectionTypeName,
872
-          group: v.group,
873
-          user: v.user,
874
-          parent: v.parent ? { id: v.parent.inspectionType } : undefined,
875
-          pId: v.parent ? v.parent.inspectionType : 0,
876
-        }));
869
+        // 如果有值,则不覆盖
870
+        if($scope.copyInspectionType.length){
871
+          result = [];
872
+          $scope.copyInspectionType.forEach(v=>{
873
+            result.push(v);
874
+            if(v.children && v.children.length){
875
+              v.children.forEach(vv=>{
876
+                result.push(vv);
877
+              })
878
+            }
879
+          })
880
+        }else{
881
+          result = result.map((v) => ({
882
+            id: v.inspectionType,
883
+            name: v.inspectionTypeName,
884
+            group: v.group,
885
+            user: v.user,
886
+            parent: v.parent ? { id: v.parent.inspectionType } : undefined,
887
+            pId: v.parent ? v.parent.inspectionType : 0,
888
+          }));
889
+        }
877 890
 
878 891
         for (var i = 0; i < nodes.length; i++) {
879 892
           for (var j = 0; j < result.length; j++) {