优化时间类型

This commit is contained in:
mkppo 2021-12-07 09:47:36 +08:00
parent e7489118c0
commit 8cb583e077

View File

@ -198,14 +198,14 @@ function datetimeMerge({ columns, item }: any) {
if (columns.find((e: any) => e.propertyName == "end" + key)) {
item.prop = key.toLocaleLowerCase();
item.label = item.prop == "time" ? "时间范围" : "日期范围";
const isTime = item.prop == "time";
item.label = isTime ? "时间范围" : "日期范围";
item.hook = "datetimeRange";
item.component = {
name: "el-date-picker",
props: {
type: item.prop == "time" ? "datetimerange" : "daterange",
valueFormat:
item.prop == "time" ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00",
type: isTime ? "datetimerange" : "daterange",
valueFormat: isTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00",
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]
}
};