xiaochan 10 mesiacov pred
rodič
commit
4592950db0

+ 1 - 1
src/views/archive/ArchiveAside.vue

@@ -1,6 +1,6 @@
 <script setup lang="tsx">
 import { Document, Files } from "@element-plus/icons-vue";
-import { useArchiveKey } from "@/views/archive/index";
+import { useArchiveKey } from "@/views/archive/index.tsx";
 import { ElMessageBox, ElTree } from "element-plus";
 import * as archiveApi from "@/api/archive/archive-api";
 import { PatientArchive } from "@/api/archive/archive-api";

+ 1 - 1
src/views/archive/ArchiveFooter.vue

@@ -1,7 +1,7 @@
 <script setup lang="ts">
 import TabsResizer from "@/components/cy/cy-el-tabs/TabsResizer.vue";
 import TabPaneResizer from "@/components/cy/cy-el-tabs/TabPaneResizer.vue";
-import { useArchiveKey } from "@/views/archive/index";
+import { useArchiveKey } from "@/views/archive/index.tsx";
 import DisplayArchiveLog from "@/views/archive/DisplayArchiveLog.vue";
 
 const root = inject(useArchiveKey);

+ 1 - 1
src/views/archive/ArchiveMain.vue

@@ -1,5 +1,5 @@
 <script setup lang="ts">
-import { useArchiveKey } from "@/views/archive/index";
+import { useArchiveKey } from "@/views/archive/index.tsx";
 
 const root = inject(useArchiveKey);
 </script>

+ 39 - 6
src/views/archive/index.ts → src/views/archive/index.tsx

@@ -11,8 +11,8 @@ import { useWebSocket } from "@vueuse/core";
 import { useUserStore } from "@/pinia/user-store";
 import { useDialog } from "@/components/cy/CyDialog/index";
 import ArchiveUpload from "./ArchiveUpload.vue";
-import { ElNotification } from "element-plus";
 import ArchiveAllLog from "@/views/archive/ArchiveAllLog.vue";
+import { ElButton, ElNotification } from "element-plus";
 
 type PatInfo = {
   inpatientNo: string;
@@ -69,6 +69,40 @@ export const useArchive = () => {
     mainTabsValue: "pdf",
   });
 
+  function notification(message) {
+    const MessageNode = (
+      <div>
+        <div>{message}</div>
+        <div>
+          <ElButton
+            text
+            type="danger"
+            onClick={() => ElNotification.closeAll()}
+          >
+            取消
+          </ElButton>
+          <ElButton
+            text
+            type="primary"
+            onClick={() => {
+              ElNotification.closeAll();
+              mutation.getData();
+            }}
+          >
+            更新目录
+          </ElButton>
+        </div>
+      </div>
+    );
+
+    ElNotification.success({
+      title: "文件有变化",
+      position: "bottom-right",
+      duration: 0,
+      message: MessageNode,
+    });
+  }
+
   const socket = useSocket({
     log: data => {
       store.logMessage.push(JSON.parse(data));
@@ -77,13 +111,12 @@ export const useArchive = () => {
     },
     change: data => {
       if (useUserStore().userInfo.code !== data.code) {
-        ElNotification.success({
-          title: "文件有变化",
-          message: data.message,
-        });
-        mutation.getData();
+        notification(data.message);
       }
     },
+    taskComplete: () => {
+      mutation.getData();
+    },
   });
 
   const mutation = {

+ 1 - 1
src/views/archive/index.vue

@@ -1,5 +1,5 @@
 <script setup lang="tsx">
-import { useArchive, useArchiveKey } from "@/views/archive/index";
+import { useArchive, useArchiveKey } from "@/views/archive/index.tsx";
 import ArchiveAside from "./ArchiveAside.vue";
 import router from "@/router";
 import XEUtils from "xe-utils";