mirror of
https://gitee.com/dromara/go-view.git
synced 2024-12-04 12:49:14 +08:00
fix: 解决修改完配置会调用两次接口的问题
This commit is contained in:
parent
ed5dd5e122
commit
6e19ed2dce
@ -96,7 +96,6 @@ import { SelectHttpType } from '../../index.d'
|
||||
import { ChartDataMatchingAndShow } from '../ChartDataMatchingAndShow'
|
||||
import { useTargetData } from '../../../hooks/useTargetData.hook'
|
||||
import { isDev, newFunctionHandle } from '@/utils'
|
||||
import debounce from 'lodash/debounce'
|
||||
|
||||
const { HelpOutlineIcon, FlashIcon, PulseIcon } = icon.ionicons5
|
||||
const { targetData, chartEditStore } = useTargetData()
|
||||
@ -122,27 +121,23 @@ const requestModelHandle = () => {
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
const sendHandle = debounce(
|
||||
async () => {
|
||||
if (!targetData.value?.request) return
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.requestGlobalConfig))
|
||||
loading.value = false
|
||||
if (res && res.data) {
|
||||
targetData.value.option.dataset = newFunctionHandle(res.data, targetData.value.filter)
|
||||
showMatching.value = true
|
||||
return
|
||||
}
|
||||
window['$message'].warning('数据异常,请检查参数!')
|
||||
} catch (error) {
|
||||
loading.value = false
|
||||
window['$message'].warning('数据异常,请检查参数!')
|
||||
const sendHandle = async () => {
|
||||
if (!targetData.value?.request) return
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.requestGlobalConfig))
|
||||
loading.value = false
|
||||
if (res && res.data) {
|
||||
targetData.value.option.dataset = newFunctionHandle(res.data, targetData.value.filter)
|
||||
showMatching.value = true
|
||||
return
|
||||
}
|
||||
},
|
||||
2000,
|
||||
{ leading: true }
|
||||
)
|
||||
window['$message'].warning('数据异常,请检查参数!')
|
||||
} catch (error) {
|
||||
loading.value = false
|
||||
window['$message'].warning('数据异常,请检查参数!')
|
||||
}
|
||||
}
|
||||
|
||||
// 颜色
|
||||
const themeColor = computed(() => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<n-modal class="go-chart-data-request" v-model:show="modelShow" :mask-closable="false" @afterLeave="closeHandle">
|
||||
<n-modal class="go-chart-data-request" v-model:show="modelShow" :mask-closable="false">
|
||||
<n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 1000px; height: 800px">
|
||||
<template #header></template>
|
||||
<template #header-extra> </template>
|
||||
@ -19,7 +19,7 @@
|
||||
<n-text>—— </n-text>
|
||||
<n-tag type="primary" :bordered="false" style="border-radius: 5px"> {{ requestContentTypeObj[requestContentType] }} </n-tag>
|
||||
</div>
|
||||
<n-button type="primary" @click="closeHandle">确认</n-button>
|
||||
<n-button type="primary" @click="closeHandle">保存 & 发送请求</n-button>
|
||||
</n-space>
|
||||
</template>
|
||||
</n-card>
|
||||
|
Loading…
Reference in New Issue
Block a user