From 21e282b2a6a9eebd40af997500cc98eef9b9d7cb Mon Sep 17 00:00:00 2001
From: xuhongjie <1943105267@qq.com>
Date: Tue, 22 Apr 2025 13:26:56 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=89=BE=E5=88=B0=E5=8A=A8=E6=80=81?=
=?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/AI/components/aiTable/index.vue | 2 +-
src/views/AI/components/issueQuey/index.vue | 4 +-
.../components/ChartDataAjax/index.vue | 102 ++++-----
.../components/ChartDataAjax/old.vue | 202 ++++++++++++++++++
.../components/ChartDataRequest/index.vue | 2 +-
.../components/ChartData/index.vue | 4 +-
.../chart/ContentEdit/hooks/useDrag.hook.ts | 15 +-
7 files changed, 263 insertions(+), 68 deletions(-)
create mode 100644 src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/old.vue
diff --git a/src/views/AI/components/aiTable/index.vue b/src/views/AI/components/aiTable/index.vue
index e863c31..5c59c72 100644
--- a/src/views/AI/components/aiTable/index.vue
+++ b/src/views/AI/components/aiTable/index.vue
@@ -7,7 +7,7 @@
- {{ valueItem }}
+ {{ valueItem }}{{obj.unit }}
diff --git a/src/views/AI/components/issueQuey/index.vue b/src/views/AI/components/issueQuey/index.vue
index 224e4e4..2199881 100644
--- a/src/views/AI/components/issueQuey/index.vue
+++ b/src/views/AI/components/issueQuey/index.vue
@@ -92,7 +92,9 @@ const getList = async () => {
try {
const res = await getIssue({
questionType: currentKey.value,
- userId:systemStore.userInfo.userId
+ userId:systemStore.userInfo.userId,
+ current:1,
+ size:100
})
if (res && res.data) {
queryList.value = res.data.records
diff --git a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/index.vue b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/index.vue
index c5e8acb..2c49952 100644
--- a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/index.vue
+++ b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/index.vue
@@ -1,52 +1,6 @@
-
-
-
-
- {{ targetData.request.requestContentType === RequestContentTypeEnum.DEFAULT ? '普通请求' : 'SQL请求' }}
-
-
-
-
-
-
-
-
-
- {{ SelectHttpTimeNameObj[targetData.request.requestIntervalUnit] }}
-
-
-
-
-
- {{ SelectHttpTimeNameObj[GlobalRequestIntervalUnit] }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -60,6 +14,7 @@
默认赋值给 dataset 字段
+
@@ -70,18 +25,10 @@
-
-
-
-
-
-
+
+
@@ -91,14 +38,22 @@ import { icon } from '@/plugins'
import { useDesignStore } from '@/store/modules/designStore/designStore'
import { SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
import { ChartDataRequest } from '../ChartDataRequest/index'
-import { RequestHttpEnum, ResultEnum, SelectHttpTimeNameObj, RequestContentTypeEnum } from '@/enums/httpEnum'
+import {
+ RequestHttpEnum,
+ ResultEnum,
+ SelectHttpTimeNameObj,
+ RequestContentTypeEnum,
+ RequestHttpIntervalEnum,
+ RequestDataTypeEnum,
+ RequestBodyEnum
+} from '@/enums/httpEnum'
import { chartDataUrl, rankListUrl, scrollBoardUrl, numberFloatUrl, numberIntUrl, textUrl, imageUrl } from '@/api/mock'
import { http, customizeHttp } from '@/api/http'
-import { SelectHttpType } from '../../index.d'
+import { SelectHttpType } from '../..'
import { ChartDataMatchingAndShow } from '../ChartDataMatchingAndShow'
import { useTargetData } from '../../../hooks/useTargetData.hook'
import { newFunctionHandle } from '@/utils'
-
+import { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
const { HelpOutlineIcon, FlashIcon, PulseIcon } = icon.ionicons5
const { targetData, chartEditStore } = useTargetData()
@@ -124,11 +79,36 @@ const requestModelHandle = () => {
// 发送请求
const sendHandle = async () => {
+
if (!targetData.value?.request) return
- loading.value = true
+ targetData.value.request = {
+ requestDataType: RequestDataTypeEnum.AJAX,
+ requestHttpType: RequestHttpEnum.POST,
+ requestUrl: '/project/zf',
+ requestInterval: 120,
+ requestIntervalUnit: RequestHttpIntervalEnum.SECOND,
+ requestContentType: RequestContentTypeEnum.DEFAULT,
+ requestParamsBodyType: RequestBodyEnum.FORM_DATA,
+ requestSQLContent: {
+ sql: 'select * from where'
+ },
+ requestParams: {
+ Body: {
+ 'form-data': {
+ prompt: '统计点检的状态分布情况,用饼图展示'
+ },
+ 'x-www-form-urlencoded': {},
+ json: '',
+ xml: ''
+ },
+ Header: {},
+ Params: {}
+ }
+ }
try {
const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.getRequestGlobalConfig))
loading.value = false
+ console.log(res,'ssssdddddddff')
if (res) {
const { data } = res
if (!data && !targetData.value.filter) {
diff --git a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/old.vue b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/old.vue
new file mode 100644
index 0000000..ae70bfe
--- /dev/null
+++ b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/old.vue
@@ -0,0 +1,202 @@
+
+
+
+
+
+
+ {{ targetData.request.requestContentType === RequestContentTypeEnum.DEFAULT ? '普通请求' : 'SQL请求' }}
+
+
+
+
+
+
+
+
+
+ {{ SelectHttpTimeNameObj[targetData.request.requestIntervalUnit] }}
+
+
+
+
+
+ {{ SelectHttpTimeNameObj[GlobalRequestIntervalUnit] }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 测试
+
+
+
+
+
+
+ 默认赋值给 dataset 字段
+
+
+
+
+
+
+
+
+ 发送请求
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataRequest/index.vue b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataRequest/index.vue
index 87a4d18..6f297ed 100644
--- a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataRequest/index.vue
+++ b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataRequest/index.vue
@@ -29,7 +29,7 @@
取消
- {{ saveBtnText || '保存 & 发送请求' }}
+ {{ saveBtnText || '111保存 & 发送请求' }}
diff --git a/src/views/chart/ContentConfigurations/components/ChartData/index.vue b/src/views/chart/ContentConfigurations/components/ChartData/index.vue
index a869a39..3f3d598 100644
--- a/src/views/chart/ContentConfigurations/components/ChartData/index.vue
+++ b/src/views/chart/ContentConfigurations/components/ChartData/index.vue
@@ -1,8 +1,8 @@
-
+
diff --git a/src/views/chart/ContentEdit/hooks/useDrag.hook.ts b/src/views/chart/ContentEdit/hooks/useDrag.hook.ts
index b0e2ccc..b40f245 100644
--- a/src/views/chart/ContentEdit/hooks/useDrag.hook.ts
+++ b/src/views/chart/ContentEdit/hooks/useDrag.hook.ts
@@ -24,11 +24,15 @@ export const dragHandle = async (e: DragEvent) => {
// 获取拖拽数据
const drayDataString = e!.dataTransfer!.getData(DragKeyEnum.DRAG_KEY)
+
+
if (!drayDataString) {
loadingFinish()
return
}
+ const chartsType = JSON.parse(drayDataString)
+
// 修改状态
chartEditStore.setEditCanvas(EditCanvasTypeEnum.IS_CREATE, false)
const dropData: Exclude = JSONParse(drayDataString)
@@ -37,14 +41,21 @@ export const dragHandle = async (e: DragEvent) => {
// 创建新图表组件
let newComponent: CreateComponentType = await createComponent(dropData)
-
+
if (dropData.redirectComponent) {
+
dropData.dataset && (newComponent.option.dataset = dropData.dataset)
newComponent.chartConfig.title = dropData.title
newComponent.chartConfig.chartFrame = dropData.chartFrame
}
+
//默认切换成动态请求
- newComponent.request.requestDataType =1
+ if(chartsType.package === 'Charts'){
+ newComponent.request.requestDataType =1
+ }else{
+ newComponent.request.requestDataType =0
+ }
+
console.log(newComponent,'创建新图表')
setComponentPosition(newComponent, e.offsetX - newComponent.attr.w / 2, e.offsetY - newComponent.attr.h / 2)
chartEditStore.addComponentList(newComponent, false, true)