Browse Source

调整连油监控

Zimo 5 ngày trước cách đây
mục cha
commit
93a09f26a9
1 tập tin đã thay đổi với 11 bổ sung1 xóa
  1. 11 1
      src/views/oli-connection/monitoring/detail.vue

+ 11 - 1
src/views/oli-connection/monitoring/detail.vue

@@ -105,6 +105,13 @@ function getInitialDateRange() {
   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 selectedDate = ref<string[]>(getInitialDateRange())
 const chartRef = ref<HTMLDivElement | null>(null)
@@ -622,7 +629,10 @@ async function initLoadChartData({
       dimensions.value.map(async (item) => {
         item.response = true
         try {
-          const res = await IotStatApi.getDeviceInfoChartly(
+          const getChartData = isRangeGreaterThan120Minutes(selectedDate.value)
+            ? IotStatApi.getDeviceInfoChart
+            : IotStatApi.getDeviceInfoChartly
+          const res = await getChartData(
             data.value.deviceCode,
             item.identifier,
             selectedDate.value[0],