修改
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; width: 100%;">
|
||||
<!-- 累计指标1 -->
|
||||
<div class="dashboard left">
|
||||
<div class="dashboard left" @click="handleDashboardClick('/operatingRevenue/operatingRevenueBase')">
|
||||
<div class="title">
|
||||
收入·单位/万元
|
||||
</div>
|
||||
@@ -13,7 +13,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- 累计指标2 -->
|
||||
<div class="dashboard right">
|
||||
<div class="dashboard right" @click="handleDashboardClick('/fullCostAnalysis/fullCostAnalysisBase')">
|
||||
<div class="title">
|
||||
全成本·单位/万元
|
||||
</div>
|
||||
@@ -39,10 +39,14 @@ export default {
|
||||
type: Array,
|
||||
// 正确写法:默认值通过 factory 函数返回(才能调用 default())
|
||||
default: () => [
|
||||
{ title: "累计收入", budget: 0, real: 0, rate: 0, diff: 0 },
|
||||
{ title: "收入", budget: 0, real: 0, rate: 0, diff: 0 },
|
||||
{ title: "累计全成本", budget: 0, real: 0, rate: 0, diff: 0 }
|
||||
]
|
||||
},
|
||||
factory: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
@@ -50,7 +54,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
ytdIncomeData: { title: "累计收入", budget: 0, real: 0, rate: 0, diff: 0, flag: 0 },
|
||||
ytdIncomeData: { title: "收入", budget: 0, real: 0, rate: 0, diff: 0, flag: 0 },
|
||||
ytdCostData: { title: "累计全成本", budget: 0, real: 0, rate: 0, diff: 0, flag: 0 }
|
||||
}
|
||||
},
|
||||
@@ -67,6 +71,14 @@ export default {
|
||||
this.updateChart(this.monthAnalysis)
|
||||
},
|
||||
methods: {
|
||||
handleDashboardClick(path) {
|
||||
this.$router.push({
|
||||
path: path,
|
||||
query: {
|
||||
factory: this.$route.query.factory ? this.$route.query.factory : this.factory
|
||||
}
|
||||
})
|
||||
},
|
||||
getRateFlag(rate) {
|
||||
if (isNaN(rate) || rate === null || rate === undefined) return 0;
|
||||
return +(rate >= 100 || rate === 0); // + 号将布尔值转为数字(true→1,false→0)
|
||||
@@ -81,8 +93,8 @@ export default {
|
||||
: this.$props.monthAnalysis; // 直接取 props 默认值
|
||||
|
||||
// 提取累计收入(第0项)、累计全成本(第1项)数据
|
||||
const incomeItem = validData[0] || { title: "累计收入", budget: 0, real: 0, rate: 0, diff: 0 };
|
||||
const costItem = validData[1] || { title: "累计全成本", budget: 0, real: 0, rate: 0, diff: 0 };
|
||||
const incomeItem = validData[0] || { title: "收入", budget: 0, real: 0, rate: 0, diff: 0 };
|
||||
const costItem = validData[1] || { title: "全成本", budget: 0, real: 0, rate: 0, diff: 0 };
|
||||
|
||||
// 整合flag字段
|
||||
this.ytdIncomeData = {
|
||||
|
||||
@@ -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: [
|
||||
{
|
||||
|
||||
@@ -77,7 +77,7 @@ export default {
|
||||
|
||||
// 路由跳转时携带序号(或名称+序号)
|
||||
this.$router.push({
|
||||
path: 'operatingRevenueBase',
|
||||
path: 'grossMarginBase',
|
||||
query: { // 使用query传递参数(推荐),也可使用params
|
||||
// baseName: itemName,
|
||||
factory: baseIndex
|
||||
@@ -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轴:利润占比(百分比)
|
||||
{
|
||||
|
||||
@@ -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; width: 100%;">
|
||||
<!-- 收入模块(传递整合了flag的incomeData) -->
|
||||
<div class="dashboard left">
|
||||
<div class="dashboard left" @click="handleDashboardClick('/operatingRevenue/operatingRevenueBase')">
|
||||
<div class="title">
|
||||
收入·单位/万元
|
||||
</div>
|
||||
@@ -13,7 +13,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- 全成本模块(传递整合了flag的totalCostData) -->
|
||||
<div class="dashboard right">
|
||||
<div class="dashboard right" @click="handleDashboardClick('/fullCostAnalysis/fullCostAnalysisBase')">
|
||||
<div class="title">
|
||||
全成本·单位/万元
|
||||
</div>
|
||||
@@ -76,6 +76,14 @@ export default {
|
||||
this.updateChart(this.ytdAnalysis)
|
||||
},
|
||||
methods: {
|
||||
handleDashboardClick(path) {
|
||||
this.$router.push({
|
||||
path: path,
|
||||
query: {
|
||||
factory: this.$route.query.factory ? this.$route.query.factory : this.factory
|
||||
}
|
||||
})
|
||||
},
|
||||
// 保留原flag判断逻辑(≥100返回1,<100返回0)
|
||||
getRateFlag(rate) {
|
||||
if (isNaN(rate) || rate === null || rate === undefined) return 0;
|
||||
|
||||
Reference in New Issue
Block a user