2024-04-24 21:44:33 +08:00
|
|
|
<script setup lang="ts">
|
2024-05-12 19:18:15 +08:00
|
|
|
import { computed } from 'vue';
|
2024-04-24 21:44:33 +08:00
|
|
|
import { $t } from '@/locales';
|
|
|
|
import { translateOptions } from '@/utils/common';
|
|
|
|
import { routeKeyRecordOptions } from '@/constants/business';
|
|
|
|
|
2024-04-25 02:01:38 +08:00
|
|
|
defineOptions({
|
|
|
|
name: 'RouterKey'
|
|
|
|
});
|
|
|
|
|
2024-05-12 19:18:15 +08:00
|
|
|
interface Props {
|
|
|
|
taskType?: Api.Common.TaskType;
|
|
|
|
}
|
|
|
|
|
2024-05-13 09:58:41 +08:00
|
|
|
const props = defineProps<Props>();
|
2024-05-12 19:18:15 +08:00
|
|
|
|
2024-06-25 14:15:09 +08:00
|
|
|
const modelValue = defineModel<Api.Common.RouteKey>('value', {
|
|
|
|
default: 4
|
|
|
|
});
|
2024-05-12 19:18:15 +08:00
|
|
|
|
|
|
|
/** select 下拉选项 */
|
|
|
|
const selectOptions = computed(() => {
|
2024-05-13 09:54:23 +08:00
|
|
|
// 2:广播, 3:切片 ==> 只能选择`轮询`
|
2024-05-12 22:12:15 +08:00
|
|
|
if (props.taskType === 2 || props.taskType === 3) {
|
2024-05-12 19:18:15 +08:00
|
|
|
return translateOptions(routeKeyRecordOptions.filter(o => o.value === 4));
|
|
|
|
}
|
2024-05-13 09:58:41 +08:00
|
|
|
// 默认undefined, 1:集群 ==> 选项不受限
|
2024-05-12 19:18:15 +08:00
|
|
|
return translateOptions(routeKeyRecordOptions);
|
|
|
|
});
|
2024-04-24 21:44:33 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2024-06-19 17:30:02 +08:00
|
|
|
<NSelect v-model:value="modelValue" :placeholder="$t('common.routeKey.routeForm')" :options="selectOptions" />
|
2024-04-24 21:44:33 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped></style>
|