<template>
  <div>
    <el-dialog title="案件详情" :visible="showarchiveDetails" @close="cancel" :destroy-on-close="true" center>
      <div class="loading" v-if="flagLoadingS">
        <i class="el-icon-loading"></i>
      </div>
      <div v-else>
          <!-- <div class="noData" v-if="noData">暂无数据！</div> -->
          <el-tabs v-model="activeName"  @tab-click="handleClick">
            <el-tab-pane label="申请人案件证据资料" name="first"></el-tab-pane>
            <el-tab-pane label="被申请人案件证据资料" name="second"></el-tab-pane>
            <el-tab-pane label="裁决书附件" name="third"></el-tab-pane>
            <!-- <el-tab-pane label="仲裁申请书" name="fourth"></el-tab-pane> -->
            <el-tab-pane label="案件视频" name="five"></el-tab-pane>
            <el-tab-pane label="庭审笔录" name="six"></el-tab-pane>
         </el-tabs>
         <div v-show="activeName=='first'">
             
             <div v-for="(item,index) in detailsAwardNum.caseAttachList" :key="index" v-if="item.annexType==2" style="margin-top:10px;">
                 <el-link target="_blank" type="primary" :href="fileURL+item.annexPath">{{item.annexName}}</el-link>
             </div>
            <el-empty v-if="isNoData(detailsAwardNum.caseAttachList,2) == 0" description="暂无数据"></el-empty>
         </div>
         <div v-show="activeName=='second'">
            <div v-for="item in detailsAwardNum.caseAttachList" v-if="item.annexType==6" style="margin-top:10px;">
                 <el-link target="_blank" type="primary" :href="fileURL+item.annexPath">{{item.annexName}}</el-link>
             </div>
             <el-empty v-if="isNoData(detailsAwardNum.caseAttachList,6) == 0" description="暂无数据"></el-empty>
         </div>
         <div  v-show="activeName=='third'">
             <div v-for="item in detailsAwardNum.caseAttachList" v-if="item.annexType==3" style="margin-top:10px;">
                 <el-link target="_blank" type="primary" :href="fileURL+item.annexPath">{{item.annexName}}</el-link>
             </div>
             <el-empty v-if="isNoData(detailsAwardNum.caseAttachList,3) == 0" description="暂无数据"></el-empty>
         </div>
         <div  v-show="activeName=='fourth'">
             <div v-for="item in detailsAwardNum.caseAttachList" v-if="item.annexType==1" style="margin-top:10px;">
                 <el-link target="_blank" type="primary" :href="fileURL+item.annexPath">{{item.annexName}}</el-link>
             </div>
             <el-empty v-if="isNoData(detailsAwardNum.caseAttachList,1) == 0" description="暂无数据"></el-empty>
         </div>
         <div  v-show="activeName=='five'">            
             <video style="background-color: #181717;width: 350px;height: 200px;margin: 10px;" :src="headPath + item.annexPath" v-for="(item,index) in videoList" :key="index" controls="controls"></video>
             <el-empty v-if="videoList == null || videoList.length ==0" description="暂无数据"></el-empty>
         </div>
         <div v-show="activeName=='six'">
             <div v-for="(item,index) in trialTranscripts" :key="index" style="margin-top:10px;">
                 <el-link target="_blank" type="primary" :href="fileURL+item.annexPath">{{item.annexName}}</el-link>
             </div>
              <el-empty v-if="trialTranscripts == null || trialTranscripts.length ==0" description="暂无数据"></el-empty>
         </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
    props: ["showarchiveDetails","detailsAwardNum","videoList","flagLoadingS","trialTranscripts"],
  components: {
    
  },
  data() {
    return {
     activeName: 'first',
      fileURL: window.location.origin + "/API",
      headPath:window.location.origin + "/API",
      noData: false,
    //   myData:[],
    //   videoLists:[]
    };
  },
  created(){
    
    
  },
  methods: {
    isNoData(data,type){
        let resNumber = 0
        if(data){
            let list = data.filter(item => item.annexType == type)
            if(list){
                resNumber = list.length
            }
        }
        return resNumber
    },
    handleClick(tab, event) {

    },
    
    cancel() {
      this.$emit("cancelDetail");
    //   this.activeName ="first"
    },
  },
}
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__body {
  height: 500px !important;
  overflow: auto !important;
}
::v-deep .el-dialog {
  width: 800px;
  background: #ffffff;
  border-radius: 20px;
}
.loading {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;

  .el-icon-loading {
    font-size: 50px;
  }
}
</style>