Ben Lin
2024-06-02 6f6207ef6eb81d2abb3805bc2cba889ea2abd135
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`,
    );
    /* 用json获取列 */
    // _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>