Bladeren bron

fix(bug-211): 修复历史清单编辑后列表不更新的问题

- 在 history.ts 中导入 editTaskThunk,添加对编辑操作的监听
- 添加 editFromEditForm 监听器,监听编辑操作的 fulfilled 状态
- 当编辑成功时自动更新列表中对应项的数据
- 支持人医和宠物产品的特定字段更新
- 修复 payload 访问路径(使用 result.code 和 result.data)

改动文件:
- src/states/patient/worklist/slices/history.ts
- package.json (版本更新: 1.70.1 -> 1.70.2)
- CHANGELOG.md
dengdx 6 uur geleden
bovenliggende
commit
84613c88b9
3 gewijzigde bestanden met toevoegingen van 51 en 4 verwijderingen
  1. 13 0
      CHANGELOG.md
  2. 1 1
      package.json
  3. 37 3
      src/states/patient/worklist/slices/history.ts

+ 13 - 0
CHANGELOG.md

@@ -2,6 +2,19 @@
 
 本项目的所有重要变更都将记录在此文件中.
 
+## [1.70.2] - 2026-01-20 10:36
+
+fix (bug-211): 修复历史清单编辑后列表不更新的问题
+
+- 在 history.ts 中导入 editTaskThunk,添加对编辑操作的监听
+- 添加 editFromEditForm 监听器,监听编辑操作的 fulfilled 状态
+- 当编辑成功时自动更新列表中对应项的数据
+- 支持人医和宠物产品的特定字段更新
+- 修复 payload 访问路径(使用 result.code 和 result.data)
+
+改动文件:
+- src/states/patient/worklist/slices/history.ts
+
 ## [1.70.1] - 2026-01-20 09:49
 
 fix (1.70.0 -> 1.70.1): 修复系统模式配置中数值解析逻辑

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "zsis",
-  "version": "1.70.1",
+  "version": "1.70.2",
   "private": true,
   "description": "医学成像系统",
   "main": "main.js",

+ 37 - 3
src/states/patient/worklist/slices/history.ts

@@ -23,6 +23,7 @@ import {
   fetchTaskList,
   lockStudy,
 } from '../../../../API/patient/workActions';
+import { editTaskThunk } from '../../edit/editFormSlice';
 import store from '@/states/store';
 import { EntitiesState } from '@/states/list_template/type.model';
 
@@ -141,10 +142,43 @@ const {
     page_size: 10,
   } satisfies WorkFilter,
   {
-        lock: {
-          thunk: lockWorkInhistorylistThunk,
-          handlers: createLockHandlers(),
+    lock: {
+      thunk: lockWorkInhistorylistThunk,
+      handlers: createLockHandlers(),
+    },
+    // 监听 editFormSlice 的编辑 thunk
+    editFromEditForm: {
+      thunk: editTaskThunk,
+      handlers: {
+        fulfilled: (
+          state: Draft<EntitiesState<work | workAnimal>>,
+          action: PayloadAction<any>
+        ) => {
+          const { studyId, result } = action.payload;
+          console.log(`historylist 监听到编辑成功,更新列表数据,studyId: ${studyId}`);
+          const item = state.data.find((item) => item.StudyID === studyId);
+          if (item && result.code === '0x000000') {
+            // 更新列表中的项目数据
+            const updatedData = result.data;
+            item.PatientName = updatedData.patient_name;
+            item.PatientID = updatedData.patient_id;
+            item.PatientSex = updatedData.patient_sex;
+            item.PatientAge = updatedData.patient_age;
+            item.PatientSize = updatedData.patient_size;
+            item.AccessionNumber = updatedData.accession_number;
+            item.OperatorID = updatedData.operator_name;
+            // 根据产品类型更新特定字段
+            if ('owner_name' in item) {
+              (item as any).owner_name = (updatedData as any).owner_name;
+              (item as any).chip_number = (updatedData as any).chip_number;
+              (item as any).variety = (updatedData as any).variety;
+              (item as any).is_anaesthesia = (updatedData as any).is_anaesthesia;
+              (item as any).is_sedation = (updatedData as any).is_sedation;
+            }
+          }
         },
+      },
+    },
   }
 );