|
@@ -15,7 +15,7 @@
|
|
|
* limitations under the License.
|
|
|
*/
|
|
|
|
|
|
-import { defineComponent, onMounted, toRefs, watch, VNode, h } from 'vue'
|
|
|
+import { defineComponent, onMounted, toRefs, watch, VNode, h, unref } from 'vue'
|
|
|
import { useI18n } from 'vue-i18n'
|
|
|
import { useRoute } from 'vue-router'
|
|
|
import {
|
|
@@ -67,6 +67,16 @@ const workflowRelation = defineComponent({
|
|
|
default: () => option.label
|
|
|
})
|
|
|
|
|
|
+ const selectFilter = (query: string, option: SelectOption) => {
|
|
|
+ return option.label
|
|
|
+ ? option.label.toString().toLowerCase().includes(query.toLowerCase())
|
|
|
+ : false
|
|
|
+ }
|
|
|
+
|
|
|
+ const updateValue = (value: any) => {
|
|
|
+ variables.workflow = value
|
|
|
+ }
|
|
|
+
|
|
|
watch(
|
|
|
() => [variables.workflow, variables.labelShow, locale.value],
|
|
|
() => {
|
|
@@ -74,7 +84,14 @@ const workflowRelation = defineComponent({
|
|
|
}
|
|
|
)
|
|
|
|
|
|
- return { t, handleResetDate, ...toRefs(variables), renderOption }
|
|
|
+ return {
|
|
|
+ t,
|
|
|
+ handleResetDate,
|
|
|
+ ...toRefs(variables),
|
|
|
+ renderOption,
|
|
|
+ selectFilter,
|
|
|
+ updateValue
|
|
|
+ }
|
|
|
},
|
|
|
render() {
|
|
|
const { t, handleResetDate } = this
|
|
@@ -103,15 +120,20 @@ const workflowRelation = defineComponent({
|
|
|
),
|
|
|
'header-extra': () => (
|
|
|
<NSpace>
|
|
|
- <NSelect
|
|
|
- clearable
|
|
|
- filterable
|
|
|
- style={{ width: '300px' }}
|
|
|
- placeholder={t('project.workflow.workflow_name')}
|
|
|
- options={this.workflowOptions}
|
|
|
- v-model={[this.workflow, 'value']}
|
|
|
- renderOption={this.renderOption}
|
|
|
- />
|
|
|
+ {h(NSelect, {
|
|
|
+ style: {
|
|
|
+ width: '300px'
|
|
|
+ },
|
|
|
+ clearable: true,
|
|
|
+ filterable: true,
|
|
|
+ placeholder: t('project.workflow.workflow_name'),
|
|
|
+ options: unref(this.workflowOptions),
|
|
|
+ value: this.workflow,
|
|
|
+ filter: this.selectFilter,
|
|
|
+ onUpdateValue: (value: any) => {
|
|
|
+ this.updateValue(value)
|
|
|
+ }
|
|
|
+ })}
|
|
|
<NTooltip trigger={'hover'}>
|
|
|
{{
|
|
|
default: () => t('project.workflow.refresh'),
|