CallDialog.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <script setup lang="ts">
  2. import {
  3. InpatientBoardKey,
  4. type InpatientBoardType,
  5. } from "@/views/single-page/InpatientBoardV2/index";
  6. import { computed } from "vue";
  7. const store = inject(InpatientBoardKey) as InpatientBoardType;
  8. const listData = computed(() => {
  9. return [
  10. ...store.callStore.urgentCallForHelp.values(),
  11. ...store.callStore.call.values(),
  12. ];
  13. });
  14. function removeLeadingZerosKeepTrailing(str: string) {
  15. if (!str) {
  16. return str; // 处理空字符串
  17. }
  18. // 删除前导零
  19. return str.replace(/^0+/, "");
  20. }
  21. </script>
  22. <template>
  23. <div class="inpatient_board-call" v-show="listData.length > 0">
  24. <div class="inpatient_board-main">
  25. <div class="inpatient_board-item">
  26. <div>床位呼叫</div>
  27. <div v-for="value in store.callStore.call.values()">
  28. {{ removeLeadingZerosKeepTrailing(value.bedNo) }} 床
  29. </div>
  30. </div>
  31. <div class="inpatient_board-item" style="color: red">
  32. <div>紧急呼叫</div>
  33. <div v-for="value in store.callStore.urgentCallForHelp.values()">
  34. {{ removeLeadingZerosKeepTrailing(value.bedNo) }} 床卫生间
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </template>
  40. <style lang="scss">
  41. .inpatient_board-call {
  42. top: 0;
  43. left: 0;
  44. z-index: 999;
  45. position: fixed;
  46. height: 100vh;
  47. width: 100vw;
  48. background: var(--el-overlay-color-lighter);
  49. .inpatient_board-main {
  50. margin: 10% 10% 0 10%;
  51. padding: 10px;
  52. display: flex;
  53. justify-content: space-between;
  54. background: white;
  55. .inpatient_board-item {
  56. color: black;
  57. margin: 5px;
  58. font-size: 50px;
  59. }
  60. }
  61. }
  62. </style>