index.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <script setup lang="tsx">
  2. import { useArchive, useArchiveKey } from "@/views/archive/index";
  3. import Aside from "./aside.vue";
  4. import router from "@/router";
  5. import XEUtils from "xe-utils";
  6. import { stringNotBlank } from "@/utils/blank-utils";
  7. import { getPatientAll } from "@/api/inpatient/patient";
  8. const store = useArchive();
  9. provide(useArchiveKey, store);
  10. const mainComp = computed(() => {
  11. if (store.store.mainComponent) {
  12. return store.store.mainComponent;
  13. }
  14. return <div></div>;
  15. });
  16. const leftComp = computed(() => {
  17. if (store.store.leftComponent) {
  18. return store.store.leftComponent;
  19. }
  20. return <div></div>;
  21. });
  22. watch(
  23. () => router.currentRoute.value,
  24. newValue => {
  25. const patInfo = XEUtils.get(newValue, "params.patInfo") as string;
  26. if (stringNotBlank(patInfo)) {
  27. const split = patInfo.split("_");
  28. store.store.patNo = split[0];
  29. store.store.times = split[1];
  30. getPatientAll(store.store.patNo, store.store.times).then(res => {
  31. store.store.patInfo = res;
  32. });
  33. }
  34. },
  35. { immediate: true }
  36. );
  37. </script>
  38. <template>
  39. <div class="layout_container">
  40. <header>asdasd</header>
  41. <div class="layout_main layout_container layout-horizontal">
  42. <Aside />
  43. <div class="layout_main">
  44. <Component :is="mainComp" />
  45. </div>
  46. <Component :is="leftComp" style="margin-left: 10px" />
  47. </div>
  48. </div>
  49. </template>