Explorar o código

fix: 设备日志排序

wzyyy %!s(int64=3) %!d(string=hai) anos
pai
achega
842778701c
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  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,
               },
             ],
           });