feat(sj_1.1.0-beta1): 优化定时任务和工作流批次任务名称显示优化

This commit is contained in:
opensnail 2024-06-22 23:49:14 +08:00
parent 35e63abcb6
commit 829f5ed956
2 changed files with 14 additions and 4 deletions

View File

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from 'vue'; import { ref, watch } from 'vue';
import type { SelectOption } from 'naive-ui';
import SelectGroup from '@/components/common/select-group.vue'; import SelectGroup from '@/components/common/select-group.vue';
import TaskBatchStatus from '@/components/common/task-batch-status.vue'; import TaskBatchStatus from '@/components/common/task-batch-status.vue';
import DatetimeRange from '@/components/common/datetime-range.vue'; import DatetimeRange from '@/components/common/datetime-range.vue';
@ -57,9 +58,13 @@ watch(
function translateOptions(options: Api.Job.Job[]) { function translateOptions(options: Api.Job.Job[]) {
return options.map(option => ({ return options.map(option => ({
value: option.id, value: option.id,
label: `${option.jobName}(${option.id})` label: option.jobName
})); }));
} }
function renderLabel(option: SelectOption) {
return [option.label as string, `(${option.value})`];
}
</script> </script>
<template> <template>
@ -71,12 +76,11 @@ function translateOptions(options: Api.Job.Job[]) {
<NAutoComplete <NAutoComplete
v-model:value="keywords" v-model:value="keywords"
:placeholder="$t('page.jobBatch.form.jobName')" :placeholder="$t('page.jobBatch.form.jobName')"
value-field="id"
label-field="workflowName"
:options="translateOptions(jobList)" :options="translateOptions(jobList)"
:empty-visible="noSearchFlag" :empty-visible="noSearchFlag"
clearable clearable
filterable filterable
:render-label="renderLabel"
@select="handleSelect" @select="handleSelect"
/> />
</NFormItemGi> </NFormItemGi>

View File

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from 'vue'; import { ref, watch } from 'vue';
import type { SelectOption } from 'naive-ui';
import { $t } from '@/locales'; import { $t } from '@/locales';
import SelectGroup from '@/components/common/select-group.vue'; import SelectGroup from '@/components/common/select-group.vue';
import TaskBatchStatus from '@/components/common/task-batch-status.vue'; import TaskBatchStatus from '@/components/common/task-batch-status.vue';
@ -56,9 +57,13 @@ watch(
function translateOptions(options: Api.Workflow.Workflow[]) { function translateOptions(options: Api.Workflow.Workflow[]) {
return options.map(option => ({ return options.map(option => ({
value: option.id, value: option.id,
label: `${option.workflowName}(${option.id})` label: option.workflowName
})); }));
} }
function renderLabel(option: SelectOption) {
return [option.label as string, `(${option.value})`];
}
</script> </script>
<template> <template>
@ -80,6 +85,7 @@ function translateOptions(options: Api.Workflow.Workflow[]) {
:empty-visible="noSearchFlag" :empty-visible="noSearchFlag"
clearable clearable
filterable filterable
:render-label="renderLabel"
@select="handleSelect" @select="handleSelect"
/> />
</NFormItemGi> </NFormItemGi>