时间查询
This commit is contained in:
parent
ea5cdade9e
commit
f9c3cb89fd
@ -95,8 +95,19 @@ export const useTable = (
|
||||
if (state.searchParam[key] || state.searchParam[key] === false || state.searchParam[key] === 0) {
|
||||
// 处理日期范围参数:如果是数组,拆分为 StartTime 和 EndTime
|
||||
if (Array.isArray(state.searchParam[key]) && state.searchParam[key].length === 2) {
|
||||
nowSearchParam['StartTime'] = state.searchParam[key][0];
|
||||
nowSearchParam['EndTime'] = state.searchParam[key][1];
|
||||
let startTime = state.searchParam[key][0];
|
||||
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 {
|
||||
nowSearchParam[key] = state.searchParam[key];
|
||||
}
|
||||
@ -104,6 +115,18 @@ export const useTable = (
|
||||
}
|
||||
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 更新分页信息
|
||||
|
||||
@ -17,9 +17,6 @@
|
||||
<el-tag :type="getAuditStatusType(scope.row.auditStatus)">
|
||||
{{ getAuditStatusText(scope.row.auditStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #ss="scope">
|
||||
|
||||
</template>
|
||||
<template #idCardImageUrl="scope">
|
||||
<PreviewImage
|
||||
@ -147,7 +144,7 @@ const columns = ref([
|
||||
],
|
||||
},
|
||||
{ prop: 'mobile', label: '联系电话', search: { el: 'input' } },
|
||||
{ prop: 'idCardImageUrl', label: '身份证' },
|
||||
{ prop: 'idCardImageUrl', label: '身份证', width: '130px' },
|
||||
{
|
||||
prop: 'auditStatus',
|
||||
label: '审核状态',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user