Browse Source

fix filter helper logic (#513)

Signed-off-by: ryjiang <jiangruiyi@gmail.com>
ryjiang 1 year ago
parent
commit
544bcf05e8
1 changed files with 10 additions and 2 deletions
  1. 10 2
      client/src/components/advancedSearch/utils.ts

+ 10 - 2
client/src/components/advancedSearch/utils.ts

@@ -4,7 +4,15 @@ export const formatValue = (value: string, type: string, operator: string) => {
   let conditionValue: string = ''; //
   let conditionValue: string = ''; //
   switch (type) {
   switch (type) {
     case DataTypeStringEnum.VarChar:
     case DataTypeStringEnum.VarChar:
-      conditionValue = `"${value}"`;
+      switch (operator) {
+        case 'in':
+        case 'not in':
+          conditionValue = `${value}`;
+          break;
+        default:
+          conditionValue = `"${value}"`;
+          break;
+      }
       break;
       break;
     case DataTypeStringEnum.JSON:
     case DataTypeStringEnum.JSON:
       switch (operator) {
       switch (operator) {
@@ -42,7 +50,7 @@ export const checkValue = (data: any): boolean => {
   const regFloat = /^-?\d+\.\d+$/;
   const regFloat = /^-?\d+\.\d+$/;
   const regIntInterval = /^\[-?\d+(,-?\d+)*\]$/;
   const regIntInterval = /^\[-?\d+(,-?\d+)*\]$/;
   const regFloatInterval = /^\[-?\d+\.\d+(,-?\d+\.\d+)*\]$/;
   const regFloatInterval = /^\[-?\d+\.\d+(,-?\d+\.\d+)*\]$/;
-  const isIn = data.operator === 'in';
+  const isIn = data.operator === 'in' || data.operator === 'not in';
 
 
   switch (data.type) {
   switch (data.type) {
     case DataTypeStringEnum.Int8:
     case DataTypeStringEnum.Int8: