소스 검색

fix: 设备日志排序

wzyyy 3 년 전
부모
커밋
842778701c
1개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 1
      src/pages/device/Instance/Detail/Log/index.tsx

+ 7 - 1
src/pages/device/Instance/Detail/Log/index.tsx

@@ -109,12 +109,18 @@ const Log = () => {
           pageSize: 10,
         }}
         request={async (params, sort) => {
+          let sorts;
+          if (sort.timestamp) {
+            sorts = sort.timestamp === 'descend' ? 'desc' : 'asc';
+          } else {
+            sorts = 'desc';
+          }
           const res = await service.queryLog(InstanceModel.detail.id!, {
             ...params,
             sorts: [
               {
                 name: 'timestamp',
-                order: sort.timestamp === 'descend' ? 'desc' : 'asc',
+                order: sorts,
               },
             ],
           });