<template>
  <div class="app-container print-work">
    <div class="level-title">
      <h1>人员信息</h1>
    </div>
    <table class="table-ui">
      <tr>
        <td class="bbg-transparent">姓名</td>
        <td >{{ infoname }}</td>
      </tr>
      <tr>
        <td class="bbg-transparent">工号</td>
        <td >{{ id }}</td>
      </tr>
      <tr>
        <td class="bbg-transparent">部门</td>
        <td >{{ info?info.DEPARTMENT_NAME:'' }}</td>
      </tr>
      <tr>
        <td class="bbg-transparent">岗位</td>
        <td >{{ info?info.POST_NAME:'' }}</td>
      </tr>
    </table>
    <table class="table-ui">
      <div class="level-title titles">
        <h1>八项作业</h1>
      </div>

      <tr>
        <td colspan="4" style="padding: 0;">
          <table class="table-vi">
            <tr class="bbg-transparent">
              <td>序号</td>
              <td>作业类型</td>
              <td>作业内容</td>
              <td>编号</td>
            </tr>
            <tr v-for="(item, index) in measuresList" :key="item.ID">
              <td>{{ index + 1 }}</td>
              <td>{{ item.WORK_TYPE }}</td>
              <td>{{ item.WORK_CONTENT }}</td>
              <td>{{ item.WORK_NUMBER }}</td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
    <table class="table-ui">
      <div class="level-title titles">
        <h1>工单信息</h1>
      </div>
      <tr class="bbg-transparent">
        <td>序号</td>
        <td>作业内容</td>
        <td>工单编号</td>
        <td>完工状态</td>
        <td>签发时间</td>
        <td>颜色</td>
      </tr>
      <tr v-for="(item, index) in gongdanList" :key="item.ID">
        <td>{{ index + 1 }}</td>
        <td>{{ item.fnote }}</td>
        <td>{{ item.fgdno }}</td>
        <td>{{ item.fwgFlagname }}</td>
        <td>{{ item.fqfdate }}</td>
        <td>{{ item.fcolorStr }}</td>
      </tr>
    </table>
  </div>
</template>

<script>
import { requestFN } from '@/utils/request'
import moment from 'moment/moment'

export default {
  props: {
    id: {
      type: String,
      default() {
        return ''
      }
    },
    type: {
      type: String,
      default() {
        return ''
      }
    },
    infoname: {
      type: String,
      default() {
        return ''
      }
    }
  },
  data() {
    return {
      config: config,
      info: {},
      ImgList: [],
      measuresList: [],
      gongdanList: []
    }
  },
  created() {
    this.getData()
  },
  methods: {
    formatDate(date, format) {
      if (date) {
        return moment(date).format(format)
      } else {
        return ''
      }
    },
    getData() {
      requestFN(
        '/map/Eight/findEightsByUserId',
        {
          empNo: this.id,
          TYPE: this.type
        }
      ).then((data) => {
        this.info = data.INFO
        this.ImgList = data.ImgList
        this.measuresList = data.varList
        this.gongdanList = data.data
        console.info(this.gongdanList)
      }).catch((e) => {
      })
    }
  }
}
</script>
<style lang="scss" scoped>

.titles {
  margin-top: 20px;
}

</style>
