<template>
  <div>
    <div>

      <el-form label-width="80px">
        <el-form-item label="请假人">
          <at-alert show-icon :message="form.createName" type="info"></at-alert>
        </el-form-item>
        <el-form-item label="请假类型">
          <at-alert show-icon :message="form.type" type="info"></at-alert>
        </el-form-item>
        <el-form-item label="标题">
          <at-alert show-icon :message="form.title" type="info"></at-alert>
        </el-form-item>
        <el-form-item label="原因">
          <at-alert show-icon :message="form.reason" type="info"></at-alert>
        </el-form-item>
        <el-form-item label="开始时间">
          <at-alert show-icon :message="form.leaveStartTime" type="info"></at-alert>
        </el-form-item>
        <el-form-item label="结束时间">
          <at-alert show-icon :message="form.leaveEndTime" type="info"></at-alert>
        </el-form-item>
        <div v-for="(historyData, index) in fromData"
             :key="index">
          <el-form-item label="">
            <at-alert show-icon :message="historyData.taskNodeName" type="warning"></at-alert>
          </el-form-item>
          <el-form-item label="审批人">
            <at-alert show-icon :message="historyData.createName" type="info"></at-alert>
          </el-form-item>
          <el-form-item label="审批时间">
            <at-alert show-icon :message="historyData.createdDate" type="info"></at-alert>
          </el-form-item>

          <el-form v-for="(fistoryFormData, indexH) in historyData.formHistoryDataDTO" :key="indexH" label-width="80px">
            <el-form-item :label=fistoryFormData.title>
              <el-input type="textarea" :rows="1" disabled v-model="fistoryFormData.value"/>
            </el-form-item>
          </el-form>
        </div>
      </el-form>
    </div>

  </div>
</template>

<script>

import {getLeave} from "@/api/business/workflow/workflow/leave";
import {historyFromData} from "@/api/business/workflow/activiti/historyFormdata";

export default {
  name: "leaveHistoryForm",
  props: {
    businessKey: {
      type: String
    }
  },
  data() {
    return {
      // 表单参数
      form: {},
      fromData: [],
    }
  },
  created() {
    this.getLeave()
    this.historyFromData()
  },
  methods: {
    getLeave() {
      getLeave(this.businessKey).then(response => {
        this.form = response.data
      })
    },
    historyFromData() {
      historyFromData(this.businessKey).then(response => {
        this.fromData = response.data
      })
    },
  }

}
</script>

<style scoped>

</style>
