Browse Source

feat: 点位请求缺少deviceType 问题

main
betaqi 2 weeks ago
parent
commit
0674a1bcf5
  1. 123
      src/api/path/dataSource/index.ts
  2. 14
      src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataRequest/components/RequestDataSourceConfig/index.vue

123
src/api/path/dataSource/index.ts

@ -7,6 +7,121 @@ import { StorageEnum } from "@/enums/storageEnum"; @@ -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) { @@ -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) => { @@ -136,6 +252,11 @@ export const fetchDataByIot = async (requestSource:RequestDataSourceConfig) => {
try {
return await http(RequestHttpEnum.POST)<ProjectDetail>(`${ModuleTypeEnum.DATA}/get-by-iot`, params)
// await specialCustomizeHttp({
// url: `${ModuleTypeEnum.DATA}/get-by-iot`,
// method: 'POST',
// params
// })
} catch {
httpErrorHandle()
}

14
src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataRequest/components/RequestDataSourceConfig/index.vue

@ -51,7 +51,7 @@ @@ -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() { @@ -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 () { @@ -178,8 +184,8 @@ function handleDeviceChange () {
const pointList = ref<any>([])
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

Loading…
Cancel
Save