Ben Lin
2024-07-25 cdd0a28197fb9b432a45bbf9ebc0cfd8db939125
src/views/tigerprojects/system/lowcode/normal/index.vue
@@ -4,7 +4,7 @@
 * @version: 
 * @Date: 2024-05-30 13:28:20
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-07-20 05:21:44
 * @LastEditTime: 2024-07-24 23:47:07
-->
<template>
  <div>
@@ -14,7 +14,7 @@
  </div>
</template>
<script lang="ts" setup>
  import { Ref, defineAsyncComponent, h, onMounted, provide, ref, unref } from 'vue';
  import { Ref, defineAsyncComponent, h, onMounted, provide, ref, unref, watch } from 'vue';
  import mainTable from './mainTable.vue';
  import { DeleteEntity, GetEnum, getEntity, getListByPage } from '/@/api/tigerapi/system';
  import { useRoute, useRouter } from 'vue-router';
@@ -26,8 +26,10 @@
  import { useGo } from '/@/hooks/web/usePage';
  import { useI18n } from '/@/hooks/web/useI18n';
  import { getRoleButtons } from '/@/api/sys/menu';
  import { useWebSocketStore } from '/@/store/modules/websocket';
  const { getLocale } = useLocale();
  const webSocketStore = useWebSocketStore();
  const { t } = useI18n();
  const route = useRoute();
  const { currentRoute } = useRouter();
@@ -46,6 +48,7 @@
  const custImport = ref<any>(null);
  const isMounted = ref(false);
  const buttons = ref([]);
  const readyState = ref<number>(WebSocket.CONNECTING);
  const AuthOption = ref({
    BY_ORG: '',
    BY_PROD: '',
@@ -59,7 +62,13 @@
  provide<Ref<string>>('isExistSql', isExistSql);
  provide<Ref<{}>>('AuthOption', AuthOption);
  provide<Ref<any>>('keyFieldValues', keyFieldValues);
  // 监听readyState变化
  watch(readyState, (newState) => {
    if (newState === WebSocket.CLOSED || newState === WebSocket.CLOSING) {
      // 尝试重连
      setTimeout(webSocketStore.connectWebSocket, 3000);
    }
  });
  onMounted(async () => {
    /* 用json获取列 */
    // _searchFormSchema.value = await fetchJson(
@@ -81,6 +90,7 @@
    // }
    // _columns.value = objs;
    webSocketStore.connectWebSocket();
    isMounted.value = false;
    /* 动态import实体名.ts的自定义方法 */
    try {
@@ -188,5 +198,4 @@
      };
    }
  }
</script>