<template>
  <el-dialog
    title="查看"
    :visible.sync="dataObj.detailDialog"
    width="800px"
    :close-on-click-modal="false"
  >
    <div class="content-box">
      <div v-if="firstshow" class="content">

        <!-- 监测表审核 -->
        <el-descriptions style="border:1px solid #ebebeb;padding:30px 20px;" :column="1">
          <el-descriptions-item v-for="(item,index) in dataObj.param" :key="index" :label="item.name">{{item.userSelfCheck}}</el-descriptions-item>
        </el-descriptions>
        <el-table :data="dataObj.fileParam" style="width: 100%">
            <el-table-column prop="name" label="附件" align="center">
            </el-table-column>
            <el-table-column prop="fileName" label="文件名" align="center">
            </el-table-column>
            <el-table-column prop="operate" align="center" label="操作">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="success"
                  @click="handleEdit(scope.$index, scope.row)">下载</el-button>
              </template>
            </el-table-column>
          </el-table>
      </div>
      <div class="last">
        <el-button @click="closeFn">返回</el-button>
      </div>
    </div>
  </el-dialog>
</template>

<script>
export default {
  props: ["dataObj"],
  data() {
    return {
      labelPosition:'right',
      size:'',
      // 第一次显示
      firstshow: true,
      // 第三次显示
      threeshow: false,
      monitorfiles:[
        '1.自查总结','2.上年度资产负债表和收益分配表','3.新获得各种认证、奖励证书复印件','4.台作社相关信息变更材料'
      ]
      };
  },
  methods:{
      // 监测表下载
      handleEdit(sort, row) {
        let _this = this
        this.dataObj.fileParam.forEach((item,index) => {
          if (item.sort == (sort+1)) {
            _this.downLoad(item.fileUrl,item.fileName);
            this.$message({
              message: '下载成功',
              type: 'success'
            });
          }
        });
      },
      filemonitordownload(sort){
        let _this = this
        this.dataObj.fileParam.forEach((item,index) => {
          if (item.sort == (sort+1)) {
            _this.downLoad(item.fileUrl,item.fileName);
          }
        });
        this.$refs.textcheck[sort].innerText = '已下载'
      },
      downLoad(content, fileName) {
        var aEle = document.createElement("a"); // 创建a标签
        aEle.download = fileName; // 设置下载文件的文件名
        aEle.href = content; // content为后台返回的下载地址
        aEle.click(); // 设置点击事件
      },
      // 取消按钮
      closeFn(){
        this.dataObj.detailDialog=false
        this.threeshow = false
        this.firstshow = true
      },
      // //////////第一次
      // 第一次下一步按钮
      nextstepFn(){
        this.firstshow = false
        this.threeshow = true
      },
      // //////////第三次
      beforethreestepFn(){
        this.threeshow = false
        this.firstshow = true
      },
  },
};
</script>

<style lang="scss" scoped>
.content-box {
  .content{
    height: 100%;
    display: flex;
    flex-direction: column;
    /deep/ .el-descriptions-item__label{
      display: inline-block;
      width: 300px;
    }
  }
  .from{
    flex: 1;
  }
}
/* 弹框滚动条 */
/deep/ .el-dialog__body {
  max-height: 62vh;
  overflow: auto;
}
/deep/ .el-dialog__header {
  background: #2ab999;
  .el-dialog__title {
    color: white;
  }
}
/deep/ .el-icon-close:before {
  color: white;
}
/* 表项 */
.file{
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  span{
    line-height: 30px;
  }
  i{
    font-size:30px;
    color:#67C23A;
  }
}
.rejectresolve{
  display: flex;
  justify-content: space-around;
  .resolve{
    text-align: center;
    width: 250px;
  }
}
.resolve{
  width: 100px;
}
/* 按钮右下角 */
.last{
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}
</style>
