From 7cf58a4d2fff6b9cba9029d4d43ba9744dbef864 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期四, 18 七月 2024 15:49:03 +0800
Subject: [PATCH] 工单更新

---
 src/views/components/CustModal.vue |   50 +++++++++++++++++++++++++++++++++++---------------
 1 files changed, 35 insertions(+), 15 deletions(-)

diff --git a/src/views/components/CustModal.vue b/src/views/components/CustModal.vue
index d621b8f..d0bd18c 100644
--- a/src/views/components/CustModal.vue
+++ b/src/views/components/CustModal.vue
@@ -4,7 +4,7 @@
  * @version: 
  * @Date: 2024-06-05 15:46:07
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-07-03 19:19:16
+ * @LastEditTime: 2024-07-18 15:42:20
 -->
 <template>
   <BasicModal
@@ -33,13 +33,12 @@
   import { ref, unref, nextTick, watch, Ref } from 'vue';
   import { BasicModal, useModalInner } from '/@/components/Modal';
   import { FormSchema } from '/@/components/Form/index';
-  import { custFunction } from './data';
   import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is';
   import { Layout, LayoutContent, Card } from 'ant-design-vue';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { useI18n } from '/@/hooks/web/useI18n';
-  import { initRoute } from '../tigerprojects/system/lowcode/data';
-  import LogicFlow from '@logicflow/core';
+  import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel';
+  import { CustModalParams } from '/@/api/tigerapi/model/systemModel';
 
   const { t } = useI18n();
   const { notification, createErrorModal } = useMessage();
@@ -51,7 +50,7 @@
   const cType = ref('');
   const title = ref('');
   const width = ref('');
-  const FnName = ref({});
+  const FnName = ref('');
   const mValues = ref<Recordable>({});
   const initFnName = ref({});
   const dtlSlots = ref([] as any[]);
@@ -60,7 +59,23 @@
   const useFormData = ref<any>({});
   const props = defineProps({
     detailSlots: { type: Array, default: [] },
+    entityName: { type: String },
   });
+
+  const custImport = ref<any[]>([]);
+  const EntityCustFunction = ref([
+    {
+      CustFunc(param: CustModalParams) {},
+    } as EntityCustFunctionType,
+  ]);
+  /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */
+  try {
+    custImport.value = await import(`../tigerprojects/system/lowcode/entityts/${props.entityName}.ts`);
+  } catch (e) {}
+  const [{ CustFunc }] = isNullOrUnDef(custImport.value['default'])
+    ? EntityCustFunction.value
+    : custImport.value['default']();
+
   watch(
     () => props.detailSlots,
     (v) => {
@@ -97,13 +112,14 @@
     //鍒濆鍖栨柟娉曡嚜瀹氫箟
     if (!isNullOrEmpty(data?.initFnName)) {
       initFnName.value = data?.initFnName;
-      custFunction(
-        unref(isUpdate.value),
-        initFnName.value[cType.value],
-        cType.value,
-        mValues.value,
-        data?.others,
-      );
+      let param: CustModalParams = {
+        cType: cType.value,
+        values: unref(isUpdate.value),
+        mValues: mValues.value,
+        others: data?.others,
+        FnName: initFnName.value[cType.value],
+      };
+      CustFunc(param);
     }
   });
 
@@ -131,8 +147,12 @@
       setModalProps({ confirmLoading: true });
       //璋冪敤鑷畾涔変繚瀛樻柟娉曚繚瀛樻暟鎹�
       values['mValues'] = mValues.value;
-      const action = await custFunction(values, FnName.value[cType.value], cType.value);
-      if (action as boolean) {
+      const action = await CustFunc({
+        cType: cType.value,
+        values: values,
+        FnName: FnName.value,
+      } as unknown as CustModalParams);
+      if (action.IsSuccessed) {
         closeModal();
         //鎴愬姛浜嬩欢锛屽皢鏁版嵁杩斿洖鍘熼〉闈�
         emit('success', {
@@ -145,7 +165,7 @@
       } else {
         createErrorModal({
           title: t('璀﹀憡'),
-          content: t('淇濆瓨鏁版嵁澶辫触'),
+          content: t(action.LocaleMsg),
           getContainer: () => document.body,
         });
       }

--
Gitblit v1.9.3