|
|
@ -228,7 +228,7 @@ export default { |
|
|
|
'form.month': function(val){ |
|
|
|
'form.month': function(val){ |
|
|
|
if(val){ |
|
|
|
if(val){ |
|
|
|
let unit = 24 * 60 * 60 * 1000 |
|
|
|
let unit = 24 * 60 * 60 * 1000 |
|
|
|
this.date = [this.formatDate('yyyy-MM-dd',new Date(new Date().getTime() - unit * 30 * val)),this.formatDate('yyyy-MM-dd',new Date(new Date().getTime() + unit))] |
|
|
|
this.date = [this.timestampToTimes(new Date(new Date().getTime() - unit * 30 * val)),this.timestampToTimes(new Date(new Date().getTime() + unit))] |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
this.date = [] |
|
|
|
this.date = [] |
|
|
|
} |
|
|
|
} |
|
|
@ -263,6 +263,16 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
timestampToTimes(timestamp) { |
|
|
|
|
|
|
|
var chinaStandard= timestamp; |
|
|
|
|
|
|
|
var date = new Date(chinaStandard); |
|
|
|
|
|
|
|
var y = date.getFullYear(); |
|
|
|
|
|
|
|
var m = date.getMonth() + 1; |
|
|
|
|
|
|
|
m = m < 10 ? ('0' + m) : m; |
|
|
|
|
|
|
|
var d = date.getDate(); |
|
|
|
|
|
|
|
d = d < 10 ? ('0' + d) : d; |
|
|
|
|
|
|
|
return y + '-' + m + '-' + d |
|
|
|
|
|
|
|
}, |
|
|
|
getData() { |
|
|
|
getData() { |
|
|
|
let data = { |
|
|
|
let data = { |
|
|
|
type: this.form.type, |
|
|
|
type: this.form.type, |
|
|
@ -282,10 +292,27 @@ export default { |
|
|
|
}).catch(res => {}); |
|
|
|
}).catch(res => {}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
initData(){ |
|
|
|
initData(){ |
|
|
|
|
|
|
|
if (this.form.month >0){ |
|
|
|
|
|
|
|
let num = this.form.month*30 |
|
|
|
|
|
|
|
let lastDay = this.getTimeByDay(num) //获取30天后的日期 |
|
|
|
|
|
|
|
let lastTime = this.formatTime(lastDay) |
|
|
|
|
|
|
|
let time = new Date() |
|
|
|
|
|
|
|
this.date = [this.timestampToTimes(time),lastTime] |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
this.date = [] |
|
|
|
|
|
|
|
} |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.page = 1 |
|
|
|
this.page = 1 |
|
|
|
this.getData() |
|
|
|
this.getData() |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
getTimeByDay(num) { |
|
|
|
|
|
|
|
let today = new Date().getTime() |
|
|
|
|
|
|
|
return today + 60 * 60 * 1000 * 24 * num; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
formatTime(time) { |
|
|
|
|
|
|
|
//new Date(time).toISOString() => 2019-02-23T08:40:35.825Z |
|
|
|
|
|
|
|
return new Date(time).toISOString().split('T')[0]; |
|
|
|
|
|
|
|
}, |
|
|
|
add(){ |
|
|
|
add(){ |
|
|
|
this.$router.push('add') |
|
|
|
this.$router.push('add') |
|
|
|
}, |
|
|
|
}, |
|
|
|