From a25bfb691268984bde89ade83bb742be2224508a Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 2 Apr 2023 14:42:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E7=8A=B6=E6=80=81=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/cron.ts | 16 ++++++++++++---- src/pages/crontab/index.tsx | 9 +-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/back/services/cron.ts b/back/services/cron.ts index 7f0ac69e..7e1ff0b2 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -18,7 +18,7 @@ import { TASK_PREFIX, QL_PREFIX } from '../config/const'; @Service() export default class CronService { - constructor(@Inject('logger') private logger: winston.Logger) { } + constructor(@Inject('logger') private logger: winston.Logger) {} private isSixCron(cron: Crontab) { const { schedule } = cron; @@ -246,8 +246,12 @@ export default class CronService { for (const key of filterKeys) { let q: any = {}; if (!filterQuery[key]) continue; - if (key === 'status' && filterQuery[key].includes(2)) { - q = { [Op.or]: [{ [key]: filterQuery[key] }, { isDisabled: 1 }] }; + if (key === 'status') { + if (filterQuery[key].includes(2)) { + q = { [Op.or]: [{ [key]: filterQuery[key] }, { isDisabled: 1 }] }; + } else { + q = { [Op.and]: [{ [key]: filterQuery[key] }, { isDisabled: 0 }] }; + } } else { q[key] = filterQuery[key]; } @@ -264,7 +268,11 @@ export default class CronService { } } - public async find({ log_path }: { log_path: string }): Promise { + public async find({ + log_path, + }: { + log_path: string; + }): Promise { try { const result = await CrontabModel.findOne({ where: { log_path } }); return result; diff --git a/src/pages/crontab/index.tsx b/src/pages/crontab/index.tsx index 8984f09f..58d768fd 100644 --- a/src/pages/crontab/index.tsx +++ b/src/pages/crontab/index.tsx @@ -279,13 +279,6 @@ const Crontab = () => { value: 3, }, ], - onFilter: (value, record) => { - if (record.isDisabled && record.status !== 0) { - return value === 2; - } else { - return record.status === value; - } - }, render: (text, record) => ( <> {(!record.isDisabled || record.status !== CrontabStatus.idle) && ( @@ -1051,7 +1044,7 @@ const Crontab = () => { rowSelection={rowSelection} rowClassName={getRowClassName} onChange={onPageChange} - components={isPhone ? undefined : vt} + // components={isPhone ? undefined : vt} />