停机时长修复
This commit is contained in:
@@ -100,11 +100,12 @@ function fmtDateStr(val) {
|
||||
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
|
||||
}
|
||||
|
||||
// duration 单位为分钟,格式化为 Xh Ym 或 Ym
|
||||
// duration 单位为秒,格式化为 Xh Ym 或 Ym
|
||||
function fmtDurationStr(val) {
|
||||
if (val == null || val === '') return '—'
|
||||
const mins = Math.round(parseFloat(val))
|
||||
if (isNaN(mins)) return String(val)
|
||||
const secs = parseFloat(val)
|
||||
if (isNaN(secs)) return String(val)
|
||||
const mins = Math.round(secs / 60)
|
||||
if (mins < 60) return `${mins}m`
|
||||
const h = Math.floor(mins / 60)
|
||||
const m = mins % 60
|
||||
@@ -185,10 +186,10 @@ export default {
|
||||
fmtDate(val) { return fmtDateStr(val) },
|
||||
fmtDuration(val) { return fmtDurationStr(val) },
|
||||
durationCls(val) {
|
||||
const mins = parseFloat(val)
|
||||
if (isNaN(mins)) return ''
|
||||
if (mins >= 60) return 'dur-high'
|
||||
if (mins >= 15) return 'dur-mid'
|
||||
const secs = parseFloat(val)
|
||||
if (isNaN(secs)) return ''
|
||||
if (secs >= 3600) return 'dur-high' // >= 1 小时
|
||||
if (secs >= 900) return 'dur-mid' // >= 15 分钟
|
||||
return ''
|
||||
},
|
||||
stopTypeTag(type) {
|
||||
|
||||
Reference in New Issue
Block a user