<template>
  <div class="patent-articles-patent-right" @mouseup="mouseup" @mousemove="mousemove">
    <el-tabs value="0">
      <el-tab-pane label="原文" name="0" :style="{height: height + 'px',overflowY: 'auto'}">
        <p class="common" v-for="(item, index) in records.original">
          <span v-if="item" data-type="权利要求原文"  v-html="getViewDom(item,'权利要求原文')"></span>
        </p>
      </el-tab-pane>
      <el-tab-pane label="译文" name="1" :style="{height: height + 'px',overflowY: 'auto'}">
        <p class="common" v-for="(item, index) in records.translation">
          <span v-if="item"  data-type="权利要求译文"  v-html="getViewDom(item,'权利要求译文')"></span>
        </p>
      </el-tab-pane>
      <el-tab-pane v-if="signPatentNo" label="权利特征" name="2" :style="{height: height + 'px',overflowY: 'auto'}">
          <Features :patentNo="signPatentNo" :reportId="reportId"></Features>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import { addContrast } from './mixins'
import { commonMixins } from "./mixins"
import Features from './features.vue'
import { patentKeywordsHighlight } from "@/views/components/common/mixins";

export default {
  components:{
    Features
  },
  props:['signPatentNo','reportId'],
  mixins: [commonMixins,addContrast,patentKeywordsHighlight],
  data() {
    return {
      height: 0,
      fullHeight: document.documentElement.clientHeight,
      records: {
        original: [],
        translation: []
      }
    }
  },
  watch: {
    fullHeight() {
      this.refresh()
    },
    patentId() {
      this.initData()
    }
  },
  created() {
    window.addEventListener('resize', this.handleResize)
  },
  mounted() {
    this.handleResize()
    this.initData()
  },
  methods: {
    initData() {
      this.records.original = this.patent.rights.map(item => item.content)
      this.records.translation = this.patent.rights.map(item => item.contentOut)
    },
    handleResize(event) {
      this.fullHeight = document.documentElement.clientHeight
      this.height = this.fullHeight - 250
    },
  }
}
</script>

<style lang="scss">
.patent-articles-patent-right {
  margin-bottom: 20px;
  .common {
    font-size: 14px;
    margin-top: 0;
    padding-right: 5px;
    word-break: break-all;
  }
  .title {
    font-weight: bold;
    border-bottom: 1px solid #e6e6e6;
    padding-bottom: 5px;
    margin-top: 0;
  }
}
</style>