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