<template>
<div :style="{ top: showPositionTop + 'px', left: showPositionLeft + 'px' }">
  <div style="background:white;display:flex; justify-content:flex-end;align-items: center;height: 50px;" >
    <el-button type="primary" size="small" @click="checkResult" style="margin-right:10px;height:32px;"> 查看结果 </el-button>
    <el-popover placement="bottom" title="关键词高亮" width="320" trigger="click" >
      <patent-keywords-highlight :project-id="projectId" />
        <el-button :disabled="!$permission('/workspace/common/highlight')" slot="reference" size="small" type="primary" class="margin-right_10">
           高亮<i class="el-icon-arrow-down el-icon--right"></i>
        </el-button>
    </el-popover>
    <el-switch
      v-model="value"
      :disabled="!$permission('/workspace/details/comparison')"
      inactive-text="对比"
      active-color="#00BFFF"
      inactive-color="#D3D3D3">
    </el-switch>
    <patent-list v-if="taskId" :patent-id="patentId" :project-id="projectId" @on-change="onChange" :taskId="taskId" :location="location1" :state="state" :ban='ban'/>
  </div>       
              
  <!-- <el-button @click="two">对比</el-button> -->
  <el-container style=" border: 1px solid #eee">
    <el-container v-show="width!='100%'">
    <el-aside style="margin:0;" width="100%" >
      <contrast-index v-if="signPatentNo" :reportType="reportType" :publicNo="signPatentNo" :signPatentNo="signPatentNo"  @getVisible="getVisible" :type="type" :reportId="reportId" :isTrue="isTrue" @openContrast='openContrast' :taskId="taskId" @patentStatusEmit="patentStatusEmit" :patentStatus2A="patentStatus2A"/>
      <contrast-index v-else :patentMessage="message" :reportType="reportType" :publicNo="pNo" @on-change='changefix' @getVisible="getVisible" :type="type" :reportId="reportId" :isTrue="isTrue" @openContrast='openContrast' :taskId="taskId" @patentStatusEmit="patentStatusEmit" :patentStatus2A="patentStatus2A"/>
    </el-aside>
    </el-container>
    <el-aside :style="{width:width}">
      <div class="patent-articles" >
        <el-container v-loading="loading">
          <!-- <el-aside width="250px" class="patent-articles-menu">
            <el-container>
              <el-header style="height: 180px;">
                <patent-list :patent-id="patentId" :project-id="projectId" @on-change="onChange" />
              </el-header>
              <el-main>
                <patent-image v-if="patent.image" :project-id="projectId" :patent="patent" :patent-id="patentId" @refresh="getPatent(patentId)"></patent-image>
              </el-main>
            </el-container>
          </el-aside> -->
          <el-container >
            <el-header class="patent-articles-title">
              <div class="patent-articles-title-box">
                <div style="position:relative">
                  <img src="@/assets/visual/fixed.png" width="20px" height="20px" v-if="fix===true&&value==true" @click="qx" style="position:absolute;top:5px;left:5px"/>
                  <img src="@/assets/visual/unfixed.png" width="20px" height="20px" v-if="fix===false&&value==true"  @click="gd" style="position:absolute;top:5px;left:5px"/>
                <!-- <div style="background-image:url('');width:20px;height:20px"></div> -->
                  <div>
                  <span v-html="getViewDom(patent.publicNo)"></span>
                  <el-tag type="primary" effect="dark" size="mini" class="margin-left_10">{{ patent.simpleStatus }}</el-tag>
                  <el-tag :type="patentStatus2=='0'?'info':'primary'" effect="dark" size="mini" class="margin-left_10" style="cursor: pointer" @click="changeStatus(patentStatus2)">{{ patentStatus[patentStatus2] }}</el-tag>
                </div>
                <div style="color: #6b6868; font-size: 15px;border-bottom: 1px solid #e6e6e6;padding-bottom: 5px;">
                  <span v-html="getViewDom2(patent, 'name')"></span>
                  <el-link type="primary" @click.native="handleChange(patent, 'name')" style="margin-left: 10px;margin-top: -3px;">
                    <span v-if="!patent.change">切换译文</span>
                    <span v-else>切换原文</span>
                  </el-link>
                </div>
                </div>
              
                <div style="  position: relative;">
                  <el-link v-for="item in menuList" :type="activeMenu === item.value ? 'primary' : undefined" :disabled="item.value === 'PatentExport' ? !$permission('/workspace/details/exportDocument'): false " @click.native="handleSelect(item.value)">{{ item.label }}</el-link>
                  <el-link v-for="item in menuList2" :type="activeMenu === item.value ? 'primary' : undefined" :disabled="item.value === 'PatentExport' ? !$permission('/workspace/details/exportDocument'): false " @click.native="handleSelect(item.value)">{{ item.label }}</el-link>
                  <el-tooltip class="item" effect="dark" :content="(showRight ? '隐藏' : '显示') + '右侧菜单'" placement="top">
                    <i :class="showRight ? 'el-icon-s-unfold' : 'el-icon-s-fold'" style="font-size: 25px;position: absolute; right: 10px; margin-top: 5px;color: #2f2f2f; cursor: pointer" @click="showRight = !showRight"></i>
                  </el-tooltip>
                </div>
              </div>
            </el-header>
            <el-main class="patent-articles-content" style="padding-left:30px">
              <div class="patent-articles-content-left" :style="{ width: showRight ? 'calc(100% - 321px)' : 'calc(100% - 21px)' }">
                <component :is="componentName" :reportType="reportType"  @getVisible="getVisible" :project-id="projectId" @isTrues="getIsTrue" :isTrue="isTrue" :type1="type" :patent="patent" :reportId="reportId" :patent-id="patentId" @openContrast='openContrast' @refresh="getPatent(patentId)" ></component>
              </div>
              <div class="patent-articles-content-right" v-if="showRight">
                <el-container>
                  <el-header>
                    <div class="patent-articles-option">
                      <el-tabs v-model="activeOption" type="card">
                        <el-tab-pane label="标引" name="PatentField"></el-tab-pane>
                        <!-- <el-tab-pane label="高亮" name="PatentKeywordsHighlight"></el-tab-pane> -->
                        <!-- <el-tab-pane label="注释" name="PatentAnnotation" :disabled="!($permission('/workspace/details/notes') && $r(projectId,[1,2]))"></el-tab-pane> -->
                      </el-tabs>
                    </div>
                  </el-header>
                  <el-main >
                    <keep-alive>
                      <component :is="activeOption" @status="getStatus" :taskId="taskId" :project-id="projectId" :patent-id="patentId" :reportId="reportId" :patentNo1="patentNo1"></component>
                        <component :is="activeOption" @status="getStatus" :taskId="taskId" :project-id="projectId" :patent-id="patentId" :reportId="reportId" :patentNo1="patentNo1"></component>
                    </keep-alive>
                  </el-main>
                </el-container>
              </div>
            </el-main>
          </el-container>
        </el-container>
        <div class="content-main" style="padding-left:40px"></div>
      </div>
    </el-aside>

   
  </el-container>

  <el-dialog title="添加对比" :visible.sync="visible" width="1000px" :before-close="close">
    <el-form :model="ruleForm" ref="ruleForm" label-width="100px" label-position="left">
       
       <el-form-item label="选中文本" class="item">
         <el-input v-model="ruleForm.content" placeholder="请输入备注" type="textarea" show-word-limit></el-input>
       </el-form-item>
       <el-form-item label="位置/附图号" class="item">
         <el-input v-model="ruleForm.position" placeholder="请输入备注" show-word-limit></el-input>
       </el-form-item>
       <el-form-item label="解析过程" class="item">
         <el-input v-model="ruleForm.paresingProcess" placeholder="请输入解析过程" show-word-limit></el-input>
       </el-form-item>
       <el-form-item label="代表图" class="item">
        <!-- :on-preview="handlePictureCardPreview"
          :on-remove="handleRemove" -->
          <!-- action="https://jsonplaceholder.typicode.com/posts/" -->
        <!-- <el-upload
          
          list-type="picture-card"
          :on-change="handleChange"
          >
          <i class="el-icon-plus"></i>
        </el-upload> -->
        <el-upload ref="upload"  action="#" :auto-upload="false"  :on-change="handleChangeUpload"  list-type="picture" :show-file-list="false">
          <span v-if="dialogImageUrl!=''" class="avatar">
            <span class="deleteImg">
             <span> 
              <i class="el-icon-zoom-in" @click.stop="handlePictureCardPreview"></i>
          <i class="el-icon-delete" @click.stop="handleRemove"></i></span>
            </span>
          <img style="width:100%" :src="dialogImageUrl" >
          </span>
          <i v-else class="el-icon-plus avatar-uploader-icon"></i>
        </el-upload>
       </el-form-item>
       <el-form-item label="权利特征" class="item" style="margin-bottom:5px">
         <span v-for="item in ruleForm.features">[{{item.rightName}}]
          <el-tooltip class="item" effect="dark" :content="item.content" placement="top">
                      <span>特征{{item.featuresOrder}}</span>
                    </el-tooltip>  
          &nbsp;&nbsp;</span>
       </el-form-item>
     </el-form>
     <div style="max-height:300px;overflow:auto">
        <Features @getFeatures="getFeatures" :patentNo="signPatentNo" :reportId="reportId" :selectedFeatures="selectedFeatures" :selectedFeaturesId="ruleForm.featureslist"></Features>
      </div>
     <div slot="footer" class="dialog-footer">
        <el-button @click="close">取 消</el-button>
        <el-button type="primary" v-if="ruleForm.id" @click="delContrast(ruleForm)">删 除</el-button>
        <el-button type="primary" @click="submit">确 定</el-button>
      </div>
  </el-dialog>
  <el-dialog :visible.sync="dialogVisible">
  <img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
</div>
</template>

<script>
import { changeTranslation, patentKeywordsHighlight } from '../common/mixins'
import PatentList from './components/PatentList'
import PatentField from './components/PatentField'
// import PatentAnnotation from './components/PatentAnnotation'
import PatentBasic from "./components/PatentBasic"
import PatentPDF from "./components/PatentPDF"
import PatentImage from "./components/PatentImage"
import PatentRight from "./components/PatentRight"
import PatentInstruction from "./components/PatentInstruction"
import PatentFamily from "./components/PatentFamily"
import PatentStatus from "./components/PatentStatus"
// import PatentKeywordsHighlight from '../components/PatentKeywordsHighlight'
import ContrastIndex from './ContrastIndex'
import PatentKeywordsHighlight from "../common/PatentKeywordsHighlight"
import Examination from './components/history/examination.vue'
import File from './components/history/file.vue'
import Invalid from './components/history/invalid.vue'
import Litigation from './components/history/litigation.vue'
import Other from './components/history/other.vue'
import { getPatentCountry } from "@/utils";
import Import from '../import/index.vue'
// import {addContrast} from './components/mixins';
import Features from './components/features.vue'

export default {
  mixins: [patentKeywordsHighlight, changeTranslation],
  props:['patentNo','taskId1','location','state'],
  components: {
    ContrastIndex,
    PatentList,
    PatentField,
    // PatentAnnotation,//右侧自定义字段中右侧注释部分
    PatentKeywordsHighlight,
    PatentBasic,
    PatentPDF,
    PatentImage,
    PatentRight,
    PatentFamily,
    PatentStatus,
    PatentInstruction,
    Import,
    Features,
    Examination,
    File,
    Invalid,
    Litigation,
    Other,
},
  data() {
    return {
      reportType:'',
      patentStatus:{
        '0':'未读',
        '1':'已读'
      },
      patentStatus2: '',
      patentStatus2A:{},
      hideUploadEdit:false,
      dialogImageUrl: '',
      dialogVisible: false,
      selectedFeatures:[],
      reportId:'',
      ruleForm:{},
      visible:false,
      location1:this.location?this.location:'',
      signPatentNo:'',
      showPositionTop:0,
      showPositionLeft:0,
      ban:0,
      pNo:'',
      message:"1",
      fix:false,
      fix2:false,
      cfix:false,
      value: false,
      width:'100%',
      showRight: false,
      patentId: parseInt(this.$route.params.id || 0),
      projectId: parseInt(this.$route.query.id || 0),
      patent: {},
      activeMenu: 'PatentBasic',
      componentName: 'PatentBasic',
      activeOption: 'PatentField',
      loading: false,
      menuList: [
        {
          value: 'PatentBasic',
          label: '基础信息'
        },
        {
          value: 'PatentRight',
          label: '权利要求'
        },
        {
          value: 'PatentImage' ,
          label:'附图'
        },
        {
          value: 'PatentInstruction',
          label: '说明书文本'
        },
        {
          value: 'PatentFamily',
          label: '同族专利'
        },
        {
          value: 'PatentStatus',
          label: '法律状态'
        },
        {
          value: 'PatentPDF',
          label: '说明书'
        },
        {
          value: 'PatentExport',
          label: '导出文档'
        },
      ],
      menuList2: [
        {
          value: 'Examination',
          label: '审查历史'
        },
        // {
        //   value: 'File',
        //   label: '申请案卷'
        // },
        {
          value: 'Invalid',
          label: '无效记录'
        },
        {
          value: 'Litigation',
          label: '诉讼历史'
        },
        {
          value: 'Other',
          label: '其他参考资料'
        },
      ],
      contrastMessage:{},
      isTrue:false,
      taskId:this.taskId1?this.taskId1:'',
      type: '',
      Already: [],
      // imgList: [],
      file:[],
      patentNo1:this.patentNo
    }
  },
  
  created() {
  },
  mounted() {
    window.selectMark = this.selectMark
    this.signPatentNo = this.$s.getSession('params').signPatentNo
    console.log(this.$s.getSession('params'))
   this.taskId = this.$s.getSession('params').taskId
   this.reportType = this.$s.getSession('params').reportType
   this.type = this.$s.getSession('params').type
    this.reportId = this.$s.getSession('params').reportId
    if(this.signPatentNo){
      this.getContrastList(this.signPatentNo)
    }
    this.getPatent(this.patentNo)
      console.log(this.reportId);
  },
  watch:{
    patentNo(val){
      this.patentNo1= val
    },
    value(val){
      this.value = val
      if(val==true){
        this.width='50%'
      }else{
        this.width='100%'
      }
    },
    fix2(val){
       if(this.fix==true&&val==true){
        this.ban=1
      }else{
        this.ban=0
      }
    },
    fix(val){
        if(this.fix2==true&&val==true){
        this.ban=1
      }else{
        this.ban=0
      }
    },
    patentStatus2(val) {
      // this.patentStatus2A=val
      this.patentStatus2A = {
        patentNo: this.patentNo,
        patentStatus2:this.patentStatus2
      }
    },

  },
  methods: {
    getIsTrue(val){
      console.log(val)
      this.isTrue = val
    },
    handleRemove(file,fileList) {
        this.file = []
        this.dialogImageUrl = ''
        this.ruleForm.filePath = ''
      },
      handlePictureCardPreview(file) {
        // this.dialogImageUrl = file.url;
        this.dialogVisible = true;
      },
      // handleDownload(file) {
      //   console.log(file);
      // },
    // 上传
    handleChangeUpload(file, fileList) {
      console.log(file,fileList)
      this.dialogImageUrl = file.url
      this.hideUploadEdit = true
      this.file.push(file.raw)
    },
  

    selectMark(Id){
    console.log(Id,this.contrastList)
  // this.selectMarkObjectId = Id;
//   this.showPizhu();
var index = this.contrastList.findIndex(item=>{
  return item.id == Id
})
console.log(index)
if(index!=-1){
  
  this.ruleForm = {
    id:this.contrastList[index].id,
    index:this.contrastList[index].position,
    content:this.contrastList[index].content,
    position:this.contrastList[index].fields,
    features:this.contrastList[index].features,
    filePath:this.contrastList[index].filePath,
    paresingProcess:this.contrastList[index].paresingProcess,
    featureslist:this.contrastList[index].featuresIdList
  }
  if(this.contrastList[index].filePath){
    this.dialogImageUrl = this.$p + this.contrastList[index].filePath
  }else{
    this.dialogImageUrl = ''
  }
  this.selectedFeatures = []
  for(var i=0;i<this.contrastList[index].features.length;i++){
    this.selectedFeatures.push({
      id:this.contrastList[index].features[i].id,
      pRightName:this.contrastList[index].features[i].rightName,
      content:this.contrastList[index].features[i].content,
      comResult:this.contrastList[index].assoRecordsFeatures[i].comResult,
    })
  }
  // this.selectedFeaturesId=this.contrastList[index].featuresId
  // this.$set(this.ruleForm,'',a)
  console.log(this.visible,this,this.height)
  if(this.visible == undefined){
    console.log('jin')
    var a = {
      ruleForm:this.ruleForm,
      selectedFeatures:this.selectedFeatures
    }
    this.$emit('getVisible',a)
  }else{
     this.visible = true
  }
 
}

  },
    //查看结果
    checkResult(){
      const router = this.$router.resolve({
                path: '/result',
                query: {
                  reportId:this.reportId,
                  taskId:this.taskId,
                  signPatentNo:this.signPatentNo,
                  type:this.type
                }
              })
      window.open(router.href, '_blank');
    },

    getVisible(val){
      console.log('进来了')
      this.ruleForm = val.ruleForm
      this.selectedFeatures = val.selectedFeatures
      this.visible = true
    },
    //关闭弹窗
    close(){
      this.dialogImageUrl = ''
      this.visible = false
      this.isTrue = false
      this.selectedFeatures=[]
      this.ruleForm = {}
      this.$refs.upload.clearFiles()
      this.file=[]
    },
    //打开弹窗
    openContrast(val){
      if(val.patentNo != this.signPatentNo){
        this.contrastMessage = val
        this.selectedFeatures=[]
        this.ruleForm = {}
        this.ruleForm.content = val.text
        this.ruleForm.position = val.column
        this.ruleForm.featureslist=[]
        this.visible = true
      }
      
    },
    //添加、修改对比
    submit(){
      if(this.ruleForm.features&&this.ruleForm.features.length>0){
          if(this.ruleForm.id){
            this.ruleForm.features.forEach(item=>{
              if(!item.featureId)
              item.featureId = item.id
            })
            var a = {
              id:this.ruleForm.id,
              patentNo:this.patent.publicNo,
              position:this.ruleForm.index,
              fields:this.ruleForm.position,
              content:this.ruleForm.content,
              paresingProcess:this.ruleForm.paresingProcess,
              assoRecordsFeatures:this.ruleForm.features,
              reportId:this.reportId,
              taskId:this.taskId
            }
            // let formData = new formData
            let formData = new FormData()
                if(this.file){
                  for (var i = 0; i < this.file.length; i++) {
                    formData.append("files", this.file[i]);
                  }
                }
            formData.append('jsons', JSON.stringify(a))
                
              this.$api.updateCompareRecords(formData).then(response=>{
                if (response.code == 200) {
                  this.$refs.upload.clearFiles()
                  this.file=[]
                  this.dialogImageUrl = ''
                  this.$message.success('修改成功')
                  this.visible = false
                  this.selectedFeatures=[]
                  this.ruleForm={}
                  this.getContrastList()
                }
              })
          }else{
              var a = {
                patentNo:this.contrastMessage.patentNo,
                position:this.contrastMessage.index,
                fields:this.contrastMessage.column,
                content:this.contrastMessage.text,
                paresingProcess:this.ruleForm.paresingProcess,
                assoRecordsFeatures:this.ruleForm.features,
                reportId:this.reportId,
                taskId:this.taskId
            }
            let formData = new FormData()
                if(this.file){
                  for (var i = 0; i < this.file.length; i++) {
                    formData.append("files", this.file[i]);
                  }
                }
            formData.append('jsons', JSON.stringify(a))
              // console.log(a)
              this.$api.addCompareRecords(formData).then(response=>{
                if (response.code == 200) {
                  this.$refs.upload.clearFiles()
                  this.file=[]
                  this.dialogImageUrl = ''
                  this.$message.success('添加成功')
                  this.visible = false
                  this.selectedFeatures=[]
                  this.ruleForm={}
                  this.patentStatus2 = '1'
                  // this.isTrue = true
                  this.getContrastList()
                }
              })
          }
        }else{
           this.$alert('请选择权利特征', '提示', {
              confirmButtonText: '确定',
              callback: action => {
              }
            });
        }
      
   
    },
    //删除对比
    delContrast(ruleForm){
      var a = JSON.parse(JSON.stringify(ruleForm))
      this.$confirm('此操作将永久删除该对比记录, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$api.deleCompareRecords({id:ruleForm.id}).then(response=>{
            if(response.code == 200){
              this.$message.success('删除成功')
              this.visible = false
              this.selectedFeatures=[]
              this.ruleForm={}
              this.dialogImageUrl = ''
              this.getContrastList2(a)
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });          
        });
     
    },
    //根据专利号查询对比记录
    getContrastList(val){
      if(val){
        var a = {
          patentNo:val,
          reportId:this.reportId
        }
      }else{
        var a = {
          patentNo:this.patent.publicNo,
          reportId:this.reportId
        }
      }
      
      this.$api.selectCompareRecord(a).then(response=>{
        if(response.code == 200){
          // console.log(response.data)
          var a = this.$store.state.report.contrastList
          var index = a.findIndex(i=>{
            return i.patentNo == this.patent.publicNo
          })
          if(index == -1){
            response.data.records.forEach(item => {
              a.push(item)
            });
          }else{
            response.data.records.forEach(item => {
              var index2 = a.findIndex(i=>{
                return i.patentNo == this.patent.publicNo && i.content == item.content
              })
              if(index2==-1){
                a.push(item)
              }else{
                a.splice(index2,1,item)
              }
            });
          }
           this.$store.commit('SET_PATENT_CONTRAST', a)
        }
      })
    },
    getContrastList2(ruleForm){
      
      var a = this.$store.state.report.contrastList
          var index = a.findIndex(i=>{
            return i.patentNo == this.patent.publicNo && i.content == ruleForm.content
          })
          if(index!=-1){
            a.splice(index,1)
          }
          this.$store.commit('SET_PATENT_CONTRAST', a)
    },
    getFeatures(val){
      console.log(val)
      var a =[]
      this.ruleForm.featureslist = []
      for(var i = 0;i<val.length;i++){
        this.ruleForm.featureslist.push(val[i].id)
       a.push({
          featureId:val[i].id,
          featuresOrder:val[i].featuresOrder,
          comResult:val[i].comResult,
          rightName:val[i].pRightName,
          content:val[i].content
        })
      }
      this.$set(this.ruleForm,'features',a)
      // this.ruleForm.features = a
    },
    changefix(val){
      // console.log(val)
      this.fix2=val
     
    },
    qx(){
      this.fix=false
      // this.message.fix=false
      // console.log(1)
    },
    gd(){
      this.fix=true
      // this.message.fix=true
    },
    changePageTitle() {
      document.title = `${this.patent.publicNo} ${this.patent.name || ''}`
    },
    async onChange(data) {
      // console.log(this.projectId,data)
      this.message=data.patentNo
      this.patentNo1 = data.patentNo
      if(this.fix!=true){
        await this.getPatent(data.patentNo)
      }
      
      await this.$router.push({
        path: '/ContrastIndex/' + data.id,
        query: {
          patentNo:data.patentNo,
          location:data.location,
        }
      })
      this.location1  = data.location
      this.patentId = data.id
      this.changePageTitle()
    },
    //查询任务下专利状态
    getPatentStatus(patentNo){
      var a = {
        taskID:this.taskId,
        patentNo:patentNo?patentNo:this.patentNo
      }
      console.log(this.patentNo);
      this.$api.getPatentStatus(a).then(response=>{
        if(response.code == 200){
          this.patentStatus2 = response.data
        }
      })
    },
    //修改已读未读
    changeStatus(val){
      if(val == '0'){
        var a = {
          taskID:this.taskId,
          patentNo:this.patentNo
        }
        this.$api.updatePatentStatus(a).then(response=>{
          if(response.code == 200){
            this.patentStatus2 = '1'
          }
        })
      }
      
    },
    //获取状态
    getStatus(val){
      this.patentStatus2 = val
    },
    patentStatusEmit(val) {
      if (this.patentNo==val.patentNo) {
        this.patentStatus2=val.patentStatus2
      }
    },
    async getPatent(publicNo) {
      this.loading = true
      const response = await this.$api.PatentByPatentNo({patentNo : publicNo})
      console.log(response)
      this.patent = response.data
      if(this.taskId){
         this.getPatentStatus(response.data.patentNo)
      }
     
      this.getContrastList()
      this.pNo=this.patent.publicNo
      console.log(this.pNo,this.patent.publicNo)
      // if (this.publicNo == this.patent.publicNo) {
      //   this.showcard = false
      // }
      const country = getPatentCountry(this.patent.patentNo)
      let change = false
      if (country !== 'CN') {
        change = true
      }
      this.$set(this.patent, 'change', change)
      this.$set(this.patent, 'change2', change)
      this.loading = false
      this.changePageTitle()
    },
    // async getPatent(id) {
    //   this.loading = true
    //   const response = await this.$api.getPatentById(id, { projectId: this.projectId })
    //   this.patent = response.data
    //   // console.log(this.patent)
    //   this.pNo=this.patent.publicNo
    //   const country = getPatentCountry(this.patent.patentNo)
    //   let change = false
    //   if (country !== 'CN') {
    //     change = true
    //   }
    //   this.$set(this.patent, 'change', change)
    //   this.$set(this.patent, 'change2', change)
    //   this.loading = false
    //   this.changePageTitle()
    // },
    handleSelect2(index, path) {

    },
    handleSelect(index) {
      if (index === 'PatentExport') {
        const router = this.$router.resolve({
          path: '/export/patent',
          query: {
            id: this.projectId,
            patent: this.patent.id
          }
        })
        window.open(router.href, '_blank');
        return false
      }
      this.activeMenu = index
      this.componentName = index
    }
  }
}
</script>
<style lang="less">
  .item .el-form-item__label{
    // color: blake;
    font-family: '黑体';
  }
  .hideUpload {
  .el-upload.el-upload--picture-card {
    display: none;
  }
}
</style>
<style lang="scss">
.content-main{
  width:80% !important ;
  background-color: skyblue !important;
}
.patent-articles {
  width: 100%;
  height: 100% !important;
  padding: 0 !important;
  .patent-articles-menu {

  }
  .el-menu-item.is-active {
    background: #ecf5ff !important;
    color: #409EFF!important;
  }
  .patent-articles-title {
    padding: 0 !important;
    height: 100px !important;
    .el-link {
      margin-right: 20px;
    }
    .patent-articles-title-box {
      font-size: 20px;
      width: 100%;
      text-align: center;
    }
  }
  .patent-articles-content {
    background: #fff;
    padding: 0;
    height: 100%;
    overflow: hidden;
    .patent-articles-content-left {
      float: left;
      height: 100%;
      overflow-y: auto;
      overflow-x: hidden;
      padding: 10px;
    }
    .patent-articles-content-right {
      width: 300px;
      border-left: 1px solid #e6e6e6;
      float: right;
      height: 100%;
      .el-header {
        height: 50px !important;
        position: relative !important;
      }
      .el-main {
        padding: 0 12px !important;
      }
      .el-container, .el-main {
        height: 100%;
      }
      .patent-articles-option {
        position: absolute;
        bottom: 0;
        height: 100%;
        left: 50px;
        .el-tabs {
          margin-top: 9px;
        }
        .el-tabs__header {
          margin-bottom: 0 !important;
        }
      }
    }
  }
}
</style>

<style lang="scss" scoped>
  .avatar-uploader-icon {
    background-color: #fbfdff;
    border: 1px dashed #c0ccda;
    font-size: 28px;
    color: #8c939d;
    width: 148px;
    height: 148px;
    line-height: 148px;
    text-align: center;
  }
 .avatar {
  
  position: relative;
    width: 148px;
    height: 148px;
    display: block;
  }
  .avatar:hover .deleteImg {
    display: block;
}
.deleteImg {
  display: none;
  font-size: 30px;
  width: 148px;
  height: 148px;
  background-color:black;
	opacity: 0.6; 
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  margin: auto;
  z-index: 999;
}
.deleteImg span i{
  margin-left: 10px;
  color: #fff;
}
.deleteImg span{
  display: flex;
  align-items:center;/*垂直居中*/
  justify-content: center;/*水平居中*/
  width:100%;
  height:100%;
}
</style>