perf: 日志列表过滤及导出

This commit is contained in:
fit2cloud-chenyw 2024-01-23 17:43:41 +08:00
parent ae9de856ce
commit 3169c79971
6 changed files with 42 additions and 5 deletions

View File

@ -21,7 +21,7 @@ const emits = defineEmits(['filter-change'])
const selectStatus = ids => {
emits(
'filter-change',
ids.map(item => item.label)
ids.map(item => item.id || item.value)
)
}

View File

@ -25,6 +25,12 @@ const valueTextFormTree = (val, options) => {
}
return result || val
}
const timestampFormatDate = value => {
if (!value) {
return '-'
}
return new Date(value)['format']()
}
const valueText = (field, val, options) => {
for (let index = 0; index < options.length; index++) {
const element = options[index]
@ -41,6 +47,9 @@ const valueText = (field, val, options) => {
return item.name || item.label
}
}
if (element.type === 'time') {
return timestampFormatDate(val)
}
if (isTree) {
return valueTextFormTree(val, selectOption)
}

@ -1 +1 @@
Subproject commit a30164b304688249585d2d9af53502a3a67211d2
Subproject commit 217f54b5a74178cb1de0b9daed983ea78bf48578

View File

@ -11,11 +11,13 @@ import java.util.List;
@Data
public class LogGridRequest extends KeywordRequest implements Serializable {
private String op;
private List<String> op;
private Long uid;
private List<Long> uid;
private Long oid;
private List<Long> oid;
private List<Long> time;
private Boolean timeDesc = true;
}

View File

@ -156,4 +156,8 @@ public interface UserApi {
@Hidden
@GetMapping("/queryByAccount")
CurUserVO queryByAccount(String account);
@Hidden
@PostMapping("/all")
List<UserItem> allUser(@RequestBody KeywordRequest request);
}

View File

@ -0,0 +1,22 @@
package io.dataease.utils;
import org.apache.commons.lang3.StringUtils;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
public class DateUtils {
public static String time2String(Long time, String pattern) {
if (StringUtils.isBlank(pattern)) pattern = "yyyy-MM-dd HH:mm:ss";
DateTimeFormatter format = DateTimeFormatter.ofPattern(pattern);
LocalDateTime timeByMilli = Instant.ofEpochMilli(time).atZone(ZoneId.of("Asia/Shanghai")).toLocalDateTime();
return format.format(timeByMilli);
}
public static String time2String(Long time) {
String pattern = "yyyy-MM-dd HH:mm:ss";
return time2String(time, pattern);
}
}