feat: [路由策略]随[任务类型]联动
This commit is contained in:
parent
bb3d1d7e9a
commit
df06186a72
@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import { translateOptions } from '@/utils/common';
|
import { translateOptions } from '@/utils/common';
|
||||||
import { routeKeyRecordOptions } from '@/constants/business';
|
import { routeKeyRecordOptions } from '@/constants/business';
|
||||||
@ -8,25 +8,41 @@ defineOptions({
|
|||||||
name: 'RouterKey'
|
name: 'RouterKey'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
taskType?: Api.Common.TaskType;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
taskType: 1
|
||||||
|
});
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
(e: 'update:value', value: Api.Common.RouteKey): void;
|
(e: 'update:value', value: Api.Common.RouteKey): void;
|
||||||
}
|
}
|
||||||
const emit = defineEmits<Emits>();
|
const emit = defineEmits<Emits>();
|
||||||
|
|
||||||
const routeKeyRef = ref<Api.Common.RouteKey>();
|
const modelValue = defineModel<Api.Common.RouteKey>('value');
|
||||||
|
|
||||||
const handleUpdate = (routeKey: Api.Common.RouteKey) => {
|
/** select 下拉选项 */
|
||||||
emit('update:value', routeKey);
|
const selectOptions = computed(() => {
|
||||||
};
|
// 默认选中轮询
|
||||||
|
emit('update:value', 4);
|
||||||
|
|
||||||
|
// 1:集群, 3:切片
|
||||||
|
if (props.taskType === 1 || props.taskType === 3) {
|
||||||
|
return translateOptions(routeKeyRecordOptions.filter(o => o.value === 4));
|
||||||
|
}
|
||||||
|
// 2:广播
|
||||||
|
return translateOptions(routeKeyRecordOptions);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NSelect
|
<NSelect
|
||||||
v-model:value="routeKeyRef"
|
v-model:value="modelValue"
|
||||||
:placeholder="$t('common.routeKey.routeForm')"
|
:placeholder="$t('common.routeKey.routeForm')"
|
||||||
:options="translateOptions(routeKeyRecordOptions)"
|
:options="selectOptions"
|
||||||
clearable
|
clearable
|
||||||
@update:value="handleUpdate"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ watch(visible, () => {
|
|||||||
<CodeMirror v-else v-model="model.argsStr" lang="json" :placeholder="$t('page.jobTask.form.argsStr')" />
|
<CodeMirror v-else v-model="model.argsStr" lang="json" :placeholder="$t('page.jobTask.form.argsStr')" />
|
||||||
</NFormItem>
|
</NFormItem>
|
||||||
<NFormItem :label="$t('page.jobTask.routeKey')" path="routeKey">
|
<NFormItem :label="$t('page.jobTask.routeKey')" path="routeKey">
|
||||||
<RouteKey v-model:value="model.routeKey" />
|
<RouteKey v-model:value="model.routeKey" :task-type="model.taskType" />
|
||||||
</NFormItem>
|
</NFormItem>
|
||||||
<NFormItem :label="$t('page.jobTask.blockStrategy')" path="blockStrategy">
|
<NFormItem :label="$t('page.jobTask.blockStrategy')" path="blockStrategy">
|
||||||
<BlockStrategy v-model:value="model.blockStrategy" />
|
<BlockStrategy v-model:value="model.blockStrategy" />
|
||||||
|
Loading…
Reference in New Issue
Block a user