fix(接口测试): 高级搜索-MOCK-根据状态筛选后筛选按钮交互错误的缺陷

--bug=1048393 --user=吕梦园
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001048393
This commit is contained in:
teukkk 2024-10-31 17:27:00 +08:00 committed by Craftsman
parent 705585e805
commit 02ea597a5b
1 changed files with 7 additions and 3 deletions

View File

@ -176,7 +176,7 @@
import { ViewTypeEnum } from '@/enums/advancedFilterEnum'; import { ViewTypeEnum } from '@/enums/advancedFilterEnum';
import { FilterFormItem, FilterResult, ViewItem } from './type'; import { ConditionsItem, FilterFormItem, FilterResult, ViewItem } from './type';
const props = defineProps<{ const props = defineProps<{
filterConfigList: FilterFormItem[]; // filterConfigList: FilterFormItem[]; //
@ -326,13 +326,17 @@
} }
const isAdvancedSearchMode = ref(false); const isAdvancedSearchMode = ref(false);
const getIsValidValue = (item: ConditionsItem) => {
if (typeof item.value === 'boolean') return String(item.value).length;
if (typeof item.value === 'number') return item.value;
return item.value?.length;
};
const handleFilter = (filter: FilterResult) => { const handleFilter = (filter: FilterResult) => {
keyword.value = ''; keyword.value = '';
const haveConditions: boolean = const haveConditions: boolean =
filter.conditions?.some((item) => { filter.conditions?.some((item) => {
const valueCanEmpty = ['EMPTY', 'NOT_EMPTY'].includes(item.operator as string); const valueCanEmpty = ['EMPTY', 'NOT_EMPTY'].includes(item.operator as string);
const isValidValue = typeof item.value !== 'number' ? item.value?.length : item.value; return valueCanEmpty || getIsValidValue(item);
return valueCanEmpty || isValidValue;
}) ?? false; }) ?? false;
// //
isAdvancedSearchMode.value = currentView.value !== internalViews.value[0].id || haveConditions; isAdvancedSearchMode.value = currentView.value !== internalViews.value[0].id || haveConditions;