Bladeren bron

修复bug

凉纪 2 jaren geleden
bovenliggende
commit
e24b835b6d

+ 1 - 0
src/views/menu/securityCheckRegister/addCheck.vue

@@ -109,6 +109,7 @@ export default {
       checkList(this.query).then(res=>{
         res.rows.forEach(v=>{
           v.checked = false;
+          v.pointId = v.id;
         });
         this.query.pageNum === 1 ? this.dataList = res.rows : this.dataList = [...this.dataList,...res.rows];
         console.log(this.dataList.length,res.total,'this.dataList')

+ 1 - 1
src/views/menu/securityCheckRegister/addWorker.vue

@@ -88,7 +88,7 @@ export default {
       this.formData.userId = this.selected;
       accredit(this.formData).then(res=>{
         this.$toast('授权成功');
-        this.$router.replace({path:'/securityDetail'});
+        this.$router.replace({path:'/securityCheckRegister'});
       })
     },
     click(v,i){

+ 12 - 11
src/views/menu/securityCheckRegister/detail.vue

@@ -164,22 +164,20 @@ export default {
       handler(val){
         console.log(val,'val')
         if(!val)return
-
-        val.forEach((valItem) => {
+        let str =  JSON.parse(JSON.stringify(val));
+        str.forEach((valItem) => {
           // 查找是否有与 valItem.itemId 相同的项
           const existingItem = this.checkList.find((checkItem) => checkItem.itemId === valItem.itemId);
-
           if (existingItem) {
             // // 如果存在相同 itemId 的项,查找 pointList 是否有与 valItem.pointId 相同的项
             const existingPoint = existingItem.pointList.find((pointItem) => pointItem.pointId === valItem.id);
             if (!existingPoint) {
               console.log(existingItem,'point添加成功')
               this.$nextTick(()=>{
-                existingItem.pointList.push({
-                  ...valItem,
-                  pointId: valItem.id,
-                });
+                existingItem.pointList.push(valItem);
               })
+            }else {
+              this.$toast('该检查项已添加');
             }
           } else {
             console.log(valItem,'item添加成功')
@@ -193,7 +191,6 @@ export default {
           }
         });
       },
-      deep:true
     },
   },
   computed:{
@@ -261,7 +258,9 @@ export default {
       this.taskInfo.isSubmit = 0;
       registerSubmit(this.taskInfo).then(res=>{
         this.$toast('保存成功');
-        this.$router.go(-1);
+        this.$router.replace ({
+          path:'/securityCheckRegister',
+        });
       })
     },
 
@@ -284,7 +283,9 @@ export default {
       this.taskInfo.isSubmit = 1;
       registerSubmit(this.taskInfo).then(res=>{
         this.$toast('提交成功');
-        this.$router.go(-1);
+        this.$router.replace ({
+          path:'/securityCheckRegister',
+        });
       })
     },
 
@@ -325,7 +326,7 @@ export default {
     //切换开关时添加操作时间
     switchChange(item){
       console.log(item,'666')
-      item.resTime = formatDate(new Date());
+      //item.resTime = formatDate(new Date());
     },
     //添加图片时的回调
     changeNfcImg(imgItem){