This commit is contained in:
高云鹏 2024-12-02 11:09:17 +08:00
commit 4919824e14
3 changed files with 51 additions and 35 deletions

View File

@ -12,6 +12,7 @@ export const historyReq = (data: any) => {
url: '/api/data/history',
method: 'post',
data: data,
timeout: 60 * 1000,
})
}

View File

@ -442,7 +442,8 @@ const queryHistoryData = () => {
startTime: new Date(timeRange.value[0]).getTime(),
endTime: new Date(timeRange.value[1]).getTime(),
} as any
historyReq(requestData).then((res) => {
historyReq(requestData)
.then((res) => {
if (res.code == 200) {
const result = res.data
if (Object.keys(result)?.length) {
@ -453,7 +454,7 @@ const queryHistoryData = () => {
tableData.push({
name: item,
times: realResult[item].times,
value: realResult[item].values.map((val: any) => (val === 0 ? 0 : val.toFixed(2))),
value: realResult[item].values.map((val: any) => (val === 0 ? 0 : val?.toFixed(2))),
})
}
})
@ -486,6 +487,9 @@ const queryHistoryData = () => {
ElMessage.warning('查询失败')
}
})
.finally(() => {
reportLoading.value = false
})
}
//

View File

@ -135,6 +135,9 @@ const switchTime = (index: number) => {
}
times.splice(index, 1)
customName.splice(index, 1)
customName.forEach((item: any, index: number, arr: any) => {
arr[index] = statAnalysisSelect.attributes + String(index + 1)
})
}
const timechange = (value: any) => {
if (times.length) {
@ -148,11 +151,18 @@ const timechange = (value: any) => {
return
} else {
times.push(value)
customName.push(statAnalysisSelect.attributes + times.length)
customName.forEach((item: any, index: number, arr: any) => {
arr[index] = statAnalysisSelect.attributes + String(index + 1)
})
}
} else {
times.push(value)
customName.push(statAnalysisSelect.attributes + times.length)
customName.forEach((item: any, index: number, arr: any) => {
arr[index] = statAnalysisSelect.attributes + String(index + 1)
})
}
}
@ -160,6 +170,7 @@ const showTime = ref(false)
const clearList = () => {
times.length = 0
time.value = []
customName.length = 0
}
const iotModelId = ref('')