Browse Source

ETA在线表格编辑中状态-小问题

hbchen 1 year ago
parent
commit
e1d3f18376

+ 34 - 20
src/views/datasheet_manage/customSheetEdit.vue

@@ -112,12 +112,12 @@ export default {
             this.permissionBtn.isShowBtn('etaTablePermission','etaTable_customize_data_save')
     }
   },
-  beforeRouteLeave(to,from,next){
-    if(to.path!='/addMixedSheet'){
-      this.markFinishStatus()
-    }
-    next()
-  },
+  // beforeRouteLeave(to,from,next){
+  //   if(to.path!='/addMixedSheet'){
+  //     this.markFinishStatus()
+  //   }
+  //   next()
+  // },
   data() {
     return {
       sheetId: this.$route.query.id || '',
@@ -232,9 +232,17 @@ export default {
         Source: 3,
         TableData: this.$refs.customTableRef.getSaveParams()
       };
-      console.log("自动保存");
+      // console.log("自动保存");
       const res = await sheetInterface.sheetEdit({ ExcelInfoId: Number(this.sheetId),...params })
       if(res.Ret !==200) return
+
+      if(res.Data.Status==1){
+        this.$message.warning(res.Data.Msg)
+        setTimeout(()=>{
+          this.backHandle()
+        },1000)
+        return 
+      }
       this.saveTime = this.$moment().format('YYYY-MM-DD HH:mm:ss')
     },1500),
     /* 保存表格 */
@@ -274,7 +282,13 @@ export default {
       : await sheetInterface.sheetAdd(params)
 
       if(res.Ret !==200) return
-
+      if(res.Data.Status==1){
+        this.$message.warning(res.Data.Msg)
+        setTimeout(()=>{
+          this.backHandle()
+        },1000)
+        return 
+      }
       this.sheetId = this.sheetId || res.Data.ExcelInfoId;
       this.$message.success('保存成功')
       this.saveTime =  this.$moment().format('YYYY-MM-DD HH:mm:ss')
@@ -289,23 +303,23 @@ export default {
       //   }
       // })
     },300),
-    markFinishStatus(){
-      if((!this.sheetId) || (!this.isCanEdit)) return
-      sheetInterface.markSheetEditStatus({ExcelInfoId: +this.sheetId,Status:2}).then(res=>{
-        if(res.Ret != 200) return 
-      })
-    }
+    // markFinishStatus(){
+    //   if((!this.sheetId) || (!this.isCanEdit)) return
+    //   sheetInterface.markSheetEditStatus({ExcelInfoId: +this.sheetId,Status:2}).then(res=>{
+    //     if(res.Ret != 200) return 
+    //   })
+    // }
   },
   created() {
     this.getClassify();
     this.getDetail();
   },
-  mounted(){
-    window.addEventListener('beforeunload',this.markFinishStatus)
-  },
-  beforeDestroy(){
-    window.removeEventListener('beforeunload',this.markFinishStatus)
-  }
+  // mounted(){
+  //   window.addEventListener('beforeunload',this.markFinishStatus)
+  // },
+  // beforeDestroy(){
+  //   window.removeEventListener('beforeunload',this.markFinishStatus)
+  // }
 }
 </script>
 <style scoped lang="scss">

+ 32 - 18
src/views/datasheet_manage/mixedSheetEdit.vue

@@ -86,12 +86,12 @@ export default {
               this.permissionBtn.isShowBtn('etaTablePermission','etaTable_customize_mix_save')
     }
   },
-  beforeRouteLeave(to,from,next){
-    if(to.path!='/addMixedSheet'){
-      this.markFinishStatus()
-    }
-    next()
-  },
+  // beforeRouteLeave(to,from,next){
+  //   if(to.path!='/addMixedSheet'){
+  //     this.markFinishStatus()
+  //   }
+  //   next()
+  // },
   data() {
     return {
       sheetId: this.$route.query.id || '',
@@ -181,6 +181,13 @@ export default {
       console.log("自动保存");
       const res = await sheetInterface.sheetEdit({ ExcelInfoId: Number(this.sheetId),...params })
       if(res.Ret !==200) return
+      if(res.Data.Status==1){
+        this.$message.warning(res.Data.Msg)
+        setTimeout(()=>{
+          this.backHandle()
+        },1000)
+        return 
+      }
       this.updateTime = this.$moment().format('YYYY-MM-DD HH:mm:ss')
     },1500),
 
@@ -220,6 +227,13 @@ export default {
       : await sheetInterface.sheetAdd(params)
 
       if(res.Ret !==200) return
+      if(res.Data.Status==1){
+        this.$message.warning(res.Data.Msg)
+        setTimeout(()=>{
+          this.backHandle()
+        },1000)
+        return 
+      }
       this.updateTime = this.$moment().format('YYYY-MM-DD HH:mm:ss')
       
       this.sheetId = this.sheetId || res.Data.ExcelInfoId;
@@ -227,23 +241,23 @@ export default {
       isAdd && this.$router.replace({path:'/addMixedSheet',query:{id:this.sheetId}})
     },300),
 
-    markFinishStatus(){
-      if((!this.sheetId) || (!this.isCanEdit)) return
-      sheetInterface.markSheetEditStatus({ExcelInfoId: +this.sheetId,Status:2}).then(res=>{
-        if(res.Ret != 200) return 
-      })
-    }
+    // markFinishStatus(){
+    //   if((!this.sheetId) || (!this.isCanEdit)) return
+    //   sheetInterface.markSheetEditStatus({ExcelInfoId: +this.sheetId,Status:2}).then(res=>{
+    //     if(res.Ret != 200) return 
+    //   })
+    // }
   },
   created() {
     this.getClassify();
     this.getDetail();
   },
-  mounted(){
-    window.addEventListener('beforeunload',this.markFinishStatus)
-  },
-  beforeDestroy(){
-    window.removeEventListener('beforeunload',this.markFinishStatus)
-  }
+  // mounted(){
+  //   window.addEventListener('beforeunload',this.markFinishStatus)
+  // },
+  // beforeDestroy(){
+  //   window.removeEventListener('beforeunload',this.markFinishStatus)
+  // }
 }
 </script>
 <style scoped lang="scss">