Authored by 李奇

优化区间显示

... ... @@ -6,10 +6,15 @@
<Option :value="item.value" v-for="item in query.type" :key="item.value">{{item.label}}</Option>
</Select>
</filter-item>
<filter-item label="时间选择" v-if="filter.type == 4">
<filter-item label="时间区间" v-if="filter.type == 4">
<DatePicker type="datetimerange" @on-change="timeRangeChange" format="yyyy-MM-dd HH:mm:ss"
placeholder="开始时间-结束时间"
style="width: 260px"></DatePicker>
style="width: 300px"></DatePicker>
</filter-item>
<filter-item label="时间区间" v-if="filter.type == 1 || filter.type == 2 || filter.type == 3">
<DatePicker type="datetimerange" format="yyyy-MM-dd HH:mm:ss"
placeholder="开始时间-结束时间" :value="typeRangeVal"
style="width: 300px" disabled readonly></DatePicker>
</filter-item>
</layout-filter>
<layout-list>
... ... @@ -47,6 +52,7 @@ export default {
startTime: 0,
endTime: 0
},
typeRangeVal: [],
orderColumns: [
{
title: 'UID',
... ... @@ -99,6 +105,27 @@ export default {
getData() {
//1: 全部 2: 今天 3: 昨天 4: 最近一周 5: 自定义
let params = {type: this.filter.type};
let todayStart = new Date(new Date().toLocaleDateString()).getTime();
console.log(todayStart)
switch (+params.type) {
case 1:
this.typeRangeVal = [todayStart, todayStart + 24 * 60 * 60 * 1000 - 1000];
break;
case 2:
this.typeRangeVal = [todayStart - 24 * 60 * 60 * 1000, todayStart - 1000];
break;
case 3:
this.typeRangeVal = [todayStart - 6 * 24 * 60 * 60 * 1000, todayStart + 24 * 60 * 60 * 1000 - 1000];
break;
default:
break;
}
if (params.type === 4) {
let {startTime, endTime} = this.timeRange;
... ...