| | |
| | | const tableData = []; |
| | | if (tableDatax.value.length > 0) { |
| | | tableDatax.value.forEach((item, index) => { |
| | | const time1 = new Date(index == 0 ? item.startTimestamp : tableDatax.value[index - 1].secondTimestamp); |
| | | const time2 = new Date(index == tableDatax.length - 1 ? item.endTimestamp : item.firstTimestamp); |
| | | |
| | | const diffInSeconds = Math.abs(time2 - time1) / 1000; |
| | | if (diffInSeconds > 60) { |
| | | tableData.push({ |
| | | firstTimestamp: index == 0 ? item.startTimestamp : tableDatax.value[index - 1].secondTimestamp, |
| | | secondTimestamp: index == tableDatax.length - 1 ? item.endTimestamp : item.firstTimestamp, |
| | |
| | | endTimestamp: item.endTimestamp, |
| | | state: 1 |
| | | }); |
| | | console.log("间隔超过60秒", diffInSeconds, time1, time2); |
| | | } else { |
| | | console.log("间隔不超过60秒", diffInSeconds, time1, time2); |
| | | } |
| | | |
| | | if (result) { |
| | | tableData.push({ |
| | | firstTimestamp: item.firstTimestamp, |
| | |
| | | backgroundColor: 'rgba(50,50,50,0.7)', |
| | | textStyle: { color: '#fff' }, |
| | | formatter: (params) => { |
| | | const seen = new Set(); |
| | | const items = params |
| | | .filter(p => { |
| | | const key = p.data?.extra?.start + '|' + p.data?.extra?.end; |
| | | if (seen.has(key)) return false; |
| | | seen.add(key); |
| | | return true; |
| | | }) |
| | | .map(p => { |
| | | const start = p.data?.extra?.start; |
| | | const end = p.data?.extra?.end; |