Commit d47334d7 authored by 涂茜's avatar 涂茜

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

parent 10071c85
Pipeline #29060 canceled with stages
...@@ -213,7 +213,7 @@ const HistoryInfo = (props) => { ...@@ -213,7 +213,7 @@ const HistoryInfo = (props) => {
const [options, setOptions] = useState({}); const [options, setOptions] = useState({});
const [colors, setColors] = useState(defaultColors); const [colors, setColors] = useState(defaultColors);
const [tableData, setTableData] = useState([]); const [tableData, setTableData] = useState([]);
const [pageSize, setPageSize] = useState(20); const [pageSize, setPageSize] = useState(2);
const [series, setSeries] = useState([]); const [series, setSeries] = useState([]);
const [columns, setColumns] = useState([ const [columns, setColumns] = useState([
{ {
...@@ -282,12 +282,14 @@ const HistoryInfo = (props) => { ...@@ -282,12 +282,14 @@ const HistoryInfo = (props) => {
return aa.localeCompare(bb); 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) => { resData.forEach((item) => {
item.dataModel.forEach((data) => { item.dataModel.forEach((data) => {
const formatTime = moment(data.pt).format( const formatTime = moment(data.pt).format(format);
contrastOption === 'day' ? '2020-01-01 HH:mm:00' : '2020-01-DD HH:mm:00',
);
if (!timeData.includes(formatTime)) { if (!timeData.includes(formatTime)) {
timeData.push(formatTime); timeData.push(formatTime);
} }
...@@ -315,9 +317,7 @@ const HistoryInfo = (props) => { ...@@ -315,9 +317,7 @@ const HistoryInfo = (props) => {
tableData.forEach((item, i) => { tableData.forEach((item, i) => {
resData.forEach((child, index) => { resData.forEach((child, index) => {
child.dataModel.forEach((value, j) => { child.dataModel.forEach((value, j) => {
const formatTime = moment(value.pt).format( const formatTime = moment(value.pt).format(format);
contrastOption === 'day' ? '2020-01-01 HH:mm:00' : '2020-01-DD HH:mm:00',
);
if (timeData[i] === formatTime) item[`value${index + 1}`] = value.pv; if (timeData[i] === formatTime) item[`value${index + 1}`] = value.pv;
}); });
}); });
...@@ -789,7 +789,7 @@ const HistoryInfo = (props) => { ...@@ -789,7 +789,7 @@ const HistoryInfo = (props) => {
dataSource={tableData} dataSource={tableData}
columns={columns} columns={columns}
{...tableProps} {...tableProps}
pagination={{ pageSize }} pagination={{ pageSize, showQuickJumper: true, showSizeChanger: true }}
onChange={(value) => { onChange={(value) => {
setPageSize(value.pageSize); 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