fix:任务查询时间带上时分秒
This commit is contained in:
@@ -83,7 +83,7 @@
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker
|
||||
v-model="query.createTime"
|
||||
type="daterange"
|
||||
type="datetimerange"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
@@ -269,16 +269,31 @@ export default {
|
||||
crudTask.getFinishType().then(data => {
|
||||
this.finishTypeList = data
|
||||
})
|
||||
const afterD = new Date(new Date().getTime() + 2 * 8.64E7)
|
||||
this.crud.query.createTime = [new Date().daysAgo(3), afterD]
|
||||
const today = new Date()
|
||||
const year = today.getFullYear()
|
||||
const month = String(today.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(today.getDate()).padStart(2, '0')
|
||||
|
||||
// 2. 构造固定时分秒的时间字符串(符合datetime-local格式)
|
||||
const startTime = `${year}-${month}-${day - 3} 00:00:00`
|
||||
const endTime = `${year}-${month}-${day} 23:59:59`
|
||||
this.crud.query.createTime = [startTime, endTime]
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
if (this.query_flag) {
|
||||
const afterD = new Date(new Date().getTime() + 2 * 8.64E7)
|
||||
this.crud.query.begin_time = (new Date().daysAgo(3)).strftime('%F', 'zh')
|
||||
this.crud.query.end_time = (afterD).strftime('%F', 'zh')
|
||||
const today = new Date()
|
||||
const year = today.getFullYear()
|
||||
const month = String(today.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(today.getDate()).padStart(2, '0')
|
||||
|
||||
// 2. 构造固定时分秒的时间字符串(符合datetime-local格式)
|
||||
const startTime = `${year}-${month}-${day - 3} 00:00:00`
|
||||
const endTime = `${year}-${month}-${day} 23:59:59`
|
||||
this.crud.query.createTime = [startTime, endTime]
|
||||
this.crud.query.begin_time = startTime
|
||||
this.crud.query.end_time = endTime
|
||||
this.query_flag = false
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user