fix(接口测试): 高级搜索-MOCK-根据状态筛选后筛选按钮交互错误的缺陷
--bug=1048393 --user=吕梦园 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001048393
This commit is contained in:
parent
705585e805
commit
02ea597a5b
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue