<template>
  <el-popover width="220">
    <template #reference>
      <el-button>
        辅助工具
      </el-button>
    </template>
    <template #default>
      <el-button @click="open(0)" type="success">医嘱</el-button>
      <el-button @click="open(1)" type="primary">护理</el-button>
      <el-button @click="open(2)" type="warning">检验</el-button>
      <el-button @click="open(3)" type="info">检查</el-button>
    </template>
  </el-popover>
  <el-drawer v-model="drawer"
             direction="btt"
             append-to-body
             destroy-on-close
             size="90%"
             :with-header="false">
    <el-button class="close_but"
               type="danger"
               icon="Close"
               @click="drawer =false">
      关闭
    </el-button>
    <emr-order-list v-if="index === 0"/>
    <emr-yz-temperature v-if="index === 1"/>
    <emr-test v-if="index === 2" @close="close"/>
    <emr-inspect v-if="index === 3"/>
  </el-drawer>

</template>

<script setup name='EmrAuxiliaryTools' lang="ts">
import EmrOrderList from "@/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/EmrOrderList.vue";
import {defineProps, onMounted, ref} from 'vue'
import EmrYzTemperature from "@/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/EmrYzTemperature.vue";
import EmrTest from "@/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/EmrTest.vue";
import {patInfo} from './emr-tools-store'
import EmrInspect from "@/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/EmrInspect.vue";

const props = defineProps({
  patInfo: {
    type: Object
  }
})


const drawer = ref(false)

onMounted(() => {
  patInfo.value = props.patInfo
})

const index = ref(-1)
const open = (val) => {
  drawer.value = true
  index.value = val
}

const close = () => {
  drawer.value = false
  index.value = -1
}

</script>

<style scoped lang="scss">
.close_but {
  position: absolute;
  top: 10px;
  right: 5px;
}
</style>
