diff --git a/frontend/src/components/pure/ms-pagination/interface.ts b/frontend/src/components/pure/ms-pagination/interface.ts index 85a7c2be6b..b16e591196 100644 --- a/frontend/src/components/pure/ms-pagination/interface.ts +++ b/frontend/src/components/pure/ms-pagination/interface.ts @@ -3,7 +3,7 @@ import { SelectProps } from '@arco-design/web-vue'; import { Size } from './types'; -export const PAGE_ITEM_TYPES = ['page', 'more', 'previous', 'next'] as const; +export const PAGE_ITEM_TYPES = ['page', 'more', 'previous', 'next', 'jumper'] as const; export type PageItemType = (typeof PAGE_ITEM_TYPES)[number]; diff --git a/frontend/src/components/pure/ms-pagination/page-jumper.vue b/frontend/src/components/pure/ms-pagination/page-jumper.vue index e4dcdb832a..747c2d9791 100644 --- a/frontend/src/components/pure/ms-pagination/page-jumper.vue +++ b/frontend/src/components/pure/ms-pagination/page-jumper.vue @@ -15,10 +15,12 @@ @change="handleChange" @enter="handleChange" /> - - {{ - t('msPagination.page', { page: pages }) - }} + + + + + {{ t('msPagination.page', { page: pages }) }} + diff --git a/frontend/src/models/apiTest/scenario.ts b/frontend/src/models/apiTest/scenario.ts index da701aa394..c99d0d2d7e 100644 --- a/frontend/src/models/apiTest/scenario.ts +++ b/frontend/src/models/apiTest/scenario.ts @@ -389,7 +389,7 @@ export interface Scenario { executeSuccessCount: number; // 执行成功数量 executeFailCount: number; // 执行失败数量 reportId?: string | number; // 场景报告 id - stepResponses: Record; // 步骤响应集合,key 为步骤 id,value 为步骤响应内容 + stepResponses: Record>; // 步骤响应集合,key 为步骤 id,value 为步骤响应内容 isExecute?: boolean; // 是否从列表执行进去场景详情 isDebug?: boolean; // 是否调试,区分执行场景和批量调试步骤 } diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts index 54ce6b1fd8..dc96b35c5e 100644 --- a/frontend/src/utils/index.ts +++ b/frontend/src/utils/index.ts @@ -1,4 +1,4 @@ -import { cloneDeep } from 'lodash-es'; +import { cloneDeep, each } from 'lodash-es'; import JSEncrypt from 'jsencrypt'; import { BatchActionQueryParams, MsTableColumnData } from '@/components/pure/ms-table/type'; @@ -194,6 +194,31 @@ export interface TreeNode { * @param tree 树形数组或树 * @param customNodeFn 自定义节点函数 * @param customChildrenKey 自定义子节点的key + */ +export function traverseTree( + tree: TreeNode | TreeNode[] | T | T[], + customNodeFn: (node: TreeNode) => TreeNode | null = (node) => node, + customChildrenKey = 'children' +) { + if (!Array.isArray(tree)) { + tree = [tree]; + } + for (let i = 0; i < tree.length; i++) { + const node = tree[i]; + if (typeof customNodeFn === 'function') { + customNodeFn(node); + } + if (node[customChildrenKey] && Array.isArray(node[customChildrenKey]) && node[customChildrenKey].length > 0) { + traverseTree(node[customChildrenKey], customNodeFn, customChildrenKey); + } + } +} + +/** + * 递归遍历树形数组或树,返回新的树 + * @param tree 树形数组或树 + * @param customNodeFn 自定义节点函数 + * @param customChildrenKey 自定义子节点的key * @param parent 父节点 * @param parentPath 父节点路径 * @param level 节点层级 diff --git a/frontend/src/views/api-test/components/environmentSelect.vue b/frontend/src/views/api-test/components/environmentSelect.vue index 4b9d8eb0ed..3feeb979df 100644 --- a/frontend/src/views/api-test/components/environmentSelect.vue +++ b/frontend/src/views/api-test/components/environmentSelect.vue @@ -61,7 +61,9 @@ value: item.id, })); currentEnv.value = currentEnv.value.length ? currentEnv.value : res[0]?.id; - await initEnvironment(); + if (currentEnv.value) { + await initEnvironment(); + } } catch (error) { // eslint-disable-next-line no-console console.log(error); diff --git a/frontend/src/views/api-test/debug/index.vue b/frontend/src/views/api-test/debug/index.vue index 6430fc9d6b..49da645308 100644 --- a/frontend/src/views/api-test/debug/index.vue +++ b/frontend/src/views/api-test/debug/index.vue @@ -20,7 +20,6 @@