feat--时间筛选器增加筛选维度

qianming 1 year ago
parent 392777c188
commit 15fa5d77c4

@ -20,6 +20,7 @@ import {
targetWidgetLinkageLogic, targetWidgetLinkageLogic,
} from "@/views/bigscreenDesigner/designer/linkageLogic"; } from "@/views/bigscreenDesigner/designer/linkageLogic";
import miment from 'miment' import miment from 'miment'
export default { export default {
name: "WidgetFormTime", name: "WidgetFormTime",
props: { props: {
@ -37,7 +38,7 @@ export default {
optionsData: {}, optionsData: {},
optionsSetup: {}, optionsSetup: {},
// //
datetimeRangePickerOptions:{ datetimeRangePickerOptions: {
shortcuts: [{ shortcuts: [{
text: '今天', text: '今天',
onClick(picker) { onClick(picker) {
@ -45,20 +46,20 @@ export default {
const end = new Date(new Date(new Date().getTime()).setHours(23, 59, 59, 999)); const end = new Date(new Date(new Date().getTime()).setHours(23, 59, 59, 999));
picker.$emit('pick', [start, end]); picker.$emit('pick', [start, end]);
} }
},{ }, {
text: '昨天', text: '昨天',
onClick(picker) { onClick(picker) {
const start=new Date(new Date(new Date().getTime()-24*60*60*1000).setHours(0, 0, 0, 0)); const start = new Date(new Date(new Date().getTime() - 24 * 60 * 60 * 1000).setHours(0, 0, 0, 0));
const end=new Date(new Date(new Date().getTime()-24*60*60*1000).setHours(23, 59, 59, 999)); const end = new Date(new Date(new Date().getTime() - 24 * 60 * 60 * 1000).setHours(23, 59, 59, 999));
picker.$emit('pick', [start, end]); picker.$emit('pick', [start, end]);
} }
},{ }, {
text: '最近一周', text: '最近一周',
onClick(picker) { onClick(picker) {
const end = new Date(new Date(new Date().getTime()).setHours(23, 59, 59, 999)); const end = new Date(new Date(new Date().getTime()).setHours(23, 59, 59, 999));
const start = new Date(new Date(new Date().getTime()+24*60*60*1000)); const start = new Date(new Date(new Date().getTime() + 24 * 60 * 60 * 1000));
start.setTime(miment().add(-6, 'DD').stamp()); start.setTime(miment().add(-6, 'DD').stamp());
new Date(start.setHours(0,0,0,0)); new Date(start.setHours(0, 0, 0, 0));
picker.$emit('pick', [start, end]); picker.$emit('pick', [start, end]);
} }
}, { }, {
@ -67,7 +68,7 @@ export default {
const end = new Date(new Date(new Date().getTime()).setHours(23, 59, 59, 999)); const end = new Date(new Date(new Date().getTime()).setHours(23, 59, 59, 999));
const start = new Date(); const start = new Date();
start.setTime(miment().add(-1, 'MM').stamp()); start.setTime(miment().add(-1, 'MM').stamp());
new Date(start.setHours(0,0,0,0)); new Date(start.setHours(0, 0, 0, 0));
picker.$emit('pick', [start, end]); picker.$emit('pick', [start, end]);
} }
}, { }, {
@ -76,7 +77,25 @@ export default {
const end = new Date(new Date(new Date().getTime()).setHours(23, 59, 59, 999)); const end = new Date(new Date(new Date().getTime()).setHours(23, 59, 59, 999));
const start = new Date(); const start = new Date();
start.setTime(miment().add(-3, 'MM').stamp()); start.setTime(miment().add(-3, 'MM').stamp());
new Date(start.setHours(0,0,0,0)); new Date(start.setHours(0, 0, 0, 0));
picker.$emit('pick', [start, end]);
}
}, {
text: '最近半年',
onClick(picker) {
const end = new Date(new Date(new Date().getTime()).setHours(23, 59, 59, 999));
const start = new Date();
start.setTime(miment().add(-6, 'MM').stamp());
new Date(start.setHours(0, 0, 0, 0));
picker.$emit('pick', [start, end]);
}
}, {
text: '最近一年',
onClick(picker) {
const end = new Date(new Date(new Date().getTime()).setHours(23, 59, 59, 999));
const start = new Date();
start.setTime(miment().add(-1, 'YY').stamp());
new Date(start.setHours(0, 0, 0, 0));
picker.$emit('pick', [start, end]); picker.$emit('pick', [start, end]);
} }
}], }],
@ -144,6 +163,7 @@ export default {
height: 100%; height: 100%;
background: inherit; background: inherit;
color: inherit; color: inherit;
&::placeholder { &::placeholder {
color: inherit; color: inherit;
} }

Loading…
Cancel
Save