From 0674a1bcf5f1a28f2606298fbb2bc7a61fa0e0ae Mon Sep 17 00:00:00 2001 From: betaqi <3188864257@qq.com> Date: Tue, 21 Oct 2025 14:10:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=82=B9=E4=BD=8D=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E7=BC=BA=E5=B0=91deviceType=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/path/dataSource/index.ts | 123 +++++++++++++++++- .../RequestDataSourceConfig/index.vue | 14 +- 2 files changed, 132 insertions(+), 5 deletions(-) diff --git a/src/api/path/dataSource/index.ts b/src/api/path/dataSource/index.ts index 4ab5544..877c6de 100644 --- a/src/api/path/dataSource/index.ts +++ b/src/api/path/dataSource/index.ts @@ -7,6 +7,121 @@ import { StorageEnum } from "@/enums/storageEnum"; import { SystemStoreEnum } from '@/store/modules/systemStore/systemStore.d' import { SelectDataSourceTypeAPIObj } from "@/enums/dataSourceEnum"; +const testData = { + "code": 0, + "msg": "", + "data": { + "dimensions": [ + "c_40136", + "c_40138", + "_ts" + ], + "source": [ + { + "c_40136": 24.93, + "c_40138": 11.31, + "_ts": 1753977600000 + }, + { + "c_40136": 24.94, + "c_40138": 11.31, + "_ts": 1753977720000 + }, + { + "c_40136": 24.94, + "c_40138": 11.31, + "_ts": 1753977840000 + }, + { + "c_40136": 24.95, + "c_40138": 11.31, + "_ts": 1753977960000 + }, + { + "c_40136": 24.96, + "c_40138": 11.31, + "_ts": 1753978080000 + }, + { + "c_40136": 24.97, + "c_40138": 11.31, + "_ts": 1753978200000 + }, + { + "c_40136": 24.98, + "c_40138": 11.31, + "_ts": 1753978320000 + }, + { + "c_40136": 24.99, + "c_40138": 11.31, + "_ts": 1753978440000 + }, + { + "c_40136": 25, + "c_40138": 11.31, + "_ts": 1753978560000 + }, + + + { + "c_40136": 27.45, + "c_40138": 11.51, + "_ts": 1754038560000 + }, + { + "c_40136": 27.45, + "c_40138": 11.51, + "_ts": 1754038680000 + }, + { + "c_40136": 27.45, + "c_40138": 11.52, + "_ts": 1754038800000 + }, + { + "c_40136": 27.45, + "c_40138": 11.52, + "_ts": 1754038920000 + }, + { + "c_40136": 27.45, + "c_40138": 11.52, + "_ts": 1754039040000 + }, + { + "c_40136": 27.45, + "c_40138": 11.53, + "_ts": 1754039160000 + }, + { + "c_40136": 27.45, + "c_40138": 11.53, + "_ts": 1754039280000 + }, + { + "c_40136": 27.45, + "c_40138": 11.54, + "_ts": 1754039400000 + }, + { + "c_40136": 27.45, + "c_40138": 11.54, + "_ts": 1754039520000 + }, + { + "c_40136": 27.45, + "c_40138": 11.55, + "_ts": 1754039640000 + }, + { + "c_40136": 27.45, + "c_40138": 11.55, + "_ts": 1754039760000 + } + ] +} +} /* * 获取站点 */ @@ -105,7 +220,8 @@ function getPointParams(requestSource:RequestDataSourceConfig) { queryType: SelectDataSourceTypeAPIObj[requestSource.dataSourceType], site: requestSource.station, with: requestSource.recentTimeRange, - deviceSn: String(requestSource.device), + deviceSn: requestSource.device.split('|')[0], + deviceType: requestSource.device.split('|')[1], points: requestSource.points, tenantId: getToken() } @@ -136,6 +252,11 @@ export const fetchDataByIot = async (requestSource:RequestDataSourceConfig) => { try { return await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.DATA}/get-by-iot`, params) + // await specialCustomizeHttp({ + // url: `${ModuleTypeEnum.DATA}/get-by-iot`, + // method: 'POST', + // params + // }) } catch { httpErrorHandle() } diff --git a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataRequest/components/RequestDataSourceConfig/index.vue b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataRequest/components/RequestDataSourceConfig/index.vue index 00b344a..a019f31 100644 --- a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataRequest/components/RequestDataSourceConfig/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataRequest/components/RequestDataSourceConfig/index.vue @@ -51,7 +51,7 @@ expand-trigger="click" :options="deviceList" label-field="name" - value-field="sn" + value-field="snAndType" check-strategy="all" :leaf-only="false" @update:value="handleDeviceChange" @@ -159,7 +159,13 @@ async function loadDevicesData() { siteId: props.targetDataSourceRequest.station }) if (res && res.code === 0 && Array.isArray(res.data)) { - deviceList.value = res.data + deviceList.value = res.data.map((item,index) => ({ + ...item, + snAndType: `${item?.sn ?? `not found sn in ${item.name}`}|${item?.type ?? + `not found type in ${ + item.name + }`}`, + })) } else { window['$message'].error('设备列表数据获取失败!') } @@ -178,8 +184,8 @@ function handleDeviceChange () { const pointList = ref([]) async function loadPointsData(){ - const findDeviceId = deviceList.value.find((device: any) => device.sn === - props.targetDataSourceRequest.device).id + const curDeviceSn = props.targetDataSourceRequest.device.split('|')[0] ?? '' + const findDeviceId = deviceList.value.find((device: any) => device.sn === curDeviceSn).id if (!findDeviceId) { pointList.value = [] return