From bc281ee4d7c7aa2498f6aaa5122a2ab55e9c327e Mon Sep 17 00:00:00 2001 From: whyour Date: Thu, 25 Aug 2022 23:12:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1pageSize=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E4=B8=BA=E4=B8=80=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/crontab/index.tsx | 45 +++++++++++-------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/src/pages/crontab/index.tsx b/src/pages/crontab/index.tsx index e22df3fe..e3931bb4 100644 --- a/src/pages/crontab/index.tsx +++ b/src/pages/crontab/index.tsx @@ -122,7 +122,7 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => { ), sorter: { - compare: (a: any, b: any) => a.name.localeCompare(b.name), + compare: (a: any, b: any) => a?.name?.localeCompare(b?.name), multiple: 2, }, }, @@ -382,31 +382,15 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => { .then((_data: any) => { const { data, total } = _data.data; setValue( - data - .sort((a: any, b: any) => { - const sortA = - a.isPinned && a.status !== 0 - ? 5 - : a.isDisabled && a.status !== 0 - ? 4 - : a.status; - const sortB = - b.isPinned && b.status !== 0 - ? 5 - : b.isDisabled && b.status !== 0 - ? 4 - : b.status; - return CrontabSort[sortA] - CrontabSort[sortB]; - }) - .map((x) => { - return { - ...x, - nextRunTime: cron_parser - .parseExpression(x.schedule) - .next() - .toDate(), - }; - }), + data.map((x) => { + return { + ...x, + nextRunTime: cron_parser + .parseExpression(x.schedule) + .next() + .toDate(), + }; + }), ); setTotal(total); }) @@ -748,11 +732,6 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => { const rowSelection = { selectedRowIds, onChange: onSelectChange, - selections: [ - Table.SELECTION_ALL, - Table.SELECTION_INVERT, - Table.SELECTION_NONE, - ], }; const delCrons = () => { @@ -927,7 +906,9 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => { total, showTotal: (total: number, range: number[]) => `第 ${range[0]}-${range[1]} 条/总共 ${total} 条`, - pageSizeOptions: [20, 100, 500, 1000] as any, + pageSizeOptions: [10, 20, 50, 100, 200, 500, total || 10000].sort( + (a, b) => a - b, + ), }} onRow={(record) => { return {