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', url: '/api/data/history',
method: 'post', method: 'post',
data: data, data: data,
timeout: 60 * 1000,
}) })
} }

View File

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

View File

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