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