zhuliu 10 місяців тому
батько
коміт
f8a4009bb0

+ 29 - 15
src/components/VabOnlyOffice/index.vue

@@ -155,7 +155,7 @@ import mixins from './index.js'
               review: true, //跟踪变化
               comment:true,//是否可以注释文档
               copy:true,
-              chat: false,
+              chat: true,
             },
             url: option.url,
           },
@@ -168,7 +168,7 @@ import mixins from './index.js'
             customization: {
               comments:true,
               about:false,
-              autosave: true,//是否自动保存
+              autosave: false,//是否自动保存
               forcesave:true,
               
               help: false,
@@ -202,6 +202,7 @@ import mixins from './index.js'
             onRequestHistoryData:this.onRequestHistoryData,//获取历史文件
             onRequestRestore:this.onRequestRestore,//恢复
             onRequestHistoryClose:this.onRequestHistoryClose,//关闭历史
+            onDocumentStateChange:this.onDocumentStateChange,
           },
           width: '100%',
           height: '100%',
@@ -252,13 +253,14 @@ import mixins from './index.js'
           return
         }
         var currentVersion = this.currentVersion.currentVersion
+        this.option.version = currentVersion
         var history = []
         for(var i = 0;i<that.historyData.length;i++){
           var item = that.historyData[i]
             history.push(
                 {
                   serverVersion:item.serverVersion,
-                  changes:item.changes,
+                  // changes:item.changes,
                   created:item.created,
                   user:item.user,
                   version:item.version,
@@ -292,12 +294,12 @@ import mixins from './index.js'
             key:obj.key,
             url:this.$c.url+ (this.$c.env=='production'?'/api':'')+'/fileManager/downloadFile?fileId=' +obj.url,
             version:obj.version,
-            previous:obj1?{
-              fileType:obj1.fileType,
-              key:obj1.key,
-              url:this.$c.url+ (this.$c.env=='production'?'/api':'')+'/fileManager/downloadFile?fileId=' +obj1.url,
-            }:null,
-            changesUrl:obj.changesUrl?(this.$c.url+ (this.$c.env=='production'?'/api':'')+'/fileManager/downloadFile?fileId=' +obj.changesUrl):""
+            // previous:obj1?{
+            //   fileType:obj1.fileType,
+            //   key:obj1.key,
+            //   url:this.$c.url+ (this.$c.env=='production'?'/api':'')+'/fileManager/downloadFile?fileId=' +obj1.url,
+            // }:null,
+            // changesUrl:obj.changesUrl?(this.$c.url+ (this.$c.env=='production'?'/api':'')+'/fileManager/downloadFile?fileId=' +obj.changesUrl):""
           }
           var params = {
             jsons:JSON.stringify(obj2)
@@ -314,19 +316,31 @@ import mixins from './index.js'
             this.docEditor.setHistoryData(obj2)
           }
       },
+      //恢复
       onRequestRestore(event){
-        console.log(event)
-        const fileType = event.data.fileType
-        const url = event.data.url
         const version = event.data.version
-        return
-        this.$api.restoreVersion().then(response=>{
-
+        var params = {
+          userId:this.option.user.id,
+          userName:this.option.user.name,
+          restoreVersion:version,
+          previousVersion:this.option.version,
+          guid:this.option.id
+        }
+        this.$api.restoreVersion(params).then(response=>{
+          if(response.code == 200){
+            this.setEditor(this.option)
+          }
         })
       },
       onRequestHistoryClose(event){
         this.setEditor(this.option)
       },
+      onDocumentStateChange(event){
+        if(this.option.isSave){
+          this.option.isSave = false
+          this.$emit('reLoadQuery',this.option)
+        }
+      },
       getFileType(fileType) {
         let docType = ''
         let fileTypesDoc = [

+ 17 - 1
src/store/persisPlugin.js

@@ -41,12 +41,28 @@ export default function(store){
     window.addEventListener('storage', function(e) {  
         var key = e.key
         if(key == 'changePermission'){
-            console.log(1)
             if(storage.getObj('vuex')){
                 console.log(2)
                 store.replaceState(storage.getObj('vuex'))
             }
             
         }
+        if(key == 'onlyOfficeFile'){
+            var data = localStorage.getItem('onlyOfficeFile')
+            if(!data){
+                return
+            }
+            var data1 = JSON.parse(data)
+            var message = this.$message({
+                message: '信息保存中,请不要立即下载',
+                type: 'warning',
+                duration:0
+            });
+              setTimeout(()=>{
+                message.close()
+                this.$message.success('信息保存成功')
+                localStorage.setItem('onlyOfficeFile',null)
+              },10000)
+        }
     });  
 }

+ 21 - 10
src/views/components/onlyOffice/index.vue

@@ -1,7 +1,7 @@
 <template>
     <div class='qualityManual-container'>
         <div v-if='show' class='qualityManual-container-office'>
-            <vab-only-office :option='option' />
+            <vab-only-office :option='option' @reLoadQuery="reLoadQuery"/>
         </div>
     </div>
 </template>
@@ -84,14 +84,25 @@ export default {
             // this.show = true
         },
         //刷新网页参数
-        reLoadQuery(){
-            this.$router.replace({
-                path: '/onlyOffice',
-                query: {
-                    ...this.file,
-                   
-                }
-            })
+        reLoadQuery(data){
+            if(data){
+                this.$router.replace({
+                    path: '/onlyOffice',
+                    query: {
+                        ...data,
+                    
+                    }
+                })
+            }else{
+                this.$router.replace({
+                    path: '/onlyOffice',
+                    query: {
+                        ...this.file,
+                    
+                    }
+                })
+            }
+            
         },
         getOption(){
             this.option.name = this.file.title
@@ -100,7 +111,7 @@ export default {
             this.option.url = this.$c.url+ (this.$c.env=='production'?'/api':'')+'/fileManager/downloadFile?fileId=' + this.file.guid
             this.option.fileType = this.file.fileType
             this.option.key = this.file.guid
-            this.option.created = formatDate(new Date(),'YYYY-MM-DD HH:mm:ss')
+            this.option.created = this.file.createTime || formatDate(new Date(),'YYYY-MM-DD HH:mm:ss')
             this.$nextTick(()=>{
                 this.show = true
             })

+ 2 - 1
src/views/report/components/reportFile/reportFileTable.vue

@@ -366,7 +366,8 @@ export default {
             projectId:this.projectId,
             guid:row.fileGuid,
             fileType:row.type,
-            title:row.referencesName
+            title:row.referencesName,
+            createTime:row.createTime
         }
       })
       window.open(router.href, '_blank')