|
@@ -10,6 +10,7 @@
|
|
|
v-model="modelValue.left_value"
|
|
v-model="modelValue.left_value"
|
|
|
class="flex-1 max-w-[160px]"
|
|
class="flex-1 max-w-[160px]"
|
|
|
placeholder="{x} 设置变量值"
|
|
placeholder="{x} 设置变量值"
|
|
|
|
|
+ @change="handleLeftValueChange"
|
|
|
/>
|
|
/>
|
|
|
<el-divider direction="vertical" />
|
|
<el-divider direction="vertical" />
|
|
|
<!-- 运算符选择 -->
|
|
<!-- 运算符选择 -->
|
|
@@ -19,8 +20,8 @@
|
|
|
style="width: 80px"
|
|
style="width: 80px"
|
|
|
></el-select>
|
|
></el-select>
|
|
|
</div>
|
|
</div>
|
|
|
- <el-divider class="my-0!" />
|
|
|
|
|
- <div>
|
|
|
|
|
|
|
+ <el-divider v-if="!modelValue.comparison_operator?.includes('empty')" class="my-0!" />
|
|
|
|
|
+ <div v-if="!modelValue.comparison_operator?.includes('empty')">
|
|
|
<div v-if="modelValue.varType !== 'number'" class="flex items-center gap-8px">
|
|
<div v-if="modelValue.varType !== 'number'" class="flex items-center gap-8px">
|
|
|
<VarInput
|
|
<VarInput
|
|
|
v-model="modelValue.right_value"
|
|
v-model="modelValue.right_value"
|
|
@@ -30,11 +31,13 @@
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
<div v-else class="flex items-center gap-8px">
|
|
<div v-else class="flex items-center gap-8px">
|
|
|
- <el-select v-model="numberType" :options="numberValOptions"></el-select>
|
|
|
|
|
- <VarInput
|
|
|
|
|
|
|
+ <el-select v-model="numberType" :options="numberValOptions" style="width: 80px"></el-select>
|
|
|
|
|
+ <el-divider direction="vertical" />
|
|
|
|
|
+ <Input
|
|
|
v-model="modelValue.right_value"
|
|
v-model="modelValue.right_value"
|
|
|
|
|
+ type="number"
|
|
|
variant="borderless"
|
|
variant="borderless"
|
|
|
- placeholder="输入值,输入 / 选择变量"
|
|
|
|
|
|
|
+ placeholder="输入值"
|
|
|
class="flex-1"
|
|
class="flex-1"
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
@@ -47,8 +50,10 @@ import { ref, computed } from 'vue'
|
|
|
import VarInput from '../VarInput.vue'
|
|
import VarInput from '../VarInput.vue'
|
|
|
import VarSelect from '../VarSelect.vue'
|
|
import VarSelect from '../VarSelect.vue'
|
|
|
import { VARIABLE_TYPE_OPERATORS } from '@/constant'
|
|
import { VARIABLE_TYPE_OPERATORS } from '@/constant'
|
|
|
|
|
+import { Input } from '@repo/ui'
|
|
|
|
|
|
|
|
import type { ConditionType } from '../../Interface'
|
|
import type { ConditionType } from '../../Interface'
|
|
|
|
|
+import type { VarType } from '@/types/var'
|
|
|
|
|
|
|
|
const modelValue = defineModel<ConditionType>('modelValue', { required: true })
|
|
const modelValue = defineModel<ConditionType>('modelValue', { required: true })
|
|
|
|
|
|
|
@@ -63,6 +68,10 @@ const operators = computed(() => {
|
|
|
const type = modelValue.value.varType ?? 'string'
|
|
const type = modelValue.value.varType ?? 'string'
|
|
|
return VARIABLE_TYPE_OPERATORS?.[type as keyof typeof VARIABLE_TYPE_OPERATORS] ?? []
|
|
return VARIABLE_TYPE_OPERATORS?.[type as keyof typeof VARIABLE_TYPE_OPERATORS] ?? []
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+const handleLeftValueChange = (value: { value: string; type: VarType }) => {
|
|
|
|
|
+ modelValue.value.varType = value.type
|
|
|
|
|
+}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|
|
@@ -73,6 +82,13 @@ const operators = computed(() => {
|
|
|
box-shadow: 0 0 0 1px var(--el-input-focus-border-color) inset;
|
|
box-shadow: 0 0 0 1px var(--el-input-focus-border-color) inset;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+:deep(.el-input__wrapper) {
|
|
|
|
|
+ box-shadow: none;
|
|
|
|
|
+ &:hover,
|
|
|
|
|
+ &.is-focus {
|
|
|
|
|
+ box-shadow: 0 0 0 1px var(--el-input-focus-border-color) inset;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
:deep(.el-select__wrapper) {
|
|
:deep(.el-select__wrapper) {
|
|
|
box-shadow: none;
|
|
box-shadow: none;
|
|
|
&:hover,
|
|
&:hover,
|