Browse Source

能耗统计

master
songguoqiang 11 months ago
parent
commit
7a5788af7d
  1. 22
      src/views/tjanalysis/energyconsumption/index.vue

22
src/views/tjanalysis/energyconsumption/index.vue

@ -10,6 +10,8 @@
end-placeholder="结束日期"
start-placeholder="开始日期"
type="daterange"
:disabled-date="disabledDate"
@change="changeTime"
/>
</el-form-item>
<el-form-item label="位置" prop="flag">
@ -58,6 +60,7 @@
import * as TjanalysisApi from '@/api/tjanalysis'
import { formatDate } from '@/utils/formatTime'
import * as DictApi from '@/utils/dict'
import dayjs from 'dayjs'
defineOptions({ name: 'energyconsumption' })
@ -184,6 +187,25 @@ onMounted(async () => {
getList()
})
function disabledDate(time){
//
var currentDate = new Date();
// 30
currentDate.setDate(currentDate.getDate() - 30);
return time.getTime() >= Date.now();
// let range = [dayjs(queryParams.dateRange[0]).subtract(30, 'day'),dayjs(queryParams.dateRange[0]).subtract(30, 'day')];
// let cur = dayjs(time);
// return time > range[0] || time < range[1];
}
function changeTime(val) {
if (new Date(val[1]) - new Date(val[0]) > 1 * 24 * 60 * 60 * 1000 * 31) {
message.alert("选择时间范围不能大于31天");
queryParams.dateRange = [val[0],val[0]];
}
}
</script>
<style>

Loading…
Cancel
Save