From 323f6a0697eac1c76e42cbc9eab9fba394286e1f Mon Sep 17 00:00:00 2001
From: shj <1790240199@qq.com>
Date: 星期五, 01 四月 2022 14:49:41 +0800
Subject: [PATCH] 检查清单

---
 src/views/safetyproduction/new.vue |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/views/safetyproduction/new.vue b/src/views/safetyproduction/new.vue
index 6d0496c..7e63649 100644
--- a/src/views/safetyproduction/new.vue
+++ b/src/views/safetyproduction/new.vue
@@ -203,6 +203,11 @@
   },
   created() {
     this.TreeA();
+      safetyInspectionItemName().then((res) => {
+        if (res.data.code == 200) {
+          this.nameList = res.data.result;
+        }
+      });
     this.id = this.$route.query.name;
     this.itemId = this.$route.query.id;
     this.itemInfo(this.$route.query.id);
@@ -218,14 +223,14 @@
             trees.push(this.list.itemList[i].elementA);
           }
           this.treeList = Array.from(new Set(trees));
-          var arr = this.checkSameDataA(this.list.itemList);
+          var arr = this.checkSameDataA(this.list.itemList);  
           for (var i = 0; i < arr.length; i++) {
-            var capB = {
+            var cser=[]
+              for(var j=0;j<arr[i].child.length;j++){ 
+             var capB = {
                 safetySelfInspectionId: "",
                 safetyInspectionItemId: "",
               }
-              var cser=[]
-              for(var j=0;j<arr[i].child.length;j++){
               capB.safetySelfInspectionId=arr[i].child[j].safetySelfInspectionId
               capB.safetyInspectionItemId=arr[i].child[j].safetyInspectionItemId
               cser.push(capB)
@@ -246,7 +251,7 @@
     },
     TreeB(id) {
       safetyInspectionItemTreeB({ id: id }).then((res) => {
-        this.list = [];
+        // this.list = [];
         if (this.id == "添加") {
           if (res.data.code == 200) {
             this.list = res.data.result;
@@ -281,9 +286,10 @@
           if(this.list.length!=0){
           var capA = { elementAName: "", id: [], child: [] };
           var atte = [];
+        
           capA.elementAName = this.list[0].elementAName;
           for (var i = 0; i < this.list.length; i++) {
-            var capB = {
+               var capB = {
               safetySelfInspectionId: "",
               safetyInspectionItemId: "",
             };
@@ -363,28 +369,24 @@
     open(type) {
       this.dialogVisible = true;
       this.form.status = type;
+      console.log("xxxxx",this.lists)
       var arr = [];
       for (var i = 0; i < this.lists.length; i++) {
-        this.lists[i].id;
+        // this.lists[i].id;
         for (var j = 0; j < this.lists[i].id.length; j++) {
           arr.push(this.lists[i].id[j]);
         }
       }
       this.form.itemList = arr;
-      safetyInspectionItemName().then((res) => {
-        if (res.data.code == 200) {
-          this.nameList = res.data.result;
-        }
-      });
     },
       closeDialog(){
         this.dialogVisible = false
-          console.log(123,this.form)
       },
     addC() {
        this.$refs["form"].validate((valid) => {
         if (valid) {
       if (this.id == "添加") {
+        console.log("添加",this.form)
         safetySelfInspectionAdd(this.form).then((res) => {
           if (res.data.code == 200) {
             this.dialogVisible = false;
@@ -400,6 +402,7 @@
           }
         });
       } else if (this.id == "编辑") {
+        console.log('编辑',this.form)
         safetySelfInspectionMod(this.form).then((res) => {
           this.dialogVisible = false;
           this.$notify({

--
Gitblit v1.9.2