<template>
  <div class="order__progress" v-show="isShow()">
    <div>
      X
    </div>
    <div class="steps__mian">
      <el-steps direction="vertical" :active="active">
        <el-step v-for="(item,index) in stepList"
                 :title="item"
                 :description="descriptionFunc(index)"/>
      </el-steps>
    </div>
  </div>
</template>

<script setup name='OrderProgress'>
import {yiZhuData} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";

let stepList = ['录入医嘱', '确认医嘱', '执行医嘱', '停止医嘱']
let descriptionList = $ref([])
let active = $ref(1)

const isShow = () => {
  // if (yiZhuData.value.actOrderNo > 0 && yiZhuData.value.statusFlag > 1) {
  //   return true
  // }
  return false
}

const descriptionFunc = (index) => {
  return descriptionList[index]
}
const fillOrder = (val) => {
  descriptionList = []
  active = parseInt(val.statusFlag)
  if (val.statusFlag === '4') {
    active = 3
  } else if (val.statusFlag === '5') {
    active = 4
  }

  descriptionList.push(val.enterOperName + '\n' + val.enterTime)
  if (val.confirmTime) {
    descriptionList.push(val.signerName + ' ' + val.confirmTime)
  }
}

defineExpose({
  fillOrder
})

</script>

<style scoped lang="scss">
.order__progress {
  width: 190px;
  height: 100%;
  top: 0;
  right: 0;
  position: fixed;

  background-color: white;
  z-index: 999;

  .steps__mian {
    height: calc(100% - 40%);
  }
}
</style>
