fix(1.4.0-beta1): 阻塞策略新增过滤熟悉

This commit is contained in:
xlsea 2025-02-25 14:25:19 +08:00
parent 55346e298c
commit 960c27ab04

View File

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { computed, ref } from 'vue';
import { $t } from '@/locales'; import { $t } from '@/locales';
import { translateOptions } from '@/utils/common'; import { translateOptions } from '@/utils/common';
import { blockStrategyRecordOptions } from '@/constants/business'; import { blockStrategyRecordOptions } from '@/constants/business';
@ -8,6 +8,12 @@ defineOptions({
name: 'BlockStrategy' name: 'BlockStrategy'
}); });
interface Props {
ignore?: Api.Common.BlockStrategy[];
}
const props = defineProps<Props>();
const valueRef = ref<Api.Common.BlockStrategy>(); const valueRef = ref<Api.Common.BlockStrategy>();
const emit = defineEmits<Emits>(); const emit = defineEmits<Emits>();
@ -18,13 +24,21 @@ interface Emits {
const handleUpdate = (value: Api.Common.BlockStrategy) => { const handleUpdate = (value: Api.Common.BlockStrategy) => {
emit('update:value', value); emit('update:value', value);
}; };
const options = computed(() => {
const list = translateOptions(blockStrategyRecordOptions);
if (!props.ignore) {
return list;
}
return list.filter(opt => opt.value !== 4);
});
</script> </script>
<template> <template>
<NSelect <NSelect
v-model:value="valueRef" v-model:value="valueRef"
:placeholder="$t('common.blockStrategy.form')" :placeholder="$t('common.blockStrategy.form')"
:options="translateOptions(blockStrategyRecordOptions)" :options="options"
@update:value="handleUpdate" @update:value="handleUpdate"
/> />
</template> </template>