|
@@ -105,6 +105,13 @@ function getInitialDateRange() {
|
|
|
return getDateRangeByWindow()
|
|
return getDateRangeByWindow()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function isRangeGreaterThan120Minutes(range: string[]) {
|
|
|
|
|
+ const begin = dayjs(range[0])
|
|
|
|
|
+ const end = dayjs(range[1])
|
|
|
|
|
+
|
|
|
|
|
+ return begin.isValid() && end.isValid() && end.diff(begin, 'minute', true) > 120
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const REALTIME_RIGHT_BLANK_MS = 60 * 1000
|
|
const REALTIME_RIGHT_BLANK_MS = 60 * 1000
|
|
|
const selectedDate = ref<string[]>(getInitialDateRange())
|
|
const selectedDate = ref<string[]>(getInitialDateRange())
|
|
|
const chartRef = ref<HTMLDivElement | null>(null)
|
|
const chartRef = ref<HTMLDivElement | null>(null)
|
|
@@ -622,7 +629,10 @@ async function initLoadChartData({
|
|
|
dimensions.value.map(async (item) => {
|
|
dimensions.value.map(async (item) => {
|
|
|
item.response = true
|
|
item.response = true
|
|
|
try {
|
|
try {
|
|
|
- const res = await IotStatApi.getDeviceInfoChartly(
|
|
|
|
|
|
|
+ const getChartData = isRangeGreaterThan120Minutes(selectedDate.value)
|
|
|
|
|
+ ? IotStatApi.getDeviceInfoChart
|
|
|
|
|
+ : IotStatApi.getDeviceInfoChartly
|
|
|
|
|
+ const res = await getChartData(
|
|
|
data.value.deviceCode,
|
|
data.value.deviceCode,
|
|
|
item.identifier,
|
|
item.identifier,
|
|
|
selectedDate.value[0],
|
|
selectedDate.value[0],
|