diff --git a/client/client/src/index/index.js b/client/client/src/index/index.js index 175ddb7d2..2bcf77084 100644 --- a/client/client/src/index/index.js +++ b/client/client/src/index/index.js @@ -10,12 +10,9 @@ export default class Controller { exprBuilder(param, value) { switch (param) { case 'search': - return { - or: [ - {id: value}, - {name: {regexp: value}} - ] - }; + return /^\d+$/.test(value) + ? {id: value} + : {name: {regexp: value}}; case 'phone': return { or: [ diff --git a/client/item/src/index/index.js b/client/item/src/index/index.js index d772e810c..0d8c44717 100644 --- a/client/item/src/index/index.js +++ b/client/item/src/index/index.js @@ -28,12 +28,9 @@ class Controller { exprBuilder(param, value) { switch (param) { case 'search': - return { - or: [ - {id: value}, - {name: {regexp: value}} - ] - }; + return /^\d+$/.test(value) + ? {id: value} + : {name: {regexp: value}}; case 'name': case 'description': return {[param]: {regexp: value}}; diff --git a/client/ticket/src/index/index.js b/client/ticket/src/index/index.js index 813165403..c9792cc9e 100644 --- a/client/ticket/src/index/index.js +++ b/client/ticket/src/index/index.js @@ -59,12 +59,9 @@ export default class Controller { exprBuilder(param, value) { switch (param) { case 'search': - return { - or: [ - {id: value}, - {nickname: {regexp: value}} - ] - }; + return /^\d+$/.test(value) + ? {id: value} + : {nickname: {regexp: value}}; case 'from': return {shipped: {gte: value}}; case 'to':