修改bug
This commit is contained in:
@@ -1,10 +1,3 @@
|
||||
<!--
|
||||
* @Date: 2020-12-14 09:07:03
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2024-09-05 09:50:14
|
||||
* @FilePath: \mt-bus-fe\src\views\OperationalOverview\components\baseTable.vue
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="visual-base-table-container">
|
||||
<el-table :max-height="maxHeight" ref="scroll_Table" @mouseenter.native="autoScroll(true)"
|
||||
|
||||
@@ -399,7 +399,7 @@ export default {
|
||||
console.log('当前编辑状态:', isEdit, '当前时间维度:', this.timeType);
|
||||
// 基础表格列配置(只读模式使用)
|
||||
const baseTableProps = [
|
||||
// { prop: 'type', label: '指标类型', align: 'center' },
|
||||
{ prop: 'type', label: '指标类型', align: 'center' },
|
||||
{ prop: 'name', label: '指标名称', align: 'center' },
|
||||
{ prop: 'unit', label: '单位', align: 'center', filter: publicFormatter('lb_dw') },
|
||||
{ prop: 'target', label: '预算值', align: 'center' },
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<div class="right">
|
||||
<div class="number" :style="{ color: getTargetColor(item.currentValue, item.targetValue) }">
|
||||
<div class="number" :style="{ color: getTargetColor(item.progress) }">
|
||||
{{ item.currentValue }}
|
||||
</div>
|
||||
<div class="title">实际值</div>
|
||||
@@ -21,15 +21,15 @@
|
||||
<div class="progress-container">
|
||||
<div class="progress-bar" :style="{
|
||||
width: item.progress + '%',
|
||||
background: getTargetColor(item.currentValue, item.targetValue)
|
||||
background: getTargetColor(item.progress)
|
||||
}"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="yield" style="display: flex;justify-content: space-between;">
|
||||
<div class="progress-percent" :style="{ color: getTargetColor(item.currentValue, item.targetValue) }">完成率
|
||||
<div class="progress-percent" :style="{ color: getTargetColor(item.progress) }">完成率
|
||||
</div>
|
||||
<div class="progress-percent" :style="{ color: getTargetColor(item.currentValue, item.targetValue) }">
|
||||
<div class="progress-percent" :style="{ color: getTargetColor(item.progress) }">
|
||||
{{ item.progress }}%
|
||||
</div>
|
||||
</div>
|
||||
@@ -95,8 +95,8 @@ export default {
|
||||
};
|
||||
});
|
||||
},
|
||||
getTargetColor(currentValue, targetValue) {
|
||||
return currentValue >= targetValue
|
||||
getTargetColor(progress) {
|
||||
return progress >= 100
|
||||
? "rgba(98, 213, 180, 1)"
|
||||
: "rgba(249, 164, 74, 1)";
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
</div>
|
||||
<div class="bottom"
|
||||
style="display: flex; width: 100%;margin-top: 8px;background-color: rgba(249, 252, 255, 1);">
|
||||
<!-- <top-item /> -->
|
||||
<coreBottomBar :line="sale.line" :dateData="dateData" />
|
||||
|
||||
</div>
|
||||
@@ -19,7 +18,6 @@
|
||||
</template>
|
||||
<script>
|
||||
import Container from './container.vue'
|
||||
// import * as echarts from 'echarts'
|
||||
import topItem from './top-item.vue'
|
||||
import coreBottomBar from './coreBottomBar.vue'
|
||||
|
||||
@@ -57,8 +55,6 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 初始化图表(若需展示图表,需在模板中添加对应 DOM)
|
||||
// this.$nextTick(() => this.updateChart())
|
||||
this.saleData = this.sale.month
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -21,9 +21,6 @@
|
||||
</CostsBottomBar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 图表容器:根据状态控制显示(若需展示图表) -->
|
||||
<!-- <div id="productionStatusChart" style="height: 200px; margin-top: 12px;" v-if="showChart"></div> -->
|
||||
</div>
|
||||
</Container>
|
||||
</div>
|
||||
|
||||
@@ -178,7 +178,7 @@ export default {
|
||||
|
||||
// 基础表格列配置(只读模式使用)
|
||||
const baseTableProps = [
|
||||
// { prop: 'type', label: '指标类型', align: 'center' },
|
||||
{ prop: 'type', label: '指标类型', align: 'center' },
|
||||
{ prop: 'name', label: '指标名称', align: 'center' },
|
||||
{ prop: 'unitLabel', label: '单位', align: 'center' },
|
||||
{ prop: 'value', label: '实际值', align: 'center' },
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<!-- 进度条颜色和宽度动态绑定 -->
|
||||
<div class="progress-bar" :style="{
|
||||
width: itemList[0].progress + '%',
|
||||
background: getColor(item.currentValue, item.targetValue)
|
||||
background: getColor(item.progress)
|
||||
}"></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -32,7 +32,7 @@
|
||||
<div class="progress-percent">完成率</div>
|
||||
<!-- 百分比颜色动态绑定 -->
|
||||
<div class="progress-percent" :style="{
|
||||
color: getColor(item.currentValue, item.targetValue)
|
||||
color: getColor(item.progress)
|
||||
}">
|
||||
{{ item.progress }}%
|
||||
</div>
|
||||
@@ -103,8 +103,8 @@ export default {
|
||||
]
|
||||
},
|
||||
// 颜色判断核心方法:实际值≥预算值返回绿色,否则返回橙色
|
||||
getColor(currentValue, targetValue) {
|
||||
return currentValue >= targetValue
|
||||
getColor(progress) {
|
||||
return progress >= 100
|
||||
? "rgba(98, 213, 180, 1)"
|
||||
: "rgba(249, 164, 74, 1)";
|
||||
},
|
||||
|
||||
@@ -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
|
||||
};
|
||||
});
|
||||
|
||||
@@ -12,9 +12,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>
|
||||
@@ -25,15 +25,15 @@
|
||||
<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.progress }}%
|
||||
</div>
|
||||
|
||||
@@ -138,9 +138,9 @@ export default {
|
||||
const { actual, target, progress } = this.itemList[index];
|
||||
|
||||
// 新增条件:如果实际值、预算值和进度都为0,则显示绿色
|
||||
if (actual === 0 && target === 0 && progress === 0) {
|
||||
return "rgba(98, 213, 180, 1)"; // 绿色
|
||||
}
|
||||
// if (actual === 0 && target === 0 && progress === 0) {
|
||||
// return "rgba(98, 213, 180, 1)"; // 绿色
|
||||
// }
|
||||
|
||||
// 原有的通用判断逻辑
|
||||
return progress >= 100
|
||||
|
||||
Reference in New Issue
Block a user