inleft
2022-02-09 9bcb19959eeb9da9bde2561e7278f6d0a55eb151
commit | author | age
9bcb19 1 <template>
I 2   <a-modal
3     title="在线编辑"
4     :footer="null"
5     :width="1500"
6     :visible="visible"
7     @cancel="handleCancel"
8     :destroyOnClose="true"
9   >
10     <a-spin :spinning="divLoading">
11       <div class="editorview" style="height: 800px;">
12         <Editor :option="option"/>
13       </div>
14     </a-spin>
15   </a-modal>
16 </template>
17 <script>
18   import Editor from '../../../components/xnComponents/EditorDiv'
19   import Vue from 'vue'
20   import { ACCESS_TOKEN } from '@/store/mutation-types'
21
22   export default {
23     components: {
24       Editor
25     },
26     data () {
27       return {
28         visible: false,
29         divLoading: false,
30         sysOnlineFileInfoResult: {},
31         option: {
32           url: '',
33           isEdit: true,
34           fileType: '',
35           title: '',
36           token: Vue.ls.get(ACCESS_TOKEN),
37           user: {
38             id: '',
39             name: ''
40           },
41           mode: '',
42           callbackUrl: '',
43           key: '',
44           review: false,
45           type: 'desktop'
46         }
47       }
48     },
49     methods: {
50       /**
51        * 初始化
52        */
53       onlineEdit(record) {
54         this.visible = true
55         const data = record.data.sysOnlineFileInfoResult
56         this.option.user.id = data.editorConfig.user.id
57         this.option.user.name = data.editorConfig.user.name
58         this.option.fileType = data.document.fileType
59         this.option.title = data.document.title
60         this.option.key = data.document.key
61         this.option.url = process.env.VUE_APP_API_BASE_URL + data.document.url // res.data.docServiceApiUrl
62         this.callbackUrl = process.env.VUE_APP_API_BASE_URL + data.editorConfig.callbackUrl
63         // this.option.type = type
64         this.option.review = false
65       },
66       handleCancel () {
67         this.visible = false
68         this.option = {
69           url: '',
70             isEdit: false,
71             fileType: '',
72             title: '',
73             token: Vue.ls.get(ACCESS_TOKEN),
74             user: {
75             id: '',
76               name: ''
77           },
78           mode: '',
79             callbackUrl: '',
80             key: '',
81             review: false
82         }
83       }
84     }
85   }
86 </script>
87 <style>
88   .editorview iframe{
89     position: absolute !important;
90   }
91 </style>