修改
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<div class="kpi-content" style="padding: 14px 16px; display: flex; width: 100%;">
|
||||
<div class="topItem-container" style="display: flex; gap: 8px;">
|
||||
<!-- 销量图表:传递销量数据 + 完成率flag -->
|
||||
<div class="dashboard left">
|
||||
<div class="dashboard left" @click="handleDashboardClick('/salesVolumeAnalysis/salesVolumeAnalysisBase')">
|
||||
<div class="title">
|
||||
销量·单位/万元
|
||||
</div>
|
||||
@@ -16,7 +16,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- 成本图表:传递全成本数据 + 完成率flag -->
|
||||
<div class="dashboard right">
|
||||
<div class="dashboard right" @click="handleDashboardClick('/salesVolumeAnalysis/salesVolumeAnalysisBase')">
|
||||
<div class="title">
|
||||
成本·单位/万元
|
||||
</div>
|
||||
@@ -27,8 +27,9 @@
|
||||
}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 运费图表:传递单价数据 + 完成率flag -->
|
||||
<div class="dashboard right">
|
||||
<div class="dashboard right" >
|
||||
<div class="title">
|
||||
运费·单位/万元
|
||||
</div>
|
||||
@@ -60,6 +61,10 @@ export default {
|
||||
销量: { completeRate: 0, diff: 0, real: 0, target: 0, thb: 0 }
|
||||
})
|
||||
},
|
||||
factory: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
@@ -92,6 +97,14 @@ export default {
|
||||
this.$nextTick(() => this.updateChart())
|
||||
},
|
||||
methods: {
|
||||
handleDashboardClick(path) {
|
||||
this.$router.push({
|
||||
path: path,
|
||||
query: {
|
||||
factory: this.$route.query.factory ? this.$route.query.factory : this.factory
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 判断完成率对应的flag值(<100为0,≥100为1)
|
||||
* @param {number} rate 完成率(原始值,如89代表89%)
|
||||
@@ -107,11 +120,11 @@ export default {
|
||||
* 若子组件内部已监听 chartData 变化,此方法可留空或补充额外逻辑
|
||||
*/
|
||||
updateChart() {
|
||||
console.log('数据更新,当前relatedMon:', this.relatedMon)
|
||||
// 打印各维度的flag值,方便调试
|
||||
console.log('销量flag:', this.getRateFlag(this.relatedMon.销量.completeRate))
|
||||
console.log('成本flag:', this.getRateFlag(this.relatedMon.成本.completeRate))
|
||||
console.log('运费flag:', this.getRateFlag(this.relatedMon.运费.completeRate))
|
||||
// console.log('数据更新,当前relatedMon:', this.relatedMon)
|
||||
// // 打印各维度的flag值,方便调试
|
||||
// console.log('销量flag:', this.getRateFlag(this.relatedMon.销量.completeRate))
|
||||
// console.log('成本flag:', this.getRateFlag(this.relatedMon.成本.completeRate))
|
||||
// console.log('运费flag:', this.getRateFlag(this.relatedMon.运费.completeRate))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,11 +83,11 @@ export default {
|
||||
return html;
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
grid: {
|
||||
top: 30,
|
||||
bottom: 30,
|
||||
right: 70,
|
||||
left: 40,
|
||||
right: 20,
|
||||
left: 60,
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
|
||||
@@ -83,11 +83,11 @@ export default {
|
||||
// return html;
|
||||
// }
|
||||
},
|
||||
grid: {
|
||||
grid: {
|
||||
top: 30,
|
||||
bottom: 30,
|
||||
right: 70,
|
||||
left: 40,
|
||||
right: 20,
|
||||
left: 60,
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
|
||||
@@ -163,7 +163,7 @@ export default {
|
||||
formatter: '{value}'
|
||||
},
|
||||
splitLine: { lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } },
|
||||
axisLine: { lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } }
|
||||
axisLine: { show: true, lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } }
|
||||
},
|
||||
{
|
||||
type: 'value',
|
||||
@@ -179,7 +179,7 @@ export default {
|
||||
formatter: '{value}%'
|
||||
},
|
||||
splitLine: { show: false },
|
||||
axisLine: { lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } },
|
||||
axisLine: { show: true, lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } },
|
||||
splitNumber: 4
|
||||
}
|
||||
],
|
||||
|
||||
@@ -54,7 +54,7 @@ export default {
|
||||
}
|
||||
|
||||
this.myChart = echarts.init(chartDom);
|
||||
|
||||
|
||||
const { allPlaceNames, series } = this.chartData || {};
|
||||
console.log('chartData', this.chartData);
|
||||
|
||||
@@ -83,11 +83,11 @@ export default {
|
||||
// return html;
|
||||
// }
|
||||
},
|
||||
grid: {
|
||||
grid: {
|
||||
top: 30,
|
||||
bottom: 30,
|
||||
right: 70,
|
||||
left: 40,
|
||||
right: 20,
|
||||
left: 60,
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
@@ -126,7 +126,7 @@ export default {
|
||||
formatter: '{value}'
|
||||
},
|
||||
splitLine: { lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } },
|
||||
axisLine: { lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } },
|
||||
axisLine: { show: true, lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } },
|
||||
},
|
||||
// 右侧Y轴:利润占比(百分比)
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ export default {
|
||||
}
|
||||
|
||||
// 解构数据,避免重复取值
|
||||
const { diff, completeRate: rate, real, target, flag } = this.detailData;
|
||||
const { diff, completeRate, real, target, flag } = this.detailData;
|
||||
// 确保数值为数字类型
|
||||
const realValue = Number(real) || 0;
|
||||
const targetValue = Number(target) || 0;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="kpi-content" style="padding: 14px 16px; display: flex; width: 100%;">
|
||||
<div class="topItem-container" style="display: flex; gap: 8px;">
|
||||
<!-- 销量图表:传递销量数据 + 完成率flag -->
|
||||
<div class="dashboard left">
|
||||
<div class="dashboard left" @click="handleDashboardClick('/salesVolumeAnalysis/salesVolumeAnalysisBase')">
|
||||
<div class="title">
|
||||
销量·单位/万元
|
||||
</div>
|
||||
@@ -16,7 +16,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- 成本图表:传递全成本数据 + 完成率flag -->
|
||||
<div class="dashboard right">
|
||||
<div class="dashboard right" @click="handleDashboardClick('/salesVolumeAnalysis/salesVolumeAnalysisBase')">
|
||||
<div class="title">
|
||||
成本·单位/万元
|
||||
</div>
|
||||
@@ -62,6 +62,10 @@ export default {
|
||||
销量: { completeRate: 0, diff: 0, real: 0, target: 0, thb: 0 }
|
||||
})
|
||||
},
|
||||
factory: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
@@ -94,6 +98,14 @@ export default {
|
||||
this.$nextTick(() => this.updateChart())
|
||||
},
|
||||
methods: {
|
||||
handleDashboardClick(path) {
|
||||
this.$router.push({
|
||||
path: path,
|
||||
query: {
|
||||
factory: this.$route.query.factory ? this.$route.query.factory : this.factory
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 判断完成率对应的flag值(<100为0,≥100为1)
|
||||
* @param {number} rate 完成率(原始值,如89代表89%)
|
||||
|
||||
Reference in New Issue
Block a user