diff --git a/core/core-frontend/src/config/axios/service.ts b/core/core-frontend/src/config/axios/service.ts index 7f2a86f964..6e5be8971c 100644 --- a/core/core-frontend/src/config/axios/service.ts +++ b/core/core-frontend/src/config/axios/service.ts @@ -138,9 +138,18 @@ service.interceptors.request.use( config.params = {} config.url = url } - config.cancelToken = new CancelToken(function executor(c) { - cancelMap[config.url] = c - }) + + if (config.url.endsWith('chartData/getData')) { + const chartKey = `chartData/getData/${(config.data as any).id}` + config.cancelToken = new CancelToken(function executor(c) { + cancelMap[chartKey] = c + }) + } else { + config.cancelToken = new CancelToken(function executor(c) { + cancelMap[config.url] = c + }) + } + config.loading && tryShowLoading(permissionStore.getCurrentPath) return config }, diff --git a/core/core-frontend/src/views/chart/components/views/index.vue b/core/core-frontend/src/views/chart/components/views/index.vue index d9fac142cf..c1c35bba58 100644 --- a/core/core-frontend/src/views/chart/components/views/index.vue +++ b/core/core-frontend/src/views/chart/components/views/index.vue @@ -2,6 +2,7 @@ import icon_info_outlined from '@/assets/svg/icon_info_outlined.svg' import icon_linkRecord_outlined from '@/assets/svg/icon_link-record_outlined.svg' import icon_viewinchat_outlined from '@/assets/svg/icon_viewinchat_outlined.svg' +import { cancelRequestBatch } from '@/config/axios/service' import icon_drilling_outlined from '@/assets/svg/icon_drilling_outlined.svg' import { useI18n } from '@/hooks/web/useI18n' import ChartComponentG2Plot from './components/ChartComponentG2Plot.vue' @@ -571,6 +572,12 @@ const jumpClick = param => { } } +const queryDataFromSelect = (firstLoad = false) => { + cancelRequestBatch(`chartData/getData/${view.value.id}`) + loading.value = false + queryData(firstLoad) +} + const queryData = debounce((firstLoad = false) => { if (loading.value) { return @@ -619,7 +626,7 @@ onBeforeMount(() => { nextTick(() => { useEmitt({ name: `query-data-${view.value.id}`, - callback: queryData + callback: queryDataFromSelect }) }) }