mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-14 01:53:06 +08:00
50 lines
1.8 KiB
Vue
50 lines
1.8 KiB
Vue
<template>
|
|
<div class="go-chart-configurations-data" v-if="targetData">
|
|
<setting-item-box name="请求方式" :alone="true">
|
|
<n-select v-model:value="targetData.request.requestDataType" :disabled="isNotData" :options="selectOptions" />
|
|
</setting-item-box>
|
|
<!-- 静态 -->
|
|
<chart-data-static v-if="targetData.request.requestDataType === RequestDataTypeEnum.STATIC"></chart-data-static>
|
|
<!-- 动态 -->
|
|
<chart-data-ajax v-if="targetData.request.requestDataType === RequestDataTypeEnum.AJAX"></chart-data-ajax>
|
|
<!-- 数据池 -->
|
|
<chart-data-pond v-if="targetData.request.requestDataType === RequestDataTypeEnum.Pond"></chart-data-pond>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
import { loadAsyncComponent } from '@/utils'
|
|
import { SettingItemBox } from '@/components/Pages/ChartItemSetting'
|
|
import { useTargetData } from '../hooks/useTargetData.hook'
|
|
import { SelectCreateDataType, SelectCreateDataEnum } from './index.d'
|
|
import { RequestDataTypeEnum } from '@/enums/httpEnum'
|
|
|
|
const ChartDataStatic = loadAsyncComponent(() => import('./components/ChartDataStatic/index.vue'))
|
|
const ChartDataAjax = loadAsyncComponent(() => import('./components/ChartDataAjax/index.vue'))
|
|
const ChartDataPond = loadAsyncComponent(() => import('./components/ChartDataPond/index.vue'))
|
|
|
|
const { targetData } = useTargetData()
|
|
|
|
// 选项
|
|
const selectOptions: SelectCreateDataType[] = [
|
|
{
|
|
label: SelectCreateDataEnum.STATIC,
|
|
value: RequestDataTypeEnum.STATIC
|
|
},
|
|
{
|
|
label: SelectCreateDataEnum.AJAX,
|
|
value: RequestDataTypeEnum.AJAX
|
|
},
|
|
{
|
|
label: SelectCreateDataEnum.Pond,
|
|
value: RequestDataTypeEnum.Pond
|
|
}
|
|
]
|
|
|
|
// 无数据源
|
|
const isNotData = computed(() => {
|
|
return typeof targetData.value?.option?.dataset === 'undefined'
|
|
})
|
|
</script>
|