重构消息通知弹窗

This commit is contained in:
dengqichen 2025-11-28 12:30:56 +08:00
parent c88426c7ad
commit f2d4fd75e4

View File

@ -39,7 +39,7 @@ const ScheduleJobList: React.FC = () => {
const [editJob, setEditJob] = useState<ScheduleJobResponse | null>(null); const [editJob, setEditJob] = useState<ScheduleJobResponse | null>(null);
const [deleteJob, setDeleteJob] = useState<ScheduleJobResponse | null>(null); const [deleteJob, setDeleteJob] = useState<ScheduleJobResponse | null>(null);
const [query, setQuery] = useState<ScheduleJobQuery>({ const [query, setQuery] = useState<ScheduleJobQuery>({
pageNum: DEFAULT_CURRENT - 1, pageNum: DEFAULT_CURRENT,
pageSize: DEFAULT_PAGE_SIZE, pageSize: DEFAULT_PAGE_SIZE,
jobName: '', jobName: '',
categoryId: undefined, categoryId: undefined,
@ -92,13 +92,13 @@ const ScheduleJobList: React.FC = () => {
// 搜索 // 搜索
const handleSearch = () => { const handleSearch = () => {
setQuery(prev => ({...prev, pageNum: 0})); setQuery(prev => ({...prev, pageNum: 1}));
}; };
// 重置 // 重置
const handleReset = () => { const handleReset = () => {
setQuery({ setQuery({
pageNum: 0, pageNum: 1,
pageSize: DEFAULT_PAGE_SIZE, pageSize: DEFAULT_PAGE_SIZE,
jobName: '', jobName: '',
categoryId: undefined, categoryId: undefined,
@ -349,7 +349,7 @@ const ScheduleJobList: React.FC = () => {
</div> </div>
<Select <Select
value={query.categoryId?.toString() || 'all'} value={query.categoryId?.toString() || 'all'}
onValueChange={(value) => setQuery({...query, categoryId: value !== 'all' ? Number(value) : undefined, pageNum: 0})} onValueChange={(value) => setQuery({...query, categoryId: value !== 'all' ? Number(value) : undefined, pageNum: 1})}
> >
<SelectTrigger className="w-[200px]"> <SelectTrigger className="w-[200px]">
<SelectValue placeholder="全部分类"/> <SelectValue placeholder="全部分类"/>
@ -365,7 +365,7 @@ const ScheduleJobList: React.FC = () => {
</Select> </Select>
<Select <Select
value={query.status || 'all'} value={query.status || 'all'}
onValueChange={(value) => setQuery({...query, status: value !== 'all' ? value as JobStatus : undefined, pageNum: 0})} onValueChange={(value) => setQuery({...query, status: value !== 'all' ? value as JobStatus : undefined, pageNum: 1})}
> >
<SelectTrigger className="w-[150px]"> <SelectTrigger className="w-[150px]">
<SelectValue placeholder="全部状态"/> <SelectValue placeholder="全部状态"/>
@ -417,28 +417,28 @@ const ScheduleJobList: React.FC = () => {
) : data && data.content.length > 0 ? ( ) : data && data.content.length > 0 ? (
data.content.map((record) => ( data.content.map((record) => (
<TableRow key={record.id}> <TableRow key={record.id}>
<TableCell className="font-medium">{record.jobName}</TableCell> <TableCell className="font-medium whitespace-nowrap">{record.jobName}</TableCell>
<TableCell>{record.category?.name || '-'}</TableCell> <TableCell className="whitespace-nowrap">{record.category?.name || '-'}</TableCell>
<TableCell> <TableCell className="whitespace-nowrap">
<code className="text-xs bg-muted px-1 py-0.5 rounded">{record.cronExpression}</code> <code className="text-xs bg-muted px-1 py-0.5 rounded">{record.cronExpression}</code>
</TableCell> </TableCell>
<TableCell> <TableCell className="whitespace-nowrap">
<code className="text-xs">{record.beanName}</code> <code className="text-xs">{record.beanName}</code>
</TableCell> </TableCell>
<TableCell> <TableCell className="whitespace-nowrap">
<code className="text-xs">{record.methodName}</code> <code className="text-xs">{record.methodName}</code>
</TableCell> </TableCell>
<TableCell>{getStatusBadge(record.status)}</TableCell> <TableCell className="whitespace-nowrap">{getStatusBadge(record.status)}</TableCell>
<TableCell className="text-xs text-muted-foreground"> <TableCell className="text-xs text-muted-foreground whitespace-nowrap">
{record.lastExecuteTime ? dayjs(record.lastExecuteTime).format('YYYY-MM-DD HH:mm:ss') : '-'} {record.lastExecuteTime ? dayjs(record.lastExecuteTime).format('YYYY-MM-DD HH:mm:ss') : '-'}
</TableCell> </TableCell>
<TableCell className="text-xs text-muted-foreground"> <TableCell className="text-xs text-muted-foreground whitespace-nowrap">
{record.nextExecuteTime ? dayjs(record.nextExecuteTime).format('YYYY-MM-DD HH:mm:ss') : '-'} {record.nextExecuteTime ? dayjs(record.nextExecuteTime).format('YYYY-MM-DD HH:mm:ss') : '-'}
</TableCell> </TableCell>
<TableCell className="text-center"> <TableCell className="text-center whitespace-nowrap">
<Badge variant="outline">{record.executeCount || 0}</Badge> <Badge variant="outline">{record.executeCount || 0}</Badge>
</TableCell> </TableCell>
<TableCell> <TableCell className="whitespace-nowrap">
{record.executeCount && record.executeCount > 0 ? ( {record.executeCount && record.executeCount > 0 ? (
<Badge variant={ <Badge variant={
(record.successCount! / record.executeCount) >= 0.9 ? 'default' : (record.successCount! / record.executeCount) >= 0.9 ? 'default' :