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

@@ -46,7 +46,7 @@
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@change="crud.toQuery"
@change="mytoQuery"
/>
</el-form-item>
@@ -192,6 +192,7 @@ export default {
del: ['admin', 'inbill:del']
},
storlist: [],
query_flag: true,
tableDataDtl: [],
open_type: null,
lock_type: null,
@@ -214,6 +215,38 @@ export default {
this.initQuery()
},
methods: {
[CRUD.HOOK.beforeRefresh]() {
debugger
if (this.query_flag) {
const end = new Date()
const start = new Date()
const endYear = end.getFullYear()
var endMonth = end.getMonth() + 1
if (end.getMonth() + 1 < 10) {
endMonth = '0' + endMonth.toString()
}
var endDay = end.getDate()
if (end.getDate() < 10) {
endDay = '0' + endDay.toString()
}
const endDate = endYear + '-' + endMonth + '-' + endDay + ' 23:59:59'
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
const startYear = start.getFullYear()
var startMonth = start.getMonth() + 1
if (start.getMonth() + 1 < 10) {
startMonth = '0' + startMonth.toString()
}
var startDay = start.getDate()
if (start.getDate() < 10) {
startDay = '0' + startDay.toString()
}
const startDate = startYear + '-' + startMonth + '-' + startDay + ' 00:00:00'
this.crud.query.createTime = [startDate, endDate]
this.crud.query.begin_time = startDate
this.crud.query.end_time = endDate
this.query_flag = false
}
},
/* 搜索框创建时间默认最近一周*/
initQuery() {
const end = new Date()
@@ -240,6 +273,15 @@ export default {
}
const startDate = startYear + '-' + startMonth + '-' + startDay + ' 00:00:00'
this.$set(this.query, 'createTime', [startDate, endDate])
},
mytoQuery(array1) {
if (array1 === null) {
this.crud.query.begin_time = ''
this.crud.query.end_time = ''
} else {
this.crud.query.begin_time = array1[0]
this.crud.query.end_time = array1[1]
}
this.crud.toQuery()
},
addDialog(type) {

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

View File

@@ -38,7 +38,7 @@
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="query.createTime"
type="daterange"