mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-18 10:39:20 +08:00
修改定时任务列表滚动
This commit is contained in:
@@ -192,3 +192,9 @@ tr.drop-over-upward td {
|
||||
margin: -24px;
|
||||
}
|
||||
}
|
||||
|
||||
.crontab-wrapper {
|
||||
.ant-table-cell {
|
||||
height: 69px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ import { SharedContext } from '@/layouts';
|
||||
import useTableScrollHeight from '@/hooks/useTableScrollHeight';
|
||||
import { getCommandScript, parseCrontab } from '@/utils';
|
||||
import { ColumnProps } from 'antd/lib/table';
|
||||
import { VList } from '../../components/vlist';
|
||||
import { useVT } from 'virtualizedtableforantd4';
|
||||
|
||||
const { Text, Paragraph } = Typography;
|
||||
const { Search } = Input;
|
||||
@@ -330,7 +330,6 @@ const Crontab = () => {
|
||||
<Tooltip title={isPc ? '运行' : ''}>
|
||||
<a
|
||||
onClick={(e) => {
|
||||
setReset(false);
|
||||
e.stopPropagation();
|
||||
runCron(record, index);
|
||||
}}
|
||||
@@ -343,7 +342,6 @@ const Crontab = () => {
|
||||
<Tooltip title={isPc ? '停止' : ''}>
|
||||
<a
|
||||
onClick={(e) => {
|
||||
setReset(false);
|
||||
e.stopPropagation();
|
||||
stopCron(record, index);
|
||||
}}
|
||||
@@ -355,7 +353,6 @@ const Crontab = () => {
|
||||
<Tooltip title={isPc ? '日志' : ''}>
|
||||
<a
|
||||
onClick={(e) => {
|
||||
setReset(false);
|
||||
e.stopPropagation();
|
||||
setLogCron({ ...record, timestamp: Date.now() });
|
||||
}}
|
||||
@@ -399,10 +396,6 @@ const Crontab = () => {
|
||||
const [moreMenuActive, setMoreMenuActive] = useState(false);
|
||||
const tableRef = useRef<any>();
|
||||
const tableScrollHeight = useTableScrollHeight(tableRef);
|
||||
const resetRef = useRef<boolean>(true);
|
||||
const setReset = (v) => {
|
||||
resetRef.current = v;
|
||||
};
|
||||
|
||||
const goToScriptManager = (record: any) => {
|
||||
const result = getCommandScript(record.command);
|
||||
@@ -686,7 +679,6 @@ const Crontab = () => {
|
||||
items: getMenuItems(record),
|
||||
onClick: ({ key, domEvent }) => {
|
||||
domEvent.stopPropagation();
|
||||
setReset(false);
|
||||
action(key, record, index);
|
||||
},
|
||||
}}
|
||||
@@ -722,7 +714,6 @@ const Crontab = () => {
|
||||
};
|
||||
|
||||
const onSearch = (value: string) => {
|
||||
setReset(true);
|
||||
setSearchText(value.trim());
|
||||
};
|
||||
|
||||
@@ -750,10 +741,6 @@ const Crontab = () => {
|
||||
setSelectedRowIds(selectedIds);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setReset(false);
|
||||
}, [selectedRowIds]);
|
||||
|
||||
const rowSelection = {
|
||||
selectedRowKeys: selectedRowIds,
|
||||
onChange: onSelectChange,
|
||||
@@ -781,7 +768,6 @@ const Crontab = () => {
|
||||
};
|
||||
|
||||
const operateCrons = (operationStatus: number) => {
|
||||
setReset(false);
|
||||
Modal.confirm({
|
||||
title: `确认${OperationName[operationStatus]}`,
|
||||
content: <>确认{OperationName[operationStatus]}选中的定时任务吗</>,
|
||||
@@ -808,7 +794,6 @@ const Crontab = () => {
|
||||
sorter: SorterResult<any> | SorterResult<any>[],
|
||||
) => {
|
||||
const { current, pageSize } = pagination;
|
||||
setReset(true);
|
||||
setPageConf({
|
||||
page: current as number,
|
||||
size: pageSize as number,
|
||||
@@ -923,21 +908,14 @@ const Crontab = () => {
|
||||
const tabClick = (key: string) => {
|
||||
const view = enabledCronViews.find((x) => x.id == key);
|
||||
setSelectedRowIds([]);
|
||||
setReset(true);
|
||||
setPageConf({ ...pageConf, page: 1 });
|
||||
setViewConf(view ? view : null);
|
||||
};
|
||||
|
||||
const vComponents = useMemo(() => {
|
||||
return VList({
|
||||
height: tableScrollHeight,
|
||||
reset: resetRef.current,
|
||||
rowHeight: 69,
|
||||
scrollTop: resetRef.current
|
||||
? 0
|
||||
: tableRef.current?.querySelector('.ant-table-body')?.scrollTop,
|
||||
});
|
||||
}, [tableScrollHeight, resetRef.current]);
|
||||
const [vt] = useVT(
|
||||
() => ({ scroll: { y: tableScrollHeight } }),
|
||||
[tableScrollHeight],
|
||||
);
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
@@ -1073,7 +1051,7 @@ const Crontab = () => {
|
||||
rowSelection={rowSelection}
|
||||
rowClassName={getRowClassName}
|
||||
onChange={onPageChange}
|
||||
components={vComponents}
|
||||
components={vt}
|
||||
/>
|
||||
</div>
|
||||
<CronLogModal
|
||||
|
||||
Reference in New Issue
Block a user