fix(bug): 接口测试&工作台 bug 修复
This commit is contained in:
parent
0a037a2f3b
commit
f4faffe168
|
@ -58,7 +58,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
async function init() {
|
||||
if (!project.value) {
|
||||
project.value = appStore.currentProjectId;
|
||||
}
|
||||
|
@ -74,6 +74,14 @@
|
|||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
init();
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
init,
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -132,35 +132,36 @@
|
|||
];
|
||||
|
||||
const tableData = ref(props.requestResult?.responseResult.assertions || []);
|
||||
const isTableFiltered = ref<boolean>(false);
|
||||
const tableFilters = ref<string[] | (string | number | boolean)[]>([]);
|
||||
|
||||
function handleFilterChange(dataIndex: string, value: string[] | (string | number | boolean)[] | undefined) {
|
||||
if (value && value.length > 0) {
|
||||
isTableFiltered.value = true;
|
||||
tableFilters.value = value;
|
||||
tableData.value =
|
||||
props.requestResult?.responseResult.assertions.filter((item) => {
|
||||
return (value as boolean[]).includes(item.pass);
|
||||
}) || [];
|
||||
} else {
|
||||
isTableFiltered.value = false;
|
||||
tableData.value = props.requestResult?.responseResult.assertions || [];
|
||||
tableFilters.value = [];
|
||||
}
|
||||
}
|
||||
|
||||
function handleSortChange(sorter: { [key: string]: string }) {
|
||||
if (Object.keys(sorter).length > 0) {
|
||||
const dataIndex = Object.keys(sorter)[0] as keyof ResponseAssertionTableItem;
|
||||
const copyArray = isTableFiltered.value
|
||||
const copyArray =
|
||||
tableFilters.value.length > 0
|
||||
? [...tableData.value]
|
||||
: [...(props.requestResult?.responseResult.assertions || [])];
|
||||
tableData.value = copyArray.sort((a, b) => {
|
||||
const sortResult = a[dataIndex] > b[dataIndex] ? -1 : 1;
|
||||
return sorter[dataIndex] === 'asc' ? sortResult : -sortResult;
|
||||
});
|
||||
} else if (tableFilters.value.length > 0) {
|
||||
handleFilterChange('pass', tableFilters.value);
|
||||
} else {
|
||||
tableData.value = isTableFiltered.value
|
||||
? [...tableData.value]
|
||||
: props.requestResult?.responseResult.assertions || [];
|
||||
tableData.value = props.requestResult?.responseResult.assertions || [];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@
|
|||
const initForm: CreateTask = {
|
||||
resourceId: '',
|
||||
cron: '',
|
||||
enable: false,
|
||||
enable: true,
|
||||
runConfig: { runMode: 'SERIAL' },
|
||||
};
|
||||
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
class="sticky top-0 z-[999] mb-[-16px] flex items-center justify-end gap-[12px] bg-[var(--color-bg-3)] pb-[16px]"
|
||||
>
|
||||
<MsProjectSelect
|
||||
ref="projectSelectRef"
|
||||
v-model:project="currentProject"
|
||||
class="w-[240px]"
|
||||
use-default-arrow-icon
|
||||
@change="handleRefresh"
|
||||
@change="handleProjectSelect"
|
||||
>
|
||||
<template #prefix>
|
||||
{{ t('menu.projectManagementShort') }}
|
||||
|
@ -105,8 +106,9 @@
|
|||
}));
|
||||
const featureOptions = ref<SelectOptionData[]>([]);
|
||||
const refreshId = ref('');
|
||||
const projectSelectRef = ref<InstanceType<typeof MsProjectSelect>>();
|
||||
|
||||
function handleRefresh(val?: string, _project?: ProjectListItem) {
|
||||
async function handleProjectSelect(val?: string, _project?: ProjectListItem) {
|
||||
if (_project) {
|
||||
const _currentProjectFeatures = JSON.parse(_project.moduleSetting);
|
||||
featureOptions.value = fullFeaturesOptions.filter((item) =>
|
||||
|
@ -116,6 +118,10 @@
|
|||
}
|
||||
refreshId.value = getGenerateId();
|
||||
}
|
||||
|
||||
function handleRefresh() {
|
||||
projectSelectRef.value?.init();
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
class="sticky top-0 z-[999] mb-[-16px] flex items-center justify-end gap-[12px] bg-[var(--color-bg-3)] pb-[16px]"
|
||||
>
|
||||
<MsProjectSelect
|
||||
ref="projectSelectRef"
|
||||
v-model:project="currentProject"
|
||||
class="w-[240px]"
|
||||
use-default-arrow-icon
|
||||
@change="handleRefresh"
|
||||
@change="handleProjectSelect"
|
||||
>
|
||||
<template #prefix>
|
||||
{{ t('menu.projectManagementShort') }}
|
||||
|
@ -104,8 +105,9 @@
|
|||
}));
|
||||
const featureOptions = ref<SelectOptionData[]>([]);
|
||||
const refreshId = ref('');
|
||||
const projectSelectRef = ref<InstanceType<typeof MsProjectSelect>>();
|
||||
|
||||
function handleRefresh(val?: string, _project?: ProjectListItem) {
|
||||
async function handleProjectSelect(val?: string, _project?: ProjectListItem) {
|
||||
if (_project) {
|
||||
const _currentProjectFeatures = JSON.parse(_project.moduleSetting);
|
||||
featureOptions.value = fullFeaturesOptions.filter((item) =>
|
||||
|
@ -115,6 +117,10 @@
|
|||
}
|
||||
refreshId.value = getGenerateId();
|
||||
}
|
||||
|
||||
function handleRefresh() {
|
||||
projectSelectRef.value?.init();
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
class="sticky top-0 z-[999] mb-[-16px] flex items-center justify-end gap-[12px] bg-[var(--color-bg-3)] pb-[16px]"
|
||||
>
|
||||
<MsProjectSelect
|
||||
ref="projectSelectRef"
|
||||
v-model:project="currentProject"
|
||||
class="w-[240px]"
|
||||
use-default-arrow-icon
|
||||
@change="handleRefresh"
|
||||
@change="handleProjectSelect"
|
||||
>
|
||||
<template #prefix>
|
||||
{{ t('menu.projectManagementShort') }}
|
||||
|
@ -86,8 +87,9 @@
|
|||
}));
|
||||
const featureOptions = ref<SelectOptionData[]>([]);
|
||||
const refreshId = ref('');
|
||||
const projectSelectRef = ref<InstanceType<typeof MsProjectSelect>>();
|
||||
|
||||
function handleRefresh(val?: string, _project?: ProjectListItem) {
|
||||
async function handleProjectSelect(val?: string, _project?: ProjectListItem) {
|
||||
if (_project) {
|
||||
const _currentProjectFeatures = JSON.parse(_project.moduleSetting);
|
||||
featureOptions.value = fullFeaturesOptions.filter((item) =>
|
||||
|
@ -97,6 +99,10 @@
|
|||
}
|
||||
refreshId.value = getGenerateId();
|
||||
}
|
||||
|
||||
function handleRefresh() {
|
||||
projectSelectRef.value?.init();
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
|
|
Loading…
Reference in New Issue