feat: enhance variable selection to support boolean type
Some checks failed
sync2gitee / repo-sync (push) Has been cancelled
Typos Check / Spell Check with Typos (push) Has been cancelled

This commit is contained in:
CaptainB 2025-09-09 18:38:26 +08:00
parent e988cbca91
commit af64f7eab7

View File

@ -56,7 +56,13 @@
v-model="item.type"
style="max-width: 85px"
class="mr-8"
@change="form_data.variable_list[index].value = null"
@change="(val: string) => {
if (val === 'bool') {
form_data.variable_list[index].value = true;
} else {
form_data.variable_list[index].value = null;
}
}"
>
<el-option v-for="item in typeOptions" :key="item" :label="item" :value="item" />
</el-select>
@ -122,6 +128,20 @@
@submitDialog="(val: string) => (form_data.variable_list[index].value = val)"
/>
</el-form-item>
<el-form-item
v-else-if="item.type === 'bool'"
:prop="'variable_list.' + index + '.value'"
:rules="{
message: $t('common.inputPlaceholder'),
trigger: 'blur',
required: true,
}"
>
<el-select v-model="item.value" style="width: 155px">
<el-option label="true" :value="true" />
<el-option label="false" :value="false" />
</el-select>
</el-form-item>
</div>
<el-form-item v-else>
<NodeCascader
@ -146,14 +166,14 @@
import { cloneDeep, set } from 'lodash'
import NodeContainer from '@/workflow/common/NodeContainer.vue'
import NodeCascader from '@/workflow/common/NodeCascader.vue'
import { computed, onMounted, ref } from 'vue'
import { computed, nextTick, onMounted, ref } from 'vue'
import { isLastNode } from '@/workflow/common/data'
import { randomId } from '@/utils/common'
import { t } from '@/locales'
const props = defineProps<{ nodeModel: any }>()
const typeOptions = ['string', 'num', 'json']
const typeOptions = ['string', 'num', 'json', 'bool']
const wheel = (e: any) => {
if (e.ctrlKey === true) {
@ -177,6 +197,7 @@ const form = {
},
],
}
const boolValue = ref(1)
const form_data = computed({
get: () => {