diff --git a/frontend/src/assets/icon-font/iconfont.css b/frontend/src/assets/icon-font/iconfont.css index bc9ed2e575..2517adc7f3 100644 --- a/frontend/src/assets/icon-font/iconfont.css +++ b/frontend/src/assets/icon-font/iconfont.css @@ -1,7 +1,7 @@ @font-face { font-family: iconfont; /* Project id 3462279 */ - src: url('iconfont.woff2?t=1716970683831') format('woff2'), url('iconfont.woff?t=1716970683831') format('woff'), - url('iconfont.ttf?t=1716970683831') format('truetype'), url('iconfont.svg?t=1716970683831#iconfont') format('svg'); + src: url('iconfont.woff2?t=1717669877554') format('woff2'), url('iconfont.woff?t=1717669877554') format('woff'), + url('iconfont.ttf?t=1717669877554') format('truetype'), url('iconfont.svg?t=1717669877554#iconfont') format('svg'); } .iconfont { font-size: 16px; @@ -10,6 +10,18 @@ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } +.icon-icon_title-top-align_outlined1::before { + content: '\e7be'; +} +.icon-icon_title-left-align_outlined1::before { + content: '\e7bf'; +} +.icon-icon_protocol::before { + content: '\e7bd'; +} +.icon-icon_info_outlined1::before { + content: '\e7bc'; +} .icon-icon_github::before { content: '\e7b9'; } diff --git a/frontend/src/assets/icon-font/iconfont.js b/frontend/src/assets/icon-font/iconfont.js index 277b0af043..6d888a12ef 100644 --- a/frontend/src/assets/icon-font/iconfont.js +++ b/frontend/src/assets/icon-font/iconfont.js @@ -1,16 +1,16 @@ (window._iconfont_svg_string_3462279 = - ''), + ''), (function (h) { var a = (a = document.getElementsByTagName('script'))[a.length - 1], l = a.getAttribute('data-injectcss'), a = a.getAttribute('data-disable-injectsvg'); if (!a) { var o, - c, i, + c, v, t, - m = function (a, l) { + z = function (a, l) { l.parentNode.insertBefore(a, l); }; if (l && !h.__iconfont__svg__cssinject__) { @@ -34,26 +34,26 @@ (l.style.height = 0), (l.style.overflow = 'hidden'), (l = l), - (a = document.body).firstChild ? m(l, a.firstChild) : a.appendChild(l)); + (a = document.body).firstChild ? z(l, a.firstChild) : a.appendChild(l)); }), document.addEventListener ? ~['complete', 'loaded', 'interactive'].indexOf(document.readyState) ? setTimeout(o, 0) - : ((c = function () { - document.removeEventListener('DOMContentLoaded', c, !1), o(); + : ((i = function () { + document.removeEventListener('DOMContentLoaded', i, !1), o(); }), - document.addEventListener('DOMContentLoaded', c, !1)) + document.addEventListener('DOMContentLoaded', i, !1)) : document.attachEvent && - ((i = o), + ((c = o), (v = h.document), (t = !1), d(), (v.onreadystatechange = function () { - 'complete' == v.readyState && ((v.onreadystatechange = null), z()); + 'complete' == v.readyState && ((v.onreadystatechange = null), m()); })); } - function z() { - t || ((t = !0), i()); + function m() { + t || ((t = !0), c()); } function d() { try { @@ -61,6 +61,6 @@ } catch (a) { return void setTimeout(d, 50); } - z(); + m(); } })(window); diff --git a/frontend/src/assets/icon-font/iconfont.json b/frontend/src/assets/icon-font/iconfont.json index 016389e620..db2cc77518 100644 --- a/frontend/src/assets/icon-font/iconfont.json +++ b/frontend/src/assets/icon-font/iconfont.json @@ -5,6 +5,34 @@ "css_prefix_text": "icon-", "description": "DE、MS项目icon管理", "glyphs": [ + { + "icon_id": "40628129", + "name": "icon_title-top-align_outlined", + "font_class": "icon_title-top-align_outlined1", + "unicode": "e7be", + "unicode_decimal": 59326 + }, + { + "icon_id": "40628128", + "name": "icon_title-left-align_outlined", + "font_class": "icon_title-left-align_outlined1", + "unicode": "e7bf", + "unicode_decimal": 59327 + }, + { + "icon_id": "40547513", + "name": "icon_protocol", + "font_class": "icon_protocol", + "unicode": "e7bd", + "unicode_decimal": 59325 + }, + { + "icon_id": "40530999", + "name": "icon_info_outlined", + "font_class": "icon_info_outlined1", + "unicode": "e7bc", + "unicode_decimal": 59324 + }, { "icon_id": "40529317", "name": "icon_github", diff --git a/frontend/src/assets/icon-font/iconfont.svg b/frontend/src/assets/icon-font/iconfont.svg index c474346167..29efd28cce 100644 --- a/frontend/src/assets/icon-font/iconfont.svg +++ b/frontend/src/assets/icon-font/iconfont.svg @@ -14,6 +14,14 @@ /> + + + + + + + + diff --git a/frontend/src/assets/icon-font/iconfont.ttf b/frontend/src/assets/icon-font/iconfont.ttf index c3e1d280a7..48dc0a44b2 100644 Binary files a/frontend/src/assets/icon-font/iconfont.ttf and b/frontend/src/assets/icon-font/iconfont.ttf differ diff --git a/frontend/src/assets/icon-font/iconfont.woff b/frontend/src/assets/icon-font/iconfont.woff index addd3fcd6d..10eb6c030c 100644 Binary files a/frontend/src/assets/icon-font/iconfont.woff and b/frontend/src/assets/icon-font/iconfont.woff differ diff --git a/frontend/src/assets/icon-font/iconfont.woff2 b/frontend/src/assets/icon-font/iconfont.woff2 index f01e712853..e67007870a 100644 Binary files a/frontend/src/assets/icon-font/iconfont.woff2 and b/frontend/src/assets/icon-font/iconfont.woff2 differ diff --git a/frontend/src/components/business/ms-folder-all/index.vue b/frontend/src/components/business/ms-folder-all/index.vue index 2d8a87e11a..88c777ff1a 100644 --- a/frontend/src/components/business/ms-folder-all/index.vue +++ b/frontend/src/components/business/ms-folder-all/index.vue @@ -27,7 +27,7 @@ import { addCommasToNumber } from '@/utils'; const props = defineProps<{ - activeFolder: string; // 选中的节点 + activeFolder?: string; // 选中的节点 folderName: string; // 名称 allCount: number; // 总数 }>(); diff --git a/frontend/src/models/apiTest/management.ts b/frontend/src/models/apiTest/management.ts index 70ea274759..3ef5e5f383 100644 --- a/frontend/src/models/apiTest/management.ts +++ b/frontend/src/models/apiTest/management.ts @@ -100,7 +100,8 @@ export interface ApiDefinitionGetModuleParams { filter?: Record; combine?: Record; moduleIds: string[]; - protocol: string; + protocols?: string[]; // TODO 协议 必填 + protocol?: string; // TODO 协议 改完回收站删除这行 projectId: string; versionId?: string; refId?: string; @@ -137,7 +138,7 @@ export interface Environment { export interface ApiDefinitionPageParams extends TableQueryParams { id: string; name: string; - protocol: string; + protocols: string[]; projectId: string; versionId: string; refId: string; @@ -180,7 +181,8 @@ export interface mockParams { } // 批量操作参数 export interface ApiDefinitionBatchParams extends BatchApiParams { - protocol: string; + protocols?: string[]; // TODO 协议 必填 + protocol?: string; // TODO 协议 改完回收站删除这行 } // 批量更新定义参数 export interface ApiDefinitionBatchUpdateParams extends ApiDefinitionBatchParams { @@ -292,7 +294,7 @@ export interface BatchRecoverApiParams extends ApiDefinitionBatchParams { // --------------------用例 // 用例列表查询参数 export interface ApiCasePageParams extends TableQueryParams { - protocol: string; + protocols: string[]; projectId: string; versionId?: string; refId?: string; @@ -332,7 +334,8 @@ export interface ApiCaseDetail extends ExecuteRequestParams { } // 批量操作参数 export interface ApiCaseBatchParams extends BatchApiParams { - protocol: string; + protocols?: string[]; // TODO 协议 必填 + protocol?: string; // TODO 协议 改完回收站删除这行 apiDefinitionId?: string; versionId?: string; } @@ -368,7 +371,7 @@ export interface ApiRunModeRequest { // 接口用例批量执行参数 export interface ApiCaseBatchExecuteParams extends BatchApiParams { apiDefinitionId?: string | number; - protocol: string; + protocols: string[]; versionId?: string; refId?: string; runModeConfig: ApiRunModeRequest; diff --git a/frontend/src/models/apiTest/mock.ts b/frontend/src/models/apiTest/mock.ts index 1b551b2fef..761e9d2472 100644 --- a/frontend/src/models/apiTest/mock.ts +++ b/frontend/src/models/apiTest/mock.ts @@ -91,4 +91,5 @@ export interface BatchEditMockParams extends BatchApiParams { tags: string[]; // 标签 append: boolean; // 是否追加 enable: boolean; // 是否启用 + protocols: string[]; // 协议集合 } diff --git a/frontend/src/models/common.ts b/frontend/src/models/common.ts index 2f337c000c..16b887468d 100644 --- a/frontend/src/models/common.ts +++ b/frontend/src/models/common.ts @@ -50,6 +50,7 @@ export interface BatchApiParams { moduleIds?: (string | number)[]; // 模块 ID 集合 versionId?: string; // 版本 ID refId?: string; // 版本来源 + protocols?: string[]; // 协议集合 } // 移动模块树 diff --git a/frontend/src/views/api-test/components/apiMethodName.vue b/frontend/src/views/api-test/components/apiMethodName.vue index ef07f8d492..7a809e653f 100644 --- a/frontend/src/views/api-test/components/apiMethodName.vue +++ b/frontend/src/views/api-test/components/apiMethodName.vue @@ -37,8 +37,8 @@ const colorMaps = [ { - color: 'rgb(var(--success-6))', - includes: [RequestMethods.GET, RequestMethods.HEAD], + color: 'rgb(var(--success-7))', + includes: [RequestMethods.GET, RequestMethods.HEAD, 'HTTP'], }, { color: 'rgb(var(--warning-7))', diff --git a/frontend/src/views/api-test/components/treeFolderAll.vue b/frontend/src/views/api-test/components/treeFolderAll.vue new file mode 100644 index 0000000000..671785ead1 --- /dev/null +++ b/frontend/src/views/api-test/components/treeFolderAll.vue @@ -0,0 +1,155 @@ + + emit('setActiveFolder', val)" + > + + + + + + + + + + {{ t('apiScenario.api') }} + + + + {{ t('ms.paramsInput.protocol') }} + + {{ t('common.all') }} + + + + {{ item.label }} + + + + + + + + {{ t('common.all') }} + + + + {{ item.label }} + + + + + + + + + + + + + + + diff --git a/frontend/src/views/api-test/management/components/addDependencyDrawer.vue b/frontend/src/views/api-test/management/components/addDependencyDrawer.vue index d340a14305..140fd94e78 100644 --- a/frontend/src/views/api-test/management/components/addDependencyDrawer.vue +++ b/frontend/src/views/api-test/management/components/addDependencyDrawer.vue @@ -18,7 +18,7 @@ :active-module="activeModule" :offspring-ids="offspringIds" class="flex-1 overflow-hidden !pl-0 !pr-[16px]" - :protocol="protocol" + :selected-protocols="selectedProtocols" :member-options="memberOptions" read-only /> @@ -50,15 +50,15 @@ const folderTree = ref([]); const activeModule = ref('all'); const offspringIds = ref([]); - const protocol = ref('HTTP'); + const selectedProtocols = ref([]); function handleNodeSelect(keys: string[], _offspringIds: string[]) { [activeModule.value] = keys; offspringIds.value = _offspringIds; } - function handleProtocolChange(val: string) { - protocol.value = val; + function handleProtocolChange(val: string[]) { + selectedProtocols.value = val; } diff --git a/frontend/src/views/api-test/management/components/management/api/apiTable.vue b/frontend/src/views/api-test/management/components/management/api/apiTable.vue index 457e0ad2b7..6fafbd8e81 100644 --- a/frontend/src/views/api-test/management/components/management/api/apiTable.vue +++ b/frontend/src/views/api-test/management/components/management/api/apiTable.vue @@ -31,7 +31,7 @@ @drag-change="handleTableDragSort" @module-change="loadApiList(false)" > - + @@ -40,22 +40,11 @@ {{ record.num }} + + + - handleMethodChange(record)" - > - - - - - - - - + {{ record.caseTotal }} @@ -279,6 +268,7 @@ import apiStatus from '@/views/api-test/components/apiStatus.vue'; import moduleTree from '@/views/api-test/management/components/moduleTree.vue'; + import { getProtocolList } from '@/api/modules/api-test/common'; import { batchDeleteDefinition, batchMoveDefinition, @@ -295,6 +285,7 @@ import { characterLimit, operationWidth } from '@/utils'; import { hasAnyPermission } from '@/utils/permission'; + import { ProtocolItem } from '@/models/apiTest/common'; import { ApiDefinitionDetail, ApiDefinitionGetModuleParams } from '@/models/apiTest/management'; import { DragSortParams } from '@/models/common'; import { RequestDefinitionStatus, RequestMethods } from '@/enums/apiEnum'; @@ -305,7 +296,7 @@ class?: string; activeModule: string; offspringIds: string[]; - protocol: string; // 查看的协议类型 + selectedProtocols: string[]; // 查看的协议类型 readOnly?: boolean; // 是否是只读模式 refreshTimeStamp?: number; memberOptions: { label: string; value: string }[]; @@ -341,13 +332,38 @@ ]) ); + // TODO: 后期优化 放store里 + const protocolList = ref([]); + async function initProtocolList() { + try { + const res = await getProtocolList(appStore.currentOrgId); + protocolList.value = res.map((e) => ({ + protocol: e.protocol, + polymorphicName: e.polymorphicName, + pluginId: e.pluginId, + })); + } catch (error) { + // eslint-disable-next-line no-console + console.log(error); + } + } + const requestMethodsOptions = computed(() => { - return Object.values(RequestMethods).map((e) => { + const otherMethods = protocolList.value + .filter((e) => e.protocol !== 'HTTP') + .map((item) => { + return { + value: item.protocol, + key: item.protocol, + }; + }); + const httpMethods = Object.values(RequestMethods).map((e) => { return { value: e, key: e, }; }); + return [...httpMethods, ...otherMethods]; }); const requestApiStatus = computed(() => { return Object.values(RequestDefinitionStatus).map((e) => { @@ -386,8 +402,9 @@ { title: 'apiTestManagement.protocol', dataIndex: 'protocol', + slotName: 'protocol', showTooltip: true, - width: 200, + width: 150, showDrag: true, }, { @@ -397,7 +414,7 @@ width: 140, showDrag: true, filterConfig: { - options: requestMethodsOptions.value, + options: [], filterSlotName: FilterSlotNameEnum.API_TEST_API_REQUEST_METHODS, }, }, @@ -494,7 +511,7 @@ ...item, filterConfig: { ...item.filterConfig, - options: props.protocol === 'HTTP' ? requestMethodsOptions.value : [], + options: requestMethodsOptions.value, }, }; } @@ -588,7 +605,7 @@ keyword: keyword.value, projectId: appStore.currentProjectId, moduleIds, - protocol: props.protocol, + protocols: props.selectedProtocols, filter: propsRes.value.filter, }; @@ -597,7 +614,7 @@ keyword: keyword.value, filter: propsRes.value.filter, moduleIds: [], - protocol: props.protocol, + protocols: props.selectedProtocols, projectId: appStore.currentProjectId, }); } @@ -624,26 +641,13 @@ ); watch( - () => props.protocol, + () => props.selectedProtocols, () => { resetSelector(); loadApiList(true); } ); - async function handleMethodChange(record: ApiDefinitionDetail) { - try { - await updateDefinition({ - id: record.id, - method: record.method, - }); - Message.success(t('common.updateSuccess')); - } catch (error) { - // eslint-disable-next-line no-console - console.log(error); - } - } - async function handleStatusChange(record: ApiDefinitionDetail) { try { await updateDefinition({ @@ -658,6 +662,7 @@ } onBeforeMount(() => { + initProtocolList(); loadApiList(true); }); @@ -705,7 +710,7 @@ projectId: appStore.currentProjectId, moduleIds: await getModuleIds(), deleteAll: true, - protocol: props.protocol, + protocols: props.selectedProtocols, }); } else { await deleteDefinition(record?.id as string); @@ -770,10 +775,11 @@ }, ]; const attrOptions = computed(() => { - if (props.protocol === 'HTTP') { - return fullAttrs; - } - return fullAttrs.filter((e) => e.value !== 'method'); + // TODO 协议 选择的数据不包含HTTP协议,则选择属性中不展示“请求类型“ + // if (props.protocol === 'HTTP') { + return fullAttrs; + // } + // return fullAttrs.filter((e) => e.value !== 'method'); }); const valueOptions = computed(() => { switch (batchForm.value.attr) { @@ -827,7 +833,7 @@ }, projectId: appStore.currentProjectId, moduleIds: await getModuleIds(), - protocol: props.protocol, + protocols: props.selectedProtocols, type: batchForm.value.attr, append: batchForm.value.append, [batchForm.value.attr]: batchForm.value.attr === 'tags' ? batchForm.value.values : batchForm.value.value, @@ -869,7 +875,7 @@ projectId: appStore.currentProjectId, moduleIds: await getModuleIds(), moduleId: selectedModuleKeys.value[0], - protocol: props.protocol, + protocols: props.selectedProtocols, }); Message.success(t('common.batchMoveSuccess')); if (isBatchMove.value) { @@ -958,12 +964,10 @@ const apiTableRef = ref(); watch( - () => props.protocol, - (val) => { - if (val) { - initFilterColumn(); - apiTableRef.value.initColumn(columns); - } + () => requestMethodsOptions.value, + () => { + initFilterColumn(); + apiTableRef.value.initColumn(columns); } ); @@ -972,15 +976,12 @@ :deep(.param-input:not(.arco-input-focus, .arco-select-view-focus)) { &:not(:hover) { border-color: transparent !important; - .arco-input::placeholder { @apply invisible; } - .arco-select-view-icon { @apply invisible; } - .arco-select-view-value { color: var(--color-text-brand); } diff --git a/frontend/src/views/api-test/management/components/management/api/index.vue b/frontend/src/views/api-test/management/components/management/api/index.vue index 81a2965724..9d5acf34e7 100644 --- a/frontend/src/views/api-test/management/components/management/api/index.vue +++ b/frontend/src/views/api-test/management/components/management/api/index.vue @@ -4,7 +4,7 @@ openApiTab({ apiInfo: record, isCopy: false, isExecute })" @@ -99,7 +99,7 @@ ref="caseTableRef" :is-api="true" :active-module="props.activeModule" - :protocol="activeApiTab.protocol" + :selected-protocols="[activeApiTab.protocol]" :api-detail="activeApiTab" :offspring-ids="props.offspringIds" :member-options="memberOptions" @@ -116,7 +116,7 @@ :active-module="props.activeModule" :offspring-ids="props.offspringIds" :definition-detail="activeApiTab" - :protocol="activeApiTab.protocol" + :selected-protocols="[activeApiTab.protocol]" :height-used="48" is-api @debug="openApiTabAndDebugMock" @@ -188,7 +188,7 @@ activeModule: string; offspringIds: string[]; moduleTree: ModuleTreeNode[]; // 模块树 - protocol: string; + selectedProtocols: string[]; currentTab: string; memberOptions: { label: string; value: string }[]; }>(); diff --git a/frontend/src/views/api-test/management/components/management/case/caseTable.vue b/frontend/src/views/api-test/management/components/management/case/caseTable.vue index 2619e7859f..5527292afa 100644 --- a/frontend/src/views/api-test/management/components/management/case/caseTable.vue +++ b/frontend/src/views/api-test/management/components/management/case/caseTable.vue @@ -51,6 +51,9 @@ {{ record.num }} + + + props.protocol, + () => props.selectedProtocols, () => { if (props.isApi) return; loadCaseListAndResetSelector(); @@ -675,7 +680,7 @@ filter: propsRes.value.filter, }, projectId: appStore.currentProjectId, - protocol: props.protocol, + protocols: props.selectedProtocols, moduleIds: selectModules, apiDefinitionId: props.apiDetail?.id as string, }; diff --git a/frontend/src/views/api-test/management/components/management/case/index.vue b/frontend/src/views/api-test/management/components/management/case/index.vue index e7545ccd84..ef27fecfc7 100644 --- a/frontend/src/views/api-test/management/components/management/case/index.vue +++ b/frontend/src/views/api-test/management/components/management/case/index.vue @@ -6,7 +6,7 @@ :offspring-ids="props.offspringIds" :is-api="false" :active-module="props.activeModule" - :protocol="props.protocol" + :selected-protocols="props.selectedProtocols" :member-options="memberOptions" @open-case-tab="openCaseTab" @open-case-tab-and-execute="openCaseTabAndExecute" @@ -44,7 +44,7 @@ const props = defineProps<{ activeModule: string; - protocol: string; + selectedProtocols: string[]; offspringIds: string[]; moduleTree: ModuleTreeNode[]; // 模块树 memberOptions: { label: string; value: string }[]; diff --git a/frontend/src/views/api-test/management/components/management/index.vue b/frontend/src/views/api-test/management/components/management/index.vue index 78d425963a..c103f48fee 100644 --- a/frontend/src/views/api-test/management/components/management/index.vue +++ b/frontend/src/views/api-test/management/components/management/index.vue @@ -41,7 +41,7 @@ v-model:api-tabs="apiTabs" :active-module="props.activeModule" :offspring-ids="props.offspringIds" - :protocol="props.protocol" + :selected-protocols="props.selectedProtocols" :module-tree="props.moduleTree" :current-tab="currentTab" :member-options="memberOptions" @@ -54,7 +54,7 @@ v-model:api-tabs="apiTabs" v-model:active-api-tab="activeApiTab" :active-module="props.activeModule" - :protocol="props.protocol" + :selected-protocols="props.selectedProtocols" :module-tree="props.moduleTree" :current-tab="currentTab" :offspring-ids="props.offspringIds" @@ -65,7 +65,7 @@ v-if="activeApiTab.id === 'all' && currentTab === 'mock'" :active-module="props.activeModule" :offspring-ids="props.offspringIds" - :protocol="props.protocol" + :selected-protocols="props.selectedProtocols" :definition-detail="activeApiTab" @debug="handleMockDebug" /> @@ -108,7 +108,7 @@ const props = defineProps<{ activeModule: string; offspringIds: string[]; - protocol: string; + selectedProtocols: string[]; moduleTree: ModuleTreeNode[]; // 模块树 }>(); const emit = defineEmits<{ diff --git a/frontend/src/views/api-test/management/components/management/mock/mockTable.vue b/frontend/src/views/api-test/management/components/management/mock/mockTable.vue index 74d734f115..5e216d1247 100644 --- a/frontend/src/views/api-test/management/components/management/mock/mockTable.vue +++ b/frontend/src/views/api-test/management/components/management/mock/mockTable.vue @@ -42,6 +42,9 @@ {{ record.expectNum }} + + + - + {{ t(item.name) }} @@ -240,7 +243,7 @@ offspringIds: string[]; definitionDetail: RequestParam; readOnly?: boolean; // 是否是只读模式 - protocol: string; // 查看的协议类型 + selectedProtocols: string[]; // 查看的协议类型 heightUsed?: number; }>(); const emit = defineEmits<{ @@ -289,8 +292,8 @@ { title: 'apiTestManagement.protocol', dataIndex: 'protocol', - showTooltip: true, - width: 200, + slotName: 'protocol', + width: 150, showDrag: true, }, { @@ -401,7 +404,7 @@ const params = { keyword: keyword.value, projectId: appStore.currentProjectId, - protocol: props.protocol, + protocols: props.selectedProtocols, apiDefinitionId: props.definitionDetail.id !== 'all' ? props.definitionDetail.id : undefined, filter: {}, moduleIds: selectModules, @@ -418,11 +421,13 @@ }); } - watchEffect(() => { - if (props.activeModule || props.protocol) { + watch( + [() => props.activeModule, () => props.selectedProtocols], + () => { loadMockList(); - } - }); + }, + { immediate: true } + ); async function handleBeforeEnableChange(record: ApiDefinitionMockDetail) { try { @@ -477,6 +482,7 @@ condition: { keyword: keyword.value }, projectId: appStore.currentProjectId, moduleIds: selectModules, + protocols: props.selectedProtocols, }); } else { await deleteMock({ @@ -559,12 +565,6 @@ value: 'Tags', }, ]; - const attrOptions = computed(() => { - if (props.protocol === 'HTTP') { - return fullAttrs; - } - return fullAttrs.filter((e) => e.value !== 'method'); - }); function cancelBatch() { showBatchModal.value = false; @@ -595,6 +595,7 @@ append: batchForm.value.append, tags: batchForm.value.attr === 'Tags' ? batchForm.value.values : [], enable: batchForm.value.attr === 'Status' ? batchForm.value.value : false, + protocols: props.selectedProtocols, }); Message.success(t('common.updateSuccess')); cancelBatch(); diff --git a/frontend/src/views/api-test/management/components/moduleTree.vue b/frontend/src/views/api-test/management/components/moduleTree.vue index e9f1f22737..4f96cded89 100644 --- a/frontend/src/views/api-test/management/components/moduleTree.vue +++ b/frontend/src/views/api-test/management/components/moduleTree.vue @@ -1,13 +1,6 @@ - handleProtocolChange()" - /> - - - - {{ t('apiTestManagement.allApi') }} - ({{ allFileCount }}) - - - - - - - - - - - - - + + - - + + ([]); const moduleProtocolOptions = ref([]); const protocolLoading = ref(false); @@ -303,9 +290,6 @@ const folderTree = ref([]); const focusNodeKey = ref(''); const selectedKeys = ref>([props.activeModule]); - const allFolderClass = computed(() => - selectedKeys.value[0] === 'all' ? 'folder-text folder-text--active' : 'folder-text' - ); const loading = ref(false); function setActiveFolder(id: string) { @@ -372,13 +356,13 @@ const lastModuleCountParam = ref({ projectId: appStore.currentProjectId, keyword: '', - protocol: moduleProtocol.value, + protocols: selectedProtocols.value, moduleIds: [], }); async function initModuleCount(params: ApiDefinitionGetModuleParams) { try { lastModuleCountParam.value = params; - lastModuleCountParam.value.protocol = moduleProtocol.value; + lastModuleCountParam.value.protocols = selectedProtocols.value; let res; if (props.trash) { res = await getTrashModuleCount(params); @@ -428,7 +412,7 @@ res = await getTrashModuleTree({ // 回收站下的模块 keyword: '', - protocol: moduleProtocol.value, + protocols: selectedProtocols.value, projectId: appStore.currentProjectId, moduleIds: [], }); @@ -436,7 +420,7 @@ // 查看模块及模块下的请求 res = await getModuleTree({ keyword: '', - protocol: moduleProtocol.value, + protocols: selectedProtocols.value, projectId: appStore.currentProjectId, moduleIds: [], }); @@ -444,7 +428,7 @@ res = await getModuleTreeOnlyModules({ // 只查看模块 keyword: '', - protocol: moduleProtocol.value, + protocols: selectedProtocols.value, projectId: appStore.currentProjectId, moduleIds: [], }); @@ -484,7 +468,7 @@ if (isSetDefaultKey) { selectedKeys.value = [folderTree.value[0].id]; } - emit('init', folderTree.value, moduleProtocol.value, nodePathObj); + emit('init', folderTree.value, selectedProtocols.value, nodePathObj); } catch (error) { // eslint-disable-next-line no-console console.log(error); @@ -494,9 +478,9 @@ } } - function handleProtocolChange() { - emit('changeProtocol', moduleProtocol.value); - lastModuleCountParam.value.protocol = moduleProtocol.value; + function selectedProtocolsChange() { + emit('changeProtocol', selectedProtocols.value); + lastModuleCountParam.value.protocols = selectedProtocols.value; initModules(); } @@ -507,12 +491,7 @@ } ); - function changeExpand() { - isExpandAll.value = !isExpandAll.value; - } - function changeApiExpand() { - isExpandApi.value = !isExpandApi.value; initModules(); } @@ -675,7 +654,6 @@ onBeforeMount(() => { initProtocolList(); - initModules(); }); async function refresh() { diff --git a/frontend/src/views/api-test/management/components/recycle/index.vue b/frontend/src/views/api-test/management/components/recycle/index.vue index 67a22dc748..44362c04ee 100644 --- a/frontend/src/views/api-test/management/components/recycle/index.vue +++ b/frontend/src/views/api-test/management/components/recycle/index.vue @@ -21,6 +21,7 @@ + + @@ -55,7 +57,7 @@ const props = defineProps<{ activeModule: string; offspringIds: string[]; - protocol: string; + selectedProtocols: string[]; // 查看的协议类型 moduleTree: ModuleTreeNode[]; // 模块树 }>(); diff --git a/frontend/src/views/api-test/management/index.vue b/frontend/src/views/api-test/management/index.vue index a78edcd567..253d0a22c8 100644 --- a/frontend/src/views/api-test/management/index.vue +++ b/frontend/src/views/api-test/management/index.vue @@ -54,7 +54,7 @@ :module-tree="folderTree" :active-module="activeModule" :offspring-ids="offspringIds" - :protocol="protocol" + :selected-protocols="selectedProtocols" @import="importDrawerVisible = true" /> @@ -93,14 +93,14 @@ const folderTreePathMap = ref>({}); const importDrawerVisible = ref(false); const offspringIds = ref([]); - const protocol = ref('HTTP'); + const selectedProtocols = ref([]); const activeNodeId = ref('all'); const moduleTreeRef = ref>(); const managementRef = ref>(); - function handleModuleInit(tree: ModuleTreeNode[], _protocol: string, pathMap: Record) { + function handleModuleInit(tree: ModuleTreeNode[], _protocols: string[], pathMap: Record) { folderTree.value = tree; - protocol.value = _protocol; + selectedProtocols.value = _protocols; folderTreePathMap.value = pathMap; } @@ -128,8 +128,8 @@ } } - function handleProtocolChange(val: string) { - protocol.value = val; + function handleProtocolChange(val: string[]) { + selectedProtocols.value = val; } const appStore = useAppStore(); @@ -139,7 +139,7 @@ projectId: appStore.currentProjectId, keyword: '', moduleIds: [], - protocol: protocol.value, + protocols: selectedProtocols.value, }); recycleModulesCount.value = res.all; } diff --git a/frontend/src/views/api-test/management/recycle.vue b/frontend/src/views/api-test/management/recycle.vue index b4e3b8ee02..0754344559 100644 --- a/frontend/src/views/api-test/management/recycle.vue +++ b/frontend/src/views/api-test/management/recycle.vue @@ -20,7 +20,7 @@ :module-tree="folderTree" :active-module="activeModule" :offspring-ids="offspringIds" - :protocol="protocol" + :selected-protocols="selectedProtocols" /> @@ -44,14 +44,14 @@ const folderTree = ref([]); const folderTreePathMap = ref>({}); const offspringIds = ref([]); - const protocol = ref('HTTP'); + const selectedProtocols = ref([]); const activeApi = ref(); const moduleTreeRef = ref>(); const managementRef = ref>(); - function handleModuleInit(tree: ModuleTreeNode[], _protocol: string, pathMap: Record) { + function handleModuleInit(tree: ModuleTreeNode[], _protocol: string[], pathMap: Record) { folderTree.value = tree; - protocol.value = _protocol; + selectedProtocols.value = _protocol; folderTreePathMap.value = pathMap; } @@ -60,8 +60,8 @@ offspringIds.value = _offspringIds; } - function handleProtocolChange(val: string) { - protocol.value = val; + function handleProtocolChange(val: string[]) { + selectedProtocols.value = val; } function refreshModuleTree() { diff --git a/frontend/src/views/test-plan/testPlan/detail/apiCase/components/caseTree.vue b/frontend/src/views/test-plan/testPlan/detail/apiCase/components/caseTree.vue index 642cdce8b5..2d3624ef91 100644 --- a/frontend/src/views/test-plan/testPlan/detail/apiCase/components/caseTree.vue +++ b/frontend/src/views/test-plan/testPlan/detail/apiCase/components/caseTree.vue @@ -7,11 +7,13 @@ class="mb-[8px]" :max-length="255" /> - @@ -50,9 +52,9 @@ import { useRoute } from 'vue-router'; import { useVModel } from '@vueuse/core'; - import MsFolderAll from '@/components/business/ms-folder-all/index.vue'; import MsTree from '@/components/business/ms-tree/index.vue'; import type { MsTreeNodeData } from '@/components/business/ms-tree/types'; + import TreeFolderAll from '@/views/api-test/components/treeFolderAll.vue'; import { getFeatureCaseModule } from '@/api/modules/test-plan/testPlan'; import { useI18n } from '@/hooks/useI18n'; @@ -94,6 +96,7 @@ const folderTree = ref([]); const loading = ref(false); const selectedKeys = useVModel(props, 'selectedKeys', emit); + const selectedProtocols = ref([]); // 初始化模块树 async function initModules() {