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 |   53 ++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 42 insertions(+), 11 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/normal/index.vue b/src/views/tigerprojects/system/lowcode/normal/index.vue
index 51e0bce..9d56235 100644
--- a/src/views/tigerprojects/system/lowcode/normal/index.vue
+++ b/src/views/tigerprojects/system/lowcode/normal/index.vue
@@ -2,7 +2,7 @@
   <div>
     <BasicTable @register="registerTable">
       <template #toolbar>
-        <a-button type="primary" @click="handleCreate"> 鏂板鍌ㄥ尯 </a-button>
+        <a-button type="primary" @click="handleCreate" preIcon="add_02|svg"> 鏂板 </a-button>
       </template>
       <template #action="{ record }">
         <TableAction
@@ -28,22 +28,27 @@
   </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 { DeleteRegion } from '/@/api/tigerapi/wms/region';
-  import { 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: '鍌ㄥ尯鍒楄〃',
+    title: '鍒楄〃淇℃伅',
     api: getListByPage,
-    searchInfo: { TABLE_NAME: 'WMS_REGION' },
+    searchInfo: { TABLE_NAME: objParams.value.ID },
     columns: _columns as unknown as BasicColumn[],
     formConfig: {
       labelWidth: 120,
@@ -66,6 +71,8 @@
   function handleCreate() {
     openDrawer(true, {
       isUpdate: false,
+      entityName: objParams.value.ID,
+      formJson: _crudFormSchema.value,
     });
   }
 
@@ -73,13 +80,15 @@
     openDrawer(true, {
       record,
       isUpdate: true,
+      entityName: objParams.value.ID,
+      formJson: _crudFormSchema.value,
     });
   }
 
   function handleDelete(record: Recordable) {
     console.log(record);
     //鍒犻櫎
-    const apiAction = DeleteRegion(record);
+    const apiAction = DeleteEntity(record, objParams.value.ID);
     apiAction.then((action) => {
       if (action.IsSuccessed) {
         reload();
@@ -92,9 +101,31 @@
   }
 
   onMounted(async () => {
-    _searchFormSchema.value = await fetchJson(
-      `${globSetting.downloadUrl}/LowCode/regionSearchform.json`,
-    );
-    _columns.value = await fetchJson(`${globSetting.downloadUrl}/LowCode/regionBaseform.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