Parcourir la source

修改安全检查保存后刷新功能

凉纪 il y a 1 an
Parent
commit
c8cd41dc4d
1 fichiers modifiés avec 20 ajouts et 6 suppressions
  1. 20 6
      src/views/menu/securityCheckRegister/add.vue

+ 20 - 6
src/views/menu/securityCheckRegister/add.vue

@@ -1,6 +1,10 @@
 <template>
   <div v-if="active" class="register-edit">
-    <nav-bar></nav-bar>
+    <van-nav-bar
+      title="安全检查登记"
+      left-arrow
+      @click-left="barGoBack"
+    />
     <div class="page-container">
       <!--   基本信息   -->
       <div class="card" v-if="taskInfo">
@@ -220,7 +224,8 @@ export default {
       go: {
         type: 'replace',
         path: '/securityCheckRegister'
-      }
+      },
+      event:null,
     }
   },
   computed: {
@@ -263,6 +268,18 @@ export default {
     clearInterval(this.timer);
   },
   methods: {
+    barGoBack(){
+      this.getRouter();
+      if(this.fromPages.name === "works"){
+        this.$router.go(-1);
+      }else {
+        this.$router.replace({
+          name:'securityCheckRegister',
+          path:'/securityCheckRegister',
+          params:{event:this.event}
+        });
+      }
+    },
     //点击NFC数字图标
     clickNFCNum(arr) {
       arr.forEach(v=>{
@@ -382,18 +399,15 @@ export default {
     },
     //插入检查项
     addItem(val) {
-      console.log(val, 'list')
       if (!val) return
       let str = JSON.parse(JSON.stringify(val))
       str.forEach(valItem => {
-        console.log(this.checkList, 'checkList')
         // 查找是否有与 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(() => {
               valItem.isAdd = 1;
               existingItem.pointList.push(valItem)
@@ -403,7 +417,6 @@ export default {
             this.$toast(existingPoint.pointName + '已添加')
           }
         } else {
-          console.log(valItem, 'item添加成功')
           this.checkList.push({
             isAdd:1,
             itemId: valItem.itemId,
@@ -485,6 +498,7 @@ export default {
       this.taskInfo.isSubmit = 0;
       registerSubmit(this.taskInfo).then(res => {
         this.$toast('保存成功');
+        this.event = 'refresh';
         //this.toPagesFcn();
       }).catch(error=>{
         if( error === '任务已完成'){