|
@@ -25,6 +25,7 @@ import mixins from './index.js'
|
|
|
docEditor: null,
|
|
|
loading:false,
|
|
|
show:true,
|
|
|
+ currentVersion:{},
|
|
|
historyData:[]
|
|
|
}
|
|
|
},
|
|
@@ -123,14 +124,14 @@ import mixins from './index.js'
|
|
|
}
|
|
|
var params = {
|
|
|
guid:this.option.id,
|
|
|
- current:1,
|
|
|
- size:1
|
|
|
}
|
|
|
- await this.$api.queryFileVersion(params).then(response=>{
|
|
|
+ await this.$api.getCurrentVersionData(params).then(response=>{
|
|
|
if(response.code == 200){
|
|
|
- if(response.data && response.data.length > 0){
|
|
|
- var obj = response.data[0]
|
|
|
+ if(response.data && response.data.fileType){
|
|
|
+ var obj = response.data
|
|
|
this.option.fileType=obj.fileType,
|
|
|
+ this.option.key=obj.key,
|
|
|
+ this.option.version = obj.version
|
|
|
this.option.url=this.$c.url+ (this.$c.env=='production'?'/api':'')+'/fileManager/downloadFile?fileId=' +obj.url
|
|
|
}
|
|
|
}
|
|
@@ -154,14 +155,14 @@ import mixins from './index.js'
|
|
|
review: true, //跟踪变化
|
|
|
comment:true,//是否可以注释文档
|
|
|
copy:true,
|
|
|
-
|
|
|
+ chat: false,
|
|
|
},
|
|
|
url: option.url,
|
|
|
},
|
|
|
documentType: this.doctype,
|
|
|
editorConfig: {
|
|
|
// callbackUrl: 'http://192.168.2.24:8803/Test/TestQuery',//"编辑word后保存时回调的地址,这个api需要自己写了,将编辑后的文件通过这个api保存到自己想要的位置
|
|
|
- callbackUrl: `http://192.168.2.103:5000/onlyOffice/callback?guid=${option.id}&created=${option.created}&user=${JSON.stringify(user)}`,//"编辑word后保存时回调的地址,这个api需要自己写了,将编辑后的文件通过这个api保存到自己想要的位置
|
|
|
+ callbackUrl: `http://192.168.2.103:5000/onlyOffice/callback?guid=${option.id}&created=${option.created}&user=${JSON.stringify(user)}&previousVersion=${option.version}`,//"编辑word后保存时回调的地址,这个api需要自己写了,将编辑后的文件通过这个api保存到自己想要的位置
|
|
|
lang: option.lang,//语言设置
|
|
|
//定制
|
|
|
customization: {
|
|
@@ -169,7 +170,7 @@ import mixins from './index.js'
|
|
|
about:false,
|
|
|
autosave: true,//是否自动保存
|
|
|
forcesave:true,
|
|
|
- chat: false,
|
|
|
+
|
|
|
help: false,
|
|
|
// "hideRightMenu": false,//定义在第一次加载时是显示还是隐藏右侧菜单。 默认值为false
|
|
|
//是否显示插件
|
|
@@ -233,57 +234,48 @@ import mixins from './index.js'
|
|
|
console.log(this.docEditor)
|
|
|
|
|
|
},
|
|
|
- onRequestHistory(event){
|
|
|
+ async onRequestHistory(event){
|
|
|
var params = {
|
|
|
guid:this.option.id
|
|
|
}
|
|
|
- this.$api.queryFileVersion(params).then(response=>{
|
|
|
+ var that = this
|
|
|
+ await this.$api.queryFileVersion(params).then(response=>{
|
|
|
if(response.code == 200){
|
|
|
- console.log(response.data)
|
|
|
- var data = response.data
|
|
|
- this.historyData = [...data]
|
|
|
- if(data.length == 0){
|
|
|
- this.docEditor.refreshHistory({
|
|
|
- currentVersion:'',
|
|
|
- history:[]
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- var currentVersion = data[0].version
|
|
|
- var history = []
|
|
|
- for(var i = 0;i<data.length;i++){
|
|
|
- var item = data[i]
|
|
|
- var changes = item.changes
|
|
|
- if(changes){
|
|
|
- changes = JSON.parse(changes)
|
|
|
- for(var j = 0;j<changes.length;j++){
|
|
|
- var change = changes[j]
|
|
|
- history.push(
|
|
|
- {
|
|
|
- ...change,
|
|
|
- version:item.version,
|
|
|
- key:item.key,
|
|
|
- serverVersion:item.serverVersion
|
|
|
- }
|
|
|
- )
|
|
|
- }
|
|
|
- }else{
|
|
|
- history.push(
|
|
|
- {
|
|
|
- version:item.version,
|
|
|
- key:item.key,
|
|
|
- }
|
|
|
- )
|
|
|
- }
|
|
|
- }
|
|
|
- this.docEditor.refreshHistory(
|
|
|
- {
|
|
|
- currentVersion:currentVersion,
|
|
|
- history:history.reverse()
|
|
|
- }
|
|
|
- )
|
|
|
+ that.currentVersion = response.data.currentVersion
|
|
|
+ that.historyData = response.data.history
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+ if(this.historyData.length == 0 || !this.currentVersion){
|
|
|
+ that.docEditor.refreshHistory({
|
|
|
+ currentVersion:'',
|
|
|
+ history:[]
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ console.log(0)
|
|
|
+ var currentVersion = this.currentVersion.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,
|
|
|
+ created:item.created,
|
|
|
+ user:item.user,
|
|
|
+ version:item.version,
|
|
|
+ key:item.key,
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ history.reverse()
|
|
|
+ this.docEditor.refreshHistory(
|
|
|
+ {
|
|
|
+ currentVersion:currentVersion,
|
|
|
+ history:history
|
|
|
+ }
|
|
|
+ )
|
|
|
},
|
|
|
async onRequestHistoryData(event){
|
|
|
const version = event.data
|
|
@@ -291,11 +283,23 @@ import mixins from './index.js'
|
|
|
return item.version == version
|
|
|
})
|
|
|
if(obj){
|
|
|
+ var obj1 = null
|
|
|
+ if(obj.previousVersion){
|
|
|
+ obj1 = this.historyData.find(item=>{
|
|
|
+ return item.version == obj.previousVersion
|
|
|
+ })
|
|
|
+ }
|
|
|
var obj2 = {
|
|
|
fileType:obj.fileType,
|
|
|
key:obj.key,
|
|
|
url:this.$c.url+ (this.$c.env=='production'?'/api':'')+'/fileManager/downloadFile?fileId=' +obj.url,
|
|
|
- version:obj.version
|
|
|
+ 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):""
|
|
|
}
|
|
|
var params = {
|
|
|
jsons:JSON.stringify(obj2)
|