mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 08:12:49 +08:00
fix: 解决配置接口点击确定会立即调用两次接口的bug
This commit is contained in:
parent
368ae13db6
commit
924a173d6b
@ -96,6 +96,7 @@ import { SelectHttpType } from '../../index.d'
|
|||||||
import { ChartDataMatchingAndShow } from '../ChartDataMatchingAndShow'
|
import { ChartDataMatchingAndShow } from '../ChartDataMatchingAndShow'
|
||||||
import { useTargetData } from '../../../hooks/useTargetData.hook'
|
import { useTargetData } from '../../../hooks/useTargetData.hook'
|
||||||
import { isDev, newFunctionHandle } from '@/utils'
|
import { isDev, newFunctionHandle } from '@/utils'
|
||||||
|
import debounce from 'lodash/debounce'
|
||||||
|
|
||||||
const { HelpOutlineIcon, FlashIcon, PulseIcon } = icon.ionicons5
|
const { HelpOutlineIcon, FlashIcon, PulseIcon } = icon.ionicons5
|
||||||
const { targetData, chartEditStore } = useTargetData()
|
const { targetData, chartEditStore } = useTargetData()
|
||||||
@ -123,23 +124,27 @@ const requestModelHandle = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 发送请求
|
// 发送请求
|
||||||
const sendHandle = async () => {
|
const sendHandle = debounce(
|
||||||
if(!targetData.value?.request) return
|
async () => {
|
||||||
loading.value = true
|
if (!targetData.value?.request) return
|
||||||
try {
|
loading.value = true
|
||||||
const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.requestGlobalConfig))
|
try {
|
||||||
loading.value = false
|
const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.requestGlobalConfig))
|
||||||
if (res && res.data) {
|
loading.value = false
|
||||||
targetData.value.option.dataset = newFunctionHandle(res.data, targetData.value.filter)
|
if (res && res.data) {
|
||||||
showMatching.value = true
|
targetData.value.option.dataset = newFunctionHandle(res.data, targetData.value.filter)
|
||||||
return
|
showMatching.value = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window['$message'].warning('数据异常,请检查参数!')
|
||||||
|
} catch (error) {
|
||||||
|
loading.value = false
|
||||||
|
window['$message'].warning('数据异常,请检查参数!')
|
||||||
}
|
}
|
||||||
window['$message'].warning('数据异常,请检查参数!')
|
},
|
||||||
} catch (error) {
|
2000,
|
||||||
loading.value = false
|
{ leading: true }
|
||||||
window['$message'].warning('数据异常,请检查参数!')
|
)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 颜色
|
// 颜色
|
||||||
const themeColor = computed(() => {
|
const themeColor = computed(() => {
|
||||||
@ -152,7 +157,7 @@ watchEffect(() => {
|
|||||||
lastFilter = filter
|
lastFilter = filter
|
||||||
sendHandle()
|
sendHandle()
|
||||||
}
|
}
|
||||||
firstFocus ++
|
firstFocus++
|
||||||
})
|
})
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user