feat: add NOT LIKE to table filters, closes #672

This commit is contained in:
Fabio Di Stasio 2023-09-25 18:16:07 +02:00
parent 98c1f43a4d
commit 9c66fd51cb
2 changed files with 7 additions and 4 deletions

View File

@ -21,10 +21,12 @@ export interface TableDeleteParams {
rows: {[key: string]: any};
}
export type TableFilterOperator = '=' | '!=' | '>' | '<' | '>=' | '<=' | 'IN' | 'NOT IN' | 'LIKE' | 'NOT LIKE' | 'BETWEEN' | 'IS NULL' | 'IS NOT NULL'
export interface TableFilterClausole {
active: boolean;
field: string;
op: '=' | '!=' | '>' | '<' | '>=' | '<=' | 'IN' | 'NOT IN' | 'LIKE' | 'BETWEEN' | 'IS NULL' | 'IS NOT NULL';
op:TableFilterOperator;
value: '';
value2: '';
}

View File

@ -76,7 +76,7 @@
import customizations from 'common/customizations';
import { FLOAT, NUMBER } from 'common/fieldTypes';
import { ClientCode, TableField } from 'common/interfaces/antares';
import { TableFilterClausole } from 'common/interfaces/tableApis';
import { TableFilterClausole, TableFilterOperator } from 'common/interfaces/tableApis';
import { computed, Prop, ref } from 'vue';
import { useI18n } from 'vue-i18n';
@ -93,8 +93,8 @@ const props = defineProps({
const emit = defineEmits(['filter-change', 'filter']);
const rows = ref([]);
const operators = ref([
'=', '!=', '>', '<', '>=', '<=', 'IN', 'NOT IN', 'LIKE', 'BETWEEN', 'IS NULL', 'IS NOT NULL'
const operators = ref<TableFilterOperator[]>([
'=', '!=', '>', '<', '>=', '<=', 'IN', 'NOT IN', 'LIKE', 'NOT LIKE', 'BETWEEN', 'IS NULL', 'IS NOT NULL'
]);
const clientCustomizations = computed(() => customizations[props.connClient]);
@ -152,6 +152,7 @@ const createClausole = (filter: TableFilterClausole) => {
value = '';
break;
case 'LIKE':
case 'NOT LIKE':
value = `${sw}%${filter.value}%${sw}`;
break;
default: