Kaynağa Gözat

护理看板优化

xiaochan 3 ay önce
ebeveyn
işleme
0d6bfbc01f

+ 15 - 13
src/local-storage.d.ts

@@ -1,25 +1,27 @@
 interface Storage {
+  readonly length: number;
 
-    readonly length: number;
+  clear(): void;
 
-    clear(): void;
+  getItem(key: string): string | null;
 
-    getItem(key: string): string | null;
+  key(index: number): string | null;
 
-    key(index: number): string | null;
+  removeItem(key: string): void;
 
-    removeItem(key: string): void;
+  setItem(key: string, value: string): void;
 
-    setItem(key: string, value: string): void;
+  [name: string]: any;
 
-    [name: string]: any;
+  /**
+   * 用户 token
+   */
+  token: string | null;
 
-    /**
-     * 用户 token
-     */
-    token: string | null
-
-    emrCache: string | null
+  /**
+   * 用户编码
+   */
+  code: string | null;
 }
 
 declare var localStorage: Storage;

+ 4 - 2
src/pinia/user-store.ts

@@ -58,6 +58,7 @@ export const useUserStore = defineStore("user", {
         });
         if (userInfo !== null) {
           state.userInfo = userInfo;
+          localStorage.code = userInfo.code;
           useSystemStore().setConfig(userInfo.userConfigJson);
           initUserInfo = true;
           return true;
@@ -73,9 +74,9 @@ export const useUserStore = defineStore("user", {
       return state.userInfo.sid + state.randomSid;
     },
     isFSCGroupLeader(state): boolean {
-      let roles = state.userInfo.roles
+      let roles = state.userInfo.roles;
       return roles.indexOf(1) !== -1 || roles.indexOf(79) !== -1;
-    }
+    },
   },
   actions: {
     setToken(val: string) {
@@ -83,6 +84,7 @@ export const useUserStore = defineStore("user", {
     },
     setUserInfo(val: UserInfo) {
       localStorage.token = val.token;
+      localStorage.code = val.code;
       this.userInfo = val;
     },
     setRandomSid(val: string) {

+ 17 - 15
src/views/single-page/InpatientBoardV2/BoardCard.vue

@@ -120,20 +120,17 @@ onMounted(() => {
     <div v-for="father in scrollingInfo.data" class="board-row">
       <div class="board-col" v-for="item in father">
         <div class="board-card">
-          <div
-            class="layout_container layout-horizontal board-card-header"
-            style="height: max-content"
-          >
-            <div class="layout_flex_1-x board-col-header">
+          <div class="board-row-header">
+            <div style="font-size: 1.25rem">
               {{ anonymizeName(item.name) }}
-              <span style="font-size: 1.25rem">{{ sexName(item.gender) }}</span>
-              <span style="font-size: 1.25rem">{{ item.age }}岁</span>
-            </div>
-            <div style="width: max-content">
-              <b style="font-size: 1.25rem"> {{ item.bedNo }}床 </b>
-              <Component :is="huliFunc(item)" />
             </div>
+            <div style="font-size: 1.25rem">{{ sexName(item.gender) }}</div>
+          </div>
+          <div class="board-row-header">
+            <span style="font-size: 1.25rem">{{ item.age }}岁</span>
+            <b style="font-size: 1.25rem"> {{ item.bedNo }}床 </b>
           </div>
+
           <div class="board-card-body">
             <div
               class="layout_display_flex"
@@ -145,6 +142,9 @@ onMounted(() => {
                 {{ item[infoKey] }}
               </div>
             </div>
+            <div>
+              <Component style="width: 100%" :is="huliFunc(item)" />
+            </div>
           </div>
         </div>
       </div>
@@ -160,16 +160,18 @@ $padding: 0.63rem;
   padding: 0.31rem 0;
   grid-template-columns: 1fr 1fr 1fr;
 
+  .board-row-header {
+    font-size: 1.4rem;
+    justify-content: space-between;
+    display: flex;
+  }
+
   .board-col {
     flex: 0 0 40%;
     padding-left: $padding;
     padding-right: $padding;
     font-size: 0.75rem;
 
-    .board-col-header {
-      font-size: 1.4rem;
-    }
-
     .board-card {
       background: #204698;
     }

+ 14 - 11
src/views/single-page/InpatientBoardV2/Index.vue

@@ -1,12 +1,11 @@
 <script setup lang="tsx">
 import BoardInfo from "./BoardInfo.vue";
-import { useFullscreen } from "@vueuse/core";
+import { useEventListener, useFullscreen } from "@vueuse/core";
 import {
   InpatientBoardKey,
   useInpatientBoard,
 } from "@/views/single-page/InpatientBoardV2/index";
 import CallDialog from "@/views/single-page/InpatientBoardV2/CallDialog.vue";
-import sleep from "@/utils/sleep";
 
 const store = useInpatientBoard();
 
@@ -14,20 +13,16 @@ provide(InpatientBoardKey, store);
 
 const divRef = ref();
 
-const { toggle, enter, isFullscreen } = useFullscreen(divRef);
+const { toggle } = useFullscreen(divRef);
 
-onMounted(async () => {
-  await nextTick();
-  await sleep(1000);
-  if (!isFullscreen.value) {
-    await enter();
-  }
+useEventListener(window, "resize", async () => {
+  store.store.showHeader = false;
 });
 </script>
 
 <template>
   <div class="layout_container inpatient-board">
-    <header class="main-header">
+    <header class="main-header" v-if="store.store.showHeader">
       <el-form :inline="true">
         <el-form-item label="当前病房:">
           <el-select
@@ -84,7 +79,15 @@ onMounted(async () => {
         </el-form-item>
       </el-form>
     </header>
-    <div class="layout_main layout_container layout-horizontal" ref="divRef">
+    <div
+      class="layout_main layout_container layout-horizontal"
+      ref="divRef"
+      @contextmenu.stop.prevent="
+        () => {
+          store.store.showHeader = !store.store.showHeader;
+        }
+      "
+    >
       <CallDialog />
       <BoardInfo />
     </div>

+ 9 - 1
src/views/single-page/InpatientBoardV2/index.ts

@@ -161,6 +161,8 @@ export function useInpatientBoard() {
   const store = reactive({
     // 表格模板
     htmlData: "",
+
+    showHeader: true,
   });
 
   const callStore = reactive({
@@ -181,6 +183,9 @@ export function useInpatientBoard() {
     empty: data => {
       callStore[data.group].clear();
     },
+    release: () => {
+      handleWardChange(urlQuery.ward);
+    },
   };
   const socket = openSocket(socketOnMessage);
 
@@ -206,6 +211,7 @@ export function useInpatientBoard() {
   }
 
   async function handleWardChange(code: string) {
+    const oldCode = urlQuery.ward;
     clearTimeout(refreshTimeOut);
     if (code) {
       urlQuery.ward = code;
@@ -229,7 +235,9 @@ export function useInpatientBoard() {
       60 * 1000 * urlQuery.refresh
     );
     mutation.getTemplate();
-    socket.open(code);
+    if (oldCode != code) {
+      socket.open(code);
+    }
   }
 
   async function setData(value: InpatientBrief[]) {