Bladeren bron

fix (1.33.1 -> 1.33.2): 修复诊断报告模板获取失败问题

- 在 fetchTemplatesThunk 中添加空值检查,确保返回空数组而不是undefined

改动文件:
- src/states/patient/DiagnosticReport/templateSlice.ts
dengdx 2 weken geleden
bovenliggende
commit
ea0d9ea5e8
3 gewijzigde bestanden met toevoegingen van 17 en 2 verwijderingen
  1. 15 0
      CHANGELOG.md
  2. 1 1
      package.json
  3. 1 1
      src/states/patient/DiagnosticReport/templateSlice.ts

+ 15 - 0
CHANGELOG.md

@@ -2,6 +2,21 @@
 
 本项目的所有重要变更都将记录在此文件中。
 
+## [1.33.2] - 2025-12-29 15:59
+
+### 修复 (Fixed)
+- **修复诊断报告模板获取失败问题** - 在 fetchTemplatesThunk 中添加空值检查,确保返回空数组而不是undefined
+  - 在 fetchTemplatesThunk 中将 return response.data.templates; 改为 return response.data.templates || [];
+  - 确保当 templates 为 undefined 时返回空数组,避免后续处理错误
+
+**核心改进:**
+- 数据安全性:添加空值检查,防止模板数据为undefined导致的错误
+- 错误处理:返回空数组确保后续代码能正常处理
+- 代码健壮性:提升API响应处理的稳定性
+
+**改动文件:**
+- src/states/patient/DiagnosticReport/templateSlice.ts
+
 ## [1.33.1] - 2025-12-29 12:59
 
 ### 修复 (Fixed)

+ 1 - 1
package.json

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

+ 1 - 1
src/states/patient/DiagnosticReport/templateSlice.ts

@@ -41,7 +41,7 @@ export const fetchTemplatesThunk = createAsyncThunk(
   async (params: ReportTemplateQueryParams | undefined, { rejectWithValue }) => {
     try {
       const response = await getReportTemplateList(params);
-      return response.data.templates;
+      return response.data.templates || [];
     } catch (error: any) {
       return rejectWithValue(error.message || '获取诊断报告模板列表失败');
     }