From 2c0bd65affde857b14fb5434dbbfe6ebf97d12dc Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期五, 27 六月 2025 16:46:06 +0800
Subject: [PATCH] feat: v2.2

---
 src/hooks/dic.ts |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/src/hooks/dic.ts b/src/hooks/dic.ts
index 3b84750..48489a0 100644
--- a/src/hooks/dic.ts
+++ b/src/hooks/dic.ts
@@ -16,3 +16,59 @@
     refetch,
   };
 }
+
+export function useUserInsureProductSetting() {
+  const { data: allUserInsureProductSettingList, refetch } = useQuery({
+    queryKey: ['dictionaryServices/getUserInsureProductSetting'],
+    queryFn: async () => {
+      let res = await dictionaryServices.getUserInsureProductSetting({ showLoading: false });
+      return res;
+    },
+    placeholderData: () => [] as API.InsureProductSettingDto[],
+  });
+
+  function getInsureProductByIdNumber(productIdNumber: string) {
+    return allUserInsureProductSettingList.value.find((x) => x.productIdNumber === productIdNumber);
+  }
+
+  function getInsureProductIdByIdNumber(productIdNumber: string) {
+    const insureProduct = getInsureProductByIdNumber(productIdNumber);
+    return insureProduct?.id ?? '';
+  }
+
+  return {
+    allUserInsureProductSettingList,
+    getInsureProductByIdNumber,
+    getInsureProductIdByIdNumber,
+    refetch,
+  };
+}
+
+type UseInsureProductSchemeAllListOptions = {
+  insureProductId?: MaybeRef<string>;
+};
+
+export function useInsureProductSchemeAllList(options: UseInsureProductSchemeAllListOptions = {}) {
+  const { insureProductId } = options;
+
+  const { data: allInsureProductSchemeList, refetch } = useQuery({
+    queryKey: ['dictionaryServices/getInsureProductSchemeAllList', insureProductId],
+    queryFn: async () => {
+      let res = await dictionaryServices.getInsureProductSchemeAllList(
+        {
+          insureProductId: unref(insureProductId),
+        },
+        { showLoading: false }
+      );
+      return res;
+    },
+    placeholderData: () => [] as API.InsureProductSchemeDto[],
+    enabled: computed(() => !!unref(insureProductId)),
+    staleTime: Infinity,
+  });
+
+  return {
+    allInsureProductSchemeList,
+    refetch,
+  };
+}

--
Gitblit v1.9.1