fix(接口测试): 断言条件选择不校验时禁止输入期望值

--bug=1037622 --user=王孝刚 【接口测试】接口断言-状态码,条件选择不校验时应该禁止输入期望值
https://www.tapd.cn/55049933/s/1480572
This commit is contained in:
wxg0103 2024-03-25 20:25:51 +08:00 committed by Craftsman
parent 4e8eec98ad
commit 30f47a7f5b
2 changed files with 19 additions and 12 deletions

View File

@ -2,16 +2,7 @@
<div class="flex h-[62px] flex-row items-end gap-[8px] text-[var(--color-text-1)]">
<div>
<div class="mb-[8px]">{{ t('ms.assertion.statusCode') }}</div>
<a-select
v-model="condition.condition"
:disabled="props.disabled"
class="w-[157px]"
@change="
emit('change', {
...condition,
})
"
>
<a-select v-model="condition.condition" :disabled="props.disabled" class="w-[157px]" @change="clearExpectedValue">
<a-option v-for="item in statusCodeOptions" :key="item.value" :value="item.value">
{{ t(item.label) }}
</a-option>
@ -20,7 +11,12 @@
<a-input
v-if="showInput"
v-model="condition.expectedValue"
:disabled="props.disabled"
:disabled="
props.disabled ||
condition.condition === 'UNCHECK' ||
condition.condition === 'NOT_EMPTY' ||
condition.condition === 'EMPTY'
"
hide-button
class="w-[157px]"
@change="
@ -59,6 +55,18 @@
}>();
const condition = useVModel(props, 'data', emit);
const showInput = computed(() => condition.value.condition !== 'none' && condition.value.condition !== '');
function clearExpectedValue() {
if (
condition.value.condition === 'UNCHECK' ||
condition.value.condition === 'NOT_EMPTY' ||
condition.value.condition === 'EMPTY'
) {
condition.value.expectedValue = '';
}
emit('change', {
...condition.value,
});
}
</script>
<style lang="less" scoped></style>

View File

@ -21,7 +21,6 @@ const EMPTY = { label: 'advanceFilter.operator.empty', value: 'EMPTY' };
const NOT_EMPTY = { label: 'advanceFilter.operator.not_empty', value: 'NOT_EMPTY' };
const REGEX = { label: 'advanceFilter.operator.regexp', value: 'REGEX' };
const LENGTH_EQUAL = { label: 'advanceFilter.operator.length.equal', value: 'LENGTH_EQUALS' };
const LENGTH_NOT_EQUAL = { label: 'advanceFilter.operator.length.not_equal', value: 'LENGTH_NOT_EQUALS' };
const LENGTH_GT = { label: 'advanceFilter.operator.length.gt', value: 'LENGTH_GT' };
const LENGTH_GE = { label: 'advanceFilter.operator.length.ge', value: 'LENGTH_GT_OR_EQUALS' };
const LENGTH_LT = { label: 'advanceFilter.operator.length.lt', value: 'LENGTH_LT' };