|
15 | 15 | * limitations under the License.
|
16 | 16 | */
|
17 | 17 |
|
18 |
| -import { defineComponent, onMounted, toRefs, watch } from 'vue' |
| 18 | +import { defineComponent, onMounted, toRefs, watch, VNode, h } from 'vue' |
19 | 19 | import { useI18n } from 'vue-i18n'
|
20 | 20 | import { useRoute } from 'vue-router'
|
21 |
| -import { NSelect, NButton, NIcon, NSpace, NTooltip } from 'naive-ui' |
| 21 | +import { NSelect, NButton, NIcon, NSpace, NTooltip, SelectOption } from 'naive-ui' |
22 | 22 | import { ReloadOutlined, EyeOutlined } from '@vicons/antd'
|
23 | 23 | import { useRelation } from './use-relation'
|
24 | 24 | import Card from '@/components/card'
|
@@ -48,14 +48,20 @@ const workflowRelation = defineComponent({
|
48 | 48 | : getWorkflowList(Number(route.params.projectCode))
|
49 | 49 | }
|
50 | 50 |
|
| 51 | + const renderOption = ({ node, option }: { node: VNode; option: SelectOption }) => |
| 52 | + h(NTooltip, null, { |
| 53 | + trigger: () => node, |
| 54 | + default: () => option.label |
| 55 | + }) |
| 56 | + |
51 | 57 | watch(
|
52 | 58 | () => [variables.workflow, variables.labelShow, locale.value],
|
53 | 59 | () => {
|
54 | 60 | handleResetDate()
|
55 | 61 | }
|
56 | 62 | )
|
57 | 63 |
|
58 |
| - return { t, handleResetDate, ...toRefs(variables) } |
| 64 | + return { t, handleResetDate, ...toRefs(variables), renderOption } |
59 | 65 | },
|
60 | 66 | render() {
|
61 | 67 | const { t, handleResetDate } = this
|
@@ -86,10 +92,12 @@ const workflowRelation = defineComponent({
|
86 | 92 | <NSpace>
|
87 | 93 | <NSelect
|
88 | 94 | clearable
|
| 95 | + filterable |
89 | 96 | style={{ width: '300px' }}
|
90 | 97 | placeholder={t('project.workflow.workflow_name')}
|
91 | 98 | options={this.workflowOptions}
|
92 | 99 | v-model={[this.workflow, 'value']}
|
| 100 | + renderOption={this.renderOption} |
93 | 101 | />
|
94 | 102 | <NTooltip trigger={'hover'}>
|
95 | 103 | {{
|
|
0 commit comments