|
|
@@ -11,96 +11,96 @@ import { showView } from '@/api/platform/file/attachment'
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
|
|
export default {
|
|
|
- name: 'editor',
|
|
|
- props: {
|
|
|
- option: {
|
|
|
- type: Object
|
|
|
+ name: 'editor',
|
|
|
+ props: {
|
|
|
+ option: {
|
|
|
+ type: Object
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ doctype: '',
|
|
|
+ newId: '',
|
|
|
+ timer: '',
|
|
|
+ configKey: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ option: {
|
|
|
+ handler: function(n, o) {
|
|
|
+ this.setEditor(n)
|
|
|
+ this.doctype = handleDocType(n.fileType)
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ // this.option = this.$route.query
|
|
|
+
|
|
|
+ /* 调用初始化方法 ,渲染wps*/
|
|
|
+ if (this.option.url) {
|
|
|
+ this.setEditor(this.option)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ setEditor(option) {
|
|
|
+ console.log(option, 'document.bodydocument.body', option.url)
|
|
|
+ this.doctype = handleDocType(option.fileType)
|
|
|
+ const url = option.url + '&access_token=' + getToken()
|
|
|
+ console.log(option, 'urq:' + url)
|
|
|
+ const config = {
|
|
|
+ type: 'mobile',
|
|
|
+ document: {
|
|
|
+ fileType: option.fileType,
|
|
|
+ key: option.key,
|
|
|
+ title: option.title,
|
|
|
+ permissions: {
|
|
|
+ comment: true,
|
|
|
+ copy: true,
|
|
|
+ download: false,
|
|
|
+ modifyContentControl: true,
|
|
|
+ modifyFilter: true,
|
|
|
+ print: false,
|
|
|
+ edit: true,
|
|
|
+ fillForms: true,
|
|
|
+ review: true
|
|
|
+ },
|
|
|
+ url: url
|
|
|
},
|
|
|
-
|
|
|
- },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- doctype: '',
|
|
|
- newId: '',
|
|
|
- timer: '',
|
|
|
- configKey: '',
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- option: {
|
|
|
- handler: function (n, o) {
|
|
|
- this.setEditor(n)
|
|
|
- this.doctype = handleDocType(n.fileType)
|
|
|
+ documentType: this.doctype,
|
|
|
+ editorConfig: {
|
|
|
+ callbackUrl: option.editUrl,
|
|
|
+ lang: 'zh',
|
|
|
+ canHistoryRestore: true,
|
|
|
+ canUseHistory: true,
|
|
|
+ customization: {
|
|
|
+ commentAuthorOnly: false,
|
|
|
+ comments: true,
|
|
|
+ compactHeader: false,
|
|
|
+ compactToolbar: true,
|
|
|
+ plugins: true,
|
|
|
+ feedback: {
|
|
|
+ // 隐藏反馈按钮
|
|
|
+ visible: false
|
|
|
},
|
|
|
- deep: true
|
|
|
- }
|
|
|
- },
|
|
|
- mounted () {
|
|
|
- // this.option = this.$route.query
|
|
|
-
|
|
|
- /* 调用初始化方法 ,渲染wps*/
|
|
|
- if (this.option.url) {
|
|
|
- this.setEditor(this.option)
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- setEditor (option) {
|
|
|
- console.log(option,'document.bodydocument.body')
|
|
|
- this.doctype = handleDocType(option.fileType)
|
|
|
- const url = option.url + '&access_token=' + getToken()
|
|
|
- console.log(option,'urq:' + url)
|
|
|
- const config = {
|
|
|
- type: 'mobile',
|
|
|
- document: {
|
|
|
- fileType: option.fileType,
|
|
|
- key: option.key,
|
|
|
- title: option.title,
|
|
|
- permissions: {
|
|
|
- comment: true,
|
|
|
- copy: true,
|
|
|
- download: false,
|
|
|
- modifyContentControl: true,
|
|
|
- modifyFilter: true,
|
|
|
- print: false,
|
|
|
- edit: true,
|
|
|
- fillForms: true,
|
|
|
- review: true
|
|
|
- },
|
|
|
- url: url
|
|
|
- },
|
|
|
- documentType: this.doctype,
|
|
|
- editorConfig: {
|
|
|
- callbackUrl: option.editUrl,
|
|
|
- lang: 'zh',
|
|
|
- canHistoryRestore: true,
|
|
|
- canUseHistory: true,
|
|
|
- customization: {
|
|
|
- commentAuthorOnly: false,
|
|
|
- comments: true,
|
|
|
- compactHeader: false,
|
|
|
- compactToolbar: true,
|
|
|
- plugins: true,
|
|
|
- feedback: {
|
|
|
- // 隐藏反馈按钮
|
|
|
- visible: false
|
|
|
- },
|
|
|
- // true 表示强制文件保存请求添加到回调处理程序
|
|
|
- forcesave: true,
|
|
|
- // 取消强制保存,进行手动保存
|
|
|
- atuosave: false
|
|
|
- },
|
|
|
- user: {
|
|
|
- id: this.$store.getters.userId,
|
|
|
- name: this.$store.getters.name
|
|
|
- },
|
|
|
- mode: option.mode
|
|
|
- },
|
|
|
- width: '100%',
|
|
|
- height: window.innerHeight - 46 + 'px'
|
|
|
- }
|
|
|
- const docEditor = new DocsAPI.DocEditor('editorDiv', config)
|
|
|
- this.configKey = config.document.key
|
|
|
- }
|
|
|
+ // true 表示强制文件保存请求添加到回调处理程序
|
|
|
+ forcesave: true,
|
|
|
+ // 取消强制保存,进行手动保存
|
|
|
+ atuosave: false
|
|
|
+ },
|
|
|
+ user: {
|
|
|
+ id: this.$store.getters.userId,
|
|
|
+ name: this.$store.getters.name
|
|
|
+ },
|
|
|
+ mode: option.mode
|
|
|
+ },
|
|
|
+ width: '100%',
|
|
|
+ height: window.innerHeight - 46 + 'px'
|
|
|
+ }
|
|
|
+ const docEditor = new DocsAPI.DocEditor('editorDiv', config)
|
|
|
+ this.configKey = config.document.key
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|