mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 23:06:06 +08:00
修复表格滚动高度
This commit is contained in:
parent
68bb4f15e2
commit
48dd6ea826
|
@ -1,4 +1,4 @@
|
||||||
import React, { PureComponent, Fragment, useState, useEffect } from 'react';
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
message,
|
message,
|
||||||
|
@ -388,6 +388,7 @@ const Crontab = () => {
|
||||||
const [cronViews, setCronViews] = useState<any[]>([]);
|
const [cronViews, setCronViews] = useState<any[]>([]);
|
||||||
const [enabledCronViews, setEnabledCronViews] = useState<any[]>([]);
|
const [enabledCronViews, setEnabledCronViews] = useState<any[]>([]);
|
||||||
const [moreMenuActive, setMoreMenuActive] = useState(false);
|
const [moreMenuActive, setMoreMenuActive] = useState(false);
|
||||||
|
const tableRef = useRef<any>();
|
||||||
|
|
||||||
const goToScriptManager = (record: any) => {
|
const goToScriptManager = (record: any) => {
|
||||||
const cmd = record.command.split(' ') as string[];
|
const cmd = record.command.split(' ') as string[];
|
||||||
|
@ -874,12 +875,15 @@ const Crontab = () => {
|
||||||
sorter: {},
|
sorter: {},
|
||||||
filters: {},
|
filters: {},
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
|
||||||
setTableScrollHeight(getTableScroll());
|
|
||||||
});
|
|
||||||
getCronViews();
|
getCronViews();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (tableRef.current) {
|
||||||
|
setTableScrollHeight(getTableScroll());
|
||||||
|
}
|
||||||
|
}, [tableRef.current]);
|
||||||
|
|
||||||
const panelContent = (
|
const panelContent = (
|
||||||
<>
|
<>
|
||||||
{selectedRowIds.length > 0 && (
|
{selectedRowIds.length > 0 && (
|
||||||
|
@ -939,6 +943,7 @@ const Crontab = () => {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<Table
|
<Table
|
||||||
|
ref={tableRef}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
pagination={{
|
pagination={{
|
||||||
current: pageConf.page,
|
current: pageConf.page,
|
||||||
|
|
|
@ -168,6 +168,7 @@ const Dependence = () => {
|
||||||
const [logDependence, setLogDependence] = useState<any>();
|
const [logDependence, setLogDependence] = useState<any>();
|
||||||
const [isLogModalVisible, setIsLogModalVisible] = useState(false);
|
const [isLogModalVisible, setIsLogModalVisible] = useState(false);
|
||||||
const [type, setType] = useState('nodejs');
|
const [type, setType] = useState('nodejs');
|
||||||
|
const tableRef = useRef<any>();
|
||||||
|
|
||||||
const getDependencies = () => {
|
const getDependencies = () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
@ -368,10 +369,10 @@ const Dependence = () => {
|
||||||
}, [searchText, type]);
|
}, [searchText, type]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setTimeout(() => {
|
if (tableRef.current) {
|
||||||
setTableScrollHeight(getTableScroll({ extraHeight: 87 }));
|
setTableScrollHeight(getTableScroll({ extraHeight: 87 }));
|
||||||
});
|
}
|
||||||
}, []);
|
}, [tableRef.current]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (logDependence) {
|
if (logDependence) {
|
||||||
|
@ -454,6 +455,7 @@ const Dependence = () => {
|
||||||
)}
|
)}
|
||||||
<DndProvider backend={HTML5Backend}>
|
<DndProvider backend={HTML5Backend}>
|
||||||
<Table
|
<Table
|
||||||
|
ref={tableRef}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rowSelection={rowSelection}
|
rowSelection={rowSelection}
|
||||||
pagination={false}
|
pagination={false}
|
||||||
|
|
8
src/pages/env/index.tsx
vendored
8
src/pages/env/index.tsx
vendored
|
@ -254,6 +254,7 @@ const Env = () => {
|
||||||
const [searchText, setSearchText] = useState('');
|
const [searchText, setSearchText] = useState('');
|
||||||
const [tableScrollHeight, setTableScrollHeight] = useState<number>();
|
const [tableScrollHeight, setTableScrollHeight] = useState<number>();
|
||||||
const [importLoading, setImportLoading] = useState(false);
|
const [importLoading, setImportLoading] = useState(false);
|
||||||
|
const tableRef = useRef<any>();
|
||||||
|
|
||||||
const getEnvs = () => {
|
const getEnvs = () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
@ -508,10 +509,10 @@ const Env = () => {
|
||||||
}, [searchText]);
|
}, [searchText]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setTimeout(() => {
|
if (tableRef.current) {
|
||||||
setTableScrollHeight(getTableScroll({ extraHeight: 87 }));
|
setTableScrollHeight(getTableScroll({ extraHeight: 87 }));
|
||||||
});
|
}
|
||||||
}, []);
|
}, [tableRef.current]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContainer
|
<PageContainer
|
||||||
|
@ -587,6 +588,7 @@ const Env = () => {
|
||||||
)}
|
)}
|
||||||
<DndProvider backend={HTML5Backend}>
|
<DndProvider backend={HTML5Backend}>
|
||||||
<Table
|
<Table
|
||||||
|
ref={tableRef}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rowSelection={rowSelection}
|
rowSelection={rowSelection}
|
||||||
pagination={false}
|
pagination={false}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
message,
|
message,
|
||||||
|
@ -247,6 +247,7 @@ const Subscription = () => {
|
||||||
const [searchValue, setSearchValue] = useState('');
|
const [searchValue, setSearchValue] = useState('');
|
||||||
const [isLogModalVisible, setIsLogModalVisible] = useState(false);
|
const [isLogModalVisible, setIsLogModalVisible] = useState(false);
|
||||||
const [logSubscription, setLogSubscription] = useState<any>();
|
const [logSubscription, setLogSubscription] = useState<any>();
|
||||||
|
const tableRef = useRef<any>();
|
||||||
|
|
||||||
const runSubscription = (record: any, index: number) => {
|
const runSubscription = (record: any, index: number) => {
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
|
@ -539,11 +540,14 @@ const Subscription = () => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setPageSize(parseInt(localStorage.getItem('pageSize') || '20'));
|
setPageSize(parseInt(localStorage.getItem('pageSize') || '20'));
|
||||||
setTimeout(() => {
|
|
||||||
setTableScrollHeight(getTableScroll());
|
|
||||||
});
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (tableRef.current) {
|
||||||
|
setTableScrollHeight(getTableScroll());
|
||||||
|
}
|
||||||
|
}, [tableRef.current]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContainer
|
<PageContainer
|
||||||
className="ql-container-wrapper subscriptiontab-wrapper"
|
className="ql-container-wrapper subscriptiontab-wrapper"
|
||||||
|
@ -568,6 +572,7 @@ const Subscription = () => {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Table
|
<Table
|
||||||
|
ref={tableRef}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
pagination={{
|
pagination={{
|
||||||
current: currentPage,
|
current: currentPage,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user