优化能量条数值处理并添加调试日志

- 添加parseNumericValue方法处理科学计数法、带符号和逗号格式的数值
- 优化EnergyBar组件的数值计算,支持各种数值格式
- 更新safePercent和getRibbonPercent方法使用新的数值解析
- 添加调试日志用于监控刷新时间和工作状态变化
- 解决合并冲突,保留能量条优化功能
This commit is contained in:
24kycj
2025-09-21 08:30:16 +08:00
parent 490aa06760
commit 606779f2b7
+4 -3
View File
@@ -1143,6 +1143,7 @@ export default {
this.doingWorkStatus = false this.doingWorkStatus = false
}, 10000) }, 10000)
this.timer2 = setInterval(this.getPrintData, this.refreshTime2) this.timer2 = setInterval(this.getPrintData, this.refreshTime2)
console.log(this.refreshTime1,this.refreshTime2)
}, },
beforeDestroy() { beforeDestroy() {
this.stopTimer() this.stopTimer()
@@ -1153,7 +1154,6 @@ export default {
return row.AssUuid ? 'ass-row' : '' return row.AssUuid ? 'ass-row' : ''
}, },
safePercent(value, total) { safePercent(value, total) {
console.log(value, total)
// 处理科学计数法、带符号和逗号的数值 // 处理科学计数法、带符号和逗号的数值
const v = this.parseNumericValue(value) const v = this.parseNumericValue(value)
const t = this.parseNumericValue(total) const t = this.parseNumericValue(total)
@@ -1816,7 +1816,6 @@ export default {
return isFinite(num) ? num : 0 return isFinite(num) ? num : 0
}, },
getRibbonPercent(current, total) { getRibbonPercent(current, total) {
console.log('current, total', current, total)
// 处理科学计数法、带符号和逗号的数值 // 处理科学计数法、带符号和逗号的数值
const c = this.parseNumericValue(current) const c = this.parseNumericValue(current)
const t = this.parseNumericValue(total) const t = this.parseNumericValue(total)
@@ -1988,11 +1987,13 @@ export default {
}, },
watch: { watch: {
hasDoingWork: { hasDoingWork: {
handler() { handler(val) {
console.log('hasDoingWork changed:', val)
if (this.hasDoingWork) { if (this.hasDoingWork) {
this.intervalTime = parseInt(this.refreshTime1) this.intervalTime = parseInt(this.refreshTime1)
clearInterval(this.timer1) clearInterval(this.timer1)
this.timer1 = setInterval(this.initData, this.intervalTime) this.timer1 = setInterval(this.initData, this.intervalTime)
console.log('hasDoingWork', this.intervalTime)
} else { } else {
this.intervalTime = parseInt(this.refreshTime2) this.intervalTime = parseInt(this.refreshTime2)
clearInterval(this.timer1) clearInterval(this.timer1)