From 6e7f546cc37ed57e7e2eda4fdfc32fa2b3e0160c Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期二, 20 十月 2026 17:41:10 +0800
Subject: [PATCH] 测试完成

---
 src/views/patient/archives/components/ArchiveList.vue |   44 +++++++++++++++++++++++++-------------------
 1 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/src/views/patient/archives/components/ArchiveList.vue b/src/views/patient/archives/components/ArchiveList.vue
index 8dac4b7..f2aed0a 100644
--- a/src/views/patient/archives/components/ArchiveList.vue
+++ b/src/views/patient/archives/components/ArchiveList.vue
@@ -64,7 +64,8 @@
 
 <script>
 import OutpatientPicker from "./OutpatientPicker.vue";
-import { getTypeByKey, loadArchives, saveArchives } from "../types";
+import { getTypeByKey } from "../types";
+import { listArchives, removeArchives } from "../apiAdapter";
 
 export default {
   name: "ArchiveList",
@@ -88,20 +89,25 @@
   methods: {
     getList() {
       this.loading = true;
-      const all = loadArchives().filter((item) => item.subType === this.type);
-      let filtered = [...all];
-      if (this.queryParams.patname) filtered = filtered.filter((i) => i.patname && i.patname.includes(this.queryParams.patname));
-      if (this.queryParams.diagname) filtered = filtered.filter((i) => i.diagname && i.diagname.includes(this.queryParams.diagname));
+      const params = {
+        pageNum: this.queryParams.pageNum,
+        pageSize: this.queryParams.pageSize,
+      };
+      if (this.queryParams.patname) params.patname = this.queryParams.patname;
+      if (this.queryParams.diagname) params.diagname = this.queryParams.diagname;
       if (this.dateRange && this.dateRange.length === 2) {
-        filtered = filtered.filter((i) => {
-          const d = (i.createTime || "").substring(0, 10);
-          return d >= this.dateRange[0] && d <= this.dateRange[1];
-        });
+        params.params = { beginTime: this.dateRange[0], endTime: this.dateRange[1] };
       }
-      this.total = filtered.length;
-      const start = (this.queryParams.pageNum - 1) * this.queryParams.pageSize;
-      this.displayList = filtered.slice(start, start + this.queryParams.pageSize);
-      this.loading = false;
+      listArchives(this.type, params)
+        .then((res) => {
+          this.displayList = res.rows || [];
+          this.total = res.total || 0;
+        })
+        .catch(() => {
+          this.displayList = [];
+          this.total = 0;
+        })
+        .finally(() => { this.loading = false; });
     },
     handleQuery() { this.queryParams.pageNum = 1; this.getList(); },
     resetQuery() {
@@ -113,20 +119,20 @@
     handleDelete() {
       if (this.ids.length === 0) { this.$modal.msgWarning("璇疯嚦灏戦�夋嫨涓�鏉�"); return; }
       this.$modal.confirm("纭鍒犻櫎閫変腑妗f锛�").then(() => {
-        const remaining = loadArchives().filter((item) => !this.ids.includes(item.id));
-        saveArchives(remaining);
-        this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-        this.getList();
+        return removeArchives(this.type, this.ids).then(() => {
+          this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+          this.getList();
+        });
       }).catch(() => {});
     },
     handleSingleDelete(row) { this.ids = [row.id]; this.handleDelete(); },
     handleCreate() { this.pickerVisible = true; },
     onPicked(record) {
       this.getList();
-      this.$router.push({ path: this.typeConfig.detailRoute, query: { id: record.id, edit: 1 } });
+      this.$router.push({ path: this.typeConfig.detailRoute, query: { id: record.id, type: this.type, detailId: record.detailId || "", edit: 1 } });
     },
     goDetail(row) {
-      this.$router.push({ path: this.typeConfig.detailRoute, query: { id: row.id } });
+      this.$router.push({ path: this.typeConfig.detailRoute, query: { id: row.id, type: this.type, detailId: row.detailId || "" } });
     },
     getProp(obj, path) {
       if (!path) return "";

--
Gitblit v1.9.3