database 模块日期筛选,默认一周
This commit is contained in:
parent
a6cb982a0f
commit
cf92cf8d73
|
@ -34,6 +34,7 @@
|
|||
<script>
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||
import { deleteAction, getAction } from '../../api/manage'
|
||||
import dateFormat from '@/components/jeecg/JEasyCron/format-date'
|
||||
|
||||
const columns = [
|
||||
{
|
||||
|
@ -169,8 +170,8 @@ export default {
|
|||
this.columns = columns
|
||||
return {
|
||||
queryParam: {
|
||||
station: '',
|
||||
detector: '',
|
||||
collectStart: this.getBeforeDate(6),
|
||||
collectStop: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'),
|
||||
},
|
||||
delParams: {
|
||||
sampleData: true,
|
||||
|
@ -185,10 +186,33 @@ export default {
|
|||
}
|
||||
},
|
||||
created() {
|
||||
// this.queryParam.collectStart = this.getBeforeDate(6)
|
||||
this.getStationList()
|
||||
this.getDetectorList()
|
||||
},
|
||||
methods: {
|
||||
// 获取n天前的日期
|
||||
getBeforeDate(n) {
|
||||
var n = n
|
||||
var d = new Date()
|
||||
var year = d.getFullYear()
|
||||
var mon = d.getMonth() + 1
|
||||
var day = d.getDate()
|
||||
if (day <= n) {
|
||||
if (mon > 1) {
|
||||
mon = mon - 1
|
||||
} else {
|
||||
year = year - 1
|
||||
mon = 12
|
||||
}
|
||||
}
|
||||
d.setDate(d.getDate() - n)
|
||||
year = d.getFullYear()
|
||||
mon = d.getMonth() + 1
|
||||
day = d.getDate()
|
||||
var s = year + '-' + (mon < 10 ? '0' + mon : mon) + '-' + (day < 10 ? '0' + day : day) + ' 00:00:00'
|
||||
return s
|
||||
},
|
||||
async getStationList() {
|
||||
try {
|
||||
const { success, result, message } = await getAction('/gardsStations/findPage', {
|
||||
|
|
Loading…
Reference in New Issue
Block a user