diff --git a/package.json b/package.json index 63fc0c3..7364aca 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ }, "scripts": { "dev": "vite --host", - "build": "vue-tsc --noEmit && vite build", + "build": "vite build", "build:prod": "vite build --mode production", "preview": "vite preview", "new": "plop --plopfile ./plop/plopfile.js", diff --git a/src/hooks/useChartDataFetch.hook.ts b/src/hooks/useChartDataFetch.hook.ts index 6d99cec..5da94d4 100644 --- a/src/hooks/useChartDataFetch.hook.ts +++ b/src/hooks/useChartDataFetch.hook.ts @@ -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 = ( } 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)