fix:合并代码后部分SQL不兼容shardingsphereSQL

This commit is contained in:
zhouz
2026-02-04 09:55:30 +08:00
parent 8bc1783734
commit 0ff15043b9
15 changed files with 219 additions and 82 deletions

View File

@@ -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