停机时长修复
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())}`
|
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) {
|
function fmtDurationStr(val) {
|
||||||
if (val == null || val === '') return '—'
|
if (val == null || val === '') return '—'
|
||||||
const mins = Math.round(parseFloat(val))
|
const secs = parseFloat(val)
|
||||||
if (isNaN(mins)) return String(val)
|
if (isNaN(secs)) return String(val)
|
||||||
|
const mins = Math.round(secs / 60)
|
||||||
if (mins < 60) return `${mins}m`
|
if (mins < 60) return `${mins}m`
|
||||||
const h = Math.floor(mins / 60)
|
const h = Math.floor(mins / 60)
|
||||||
const m = mins % 60
|
const m = mins % 60
|
||||||
@@ -185,10 +186,10 @@ export default {
|
|||||||
fmtDate(val) { return fmtDateStr(val) },
|
fmtDate(val) { return fmtDateStr(val) },
|
||||||
fmtDuration(val) { return fmtDurationStr(val) },
|
fmtDuration(val) { return fmtDurationStr(val) },
|
||||||
durationCls(val) {
|
durationCls(val) {
|
||||||
const mins = parseFloat(val)
|
const secs = parseFloat(val)
|
||||||
if (isNaN(mins)) return ''
|
if (isNaN(secs)) return ''
|
||||||
if (mins >= 60) return 'dur-high'
|
if (secs >= 3600) return 'dur-high' // >= 1 小时
|
||||||
if (mins >= 15) return 'dur-mid'
|
if (secs >= 900) return 'dur-mid' // >= 15 分钟
|
||||||
return ''
|
return ''
|
||||||
},
|
},
|
||||||
stopTypeTag(type) {
|
stopTypeTag(type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user