Commit d47334d7 authored by 涂茜's avatar 涂茜

fix: 修改历史曲线表格采集时间展示问题及分页问题

parent 10071c85
Pipeline #29060 canceled with stages
......@@ -213,7 +213,7 @@ const HistoryInfo = (props) => {
const [options, setOptions] = useState({});
const [colors, setColors] = useState(defaultColors);
const [tableData, setTableData] = useState([]);
const [pageSize, setPageSize] = useState(20);
const [pageSize, setPageSize] = useState(2);
const [series, setSeries] = useState([]);
const [columns, setColumns] = useState([
{
......@@ -282,12 +282,14 @@ const HistoryInfo = (props) => {
return aa.localeCompare(bb);
});
};
let format = timeFormat;
if (timeValue === 'contrast') {
format = contrastOption === 'day' ? '2020-01-01 HH:mm:00' : '2020-01-DD HH:mm:00';
}
// 处理采集时间
resData.forEach((item) => {
item.dataModel.forEach((data) => {
const formatTime = moment(data.pt).format(
contrastOption === 'day' ? '2020-01-01 HH:mm:00' : '2020-01-DD HH:mm:00',
);
const formatTime = moment(data.pt).format(format);
if (!timeData.includes(formatTime)) {
timeData.push(formatTime);
}
......@@ -315,9 +317,7 @@ const HistoryInfo = (props) => {
tableData.forEach((item, i) => {
resData.forEach((child, index) => {
child.dataModel.forEach((value, j) => {
const formatTime = moment(value.pt).format(
contrastOption === 'day' ? '2020-01-01 HH:mm:00' : '2020-01-DD HH:mm:00',
);
const formatTime = moment(value.pt).format(format);
if (timeData[i] === formatTime) item[`value${index + 1}`] = value.pv;
});
});
......@@ -789,7 +789,7 @@ const HistoryInfo = (props) => {
dataSource={tableData}
columns={columns}
{...tableProps}
pagination={{ pageSize }}
pagination={{ pageSize, showQuickJumper: true, showSizeChanger: true }}
onChange={(value) => {
setPageSize(value.pageSize);
}}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment