fix(接口测试): 修复创建case时没有将api请求参数信息带过来的缺陷&修复case编辑完是未保存状态的缺陷&修改新建请求按钮样式
--bug=1037680 --user=吕梦园 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001037680 --bug=1037697 --user=吕梦园 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001037697 --bug=1038245 --user=吕梦园 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001038245
This commit is contained in:
parent
46d6a93614
commit
cb4bad71d6
|
@ -240,6 +240,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 按钮下拉框 **/
|
||||||
|
.arco-btn-group {
|
||||||
|
.arco-btn-primary:first-child {
|
||||||
|
margin-right: 1px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 输入框,选择器,文本域 **/
|
/** 输入框,选择器,文本域 **/
|
||||||
.arco-select {
|
.arco-select {
|
||||||
.arco-icon {
|
.arco-icon {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<a-dropdown-button
|
<a-dropdown-button
|
||||||
v-if="hasLocalExec && !props.executeLoading"
|
v-if="hasLocalExec && !props.executeLoading"
|
||||||
class="exec-btn"
|
type="primary"
|
||||||
@click="() => execute(isPriorityLocalExec ? 'localExec' : 'serverExec')"
|
@click="() => execute(isPriorityLocalExec ? 'localExec' : 'serverExec')"
|
||||||
@select="execute"
|
@select="execute"
|
||||||
>
|
>
|
||||||
|
@ -55,13 +55,3 @@
|
||||||
hasLocalExec,
|
hasLocalExec,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.exec-btn :deep(.arco-btn) {
|
|
||||||
color: white !important;
|
|
||||||
background-color: rgb(var(--primary-5)) !important;
|
|
||||||
.btn-base-primary-hover();
|
|
||||||
.btn-base-primary-active();
|
|
||||||
.btn-base-primary-disabled();
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
:disabled="props.disabled"
|
:disabled="props.disabled"
|
||||||
mode="button"
|
mode="button"
|
||||||
:step="100"
|
:step="100"
|
||||||
|
:precision="0"
|
||||||
:min="0"
|
:min="0"
|
||||||
class="w-[160px]"
|
class="w-[160px]"
|
||||||
/>
|
/>
|
||||||
|
@ -30,6 +31,7 @@
|
||||||
:disabled="props.disabled"
|
:disabled="props.disabled"
|
||||||
mode="button"
|
mode="button"
|
||||||
:step="100"
|
:step="100"
|
||||||
|
:precision="0"
|
||||||
:min="0"
|
:min="0"
|
||||||
class="w-[160px]"
|
class="w-[160px]"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -2,19 +2,32 @@
|
||||||
<div class="flex h-full flex-col p-[12px_16px]">
|
<div class="flex h-full flex-col p-[12px_16px]">
|
||||||
<div class="mb-[8px] flex items-center gap-[8px]">
|
<div class="mb-[8px] flex items-center gap-[8px]">
|
||||||
<a-input v-model:model-value="moduleKeyword" :placeholder="t('apiTestDebug.searchTip')" allow-clear />
|
<a-input v-model:model-value="moduleKeyword" :placeholder="t('apiTestDebug.searchTip')" allow-clear />
|
||||||
<a-dropdown @select="handleSelect">
|
<a-dropdown-button
|
||||||
<a-button v-permission="['PROJECT_API_DEBUG:READ+ADD', 'PROJECT_API_DEBUG:READ+IMPORT']" type="primary">
|
v-if="hasAllPermission(['PROJECT_API_DEBUG:READ+ADD', 'PROJECT_API_DEBUG:READ+IMPORT'])"
|
||||||
{{ t('apiTestDebug.newApi') }}
|
type="primary"
|
||||||
</a-button>
|
@click="handleSelect('newApi')"
|
||||||
|
>
|
||||||
|
{{ t('apiTestDebug.newApi') }}
|
||||||
|
<template #icon>
|
||||||
|
<icon-down />
|
||||||
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<a-doption v-permission="['PROJECT_API_DEBUG:READ+ADD']" value="newApi">
|
<a-doption value="import" @click="handleSelect('import')">
|
||||||
{{ t('apiTestDebug.newApi') }}
|
|
||||||
</a-doption>
|
|
||||||
<a-doption v-permission="['PROJECT_API_DEBUG:READ+IMPORT']" value="import">
|
|
||||||
{{ t('apiTestDebug.importApi') }}
|
{{ t('apiTestDebug.importApi') }}
|
||||||
</a-doption>
|
</a-doption>
|
||||||
</template>
|
</template>
|
||||||
</a-dropdown>
|
</a-dropdown-button>
|
||||||
|
<a-button
|
||||||
|
v-else-if="
|
||||||
|
!hasAnyPermission(['PROJECT_API_DEBUG:READ+ADD']) && hasAnyPermission(['PROJECT_API_DEBUG:READ+IMPORT'])
|
||||||
|
"
|
||||||
|
type="primary"
|
||||||
|
>
|
||||||
|
{{ t('apiTestDebug.importApi') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button v-else v-permission="['PROJECT_API_DEBUG:READ+ADD']" type="primary">
|
||||||
|
{{ t('apiTestDebug.newApi') }}
|
||||||
|
</a-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="folder">
|
<div class="folder">
|
||||||
<div class="folder-text">
|
<div class="folder-text">
|
||||||
|
@ -159,7 +172,7 @@
|
||||||
import useModal from '@/hooks/useModal';
|
import useModal from '@/hooks/useModal';
|
||||||
import useAppStore from '@/store/modules/app';
|
import useAppStore from '@/store/modules/app';
|
||||||
import { characterLimit, mapTree } from '@/utils';
|
import { characterLimit, mapTree } from '@/utils';
|
||||||
import { hasAnyPermission } from '@/utils/permission';
|
import { hasAllPermission, hasAnyPermission } from '@/utils/permission';
|
||||||
|
|
||||||
import { ModuleTreeNode } from '@/models/common';
|
import { ModuleTreeNode } from '@/models/common';
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@
|
||||||
</MsButton>
|
</MsButton>
|
||||||
{{ t('apiTestManagement.or') }}
|
{{ t('apiTestManagement.or') }}
|
||||||
<MsButton class="ml-[8px]" @click="emit('import')">
|
<MsButton class="ml-[8px]" @click="emit('import')">
|
||||||
{{ t('caseManagement.featureCase.importExcel') }}
|
{{ t('common.import') }}
|
||||||
</MsButton>
|
</MsButton>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -190,7 +190,7 @@
|
||||||
} else {
|
} else {
|
||||||
await getApiDetail();
|
await getApiDetail();
|
||||||
}
|
}
|
||||||
// 创建或者复制的时候,请求参数为接口定义的请求参数
|
// 创建的时候,请求参数为接口定义的请求参数
|
||||||
detailForm.value = {
|
detailForm.value = {
|
||||||
...cloneDeep(defaultDetail.value),
|
...cloneDeep(defaultDetail.value),
|
||||||
...(apiDetailInfo.value.protocol === 'HTTP'
|
...(apiDetailInfo.value.protocol === 'HTTP'
|
||||||
|
@ -199,8 +199,11 @@
|
||||||
body: apiDetailInfo.value?.body ?? apiDetailInfo.value.request.body,
|
body: apiDetailInfo.value?.body ?? apiDetailInfo.value.request.body,
|
||||||
rest: apiDetailInfo.value.rest ?? apiDetailInfo.value.request.rest,
|
rest: apiDetailInfo.value.rest ?? apiDetailInfo.value.request.rest,
|
||||||
query: apiDetailInfo.value.query ?? apiDetailInfo.value.request.query,
|
query: apiDetailInfo.value.query ?? apiDetailInfo.value.request.query,
|
||||||
|
authConfig: apiDetailInfo.value.authConfig ?? apiDetailInfo.value.request.authConfig,
|
||||||
|
otherConfig: apiDetailInfo.value.otherConfig ?? apiDetailInfo.value.request.otherConfig,
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
|
children: apiDetailInfo.value.children ?? apiDetailInfo.value.request.children,
|
||||||
url: apiDetailInfo.value.url ?? apiDetailInfo.value.request.url,
|
url: apiDetailInfo.value.url ?? apiDetailInfo.value.request.url,
|
||||||
};
|
};
|
||||||
// 复制
|
// 复制
|
||||||
|
@ -268,16 +271,9 @@
|
||||||
if (!isContinue) {
|
if (!isContinue) {
|
||||||
handleSaveCaseCancel();
|
handleSaveCaseCancel();
|
||||||
}
|
}
|
||||||
// 继续创建
|
// 保存并继续创建都以当前页面内容为基础,不需要还原
|
||||||
detailForm.value = {
|
detailForm.value.id = `case-${Date.now()}`;
|
||||||
...cloneDeep(defaultDetail.value),
|
detailForm.value.name = '';
|
||||||
id: `case-${Date.now()}`,
|
|
||||||
headers: apiDetailInfo.value.headers ?? apiDetailInfo.value.request.headers,
|
|
||||||
body: apiDetailInfo.value.body ?? apiDetailInfo.value.request.body,
|
|
||||||
rest: apiDetailInfo.value.rest ?? apiDetailInfo.value.request.rest,
|
|
||||||
query: apiDetailInfo.value.query ?? apiDetailInfo.value.request.query,
|
|
||||||
url: apiDetailInfo.value.url ?? apiDetailInfo.value.request.url,
|
|
||||||
};
|
|
||||||
drawerLoading.value = false;
|
drawerLoading.value = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
} else {
|
} else {
|
||||||
// 更新数据
|
// 更新数据
|
||||||
const index = apiTabs.value.findIndex((item) => item.id === id);
|
const index = apiTabs.value.findIndex((item) => item.id === id);
|
||||||
apiTabs.value[index] = tabItemInfo;
|
apiTabs.value[index] = cloneDeep(tabItemInfo);
|
||||||
activeApiTab.value = tabItemInfo;
|
activeApiTab.value = tabItemInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,28 +14,39 @@
|
||||||
:placeholder="props.isModal ? t('apiTestManagement.moveSearchTip') : t('apiTestManagement.searchTip')"
|
:placeholder="props.isModal ? t('apiTestManagement.moveSearchTip') : t('apiTestManagement.searchTip')"
|
||||||
allow-clear
|
allow-clear
|
||||||
/>
|
/>
|
||||||
<a-dropdown
|
<template v-if="!props.readOnly && !props.trash">
|
||||||
v-if="
|
<a-dropdown-button
|
||||||
!props.readOnly &&
|
v-if="
|
||||||
!props.trash &&
|
moduleProtocol === 'HTTP' &&
|
||||||
hasAnyPermission(['PROJECT_API_DEFINITION:READ+ADD', 'PROJECT_API_DEFINITION:READ+IMPORT'])
|
hasAllPermission(['PROJECT_API_DEFINITION:READ+ADD', 'PROJECT_API_DEFINITION:READ+IMPORT'])
|
||||||
"
|
"
|
||||||
@select="handleSelect"
|
type="primary"
|
||||||
>
|
@click="handleSelect('newApi')"
|
||||||
<a-button type="primary">{{ t('apiTestManagement.newApi') }}</a-button>
|
>
|
||||||
<template #content>
|
{{ t('apiTestManagement.newApi') }}
|
||||||
<a-doption v-permission="['PROJECT_API_DEFINITION:READ+ADD']" value="newApi">{{
|
<template #icon>
|
||||||
t('apiTestManagement.newApi')
|
<icon-down />
|
||||||
}}</a-doption>
|
</template>
|
||||||
<a-doption
|
<template #content>
|
||||||
v-if="moduleProtocol === 'HTTP'"
|
<a-doption value="import" @click="handleSelect('import')">
|
||||||
v-permission="['PROJECT_API_DEFINITION:READ+IMPORT']"
|
{{ t('apiTestManagement.importApi') }}
|
||||||
value="import"
|
</a-doption>
|
||||||
>
|
</template>
|
||||||
{{ t('apiTestManagement.importApi') }}
|
</a-dropdown-button>
|
||||||
</a-doption>
|
<a-button
|
||||||
</template>
|
v-else-if="
|
||||||
</a-dropdown>
|
moduleProtocol === 'HTTP' &&
|
||||||
|
!hasAnyPermission(['PROJECT_API_DEFINITION:READ+ADD']) &&
|
||||||
|
hasAnyPermission(['PROJECT_API_DEFINITION:READ+IMPORT'])
|
||||||
|
"
|
||||||
|
type="primary"
|
||||||
|
>
|
||||||
|
{{ t('apiTestManagement.importApi') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button v-else v-permission="['PROJECT_API_DEFINITION:READ+ADD']" type="primary">
|
||||||
|
{{ t('apiTestManagement.newApi') }}
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="folder" @click="setActiveFolder('all')">
|
<div class="folder" @click="setActiveFolder('all')">
|
||||||
<div :class="allFolderClass">
|
<div :class="allFolderClass">
|
||||||
|
@ -205,7 +216,7 @@
|
||||||
import useModal from '@/hooks/useModal';
|
import useModal from '@/hooks/useModal';
|
||||||
import useAppStore from '@/store/modules/app';
|
import useAppStore from '@/store/modules/app';
|
||||||
import { mapTree } from '@/utils';
|
import { mapTree } from '@/utils';
|
||||||
import { hasAnyPermission } from '@/utils/permission';
|
import { hasAllPermission, hasAnyPermission } from '@/utils/permission';
|
||||||
|
|
||||||
import { ModuleTreeNode } from '@/models/common';
|
import { ModuleTreeNode } from '@/models/common';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue