refactor: 移除未使用的主机信息查询逻辑

This commit is contained in:
TsMask
2025-02-28 19:42:36 +08:00
parent 1e2824657c
commit 1162bb5b28

View File

@@ -2,10 +2,8 @@
import { PageContainer } from 'antdv-pro-layout';
import { Modal } from 'ant-design-vue/es';
import { useFullscreen } from '@vueuse/core';
import { defineAsyncComponent, reactive, ref, toRaw } from 'vue';
import { defineAsyncComponent, reactive, ref } from 'vue';
import { parseDuration } from '@/utils/date-utils';
import { listNeHost } from '@/api/ne/neHost';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import useI18n from '@/hooks/useI18n';
const { t } = useI18n();
const TerminalSSH = defineAsyncComponent(
@@ -53,39 +51,6 @@ const hostState: HostStateType = reactive({
data: [],
});
/**查询主机信息列表, pageNum初始页数 */
function fnGetHostList(pageNum?: number) {
if (hostState.loading) return;
hostState.loading = true;
if (pageNum) {
hostState.params.pageNum = pageNum;
}
// 超过总数不请求
if (hostState.data.length >= hostState.total && hostState.total !== 0) {
hostState.loading = false;
return;
}
listNeHost(toRaw(hostState.params)).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
hostState.total = res.total;
hostState.data = hostState.data.concat(res.rows);
// 页数+
if (hostState.data.length < hostState.total) {
hostState.params.pageNum += 1;
}
}
hostState.loading = false;
});
}
/**选择主机 */
function fnSelectHost() {
if (hostState.loading) return;
hostState.show = true;
fnGetHostList(1);
}
/**连接主机 */
function fnConnectHost(data: Record<string, any>) {
const id = `${Date.now()}`;