Bläddra i källkod

修复公共基础模板列表页面回显问题

Huanyi 3 veckor sedan
förälder
incheckning
93e2fb3b72

+ 63 - 2
.specstory/history/2025-08-07_01-59Z-预包装处方模板数据未回显.md

@@ -2727,13 +2727,74 @@ Lines added: 1, lines removed: undefined
 
 _**User**_
 
-[plugin:vite:vue] Error parsing JavaScript expression: Unterminated string constant. (1:40)
+@/views @/parameter @/basicPublicTemplate @/enteralNutritionTemplate @index.vue 在开局获取数据的时候,需要将模板类型锁定为公共基础模板
 
 ---
 
 _**Assistant**_
 
-Read file: src/views/parameter/personalTemplate/enteralNutritionTemplate/index.vue
+我明白了,您需要在基础公共模板页面获取数据时,将模板类型锁定为公共基础模板(templateType = 1)。让我修改基础公共模板页面的查询逻辑。
+
+---
+
+Read file: src/views/parameter/basicPublicTemplate/enteralNutritionTemplate/index.vue
+
+---
+
+我需要在基础公共模板页面的查询参数中添加 `templateType: 1` 来锁定为公共基础模板:
+
+---
+
+<details><summary>Edit file: src/views/parameter/basicPublicTemplate/enteralNutritionTemplate/index.vue</summary>
+
+undefined
+
+**Chunk 1**
+Lines added: 1, lines removed: undefined
+
+```diff
+@@ -176,4 +176,5 @@
+          content: undefined,
+          status: undefined,
++         templateType: 1, // 设置为基础公共模板类型
+          params: {
+          }
+```
+
+</details>
+
+---
+
+现在我还需要确保在 `handleTypeChange` 函数中也保持 templateType 的设置:
+
+---
+
+Read file: src/views/parameter/basicPublicTemplate/enteralNutritionTemplate/index.vue
+
+---
+
+<details><summary>Edit file: src/views/parameter/basicPublicTemplate/enteralNutritionTemplate/index.vue</summary>
+
+undefined
+
+**Chunk 1**
+Lines added: 2, lines removed: undefined
+
+```diff
+@@ -226,4 +226,6 @@
+      queryParams.value.type = type;
+      queryParams.value.pageNum = 1;
++     // 确保始终查询基础公共模板
++     queryParams.value.templateType = 1;
+      getList();
+  }
+```
+
+</details>
+
+---
+
+
 
 ---
 

+ 7 - 0
src/views/parameter/basicPublicTemplate/enteralNutritionTemplate/index.vue

@@ -175,6 +175,7 @@ const data = reactive<PageData<EnteralNutritionTemplateForm, EnteralNutritionTem
         prescriptionDepartmentName: undefined,
         content: undefined,
         status: undefined,
+        templateType: 1, // 设置为基础公共模板类型
         params: {
         }
     },
@@ -211,12 +212,16 @@ const reset = () => {
 /** 搜索按钮操作 */
 const handleQuery = () => {
     queryParams.value.pageNum = 1;
+    // 确保始终查询基础公共模板
+    queryParams.value.templateType = 1;
     getList();
 }
 
 /** 重置按钮操作 */
 const resetQuery = () => {
     queryFormRef.value?.resetFields();
+    // 确保重置后仍然查询基础公共模板
+    queryParams.value.templateType = 1;
     handleQuery();
 }
 
@@ -224,6 +229,8 @@ const resetQuery = () => {
 const handleTypeChange = (type: number) => {
     queryParams.value.type = type;
     queryParams.value.pageNum = 1;
+    // 确保始终查询基础公共模板
+    queryParams.value.templateType = 1;
     getList();
 }