Przeglądaj źródła

【值班系统】登录日志,列表,时长数据未显示单位,应按xx时xx分xx秒格式显示

CzRger 1 rok temu
rodzic
commit
695b319589
1 zmienionych plików z 21 dodań i 0 usunięć
  1. 21 0
      src/views/system/login-log/index.vue

+ 21 - 0
src/views/system/login-log/index.vue

@@ -69,6 +69,9 @@
             <template #exitTime-column-value="{ scope }">
               {{scope.row.exitTime ? $util.YMDHms(scope.row.exitTime) : scope.row.exitTime}}
             </template>
+            <template #duration-column-value="{ scope }">
+              {{scope.row.duration ? formatDuration(scope.row.duration) : scope.row.duration}}
+            </template>
           </CusTable>
         </template>
       </CusContent>
@@ -223,6 +226,23 @@ export default defineComponent({
         ElMessage.error('导出失败!')
       })
     }
+    const formatDuration = (second) => {
+      const f = that.$util.comTime(second * 1000)
+      let str = ''
+      if (f.d) {
+        str += f.d + '天'
+      }
+      if (f.h) {
+        str += f.h + '时'
+      }
+      if (f.m) {
+        str += f.m + '分'
+      }
+      if (f.s) {
+        str += f.s + '秒'
+      }
+      return str
+    }
     onMounted(() => {
       state.back_queryForm = JSON.parse(JSON.stringify(state.queryForm))
       initDictionary()
@@ -237,6 +257,7 @@ export default defineComponent({
       onSearch,
       onExport,
       refreshSearch,
+      formatDuration
     }
   },
 })