smart-car-web/src/views/device/location/config.js

33 lines
1.4 KiB
JavaScript

export const formLabel = [
{
isShow: false, // 是否展示label
f_type: 'dateTimeRange',
f_label: '时间选择',
f_model: 'timeRange',
f_width: '400px',
dateType: ['startTime', 'endTime'],
valueFormat: 'yyyy-MM-dd HH:mm',
// 默认时间设置,可以是数组 [startTime, endTime] 或函数返回数组
// 函数形式:() => [startTime, endTime],支持动态计算
defaultValue: () => {
// 默认设置为当天00:00到23:59
const now = new Date()
const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0)
const todayEnd = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59)
const formatTime = (date) => {
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}`
}
return [formatTime(todayStart), formatTime(todayEnd)]
},
},
]
export const columnsList = [
{ t_props: 'locationTime', t_label: '时间' },
{ t_props: 'locationName', t_label: '地点' },
]