|
|
|
|
@ -13,6 +13,7 @@ import { intervalUnitHandle, isPreview, newFunctionHandle } from '@/utils'
@@ -13,6 +13,7 @@ import { intervalUnitHandle, isPreview, newFunctionHandle } from '@/utils'
|
|
|
|
|
import { setOption } from '@/packages/public/chart' |
|
|
|
|
import { isNil } from 'lodash' |
|
|
|
|
import dayjs from "dayjs"; |
|
|
|
|
import { fetchDataByIot } from "@/api/path/dataSource"; |
|
|
|
|
|
|
|
|
|
// 获取类型
|
|
|
|
|
type ChartEditStoreType = typeof useChartEditStore |
|
|
|
|
@ -120,17 +121,23 @@ export const useChartDataFetch = (
@@ -120,17 +121,23 @@ export const useChartDataFetch = (
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function SourceRequestIntervalFn() { |
|
|
|
|
const chartEditStore = useChartEditStore() |
|
|
|
|
const { |
|
|
|
|
station, |
|
|
|
|
device, |
|
|
|
|
points, |
|
|
|
|
requestIntervalUnit: targetUnit, |
|
|
|
|
requestInterval: targetInterval |
|
|
|
|
} = toRefs(targetComponent.requestSource) |
|
|
|
|
try { |
|
|
|
|
function fetchFn() { |
|
|
|
|
console.log(station.value) |
|
|
|
|
async function fetchFn() { |
|
|
|
|
const res = await fetchDataByIot(targetComponent.requestSource) |
|
|
|
|
if (res) { |
|
|
|
|
try { |
|
|
|
|
const filter = targetComponent.filter |
|
|
|
|
const { data } = res |
|
|
|
|
echartsUpdateHandle(newFunctionHandle(data, res, filter)) |
|
|
|
|
// 更新回调函数
|
|
|
|
|
if (updateCallback) { |
|
|
|
|
updateCallback(newFunctionHandle(data, res, filter)) |
|
|
|
|
} |
|
|
|
|
} catch (error) { |
|
|
|
|
console.error(error) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
createFetchInterval(fetchFn, targetComponent.requestSource) |
|
|
|
|
|