<template>
  <div >
    <template v-for="(fromReData,i) in forms.data">
      <el-divider content-position="left">{{fromReData.taskName}}</el-divider>
      <el-card class="box-card">
        <ele-form
          :isShowSubmitBtn=false
          :isShowBackBtn=false
          :isShowResetBtn=false
          :rules="fromReData.formObj.rules"
          :form-desc="fromReData.formObj.formDesc"
          :form-data="fromReData.formObj.formData"
        >
        </ele-form>
      </el-card>
      <br/>
      <el-card class="box-card">
        <template v-if="i===0">
          <el-tag>发起人&nbsp;:&nbsp;{{fromReData.createUser}}</el-tag>
          <br/>
          <br/>
          <el-tag>发起部门&nbsp;:&nbsp;{{fromReData.createDept}}</el-tag>
          <br/>
          <br/>
          <el-tag>发起时间&nbsp;:&nbsp;{{fromReData.createTime}}</el-tag>
        </template>
        <template v-else>
          <el-tag>处理人&nbsp;:&nbsp;{{fromReData.createUser}}</el-tag>
          <br/>
          <br/>
          <el-tag>处理部门&nbsp;:&nbsp;{{fromReData.createDept}}</el-tag>
          <br/>
          <br/>
          <el-tag>处理时间&nbsp;:&nbsp;{{fromReData.createTime}}</el-tag>
        </template>
      </el-card>
      <br/>
      <br/>
    </template>
  </div>
</template>
<script>
  import { showForms } from '@/api/activiti/formsActiviti.js'
  export default {
    props:{
      instanceId:String
    },
    data: function() {
      return {
        forms: {
          data: []
        }
      }
    },
    // 初始化方法
    created() {
    },
    methods: {
      showForms(instanceId) {
        showForms(instanceId).then(response => {
          if (response.code === 200) {
            let list = response.data
            //进行数据处理
            for (var i = 0; i < list.length; i++) {
              //将json字符串转化为对象
              list[i].formObj = JSON.parse(list[i].formObj)
              let mapElement = list[i].formObj.formDesc
              for (var key in mapElement) {
                let type = mapElement[key].type
                //mapElement[key].disabled=true;
                // if ('upload-file' === type) {
                //   let canDelete = mapElement[key].attrs.isCanDelete
                //   if (canDelete !== undefined) {
                //     mapElement[key].attrs.isCanDelete = true
                //   }
                //   let disabled = mapElement[key].attrs.disabled
                //   if (disabled !== undefined) {
                //     mapElement[key].attrs.disabled = false
                //   }
                // }
              }
            }
            this.forms.data = list
            this.forms.open = true
            this.forms.title = '查看审核流程'
          } else {
            this.msgError(response.msg)
          }
        })
      }
    }
  }
</script>

<style scoped>
  /* .el-upload-list--picture-card .el-upload-list__item-actions span+span {*/
  /*  margin-left: 0;*/
  /*}*/
  /*.el-upload-list__item-actions .el-icon-delete{*/
  /*  display: none;*/
  /*  width:0;*/
  /*  height:0*/
  /*}*/
  /*.ele-upload-file-uploader{*/
  /*  display: none;*/
  /*}*/
  /*.ele-upload-list__item-content-action .el-link.el-link--danger .el-link--inner{*/
  /*  display: none;*/
  /*}*/
</style>
