diff --git a/src/pages/Item/ItemTypeList.vue b/src/pages/Item/ItemTypeList.vue index 17d1c0044..c6557dc79 100644 --- a/src/pages/Item/ItemTypeList.vue +++ b/src/pages/Item/ItemTypeList.vue @@ -24,10 +24,40 @@ const redirectToItemTypeSummary = (id) => { const redirectToCreateView = () => { router.push({ name: 'ItemTypeCreate' }); }; -const exprBuilder = (param, value) => ({ - name: { like: `%${value}%` }, - code: { like: `%${value}%` }, -}); + +const exprBuilder = (param, value) => { + switch (param) { + case 'name': + return { + name: { like: `%${value}%` }, + }; + case 'code': + return { + code: { like: `%${value}%` }, + }; + case 'search': + if (value) { + if (!isNaN(value)) { + return { id: value }; + } else { + return { + or: [ + { + name: { + like: `%${value}%`, + }, + }, + { + code: { + like: `%${value}%`, + }, + }, + ], + }; + } + } + } +};