|
@@ -6,6 +6,9 @@
|
|
|
:options="selectOptions"
|
|
:options="selectOptions"
|
|
|
/>
|
|
/>
|
|
|
</setting-item-box>
|
|
</setting-item-box>
|
|
|
|
|
+ <setting-item-box name="源地址:" :alone="true">
|
|
|
|
|
+ <n-text type="info">{{ requestOriginUrl || '暂无' }}</n-text>
|
|
|
|
|
+ </setting-item-box>
|
|
|
<setting-item-box :alone="true">
|
|
<setting-item-box :alone="true">
|
|
|
<template #name>
|
|
<template #name>
|
|
|
地址
|
|
地址
|
|
@@ -25,9 +28,9 @@
|
|
|
</n-tooltip>
|
|
</n-tooltip>
|
|
|
</template>
|
|
</template>
|
|
|
<n-input
|
|
<n-input
|
|
|
- v-model:value="targetData.data.requestUrl"
|
|
|
|
|
|
|
+ v-model:value.trim="targetData.data.requestUrl"
|
|
|
:min="1"
|
|
:min="1"
|
|
|
- placeholder="http(s)://..."
|
|
|
|
|
|
|
+ placeholder="请输入地址(去除源)"
|
|
|
/>
|
|
/>
|
|
|
</setting-item-box>
|
|
</setting-item-box>
|
|
|
<setting-item-box name="测试" :alone="true">
|
|
<setting-item-box name="测试" :alone="true">
|
|
@@ -38,39 +41,34 @@
|
|
|
<flash-icon />
|
|
<flash-icon />
|
|
|
</n-icon>
|
|
</n-icon>
|
|
|
</template>
|
|
</template>
|
|
|
- 发送地址请求
|
|
|
|
|
|
|
+ 发送请求
|
|
|
</n-button>
|
|
</n-button>
|
|
|
</n-space>
|
|
</n-space>
|
|
|
</setting-item-box>
|
|
</setting-item-box>
|
|
|
<go-skeleton :load="loading" :repeat="3"></go-skeleton>
|
|
<go-skeleton :load="loading" :repeat="3"></go-skeleton>
|
|
|
<chart-data-matching-and-show
|
|
<chart-data-matching-and-show
|
|
|
v-show="showMatching && !loading"
|
|
v-show="showMatching && !loading"
|
|
|
- :targetData="targetData"
|
|
|
|
|
:ajax="true"
|
|
:ajax="true"
|
|
|
></chart-data-matching-and-show>
|
|
></chart-data-matching-and-show>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import { PropType, ref } from 'vue'
|
|
|
|
|
|
|
+import { ref, toRefs } from 'vue'
|
|
|
import { icon } from '@/plugins'
|
|
import { icon } from '@/plugins'
|
|
|
import { CreateComponentType } from '@/packages/index.d'
|
|
import { CreateComponentType } from '@/packages/index.d'
|
|
|
import { SettingItemBox } from '@/components/ChartItemSetting/index'
|
|
import { SettingItemBox } from '@/components/ChartItemSetting/index'
|
|
|
import { RequestHttpEnum } from '@/enums/httpEnum'
|
|
import { RequestHttpEnum } from '@/enums/httpEnum'
|
|
|
-import { SelectHttpType } from '../../index.d'
|
|
|
|
|
import { featchMockData } from '@/api/mock'
|
|
import { featchMockData } from '@/api/mock'
|
|
|
import { http } from '@/api/http'
|
|
import { http } from '@/api/http'
|
|
|
|
|
+import { SelectHttpType } from '../../index.d'
|
|
|
import { ChartDataMatchingAndShow } from '../ChartDataMatchingAndShow'
|
|
import { ChartDataMatchingAndShow } from '../ChartDataMatchingAndShow'
|
|
|
|
|
+import { useTargetData } from '../../../hooks/useTargetData.hook'
|
|
|
|
|
|
|
|
const { HelpOutlineIcon, FlashIcon } = icon.ionicons5
|
|
const { HelpOutlineIcon, FlashIcon } = icon.ionicons5
|
|
|
|
|
|
|
|
-const props = defineProps({
|
|
|
|
|
- targetData: {
|
|
|
|
|
- type: Object as PropType<CreateComponentType>,
|
|
|
|
|
- required: true
|
|
|
|
|
- }
|
|
|
|
|
-})
|
|
|
|
|
-
|
|
|
|
|
|
|
+const { targetData, chartEditStore } = useTargetData()
|
|
|
|
|
+const { requestOriginUrl } = toRefs(chartEditStore.getRequestGlobalConfig)
|
|
|
// 是否是开发环境
|
|
// 是否是开发环境
|
|
|
const ISDEV = import.meta.env.DEV === true
|
|
const ISDEV = import.meta.env.DEV === true
|
|
|
// 是否展示数据分析
|
|
// 是否展示数据分析
|
|
@@ -92,16 +90,17 @@ const selectOptions: SelectHttpType[] = [
|
|
|
// 发送请求
|
|
// 发送请求
|
|
|
const sendHandle = async () => {
|
|
const sendHandle = async () => {
|
|
|
loading.value = true
|
|
loading.value = true
|
|
|
- const { requestUrl, requestHttpType } = props.targetData.data
|
|
|
|
|
- if(!requestUrl) {
|
|
|
|
|
|
|
+ const { requestUrl, requestHttpType } = targetData.value.data
|
|
|
|
|
+ if (!requestUrl) {
|
|
|
window['$message'].warning('请求参数不正确,请检查!')
|
|
window['$message'].warning('请求参数不正确,请检查!')
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- const res = await http(requestHttpType)((requestUrl as string).trim(), {})
|
|
|
|
|
|
|
+ const completePath = requestOriginUrl && requestOriginUrl.value + requestUrl
|
|
|
|
|
+ const res = await http(requestHttpType)(completePath || '', {})
|
|
|
loading.value = false
|
|
loading.value = false
|
|
|
- if(res.status === 200) {
|
|
|
|
|
|
|
+ if (res.status === 200) {
|
|
|
// @ts-ignore
|
|
// @ts-ignore
|
|
|
- props.targetData.option.dataset = res.data
|
|
|
|
|
|
|
+ targetData.value.option.dataset = res.data
|
|
|
showMatching.value = true
|
|
showMatching.value = true
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
@@ -110,5 +109,6 @@ const sendHandle = async () => {
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
-@include go('chart-configurations-data-ajax') {}
|
|
|
|
|
|
|
+@include go('chart-configurations-data-ajax') {
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|