<template>
  <el-drawer
    title="外加工单脚印"
    :reverse="true"
    :visible.sync="drawer"
    :append-to-body="appendToBody"
    :with-header="false">
    <el-timeline style="width: 90%;margin-top: 20px">
      <el-timeline-item
v-for="step in stepList"
                        :timestamp="timeString ? (step.workTime).substring(0,19):step.workMan+'  '+(step.workTime).substring(0,19)"
                        placement="top">
        <el-card class="stepList">
          <h4 style="margin: 5px 0">{{ step.workMemo }}</h4>
          <template v-if="step.workExplain && step.workExplain.substring(0, 6) == 'qrcode'">
            <img :src="step.workExplain.substring(7, step.workExplain.length)" width="100" height="100">
          </template>
          <template v-else>
            <p>{{ step.workExplain }}</p>
          </template>
        </el-card>
      </el-timeline-item>

    </el-timeline>
  </el-drawer>
</template>

<script>
import {getBillStepList} from '@/api/outsideFactory/queryCraftBill/index.js'

export default {
  name: 'billStep',
  props: {
    appendToBody: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      idOrder: '',
      drawer: false,
      stepList: [],
      timeString: ''
    }
  },
  methods: {
    // 获取脚印
    getBillStep() {
      const _that = this
      _that.drawer = true
      var data = {
        idCraftBill: _that.idOrder
      }
      // console.log(data);
      getBillStepList(data).then(response => {
        console.log(response.data)
        const data = response.data
        _that.stepList = data;
        if (response.data.length<=0){
          _that.drawer = false;
          _that.$message("暂无外加工单脚印")
        }
      }).catch(err => {
        _that.drawer = false;
        _that.$message.error(err)
      })
    }
  }
}
</script>

<style scoped>

</style>
