mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 03:22:56 +08:00
refactor: 点击当前仪表板支持取消上次仪表板请求
This commit is contained in:
parent
6430159b79
commit
50cd883870
@ -296,4 +296,23 @@ const executeVersionHandler = (response: AxiosResponse) => {
|
||||
showMsg('系统有升级,请点击刷新页面', '-sys-upgrade-')
|
||||
}
|
||||
}
|
||||
export { service, cancelMap }
|
||||
|
||||
const cancelRequestBatch = cancelKey => {
|
||||
if (cancelKey) {
|
||||
if (cancelKey.indexOf('/**') > -1) {
|
||||
const cancelKeyPre = cancelKey.split('/**')[0]
|
||||
Object.keys(cancelMap).forEach(key => {
|
||||
if (key.indexOf(cancelKeyPre) > -1) {
|
||||
cancelMap[key]?.(() => {
|
||||
console.warn('Operation canceled by the user,url:' + key)
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
cancelMap[cancelKey]?.(() => {
|
||||
console.warn('Operation canceled by the user,url:' + cancelKey)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
export { service, cancelMap, cancelRequestBatch }
|
||||
|
@ -47,6 +47,7 @@ import { findParentIdByChildIdRecursive } from '@/utils/canvasUtils'
|
||||
import { XpackComponent } from '@/components/plugin'
|
||||
import treeSort, { treeParentWeight } from '@/utils/treeSortUtils'
|
||||
import router from '@/router'
|
||||
import { cancelRequestBatch } from '@/config/axios/service'
|
||||
const { wsCache } = useCache()
|
||||
|
||||
const dvMainStore = dvMainStoreWithOut()
|
||||
@ -232,8 +233,16 @@ const filterNode = (value: string, data: BusiTreeNode) => {
|
||||
if (!value) return true
|
||||
return data.name?.toLocaleLowerCase().includes(value.toLocaleLowerCase())
|
||||
}
|
||||
//取消之前请求
|
||||
const cancelPreRequest = () => {
|
||||
cancelRequestBatch('/dataVisualization/findById')
|
||||
cancelRequestBatch('/chartData/getData')
|
||||
cancelRequestBatch('/linkage/getVisualizationAllLinkageInfo/**')
|
||||
cancelRequestBatch('/linkJump/queryVisualizationJumpInfo/**')
|
||||
}
|
||||
|
||||
const nodeClick = (data: BusiTreeNode) => {
|
||||
cancelPreRequest()
|
||||
selectedNodeKey.value = data.id
|
||||
if (data.leaf) {
|
||||
emit('nodeClick', data)
|
||||
|
Loading…
Reference in New Issue
Block a user