<template>
  <component
    :is="selectOfd"
    :url="$route.query.url"
    :read-only="$route.query.readonly === 'true'"
    :querystring="$route.query.querystring"
    :group-id="$route.query.groupId"
    :put-seal-on="$route.query.putSealOn === 'true'"
  >
  </component>
</template>

<script>
import { sdLocalStorage } from '@/common/services/storage-service'
import SdFoxitReader from '@/common/components/sd-foxit-reader'
import SdSuwellReader from '@/common/components/sd-suwell-reader'
import components from './_import-components/sd-ofd-view-import'
export default {
  name: 'SdOfdView',
  components: {
    ...components,
    SdFoxitReader,
    SdSuwellReader,
  },
  data() {
    return {
      selectOfd: '',
    }
  },
  created() {
    const previewConfig = JSON.parse(sdLocalStorage.getItem('commonConfig') || '{}').oaDocPreview
    // 有记录进行判断，没记录默认数科
    if (previewConfig) {
      // this.selectOfd = previewConfig.layoutDocFirm
      switch (previewConfig.layoutDocFirm) {
        case 'SUWELL':
          this.selectOfd = SdSuwellReader
          break
        case 'FOXIT':
          this.selectOfd = SdFoxitReader
          break
        default:
          this.selectOfd = SdSuwellReader
      }
    } else {
      this.selectOfd = SdSuwellReader
    }
  },
  methods: {},
}
</script>

<style module lang="scss">
@use '@/common/design' as *;
</style>
