修复视图筛选不能正确处理不包含

用Op.and确保原文和编码后的内容都不包含才算匹配上
This commit is contained in:
cddjr 2022-09-05 01:49:29 +08:00
parent 2816dcee52
commit 07632f0005
No known key found for this signature in database
GPG Key ID: 0D1E625DFCF77A9F

View File

@ -121,13 +121,16 @@ export default class CronService {
for (const col of viewQuery.filters) { for (const col of viewQuery.filters) {
const { property, value, operation } = col; const { property, value, operation } = col;
let q: any = {}; let q: any = {};
let operate2 = null;
let operate = null; let operate = null;
switch (operation) { switch (operation) {
case 'Reg': case 'Reg':
operate = Op.like; operate = Op.like;
operate2 = Op.or;
break; break;
case 'NotReg': case 'NotReg':
operate = Op.notLike; operate = Op.notLike;
operate2 = Op.and;
break; break;
case 'In': case 'In':
q[Op.or] = [ q[Op.or] = [
@ -154,9 +157,9 @@ export default class CronService {
default: default:
break; break;
} }
if (operate) { if (operate && operate2) {
q[property] = { q[property] = {
[Op.or]: [ [operate2]: [
{ [operate]: `%${value}%` }, { [operate]: `%${value}%` },
{ [operate]: `%${encodeURIComponent(value)}%` }, { [operate]: `%${encodeURIComponent(value)}%` },
], ],