From 9c4e34d06e251667e650055412256e5743b90d72 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期五, 07 十一月 2025 19:05:06 +0800
Subject: [PATCH] fix: bug

---
 src/fabric-editor/hooks/context.ts |   35 +++++++++++++++++++++++++++++------
 1 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/src/fabric-editor/hooks/context.ts b/src/fabric-editor/hooks/context.ts
index 9909450..304f590 100644
--- a/src/fabric-editor/hooks/context.ts
+++ b/src/fabric-editor/hooks/context.ts
@@ -12,6 +12,8 @@
   checkTemplateParamObjectListNotNull,
   convertJsonMapToTemplateParamObjectList,
 } from '../utils';
+import { CanvasHeight, CanvasWidth } from '../constants';
+import _ from 'lodash';
 
 export interface TemplateDetailContext {
   templateDetail: Ref<API.GetContractTemplateQueryResult>;
@@ -29,10 +31,11 @@
 );
 
 type UseTemplateDetailProvideOptions = {
-  id: MaybeRef<string>;
+  id?: MaybeRef<string>;
+  isDefault?: boolean;
 };
 
-export function useTemplateDetailProvide({ id }: UseTemplateDetailProvideOptions) {
+export function useTemplateDetailProvide({ id, isDefault }: UseTemplateDetailProvideOptions) {
   console.log('id: ', id);
   // const templateParamList = ref<API.GetContractTemplateQueryResultValue[]>([]);
 
@@ -74,9 +77,28 @@
     return [];
   });
 
-  const { dictionaryDataList: templateParamList } = useDictionaryDataSelect({
-    categoryCode: computed(() => CategoryCode.ElectronSignParam),
+  const { data: templateParamList } = useQuery({
+    queryKey: ['electronSignServices/getContractParamterSelect', id],
+    queryFn: async () => {
+      let params: API.APIgetContractParamterSelectParams = {
+        templateId: unref(id),
+        isDefault: isDefault,
+      };
+      return await electronSignServices.getContractParamterSelect(
+        _.pickBy(params, (value) => value !== undefined && value !== null),
+        {
+          showLoading: false,
+        }
+      );
+    },
+    // enabled: computed(() => !!unref(id)),
+    placeholderData: () => [] as API.SelectOptionStringGetDictionaryDataSelectQueryResultOption[],
+    onSuccess(data) {},
   });
+
+  // const { dictionaryDataList: templateParamList } = useDictionaryDataSelect({
+  //   categoryCode: computed(() => CategoryCode.ElectronSignParam),
+  // });
 
   const templateEditState = reactive({
     templateId: unref(id),
@@ -93,6 +115,7 @@
 
   return {
     isLoading,
+    templateParamList,
   };
 }
 
@@ -186,8 +209,8 @@
               recorder: x.recorder,
               userType: x.userType,
               bindProperty: x.bindProperty,
-              x: x.left,
-              y: x.top,
+              x: x.left / CanvasWidth,
+              y: x.top / CanvasHeight,
               page: x.pageNum + 1,
             } as API.SaveContractTemplateValuesCommandItem)
         ),

--
Gitblit v1.9.1