时间查询

This commit is contained in:
马梓彭 2026-04-12 17:51:09 +08:00
parent ea5cdade9e
commit f9c3cb89fd
2 changed files with 26 additions and 6 deletions

View File

@ -95,8 +95,19 @@ export const useTable = (
if (state.searchParam[key] || state.searchParam[key] === false || state.searchParam[key] === 0) { if (state.searchParam[key] || state.searchParam[key] === false || state.searchParam[key] === 0) {
// 处理日期范围参数:如果是数组,拆分为 StartTime 和 EndTime // 处理日期范围参数:如果是数组,拆分为 StartTime 和 EndTime
if (Array.isArray(state.searchParam[key]) && state.searchParam[key].length === 2) { if (Array.isArray(state.searchParam[key]) && state.searchParam[key].length === 2) {
nowSearchParam['StartTime'] = state.searchParam[key][0]; let startTime = state.searchParam[key][0];
nowSearchParam['EndTime'] = state.searchParam[key][1]; let endTime = state.searchParam[key][1];
// 如果是 Date 对象,格式化为本地日期字符串,避免时区转换问题
if (startTime instanceof Date) {
startTime = formatLocalDate(startTime);
}
if (endTime instanceof Date) {
endTime = formatLocalDate(endTime);
}
nowSearchParam['StartTime'] = startTime;
nowSearchParam['EndTime'] = endTime;
} else { } else {
nowSearchParam[key] = state.searchParam[key]; nowSearchParam[key] = state.searchParam[key];
} }
@ -105,6 +116,18 @@ export const useTable = (
Object.assign(state.totalParam, nowSearchParam, isPageable ? pageParam.value : {}); Object.assign(state.totalParam, nowSearchParam, isPageable ? pageParam.value : {});
}; };
/**
* @description 格式化日期为本地日期字符串,避免时区转换
* @param date Date 对象
* @returns YYYY-MM-DD 格式的字符串
* */
const formatLocalDate = (date: Date): string => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
};
/** /**
* @description 更新分页信息 * @description 更新分页信息
* @param {Object} resPageable 后台返回的分页数据 * @param {Object} resPageable 后台返回的分页数据

View File

@ -17,9 +17,6 @@
<el-tag :type="getAuditStatusType(scope.row.auditStatus)"> <el-tag :type="getAuditStatusType(scope.row.auditStatus)">
{{ getAuditStatusText(scope.row.auditStatus) }} {{ getAuditStatusText(scope.row.auditStatus) }}
</el-tag> </el-tag>
</template>
<template #ss="scope">
</template> </template>
<template #idCardImageUrl="scope"> <template #idCardImageUrl="scope">
<PreviewImage <PreviewImage
@ -147,7 +144,7 @@ const columns = ref([
], ],
}, },
{ prop: 'mobile', label: '联系电话', search: { el: 'input' } }, { prop: 'mobile', label: '联系电话', search: { el: 'input' } },
{ prop: 'idCardImageUrl', label: '身份证' }, { prop: 'idCardImageUrl', label: '身份证', width: '130px' },
{ {
prop: 'auditStatus', prop: 'auditStatus',
label: '审核状态', label: '审核状态',