浏览代码

ETA在线表格编辑中状态-优化-1

hbchen 1 年之前
父节点
当前提交
9c96f95692
共有 2 个文件被更改,包括 48 次插入14 次删除
  1. 15 0
      src/views/datasheet_manage/addSheet.vue
  2. 33 14
      src/views/datasheet_manage/sheetList.vue

+ 15 - 0
src/views/datasheet_manage/addSheet.vue

@@ -175,6 +175,14 @@ export default {
       }
       const res = await sheetInterface.sheetEdit(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')
 
       // console.log("自动保存");
@@ -214,6 +222,13 @@ export default {
 
       this.loading.close()
       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;

+ 33 - 14
src/views/datasheet_manage/sheetList.vue

@@ -719,6 +719,13 @@ export default {
       });
       this.loading.close();
       if (res.Ret !== 200) return;
+      if(res.Data.Status==1){
+        this.$message.warning(res.Data.Msg)
+        this.refreshOnlineExcel()
+        this.onlineExcelEditing=false
+        this.editButtonText = `${res.Data.Editor}编辑中`
+        return 
+      }
       this.$message.success("保存成功");
       this.markFinishStatus()
 
@@ -726,7 +733,7 @@ export default {
       this.getDetailHandle();
     }, 300),
     autoSaveFun:_.debounce(async function(){
-      console.log("自动保存");
+      // console.log("自动保存");
       if(!this.onlineExcelEditing || this.cancelAutoSave){
         this.cancelAutoSave=false
         return
@@ -745,6 +752,14 @@ export default {
         Content: JSON.stringify(data),
       });
       if (res.Ret !== 200) return;
+      if(res.Data.Status==1){
+        this.$message.warning(res.Data.Msg)
+        this.refreshOnlineExcel()
+        this.onlineExcelEditing=false
+        this.editButtonText = `${res.Data.Editor}编辑中`
+        this.autoSaveType=''
+        return 
+      }
       if(this.autoSaveType == "nameEdit"){
         this.getTreeData();
         this.autoSaveType=''
@@ -841,19 +856,7 @@ export default {
           if(this.sheetDetailInfo.Source === 1) {
             if(this.editButtonText.indexOf('编辑中')!=-1){
               // 编辑中的状态 重新获取最新的详情数据
-              sheetInterface.sheetDetail({
-                ExcelInfoId: this.select_id,
-              })
-              .then((res) => {
-                if (res.Ret !== 200) return;
-
-                this.sheetDetailInfo = res.Data;
-                this.saveTime = this.$moment(this.sheetDetailInfo.ModifyTime).format('YYYY-MM-DD HH:mm:ss')||''
-
-                this.$nextTick(() => {
-                  this.$refs.sheetRef.init();
-                });
-              });
+              this.refreshOnlineExcel()
             }
 
             this.onlineExcelEditing=true
@@ -960,6 +963,22 @@ export default {
         // 保持连接 让请求不会因为页面关闭而中断
         keepalive: true
       });
+    },
+    // 刷新在线excel详情数据
+    refreshOnlineExcel(){
+      sheetInterface.sheetDetail({
+        ExcelInfoId: this.select_id,
+      })
+      .then((res) => {
+        if (res.Ret !== 200) return;
+
+        this.sheetDetailInfo = res.Data;
+        this.saveTime = this.$moment(this.sheetDetailInfo.ModifyTime).format('YYYY-MM-DD HH:mm:ss')||''
+
+        this.$nextTick(() => {
+          this.$refs.sheetRef.init();
+        });
+      });
     }
   },
   mounted() {