From 6f6207ef6eb81d2abb3805bc2cba889ea2abd135 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期日, 02 六月 2024 01:12:32 +0800
Subject: [PATCH] 低代码更新

---
 src/views/tigerprojects/system/lowcode/normal/index.vue |   41 +++++++++++++++++++++++++++++++++--------
 1 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/normal/index.vue b/src/views/tigerprojects/system/lowcode/normal/index.vue
index d3a78a3..9d56235 100644
--- a/src/views/tigerprojects/system/lowcode/normal/index.vue
+++ b/src/views/tigerprojects/system/lowcode/normal/index.vue
@@ -28,19 +28,22 @@
   </div>
 </template>
 <script lang="ts" setup>
-  import { onMounted, ref } from 'vue';
+  import { h, onMounted, ref } from 'vue';
   import { BasicTable, useTable, TableAction, BasicColumn, FormSchema } from '/@/components/Table';
   import { useDrawer } from '/@/components/Drawer';
   import normalDrawer from './normalDrawer.vue';
-  import { DeleteEntity, fetchJson, getListByPage } from '/@/api/tigerapi/system';
+  import { DeleteEntity, fetchJson, getEntity, getListByPage } from '/@/api/tigerapi/system';
   import { useGlobSetting } from '/@/hooks/setting';
   import { useRoute } from 'vue-router';
+  import { Tag, Tooltip } from 'ant-design-vue';
+  import { isNullOrEmpty } from '/@/utils/is';
 
   const route = useRoute();
   const objParams = ref(JSON.parse(decodeURI(route.params?.id as string)));
   const globSetting = useGlobSetting();
   const _columns = ref([]);
   const _searchFormSchema = ref([]);
+  const _crudFormSchema = ref([]);
   const [registerDrawer, { openDrawer }] = useDrawer();
   const [registerTable, { reload }] = useTable({
     title: '鍒楄〃淇℃伅',
@@ -69,6 +72,7 @@
     openDrawer(true, {
       isUpdate: false,
       entityName: objParams.value.ID,
+      formJson: _crudFormSchema.value,
     });
   }
 
@@ -77,6 +81,7 @@
       record,
       isUpdate: true,
       entityName: objParams.value.ID,
+      formJson: _crudFormSchema.value,
     });
   }
 
@@ -96,11 +101,31 @@
   }
 
   onMounted(async () => {
-    _searchFormSchema.value = await fetchJson(
-      `${globSetting.downloadUrl}/LowCode/${objParams.value.ID}/${objParams.value.ID}_Searchform.json`,
-    );
-    _columns.value = await fetchJson(
-      `${globSetting.downloadUrl}/LowCode/${objParams.value.ID}/${objParams.value.ID}_Baseform.json`,
-    );
+    /* 鐢╦son鑾峰彇鍒� */
+    // _searchFormSchema.value = await fetchJson(
+    //   `${globSetting.downloadUrl}/LowCode/${objParams.value.ID}/${objParams.value.ID}_Searchform.json`,
+    // );
+    // var objs = await fetchJson(
+    //   `${globSetting.downloadUrl}/LowCode/${objParams.value.ID}/${objParams.value.ID}_Baseform.json`,
+    // );
+    // for (const i in objs) {
+    //   if (!isNullOrEmpty(objs[i].customRender)) {
+    //     const func = new Function(objs[i].customRender)();
+    //     objs[i].customRender = ({ record }) => {
+    //       let texts = func(record);
+    //       return h(Tooltip, { title: texts.text }, () =>
+    //         h(Tag, { color: texts.color }, () => texts.text),
+    //       );
+    //     };
+    //   }
+    // }
+    // _columns.value = objs;
+    const data = await getEntity({
+      sqlcmd: "ASSEMBLY_NAME ='" + objParams.value.ID + "'",
+      entityName: 'SYS_LOW_CODE',
+    });
+    _searchFormSchema.value = JSON.parse(data.Data.Items[0].SEARCH_FORM_JSON);
+    _columns.value = JSON.parse(data.Data.Items[0].BASE_FORM_JSON);
+    _crudFormSchema.value = JSON.parse(data.Data.Items[0].FORM_JSON);
   });
 </script>

--
Gitblit v1.9.3