|
|
|
@ -371,6 +371,22 @@ watch(
|
|
|
|
|
immediate: true, |
|
|
|
|
}, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const isLogicalOpChangeAllowed = computed(() => { |
|
|
|
|
return new Set(filters.value.slice(1).map((filter) => filter.logical_op)).size > 1 |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const onLogicalOpUpdate = async (filter: Filter, index: number) => { |
|
|
|
|
if (index === 1 && filters.value.slice(2).every((siblingFilter) => siblingFilter.logical_op !== filter.logical_op)) { |
|
|
|
|
await Promise.all( |
|
|
|
|
filters.value.slice(2).map(async (siblingFilter, i) => { |
|
|
|
|
siblingFilter.logical_op = filter.logical_op |
|
|
|
|
saveOrUpdate(siblingFilter, i + 2, false, false, true) |
|
|
|
|
}), |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
await filterUpdateCondition(filter, index) |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
@ -455,9 +471,9 @@ watch(
|
|
|
|
|
:dropdown-match-select-width="false" |
|
|
|
|
class="h-full !min-w-20 !max-w-20 capitalize" |
|
|
|
|
hide-details |
|
|
|
|
:disabled="filter.readOnly" |
|
|
|
|
:disabled="filter.readOnly || (i > 1 && !isLogicalOpChangeAllowed)" |
|
|
|
|
dropdown-class-name="nc-dropdown-filter-logical-op" |
|
|
|
|
@change="filterUpdateCondition(filter, i)" |
|
|
|
|
@change="onLogicalOpUpdate(filter, i)" |
|
|
|
|
@click.stop |
|
|
|
|
> |
|
|
|
|
<a-select-option v-for="op of logicalOps" :key="op.value" :value="op.value"> |
|
|
|
|