点位图表数据名称、时间限制

This commit is contained in:
白菜
2025-09-26 17:34:12 +08:00
parent 506cf28c96
commit 6600a5db7a
3 changed files with 10 additions and 8 deletions

View File

@ -83,13 +83,15 @@ export default {
if(this.dateRange && this.dateRange.length>0){
const {dataUnit} = this
const [start,end] = this.dateRange
const startTime = new Date(start),endTime=new Date(end)
const timeDis= dataUnit === 3? 30 * 24 * 60 * 60 * 1000 :dataUnit === 2 ? 24 * 60 * 60 * 1000 : 60 * 60 * 1000
if(endTime - startTime > timeDis){
this.$message.error(`时间范围不能超过${dataUnit === 3 ? '30天' : dataUnit === 2 ? '24小时' : '1小时'}`)
}else{
this.$emit('updateDate',this.dateRange || [])
if([1,2].includes(dataUnit)){
const startTime = new Date(start),endTime=new Date(end)
const timeDis= 7 * 24 * 60 * 60 * 1000
if(endTime - startTime > timeDis){
this.$message.error(`按分钟或小时查询数据,时间范围不能超过7天`)
return
}
}
this.$emit('updateDate',this.dateRange || [])
}else{
this.$emit('updateDate',this.dateRange || [])
}