From 226ad601bb8326814c3e94efd6f476014f6a9e66 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期四, 27 六月 2024 23:06:47 +0800
Subject: [PATCH] 产品工艺路线工序配置更新

---
 src/views/tigerprojects/system/lowcode/detail/detail.vue |   99 +++++++++++++++++--------------------------------
 1 files changed, 35 insertions(+), 64 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/detail/detail.vue b/src/views/tigerprojects/system/lowcode/detail/detail.vue
index 7fef75c..608ff90 100644
--- a/src/views/tigerprojects/system/lowcode/detail/detail.vue
+++ b/src/views/tigerprojects/system/lowcode/detail/detail.vue
@@ -37,6 +37,7 @@
   import { useGo } from '/@/hooks/web/usePage';
   import { DeleteEntity, getListByPage } from '/@/api/tigerapi/system';
   import { useI18n } from '/@/hooks/web/useI18n';
+  import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel';
 
   const { t } = useI18n();
 
@@ -55,9 +56,37 @@
   const dtlSlots = ref([] as any[]);
   const useModalData = ref({}); //琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶
   const useFormData = ref({});
-  const custImport = ref<any[]>(await import(`../entityts/${props.entityName}.ts`));
-  const [{ EditeOperation, GetBaseColumns, GetSearchForm, GetCrudForm, OthersValues }] =
-    custImport.value['default']();
+  const custImport = ref<any[]>([]);
+  const EntityCustFunction = ref([
+    {
+      ActionItem(params, data, ...args) {},
+      EditOperation(data, d, u) {},
+      GetBaseColumns() {},
+      GetSearchForm() {},
+      GetCrudForm() {},
+      OthersValues(val, id) {},
+      GetSelectSuccess(d, u, ...args) {},
+      OpenSelectItem(openItemModal: Fn, ...args) {},
+    } as EntityCustFunctionType,
+  ]);
+  /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */
+  try {
+    custImport.value = await import(`../entityts/${objParams['Name']}.ts`);
+  } catch (e) {}
+  const [
+    {
+      ActionItem: nActionItem,
+      EditOperation,
+      GetBaseColumns,
+      GetSearchForm,
+      GetCrudForm,
+      OthersValues,
+      GetSelectSuccess,
+      OpenSelectItem,
+    },
+  ] = isNullOrUnDef(custImport.value['default'])
+    ? EntityCustFunction.value
+    : custImport.value['default']();
   others.value = OthersValues(objParams['CODE'], objParams['ID']);
   const [registerTable, { getForm, reload, setProps }] = useTable({
     title: `${objParams['firstTitle']}鍒楄〃`,
@@ -121,8 +150,7 @@
     if (isNullOrUnDef(custImport.value)) {
       return actionItem;
     }
-    const [{ ActionItem }] = custImport.value['default']();
-    return ActionItem(
+    return nActionItem(
       params,
       actionItem,
       openDrawer,
@@ -198,21 +226,7 @@
    * @return {*}
    */
   function handleItemSuccess(d, u, item) {
-    /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */
-    try {
-      import(
-        `../entityts/${getForm().getFieldsValue()[`${item.replace(/form-/, '').replace(/add/, '')}PSelect_0`]}.ts`
-      )
-        .then((m) => {
-          const [{ GetSelectSuccess }] = m.default();
-          getForm().setFieldsValue(GetSelectSuccess(d, u));
-        })
-        .catch(() => {
-          getForm().setFieldsValue({
-            ITEM_CODE: d.values['val'],
-          });
-        });
-    } catch (e) {}
+    getForm().setFieldsValue(GetSelectSuccess(d, u));
   }
 
   /**
@@ -221,49 +235,6 @@
    * @return {*}
    */
   function handleSelectItem(item) {
-    /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */
-    try {
-      import(
-        `../entityts/${props.useTableData['table'][1].getForm().getFieldsValue()[`${item.replace(/form-/, '').replace(/add/, '')}PSelect_0`]}.ts`
-      )
-        .then((m) => {
-          const [{ OpenSelectItem }] = m.default();
-          OpenSelectItem(openItemModal);
-        })
-        .catch(() => {
-          openItemModal(true, {
-            title: '鐗╂枡鍒楄〃',
-            schemas: [
-              {
-                field: 'ITEM_CODE',
-                component: 'Input',
-                label: '鐗╂枡缂栫爜',
-                colProps: {
-                  span: 12,
-                },
-              },
-            ],
-            ItemColumns: [
-              {
-                title: t('鐗╂枡缂栫爜'),
-                dataIndex: 'ITEM_CODE',
-                resizable: true,
-                sorter: true,
-                width: 200,
-              },
-              {
-                title: t('鐗╂枡鍚嶇О'),
-                dataIndex: 'ITEM_NAME',
-                resizable: true,
-                sorter: true,
-                width: 180,
-              },
-            ],
-            tableName: 'BAS_ITEM',
-            rowKey: 'ITEM_CODE',
-            searchInfo: { TABLE_NAME: 'BAS_ITEM' },
-          });
-        });
-    } catch (e) {}
+    OpenSelectItem(openItemModal);
   }
 </script>

--
Gitblit v1.9.3