两位小数
This commit is contained in:
parent
f2b50e5b80
commit
09a71eefd3
@ -442,50 +442,54 @@ 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)
|
||||||
if (res.code == 200) {
|
.then((res) => {
|
||||||
const result = res.data
|
if (res.code == 200) {
|
||||||
if (Object.keys(result)?.length) {
|
const result = res.data
|
||||||
const realResult = result[windBlowerValue.value]
|
if (Object.keys(result)?.length) {
|
||||||
let tableData = [] as any
|
const realResult = result[windBlowerValue.value]
|
||||||
attributeCodes.forEach((item: any) => {
|
let tableData = [] as any
|
||||||
if (Object.keys(realResult).includes(item)) {
|
attributeCodes.forEach((item: any) => {
|
||||||
tableData.push({
|
if (Object.keys(realResult).includes(item)) {
|
||||||
name: item,
|
tableData.push({
|
||||||
times: realResult[item].times,
|
name: item,
|
||||||
value: realResult[item].values.map((val: any) => (val === 0 ? 0 : val.toFixed(2))),
|
times: realResult[item].times,
|
||||||
|
value: realResult[item].values.map((val: any) => (val === 0 ? 0 : val?.toFixed(2))),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const processedData = new Map()
|
||||||
|
idCounter.value = 0
|
||||||
|
if (tableData.length) {
|
||||||
|
tableData.forEach(({ name, times, value }: any) => {
|
||||||
|
times.forEach((time: number, index: number) => {
|
||||||
|
if (!processedData.has(time)) {
|
||||||
|
processedData.set(time, { id: idCounter.value++, time: timestampToTime(time) })
|
||||||
|
}
|
||||||
|
const values = value[index]
|
||||||
|
processedData.get(time)[name] = enumStore.keys.includes(name) ? enumStore.data?.[name]?.[values] : values
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
reportTableData.value = Array.from(processedData.values())
|
||||||
const processedData = new Map()
|
if (!reportTableData.value.length) {
|
||||||
idCounter.value = 0
|
ElMessage.warning('查询数据为空!')
|
||||||
if (tableData.length) {
|
reportTableData.value = []
|
||||||
tableData.forEach(({ name, times, value }: any) => {
|
}
|
||||||
times.forEach((time: number, index: number) => {
|
reportLoading.value = false
|
||||||
if (!processedData.has(time)) {
|
} else {
|
||||||
processedData.set(time, { id: idCounter.value++, time: timestampToTime(time) })
|
|
||||||
}
|
|
||||||
const values = value[index]
|
|
||||||
processedData.get(time)[name] = enumStore.keys.includes(name) ? enumStore.data?.[name]?.[values] : values
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
reportTableData.value = Array.from(processedData.values())
|
|
||||||
if (!reportTableData.value.length) {
|
|
||||||
ElMessage.warning('查询数据为空!')
|
ElMessage.warning('查询数据为空!')
|
||||||
reportTableData.value = []
|
reportTableData.value = []
|
||||||
|
reportLoading.value = false
|
||||||
}
|
}
|
||||||
reportLoading.value = false
|
|
||||||
} else {
|
} else {
|
||||||
ElMessage.warning('查询数据为空!')
|
|
||||||
reportTableData.value = []
|
|
||||||
reportLoading.value = false
|
reportLoading.value = false
|
||||||
|
ElMessage.warning('查询失败')
|
||||||
}
|
}
|
||||||
} else {
|
})
|
||||||
|
.finally(() => {
|
||||||
reportLoading.value = false
|
reportLoading.value = false
|
||||||
ElMessage.warning('查询失败')
|
})
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 时间转换
|
// 时间转换
|
||||||
|
Loading…
Reference in New Issue
Block a user