fix:合并代码后部分SQL不兼容shardingsphereSQL
This commit is contained in:
@@ -273,32 +273,41 @@ export default {
|
||||
const today = new Date()
|
||||
const threeDaysAgo = new Date(today)
|
||||
threeDaysAgo.setDate(today.getDate() - 3)
|
||||
const year = today.getFullYear()
|
||||
const month = String(today.getMonth() + 1).padStart(2, '0')
|
||||
const beforeDay = String(threeDaysAgo.getDate()).padStart(2, '0')
|
||||
const day = String(today.getDate()).padStart(2, '0')
|
||||
// 从 threeDaysAgo 提取完整日期信息
|
||||
const beforeYear = threeDaysAgo.getFullYear();
|
||||
const beforeMonth = String(threeDaysAgo.getMonth() + 1).padStart(2, '0');
|
||||
const beforeDay = String(threeDaysAgo.getDate()).padStart(2, '0');
|
||||
|
||||
// 2. 构造固定时分秒的时间字符串(符合datetime-local格式)
|
||||
const startTime = `${year}-${month}-${beforeDay} 00:00:00`
|
||||
const endTime = `${year}-${month}-${day} 23:59:59`
|
||||
// 从 today 提取完整日期信息
|
||||
const currentYear = today.getFullYear();
|
||||
const currentMonth = String(today.getMonth() + 1).padStart(2, '0');
|
||||
const currentDay = String(today.getDate()).padStart(2, '0');
|
||||
|
||||
// 构造正确的时间范围
|
||||
const startTime = `${beforeYear}-${beforeMonth}-${beforeDay} 00:00:00`;
|
||||
const endTime = `${currentYear}-${currentMonth}-${currentDay} 23:59:59`;
|
||||
this.crud.query.createTime = [startTime, endTime]
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
debugger
|
||||
if (this.query_flag) {
|
||||
const today = new Date()
|
||||
const threeDaysAgo = new Date(today) // 复制今天日期,避免修改原对象
|
||||
threeDaysAgo.setDate(today.getDate() - 3) // 正确减去3天
|
||||
const year = today.getFullYear()
|
||||
const month = String(today.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(today.getDate()).padStart(2, '0')
|
||||
const beforeDay = String(threeDaysAgo.getDate()).padStart(2, '0')
|
||||
const threeDaysAgo = new Date(today)
|
||||
threeDaysAgo.setDate(today.getDate() - 3)
|
||||
// 从 threeDaysAgo 提取完整日期信息
|
||||
const beforeYear = threeDaysAgo.getFullYear();
|
||||
const beforeMonth = String(threeDaysAgo.getMonth() + 1).padStart(2, '0');
|
||||
const beforeDay = String(threeDaysAgo.getDate()).padStart(2, '0');
|
||||
|
||||
// 2. 构造固定时分秒的时间字符串(符合datetime-local格式)
|
||||
const startTime = `${year}-${month}-${beforeDay} 00:00:00`
|
||||
const endTime = `${year}-${month}-${day} 23:59:59`
|
||||
// 从 today 提取完整日期信息
|
||||
const currentYear = today.getFullYear();
|
||||
const currentMonth = String(today.getMonth() + 1).padStart(2, '0');
|
||||
const currentDay = String(today.getDate()).padStart(2, '0');
|
||||
|
||||
// 构造正确的时间范围
|
||||
const startTime = `${beforeYear}-${beforeMonth}-${beforeDay} 00:00:00`;
|
||||
const endTime = `${currentYear}-${currentMonth}-${currentDay} 23:59:59`;
|
||||
this.crud.query.createTime = [startTime, endTime]
|
||||
this.crud.query.begin_time = startTime
|
||||
this.crud.query.end_time = endTime
|
||||
|
||||
Reference in New Issue
Block a user