[update] 企标制修订和企标更改流程左侧预览改成在线编辑预览

This commit is contained in:
lideqin
2024-04-24 15:09:46 +08:00
parent a3f60b207b
commit 386b99a97b
3 changed files with 34 additions and 51 deletions
@@ -45,6 +45,7 @@ import { previewPdf } from '@/utils/previewPdf'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { queryFileInfoByEditId } from '../../../../api/workCenter'
import { onlineEditorGetUrl, onlineEditorView } from '../../../../utils/onlyOfficeUtils'
const Base64 = require('js-base64').Base64
@@ -85,17 +86,17 @@ export default {
}
},
methods: {
add (fileId) {
this.getFileInfo(fileId).then(res => {
this.handlePreview(res)
})
async add (fileId) {
if (fileId) {
this.iframeSrc = await onlineEditorGetUrl(fileId)
}
this.visible = true
this.form.resetFields()
},
edit (fileId, record, index) {
this.getFileInfo(fileId).then(res => {
this.handlePreview(res)
})
if (fileId) {
this.iframeSrc = onlineEditorGetUrl(fileId)
}
this.visible = true
this.index = index
this.form.resetFields()
@@ -104,24 +105,6 @@ export default {
this.form.setFieldsValue(pick(this.model, 'clause', 'requirement'))
})
},
getFileInfo (fileId) {
return new Promise(resolve => {
let fileInfo
queryFileInfoByEditId({ id: fileId }).then(res => {
if (res.success) {
fileInfo = res.result
}
}).finally(() => {
resolve(fileInfo)
})
})
},
handlePreview (file) {
const filePaths = file.editFilePath.split('/')
const fileName = filePaths[filePaths.length - 1]
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(this.documentUrl + file.editFilePath + '&fullfilename=' + fileName))}`
this.iframeSrc = url
},
close () {
this.visible = false
this.model = {}
@@ -64,6 +64,7 @@ import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { USER_INFO } from '../../../../store/mutation-types'
import { queryFileInfoByEditId } from '../../../../api/workCenter'
import { onlineEditorGetUrl } from '../../../../utils/onlyOfficeUtils'
const Base64 = require('js-base64').Base64
@@ -124,18 +125,18 @@ export default {
}
},
methods: {
add (file) {
this.getFileInfo(file).then(res => {
this.handlePreview(res)
})
async add (file) {
if (file) {
this.iframeSrc = await onlineEditorGetUrl(file)
}
this.isAdd = true
this.visible = true
this.form.resetFields()
},
edit (file, record, index) {
this.getFileInfo(file).then(res => {
this.handlePreview(res)
})
async edit (file, record, index) {
if (file) {
this.iframeSrc = await onlineEditorGetUrl(file)
}
this.visible = true
this.index = index
this.form.resetFields()
@@ -144,24 +145,6 @@ export default {
this.form.setFieldsValue(pick(this.model, 'clauseNum', 'clauseName', 'editAdvice'))
})
},
getFileInfo (fileId) {
return new Promise(resolve => {
let fileInfo
queryFileInfoByEditId({ id: fileId }).then(res => {
if (res.success) {
fileInfo = res.result
}
}).finally(() => {
resolve(fileInfo)
})
})
},
handlePreview (file) {
const filePaths = file.editFilePath.split('/')
const fileName = filePaths[filePaths.length - 1]
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(this.documentUrl + file.editFilePath + '&fullfilename=' + fileName))}`
this.iframeSrc = url
},
close () {
this.visible = false
this.model = {}