修改bug
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
<!-- 实际值:根据 实际值≥目标值 动态绑定类名 -->
|
||||
<div class="right">
|
||||
<div class="number" :class="{
|
||||
'number-exceed': item.currentValue >= item.targetValue,
|
||||
'number-below': item.currentValue < item.targetValue
|
||||
'number-exceed': item.progress >= 100,
|
||||
'number-below': item.progress < 100
|
||||
}">
|
||||
{{ item.currentValue }}
|
||||
</div>
|
||||
@@ -27,8 +27,8 @@
|
||||
<div class="progress-group">
|
||||
<div class="progress-container">
|
||||
<div class="progress-bar" :style="{ width: item.progressWidth + '%' }" :class="{
|
||||
'bar-exceed': item.currentValue >= item.targetValue,
|
||||
'bar-below': item.currentValue < item.targetValue
|
||||
'bar-exceed': item.progress >= 100,
|
||||
'bar-below': item.progress < 100
|
||||
}"></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -36,14 +36,14 @@
|
||||
<!-- 完成率:同步绑定类名 -->
|
||||
<div class="yield" style="display: flex;justify-content: space-between;">
|
||||
<div class="progress-percent" :class="{
|
||||
'percent-exceed': item.currentValue >= item.targetValue,
|
||||
'percent-below': item.currentValue < item.targetValue
|
||||
'percent-exceed': item.progress >= 100,
|
||||
'percent-below': item.progress < 100
|
||||
}">完成率</div>
|
||||
<div class="progress-percent" :class="{
|
||||
'percent-exceed': item.currentValue >= item.targetValue,
|
||||
'percent-below': item.currentValue < item.targetValue
|
||||
'percent-exceed': item.progress >= 100,
|
||||
'percent-below': item.progress < 100
|
||||
}">
|
||||
{{ item.progressDisplay }}
|
||||
{{ item.progress }}%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -62,9 +62,9 @@
|
||||
<!-- 实际值:根据与目标值的比较动态变色 -->
|
||||
<div class="right">
|
||||
<div class="number" :class="{
|
||||
'exceed-target': item.currentValue > item.targetValue,
|
||||
'below-target': item.currentValue < item.targetValue,
|
||||
'equal-target': item.currentValue === item.targetValue
|
||||
'exceed-target': item.progress > 100,
|
||||
'below-target': item.progress < 100,
|
||||
'equal-target': item.progress == 100
|
||||
}">
|
||||
{{ item.currentValue }}
|
||||
</div>
|
||||
@@ -75,17 +75,17 @@
|
||||
<div class="progress-group">
|
||||
<div class="progress-container">
|
||||
<div class="progress-bar" :style="{ width: item.progress + '%' }" :class="{
|
||||
'exceed-pro-target': item.currentValue > item.targetValue,
|
||||
'below-pro-target': item.currentValue < item.targetValue,
|
||||
'equal-pro-target': item.currentValue === item.targetValue
|
||||
'exceed-pro-target': item.progress > 100,
|
||||
'below-pro-target': item.progress < 100,
|
||||
'equal-pro-target': item.progress == 100
|
||||
}"></div>
|
||||
</div>
|
||||
<div class="progress-percent" :class="{
|
||||
'exceed-target': item.currentValue > item.targetValue,
|
||||
'below-target': item.currentValue < item.targetValue,
|
||||
'equal-target': item.currentValue === item.targetValue
|
||||
'exceed-target': item.progress > 100,
|
||||
'below-target': item.progress < 100,
|
||||
'equal-target': item.progress == 100
|
||||
}">
|
||||
{{ item.progressDisplay }}
|
||||
{{ item.progress }}%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -226,7 +226,7 @@ export default {
|
||||
// 额外兜底:避免data中的属性为undefined
|
||||
const target = data.target || 0;
|
||||
const real = data.real || 0;
|
||||
const rate = data.rate || '0%';
|
||||
const rate = data.rate || 0;
|
||||
|
||||
// 解析rate字符串
|
||||
const parsedRate = this.parseRateString(rate);
|
||||
@@ -234,24 +234,12 @@ export default {
|
||||
// 进度条宽度:限制在0-100之间
|
||||
const progressWidth = Math.min(Math.max(parsedRate.progressValue, 0), 100);
|
||||
|
||||
// 显示文本处理
|
||||
let progressDisplay;
|
||||
if (mappingItem.isPercentage) {
|
||||
// 对于需要加%的指标,确保有%符号
|
||||
progressDisplay = parsedRate.displayText.includes('%')
|
||||
? parsedRate.displayText
|
||||
: `${parsedRate.displayText}%`;
|
||||
} else {
|
||||
// 对于经营性利润和利润总额,直接使用原始rate字符串
|
||||
progressDisplay = parsedRate.displayText;
|
||||
}
|
||||
|
||||
return {
|
||||
name: mappingItem.name,
|
||||
targetValue: target,
|
||||
currentValue: real,
|
||||
progressWidth: progressWidth, // 用于进度条宽度
|
||||
progressDisplay: progressDisplay, // 用于显示文本
|
||||
progress: rate, // 用于显示文本
|
||||
route: mappingItem.route
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user