Skip to content

Commit af64f7e

Browse files
committed
feat: enhance variable selection to support boolean type
1 parent e988cbc commit af64f7e

File tree

1 file changed

+24
-3
lines changed
  • ui/src/workflow/nodes/variable-assign-node

1 file changed

+24
-3
lines changed

ui/src/workflow/nodes/variable-assign-node/index.vue

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@
5656
v-model="item.type"
5757
style="max-width: 85px"
5858
class="mr-8"
59-
@change="form_data.variable_list[index].value = null"
59+
@change="(val: string) => {
60+
if (val === 'bool') {
61+
form_data.variable_list[index].value = true;
62+
} else {
63+
form_data.variable_list[index].value = null;
64+
}
65+
}"
6066
>
6167
<el-option v-for="item in typeOptions" :key="item" :label="item" :value="item" />
6268
</el-select>
@@ -122,6 +128,20 @@
122128
@submitDialog="(val: string) => (form_data.variable_list[index].value = val)"
123129
/>
124130
</el-form-item>
131+
<el-form-item
132+
v-else-if="item.type === 'bool'"
133+
:prop="'variable_list.' + index + '.value'"
134+
:rules="{
135+
message: $t('common.inputPlaceholder'),
136+
trigger: 'blur',
137+
required: true,
138+
}"
139+
>
140+
<el-select v-model="item.value" style="width: 155px">
141+
<el-option label="true" :value="true" />
142+
<el-option label="false" :value="false" />
143+
</el-select>
144+
</el-form-item>
125145
</div>
126146
<el-form-item v-else>
127147
<NodeCascader
@@ -146,14 +166,14 @@
146166
import { cloneDeep, set } from 'lodash'
147167
import NodeContainer from '@/workflow/common/NodeContainer.vue'
148168
import NodeCascader from '@/workflow/common/NodeCascader.vue'
149-
import { computed, onMounted, ref } from 'vue'
169+
import { computed, nextTick, onMounted, ref } from 'vue'
150170
import { isLastNode } from '@/workflow/common/data'
151171
import { randomId } from '@/utils/common'
152172
import { t } from '@/locales'
153173
154174
const props = defineProps<{ nodeModel: any }>()
155175
156-
const typeOptions = ['string', 'num', 'json']
176+
const typeOptions = ['string', 'num', 'json', 'bool']
157177
158178
const wheel = (e: any) => {
159179
if (e.ctrlKey === true) {
@@ -177,6 +197,7 @@ const form = {
177197
},
178198
],
179199
}
200+
const boolValue = ref(1)
180201
181202
const form_data = computed({
182203
get: () => {

0 commit comments

Comments
 (0)