From dfa4ff3f54f4079f8f4edcd529ae0be6bb1d4023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98937886381=E2=80=99?= <‘937886381@qq.com’> Date: Fri, 14 Nov 2025 17:04:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home/components/KFAP.vue | 8 +- src/views/home/components/KFAPMiddleBar.vue | 124 ++++++++---- src/views/home/components/coreBottomBar.vue | 7 +- .../home/components/financeCostsBottomBar.vue | 8 +- src/views/home/components/operating-item.vue | 4 +- src/views/home/components/operatingBar.vue | 190 +++++++++++++++++- .../home/components/operatingLineBar.vue | 38 ++-- .../home/components/operatingLineBarSale.vue | 173 ++++++++++++++++ .../home/components/operatingSalesRevenue.vue | 64 +++++- .../home/components/order-bottom-leftItem.vue | 2 +- src/views/home/components/premProdStatus.vue | 23 ++- .../home/components/profit-item-middle.vue | 2 +- src/views/home/components/profit-item.vue | 2 +- src/views/home/components/profitBar.vue | 53 ++++- src/views/home/components/psiLineBar.vue | 4 +- src/views/home/components/psr-item.vue | 2 +- src/views/home/components/top-item.vue | 2 +- .../home/components/top-product-item.vue | 2 +- .../costComponents/costItemOverviewItem.vue | 32 +-- .../home/costComponents/operatingLineBar.vue | 56 +++++- .../costComponents/processingCost-Item.vue | 1 + .../home/costComponents/productLeftTable.vue | 4 +- .../home/costComponents/productRightTable.vue | 4 +- .../costComponents/profitImpactLineChart.vue | 2 +- .../home/costComponents/rawSheet-Item.vue | 1 + src/views/home/costComponents/top-item.vue | 2 +- .../home/costComponents/top-product-item.vue | 2 +- src/views/home/profitAnalysis.vue | 13 +- 28 files changed, 684 insertions(+), 141 deletions(-) create mode 100644 src/views/home/components/operatingLineBarSale.vue diff --git a/src/views/home/components/KFAP.vue b/src/views/home/components/KFAP.vue index d3bb76c0..36ed7f84 100644 --- a/src/views/home/components/KFAP.vue +++ b/src/views/home/components/KFAP.vue @@ -8,7 +8,7 @@
@@ -51,11 +51,13 @@ export default { if (!Array.isArray(this.middleChartData)) return []; return this.middleChartData.map(item => item.name).filter(Boolean); }, - profitProportionData() { + profitListData() { if (!Array.isArray(this.middleChartData)) return []; return this.PlaceNames.map(place => { const target = this.middleChartData.find(item => item.name === place); - return target?.profitProportion || 0; + console.log('target?.profit', target?.profit); + + return target?.profit || 0; }); }, incomeValueData() { diff --git a/src/views/home/components/KFAPMiddleBar.vue b/src/views/home/components/KFAPMiddleBar.vue index a35ab0e5..a4d310dd 100644 --- a/src/views/home/components/KFAPMiddleBar.vue +++ b/src/views/home/components/KFAPMiddleBar.vue @@ -7,7 +7,7 @@
- + 利润 @@ -60,39 +60,13 @@ export default { // 原有计算属性(allPlaceNames、profitProportionData 等)保持不变 // 新增:定义图表 series 配置 chartSeries() { - const { allPlaceNames, incomeValueData, profitProportionData, costValueData, costCompletedData } = this.chartData + const { allPlaceNames, incomeValueData, profitListData, costValueData, costCompletedData } = this.chartData // 处理空数据默认值 const incomeData = incomeValueData || Array(allPlaceNames.length).fill(0); - const profitData = profitProportionData || Array(allPlaceNames.length).fill(0); + const profitData = profitListData || Array(allPlaceNames.length).fill(0); const costData = costValueData || Array(allPlaceNames.length).fill(0); return [ - // 1. 利润占比:折线图 - { - name: '利润', - type: 'line', - yAxisIndex: 1, - lineStyle: { - color: 'rgba(40, 138, 255, .5)', - width: 2 - }, - itemStyle: { - color: 'rgba(40, 138, 255, 1)', - borderColor: 'rgba(40, 138, 255, 1)', - borderWidth: 2, - radius: 4 - }, - areaStyle: { - opacity: 0.2, - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ - { offset: 0, color: 'rgba(40, 138, 255, .9)' }, - { offset: 1, color: 'rgba(255, 132, 0, 0)' } - ]) - }, - data: profitData, - symbol: 'circle', - symbolSize: 6 - }, // 2. 营业收入:柱状图 { name: '营业收入', @@ -100,26 +74,106 @@ export default { yAxisIndex: 0, barWidth: 18, itemStyle: { - color: '#2889FF', - borderRadius: [4, 4, 0, 0] + // 移除多余的 normal 层级,直接配置 color 渐变 + color: { + type: 'linear', + x: 0, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { offset: 0, color: 'rgba(130, 204, 255, 1)' }, + { offset: 1, color: '#2889FF' } + ] + }, + borderRadius: [4, 4, 0, 0], + borderWidth: 0 }, + // itemStyle: { + // color: '#2889FF', + // borderRadius: [4, 4, 0, 0] + // }, data: incomeData }, // 3. 成本:柱状图(动态颜色) { name: '成本', type: 'bar', + stack: 'total', // 堆叠分组名(与利润保持一致) yAxisIndex: 0, barWidth: 18, itemStyle: { + // 根据 safeFlag 动态返回不同的渐变色 color: (params) => { - const completed = costCompletedData?.[params.dataIndex] ?? 0; - return completed === 1 ? 'rgba(255, 132, 0, 1)' : 'rgba(40, 203, 151, 1)'; + const dataIndex = params.dataIndex; + const currentFlag = costCompletedData[dataIndex] || 0; // 默认为0(不达标) + + // 达标时的渐变(绿色系) + if (currentFlag === 1) { + return { + type: 'linear', + x: 0, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { offset: 0, color: 'rgba(174, 239, 224, 1)' }, // 浅绿 + { offset: 1, color: 'rgba(118, 218, 190, 1)' } // 深绿 + ] + }; + } + // 不达标时的渐变(橙色系) + else { + return { + type: 'linear', + x: 0, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { offset: 0, color: 'rgba(253, 209, 129, 1)' }, // 浅橙 + { offset: 1, color: 'rgba(249, 164, 74, 1)' } // 深橙 + ] + }; + } }, - borderRadius: [4, 4, 0, 0] + borderRadius: [4, 4, 0, 0], + borderWidth: 0 }, data: costData - } + }, + { + name: '利润', + type: 'bar', + yAxisIndex: 0, + // lineStyle: { + // color: 'rgba(40, 138, 255, .5)', + // width: 2 + // }, + stack: 'total', // 堆叠分组名(与利润保持一致) + barWidth: 18, + itemStyle: { + // 移除多余的 normal 层级,直接配置 color 渐变 + color: { + type: 'linear', + x: 0, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { offset: 0, color: 'rgba(130, 204, 255, 1)' }, + { offset: 1, color: '#288aff' } + ] + }, + borderRadius: [4, 4, 0, 0], + borderWidth: 0 + }, + // itemStyle: { + // color: '#288aff', + // borderRadius: [4, 4, 0, 0] + // }, + data: profitData, + }, ]; } }, diff --git a/src/views/home/components/coreBottomBar.vue b/src/views/home/components/coreBottomBar.vue index d12c4acf..25a9687d 100644 --- a/src/views/home/components/coreBottomBar.vue +++ b/src/views/home/components/coreBottomBar.vue @@ -65,8 +65,7 @@ export default { lineStyle: { color: 'rgba(91, 230, 190, 1)', width: 2 }, itemStyle: { color: 'rgba(91, 230, 190, 1)', - borderColor: '#fff', - borderWidth: 1 + borderColor: 2 }, areaStyle: { opacity: 0.3, @@ -86,8 +85,8 @@ export default { lineStyle: { color: 'rgba(255, 132, 0, 1)', width: 2 }, itemStyle: { color: 'rgba(255, 132, 0, 1)', - borderColor: '#fff', - borderWidth: 1 + borderColor: 'rgba(255, 132, 0, 1)', + borderWidth: 2, }, areaStyle: { opacity: 0.3, diff --git a/src/views/home/components/financeCostsBottomBar.vue b/src/views/home/components/financeCostsBottomBar.vue index b00b7ddc..3eacb2a6 100644 --- a/src/views/home/components/financeCostsBottomBar.vue +++ b/src/views/home/components/financeCostsBottomBar.vue @@ -66,8 +66,8 @@ export default { lineStyle: { color: 'rgba(91, 230, 190, 1)' }, itemStyle: { color: 'rgba(91, 230, 190, 1)', - borderColor: '#fff', - borderWidth: 1 + borderColor: 'rgba(91, 230, 190, 1)', + borderWidth: 2 }, areaStyle: { opacity: 0.3, @@ -86,8 +86,8 @@ export default { lineStyle: { color: 'rgba(255, 132, 0, 1)' }, itemStyle: { color: 'rgba(255, 132, 0, 1)', - borderColor: '#fff', - borderWidth: 1 + borderColor: 'rgba(255, 132, 0, 1)', + borderWidth: 2 }, areaStyle: { opacity: 0.3, diff --git a/src/views/home/components/operating-item.vue b/src/views/home/components/operating-item.vue index d8b753a7..daa18395 100644 --- a/src/views/home/components/operating-item.vue +++ b/src/views/home/components/operating-item.vue @@ -22,7 +22,7 @@
-{{ item.proportion !== null && item.proportion !== undefined ? (item.proportion * 100) + '%' : '0%' }} +{{ item.proportion !== null && item.proportion !== undefined ? (item.proportion) + '%' : '0%' }}
完成率
@@ -133,7 +133,7 @@ export default { height: 46px; background: linear-gradient(to bottom, rgba(255, 0, 0, 0), - rgba(40, 203, 151, 1)); + #cbcbcb); } .left, diff --git a/src/views/home/components/operatingBar.vue b/src/views/home/components/operatingBar.vue index 99f9fef2..532df8e9 100644 --- a/src/views/home/components/operatingBar.vue +++ b/src/views/home/components/operatingBar.vue @@ -36,13 +36,15 @@
- +
diff --git a/src/views/home/components/operatingLineBar.vue b/src/views/home/components/operatingLineBar.vue index 7130c104..cefdd756 100644 --- a/src/views/home/components/operatingLineBar.vue +++ b/src/views/home/components/operatingLineBar.vue @@ -131,25 +131,25 @@ export default { splitNumber: 4 }, // 右侧Y轴:利润占比(百分比) - { - type: 'value', - nameTextStyle: { - color: 'rgba(0, 0, 0, 0.45)', - fontSize: 12, - align: 'left' - }, - min: 0, - max: 100, - axisTick: { show: false }, - axisLabel: { - color: 'rgba(0, 0, 0, 0.45)', - fontSize: 12, - formatter: '{value}%' - }, - splitLine: { show: false }, - axisLine: { lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } }, - splitNumber: 4 - } + // { + // type: 'value', + // nameTextStyle: { + // color: 'rgba(0, 0, 0, 0.45)', + // fontSize: 12, + // align: 'left' + // }, + // min: 0, + // max: 100, + // axisTick: { show: false }, + // axisLabel: { + // color: 'rgba(0, 0, 0, 0.45)', + // fontSize: 12, + // formatter: '{value}%' + // }, + // splitLine: { show: false }, + // axisLine: { lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } }, + // splitNumber: 4 + // } ], series: chartSeries // 直接使用父组件传递的 series }; diff --git a/src/views/home/components/operatingLineBarSale.vue b/src/views/home/components/operatingLineBarSale.vue new file mode 100644 index 00000000..8e0ee6e6 --- /dev/null +++ b/src/views/home/components/operatingLineBarSale.vue @@ -0,0 +1,173 @@ + + diff --git a/src/views/home/components/operatingSalesRevenue.vue b/src/views/home/components/operatingSalesRevenue.vue index 3f41cdbc..d5c72001 100644 --- a/src/views/home/components/operatingSalesRevenue.vue +++ b/src/views/home/components/operatingSalesRevenue.vue @@ -41,15 +41,61 @@ export default { chart: null, parentItemList: [ { - name: "利润总额", targetValue: 0, value: 0, proportion: 0, - route:'profitAnalysis' - }, - { name: "毛利率", targetValue: 0, value: 0, proportion: 0, route: 'profitAnalysis' }, - { name: "单价", targetValue: 0, value: 0, proportion: 0, route: 'cost/cost' }, - { name: "净价", targetValue: 0, value: 0, proportion: 0, route: 'cost/cost' }, - { name: "销量", targetValue: 0, value: 0, proportion: 0, route: 'profitAnalysis' }, - { name: "双镀面板", targetValue: 0, value: 0, proportion: 0, route: 'profitAnalysis' }, - { name: "溢价产品销量", targetValue: 0, value: 0, proportion: 0, route: 'profitAnalysis' } + name: "利润总额", + targetValue: 50, + value: 58, + proportion: 116, + route: 'profitAnalysis', + completed: 1 // 实际超目标,达标 + }, + { + name: "毛利率", + targetValue: 30, + value: 28.5, + proportion: 95, + route: 'profitAnalysis', + completed: 0 // 未达30%目标,不达标 + }, + { + name: "单价", + targetValue: 12, + value: 12.5, + proportion: 104.2, + route: 'cost/cost', + completed: 1 // 单价达标 + }, + { + name: "净价", + targetValue: 9, + value: 8.8, + proportion: 97.8, + route: 'cost/cost', + completed: 0 // 未达目标,不达标 + }, + { + name: "销量", + targetValue: 100, + value: 120, + proportion: 120, + route: 'profitAnalysis', + completed: 1 // 销量超额达标 + }, + { + name: "双镀面板", + targetValue: 30, + value: 29, + proportion: 96.7, + route: 'profitAnalysis', + completed: 0 // 略低目标,不达标 + }, + { + name: "溢价产品销量", + targetValue: 15, + value: 18, + proportion: 120, + route: 'profitAnalysis', + completed: 1 // 超额达标 + } ] } }, diff --git a/src/views/home/components/order-bottom-leftItem.vue b/src/views/home/components/order-bottom-leftItem.vue index f1448730..ca6253ed 100644 --- a/src/views/home/components/order-bottom-leftItem.vue +++ b/src/views/home/components/order-bottom-leftItem.vue @@ -354,7 +354,7 @@ export default { height: 46px; background: linear-gradient(to bottom, rgba(255, 0, 0, 0), - rgba(40, 203, 151, 1)); + #cbcbcb); } .cityLine { diff --git a/src/views/home/components/premProdStatus.vue b/src/views/home/components/premProdStatus.vue index 23d02d45..e2ecf3ae 100644 --- a/src/views/home/components/premProdStatus.vue +++ b/src/views/home/components/premProdStatus.vue @@ -67,13 +67,22 @@ export default { return { chart: null, parentItemList: [ - { name: "月度", targetValue: 0, value: 0, proportion: 0, route:'profitAnalysis' }, - { name: "年度", targetValue: 0, value: 0, proportion: 0, route: 'profitAnalysis' }, - // { unit: "单价", targetValue: 20, currentValue: 16, progress: 80 }, - // { unit: "净价", targetValue: 20, currentValue: 16, progress: 80 }, - // { unit: "销量", targetValue: 20, currentValue: 16, progress: 80 }, - // { unit: "双镀面板", targetValue: 15, currentValue: 13.8, progress: 92 }, - // { unit: "溢价产品销量", targetValue: 15, currentValue: 13.8, progress: 92 } + { + name: "月度", + targetValue: 80, + value: 76, + proportion: 95, + route: 'profitAnalysis', + completed: 0 // 未达目标值,不达标 + }, + { + name: "年度", + targetValue: 900, + value: 920, + proportion: 102.2, + route: 'profitAnalysis', + completed: 1 // 超出目标值,达标 + } ] } }, diff --git a/src/views/home/components/profit-item-middle.vue b/src/views/home/components/profit-item-middle.vue index e8219015..00d07252 100644 --- a/src/views/home/components/profit-item-middle.vue +++ b/src/views/home/components/profit-item-middle.vue @@ -138,7 +138,7 @@ export default { height: 46px; background: linear-gradient(to bottom, rgba(255, 0, 0, 0), - rgba(40, 203, 151, 1)); + #cbcbcb); } .left, diff --git a/src/views/home/components/profit-item.vue b/src/views/home/components/profit-item.vue index 8c2e8d1b..9639fc6a 100644 --- a/src/views/home/components/profit-item.vue +++ b/src/views/home/components/profit-item.vue @@ -136,7 +136,7 @@ export default { height: 46px; background: linear-gradient(to bottom, rgba(255, 0, 0, 0), - rgba(40, 203, 151, 1)); + #cbcbcb); } .left, diff --git a/src/views/home/components/profitBar.vue b/src/views/home/components/profitBar.vue index fbb1d0cc..925380ca 100644 --- a/src/views/home/components/profitBar.vue +++ b/src/views/home/components/profitBar.vue @@ -50,6 +50,8 @@