Commit 5dde9640 authored by 徐乐's avatar 徐乐

修改

parent 9cf69177
...@@ -613,7 +613,7 @@ const HistoryView = (props) => { ...@@ -613,7 +613,7 @@ const HistoryView = (props) => {
}; };
data.forEach((item, index) => { data.forEach((item, index) => {
const { stationCode, sensorName, dataModel } = item; const { stationCode, sensorName, dataModel } = item;
dataModel.forEach((data) => { dataModel && dataModel.forEach((data) => {
const formatTime = moment(data.pt).format(format); const formatTime = moment(data.pt).format(format);
let time = formatTime; let time = formatTime;
...@@ -629,7 +629,7 @@ const HistoryView = (props) => { ...@@ -629,7 +629,7 @@ const HistoryView = (props) => {
data.forEach((child, index) => { data.forEach((child, index) => {
const { dataModel } = child; const { dataModel } = child;
const dataIndex = dataIndexAccess(child, index); const dataIndex = dataIndexAccess(child, index);
dataModel.forEach((value, j) => { dataModel && dataModel.forEach((value, j) => {
const formatTime = moment(value.pt).format(format); const formatTime = moment(value.pt).format(format);
const dataRow = timeData[formatTime]; const dataRow = timeData[formatTime];
if (dataRow) { if (dataRow) {
...@@ -739,8 +739,8 @@ const HistoryView = (props) => { ...@@ -739,8 +739,8 @@ const HistoryView = (props) => {
const { dateFrom, dateTo } = dateRange?.[index] ?? {}; const { dateFrom, dateTo } = dateRange?.[index] ?? {};
if (res.code === 0 && res.data.length) { if (res.code === 0 && res.data.length) {
res.data.forEach((d) => { res.data.forEach((d) => {
d.dateFrom = dateFrom; d.dateFrom = dateFrom || '';
d.dateTo = dateTo; d.dateTo = dateTo || '';
}); });
deviceParams.forEach((p) => { deviceParams.forEach((p) => {
// 返回数据按查询指标顺序排序 // 返回数据按查询指标顺序排序
...@@ -756,6 +756,7 @@ const HistoryView = (props) => { ...@@ -756,6 +756,7 @@ const HistoryView = (props) => {
} else { } else {
return {}; return {};
} }
}); });
data = data.concat(list); data = data.concat(list);
}); });
......
...@@ -40,7 +40,7 @@ const nameFormatter = (data, contrast, contrastOption, nameWithSensor) => { ...@@ -40,7 +40,7 @@ const nameFormatter = (data, contrast, contrastOption, nameWithSensor) => {
* @returns 图表系列数据, [[DateTime, value]] * @returns 图表系列数据, [[DateTime, value]]
*/ */
const dataAccessor = (data, contrast, contrastOption) => { const dataAccessor = (data, contrast, contrastOption) => {
const { dataModel } = data; const dataModel = data?.dataModel ?? [];
let _currentYear = moment().format('YYYY'); let _currentYear = moment().format('YYYY');
const formatStr = const formatStr =
contrastOption === 'day' ? `${_currentYear}-01-01 HH:mm:00` : `${_currentYear}-01-DD HH:mm:00`; contrastOption === 'day' ? `${_currentYear}-01-01 HH:mm:00` : `${_currentYear}-01-DD HH:mm:00`;
......
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