From 5ceeed41b099bd638075c6fa284241d545037573 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期四, 07 八月 2025 09:41:24 +0800
Subject: [PATCH] feat: 企业

---
 src/hooks/dic.ts |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/hooks/dic.ts b/src/hooks/dic.ts
index 8935320..8543fa8 100644
--- a/src/hooks/dic.ts
+++ b/src/hooks/dic.ts
@@ -25,6 +25,12 @@
     });
   }
 
+  function updateDictionaryCategorySelect() {
+    queryClient.invalidateQueries({
+      queryKey: ['dictionaryServices/getDictionaryCategorySelect'],
+    });
+  }
+
   function getDictionaryCategoryById(id: string) {
     return dictionaryCategoryList.value.find((x) => x.value === id);
   }
@@ -43,12 +49,13 @@
     getDictionaryCategoryById,
     getDictionaryCategoryNameByCode,
     getDictionaryCategoryByCode,
+    updateDictionaryCategorySelect,
   };
 }
 
 type UseDictionaryDataSelectOptions = {
   categoryId?: MaybeRef<string>;
-  categoryCode?: MaybeRef<string>;
+  categoryCode?: MaybeRef<CategoryCode>;
 };
 
 export function useDictionaryDataSelect({
@@ -56,7 +63,7 @@
   categoryCode,
 }: UseDictionaryDataSelectOptions) {
   const { data: dictionaryDataList, refetch } = useQuery({
-    queryKey: ['dictionaryServices/getDictionaryDataSelect'],
+    queryKey: ['dictionaryServices/getDictionaryDataSelect', categoryId, categoryCode],
     queryFn: async () => {
       let res = await dictionaryServices.getDictionaryDataSelect(
         {
@@ -72,8 +79,6 @@
     },
     placeholderData: () =>
       [] as API.SelectQueryResultOptionGuidGetDictionaryDataSelectQueryResultOption[],
-
-    enabled: !!unref(categoryId) || !!unref(categoryCode),
   });
 
   function getDictionaryDataNameById(id: string) {
@@ -98,6 +103,12 @@
     });
   }
 
+  function updateDictionaryDataSelect() {
+    queryClient.invalidateQueries({
+      queryKey: ['dictionaryServices/getDictionaryDataSelect'],
+    });
+  }
+
   return {
     dictionaryDataList,
     ensureQueryData,
@@ -105,5 +116,6 @@
     getDictionaryDataNameById,
     getDictionaryDataNameByCode,
     getDictionaryDataByCode,
+    updateDictionaryDataSelect,
   };
 }

--
Gitblit v1.9.1