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