<!--
    查看单个文档
    <lookDocumentDataDialog v-if="lookDocumentType" :propsLookDocumentData="propsLookDocumentData"></lookDocumentDataDialog>

    import lookDocumentDataDialog from '@/components/lookDocumentDialog/lookDocumentDataDialog.vue'

    components: {
      lookDocumentDataDialog
    },

    data(){
      return{
        //子组件数据
        lookDocumentType:false,
        propsLookDocumentData:{},
      }
    }

    //查看单个文档
    lookDocumentButton(type,row){
      if(type==1){
        this.$set(this,'propsLookDocumentData',{
          title:"整改报告",
          type:1,
          id:row.id,
          name:row.title
        });
        this.$set(this,'lookDocumentType',true);
      }else{
        this.$set(this,'lookDocumentType',false);
      }
    },
-->
<template>
  <el-dialog class="lookDocumentDataDialog" :title="lookDocumentTitle"
             :class="fullScreenType?'lookDocumentDataDialog-fullScreen':''"
             :visible.sync="lookDocumentType" v-if="lookDocumentType"
             @close="outLook"
             width="834px" height="645px" append-to-body>
    <div class="lookDocumentDataDialog-page scrollbar-box">
      <rectificationReportDom v-if="documentType == 1" :propsRectificationReportData="propsRectificationReportData"></rectificationReportDom>
      <noticeDom v-if="documentType == 2" :propsNoticeDomData="propsNoticeDomData"></noticeDom>
      <informDom v-if="documentType == 3" :propsInformDomData="propsInformDomData"></informDom>
    </div>
    <p class="positionButton" @click="fullScreenButton">{{fullScreenType?'退出':'全屏'}}</p>
    <div slot="footer" class="dialog-footer dialog-footer-box" style="display: flex">
      <p class="dialog-footer-button-null"></p>
      <p class="dialog-footer-button-info" @click="outLook">取消</p>
      <p class="dialog-footer-button-primary" @click="downloadButton">下载</p>
      <p class="dialog-footer-button-null"></p>
    </div>
  </el-dialog>
</template>

<script>
  import rectificationReportDom from './components/rectificationReportDom.vue'
  import noticeDom from './components/noticeDom.vue'
  import informDom from './components/informDom.vue'
  export default {
    name: 'lookDocumentDataDialog',
    props:{
      propsLookDocumentData:{},
    },
    components: {
      rectificationReportDom,
      noticeDom,
      informDom
    },
    data(){
      return{
        //全屏状态
        fullScreenType:false,
        lookDocumentType:true,
        lookDocumentTitle:"",
        lookDocumentSrc:"",
        documentType:null,//1.整改报告 2.通知书 3.告知书,
        //整改报告
        propsRectificationReportData:{},
        //通知书
        propsNoticeDomData:{},
        //告知书
        propsInformDomData:{},
      }
    },
    created(){
      this.$set(this,'lookDocumentTitle',this.propsLookDocumentData.title);
      if(this.propsLookDocumentData.type == 1){
        this.$set(this.propsRectificationReportData,'id',this.propsLookDocumentData.id)
        this.$set(this,'documentType',1)
      }else if(this.propsLookDocumentData.type == 2){
        this.$set(this.propsNoticeDomData,'id',this.propsLookDocumentData.id)
        this.$set(this,'documentType',2)
      }else if(this.propsLookDocumentData.type == 3){
        this.$set(this.propsInformDomData,'id',this.propsLookDocumentData.id)
        this.$set(this,'documentType',3)
      }
    },
    mounted(){

    },
    methods:{
      // 返回按钮
      outLook(){
        this.$parent.lookDocumentButton(2)
      },
      // 下载按钮
      downloadButton(){
        if(this.documentType == 1){
          this.downloadGet('/zd-security/checkRectify/genReport?id='+this.propsLookDocumentData.id+'&fileUrl='+localStorage.getItem('fileBrowseEnvironment'),this.propsLookDocumentData.name+'(整改报告).docx');
        }else if(this.documentType == 2){
          this.downloadGet('/zd-security/checkManage/getRectifyAdviceNote?checkMangeId='+this.propsLookDocumentData.id+'&fileUrl='+localStorage.getItem('fileBrowseEnvironment'),this.propsLookDocumentData.name+'(整改通知书).docx');
        }else if(this.documentType == 3){
          this.downloadGet('/zd-security/checkManage/getRectifyNotification?checkMangeId='+this.propsLookDocumentData.id+'&fileUrl='+localStorage.getItem('fileBrowseEnvironment'),this.propsLookDocumentData.name+'(整改告知书).docx');
        }
      },
      fullScreenButton(){
        this.fullScreenType = !this.fullScreenType
      },
      //打开新窗口
      goPage(){
        window.open(this.lookDocumentSrc)
      },
    }
  }
</script>

<style scoped lang="scss">
  .lookDocumentDataDialog{
    .lookDocumentDataDialog-page{
      display: flex;
      flex-direction: column;
      flex:1;
      height:645px;
      position: relative;
    }
    .positionButton{
      position: absolute;
      top:15px;
      right: 15px;
      border:1px solid #0183fa;
      border-radius:4px;
      line-height:30px;
      width:60px;
      text-align: center;
      cursor: pointer;
      color:#0183fa;
      background-color: #fff;
    }
    .positionButton:hover{
      background-color:#0183fa;
      color:#fff;
    }
  }
  .lookDocumentDataDialog-fullScreen{
    background-color: #666;
    .positionButton{
      top:25px;
      right: 15px;
    }
    ::v-deep .el-dialog{
      width:100% !important;
      height:100% !important;
      box-shadow: none;
    }
    ::v-deep .el-dialog__header{
      display: none;
    }
    ::v-deep .el-dialog__body{
      height:100% !important;
      background-color: #666;
      .lookDocumentDataDialog-page{
        height:100%;
      }
    }
    ::v-deep .el-dialog__footer{
      display: none;
    }
  }
</style>
