mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 08:12:49 +08:00
style: 修改请求键名 data 为 request
This commit is contained in:
parent
f612b62b0a
commit
410dc4fc58
@ -30,7 +30,7 @@ export const useChartDataFetch = (
|
||||
// 组件类型
|
||||
const { chartFrame } = targetComponent.chartConfig
|
||||
// 请求配置
|
||||
const { requestDataType, requestHttpType, requestUrl } = toRefs(targetComponent.data)
|
||||
const { requestDataType, requestHttpType, requestUrl } = toRefs(targetComponent.request)
|
||||
// 非请求类型
|
||||
if (requestDataType.value !== RequestDataTypeEnum.AJAX) return
|
||||
// 处理地址
|
||||
|
4
src/packages/index.d.ts
vendored
4
src/packages/index.d.ts
vendored
@ -27,9 +27,7 @@ export type ConfigType = {
|
||||
|
||||
// 数据请求
|
||||
interface requestConfig {
|
||||
data: RequestConfigType,
|
||||
// 暂时约定为数据存储区域(未使用)
|
||||
requestData: any
|
||||
request: RequestConfigType,
|
||||
}
|
||||
|
||||
// Echarts 数据类型
|
||||
|
@ -41,10 +41,8 @@ export class publicConfig implements PublicConfigType {
|
||||
// 动画
|
||||
animations: []
|
||||
}
|
||||
// 数据
|
||||
public data = { ...requestConfig }
|
||||
// 数据获取
|
||||
public requestData = []
|
||||
// 请求
|
||||
public request = { ...requestConfig }
|
||||
// 数据过滤
|
||||
public filter = undefined
|
||||
|
||||
|
@ -134,9 +134,10 @@ export enum ChartEditStoreEnum {
|
||||
export type RequestGlobalConfigType = {
|
||||
// 请求源地址
|
||||
requestOriginUrl?: string
|
||||
// 轮询时间
|
||||
// 全局默认轮询时间
|
||||
requestInterval: number
|
||||
}
|
||||
|
||||
// 单个图表请求配置
|
||||
export type RequestConfigType = {
|
||||
// 获取数据的方式
|
||||
@ -145,6 +146,8 @@ export type RequestConfigType = {
|
||||
requestHttpType: RequestHttpEnum
|
||||
// 源后续的 url
|
||||
requestUrl?: string
|
||||
// 组件定制轮询时间
|
||||
requestInterval: number
|
||||
}
|
||||
|
||||
// Store 类型
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="go-chart-configurations-data-ajax">
|
||||
<setting-item-box name="类型" :alone="true">
|
||||
<n-select v-model:value="targetData.data.requestHttpType" :options="selectOptions" />
|
||||
<n-select v-model:value="targetData.request.requestHttpType" :options="selectOptions" />
|
||||
</setting-item-box>
|
||||
|
||||
<setting-item-box name="源地址:" :alone="true">
|
||||
@ -25,7 +25,7 @@
|
||||
</ul>
|
||||
</n-tooltip>
|
||||
</template>
|
||||
<n-input v-model:value.trim="targetData.data.requestUrl" :min="1" placeholder="请输入地址(去除源)" />
|
||||
<n-input v-model:value.trim="targetData.request.requestUrl" :min="1" placeholder="请输入地址(去除源)" />
|
||||
</setting-item-box>
|
||||
|
||||
<setting-item-box :alone="true">
|
||||
@ -117,7 +117,7 @@ const selectOptions: SelectHttpType[] = [
|
||||
const sendHandle = async () => {
|
||||
loading.value = true
|
||||
if(!targetData.value) return
|
||||
const { requestUrl, requestHttpType } = targetData.value.data
|
||||
const { requestUrl, requestHttpType } = targetData.value.request
|
||||
if (!requestUrl) {
|
||||
window['$message'].warning('请求参数不正确,请检查!')
|
||||
return
|
||||
|
@ -118,7 +118,7 @@ const { uploadFileListRef, customRequest, beforeUpload, download } = useFile(tar
|
||||
|
||||
// 是否展示过滤器
|
||||
const filterShow = computed(() => {
|
||||
return targetData.value.data.requestDataType === RequestDataTypeEnum.AJAX
|
||||
return targetData.value.request.requestDataType === RequestDataTypeEnum.AJAX
|
||||
})
|
||||
|
||||
// 是图表类型
|
||||
|
@ -109,7 +109,7 @@ import cloneDeep from 'lodash/cloneDeep'
|
||||
const { DocumentTextIcon } = icon.ionicons5
|
||||
const { FilterIcon, FilterEditIcon } = icon.carbon
|
||||
const { targetData, chartEditStore } = useTargetData()
|
||||
const { requestDataType } = toRefs(targetData.value.data)
|
||||
const { requestDataType } = toRefs(targetData.value.request)
|
||||
const { requestOriginUrl } = toRefs(chartEditStore.getRequestGlobalConfig)
|
||||
|
||||
// 受控弹窗
|
||||
@ -124,7 +124,7 @@ const sourceData = ref<any>('')
|
||||
// 动态获取数据
|
||||
const fetchTargetData = async () => {
|
||||
try {
|
||||
const { requestUrl, requestHttpType } = targetData.value.data
|
||||
const { requestUrl, requestHttpType } = targetData.value.request
|
||||
if (!requestUrl) {
|
||||
window['$message'].warning('请求参数不正确,请检查!')
|
||||
sourceData.value = '请求参数不正确,请检查!'
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="go-chart-configurations-data" v-if="targetData">
|
||||
<setting-item-box name="请求方式" :alone="true">
|
||||
<n-select
|
||||
v-model:value="targetData.data.requestDataType"
|
||||
v-model:value="targetData.request.requestDataType"
|
||||
:options="selectOptions"
|
||||
/>
|
||||
</setting-item-box>
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
<!-- 静态 -->
|
||||
<chart-data-static
|
||||
v-if="targetData.data.requestDataType === RequestDataTypeEnum.STATIC"
|
||||
v-if="targetData.request.requestDataType === RequestDataTypeEnum.STATIC"
|
||||
></chart-data-static>
|
||||
|
||||
<!-- 动态 -->
|
||||
|
Loading…
Reference in New Issue
Block a user