diff --git a/.env.dev b/.env.dev index 1f370043..e0b89faf 100644 --- a/.env.dev +++ b/.env.dev @@ -10,11 +10,11 @@ VUE_APP_TITLE = 洛玻集团驾驶舱 # VUE_APP_BASE_API = 'http://172.16.33.83:7070' # 杨姗姗 -VUE_APP_BASE_API = 'http://172.16.20.218:7070' +# VUE_APP_BASE_API = 'http://172.16.20.218:7070' # 小田 # VUE_APP_BASE_API = 'http://172.16.19.232:7070' # 测试 -# VUE_APP_BASE_API = 'http://192.168.0.35:8080' +VUE_APP_BASE_API = 'http://192.168.0.35:8080' # 闫阳 # VUE_APP_BASE_API = 'http://172.16.19.131:7070' diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index b9a50a33..260d838d 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -97,7 +97,6 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { '/procurementGainAnalysis', '/fullCostAnalysis', '/electricityCostAnalysis', - // '/expenseAnalysis', "/cost", // cost 根路由 "/cost/profitImpactAnalysis", // cost 子菜单(完整路径) ]; diff --git a/src/views/home/accountsReceivableComponents/operatingLineChart.vue b/src/views/home/accountsReceivableComponents/operatingLineChart.vue index d58d92bd..c4337c48 100644 --- a/src/views/home/accountsReceivableComponents/operatingLineChart.vue +++ b/src/views/home/accountsReceivableComponents/operatingLineChart.vue @@ -100,7 +100,7 @@ getRateFlag(rate, real, target) { if (rate >= 100) return 1; // 2. 完成率 = 0 且 (目标值=0 或 实际值=目标值=0) => 达标 - if (rate === 0 && target === 0) return 1; + // if (rate === 0 && target === 0) return 1; // 其他情况 => 未达标 return 0; diff --git a/src/views/home/accountsReceivableComponents/operatingLineChartCumulative.vue b/src/views/home/accountsReceivableComponents/operatingLineChartCumulative.vue index 7b048e33..c3bbdda9 100644 --- a/src/views/home/accountsReceivableComponents/operatingLineChartCumulative.vue +++ b/src/views/home/accountsReceivableComponents/operatingLineChartCumulative.vue @@ -95,7 +95,7 @@ getRateFlag(rate, real, target) { if (rate >= 100) return 1; // 2. 完成率 = 0 且 (目标值=0 或 实际值=目标值=0) => 达标 - if (rate === 0 && target === 0) return 1; + // if (rate === 0 && target === 0) return 1; // 其他情况 => 未达标 return 0; diff --git a/src/views/home/components/coresBar.vue b/src/views/home/components/coresBar.vue index 102977ad..0c3a0bc0 100644 --- a/src/views/home/components/coresBar.vue +++ b/src/views/home/components/coresBar.vue @@ -77,7 +77,7 @@ export default { label: { backgroundColor: '#6a7985' } } }, - grid: { top: 35, bottom: 3, right: 15, left: 15, containLabel: true}, + grid: { top: 35, bottom: 3, right: 15, left: 18, containLabel: true}, xAxis: [ { type: 'category', diff --git a/src/views/home/components/keyWork.vue b/src/views/home/components/keyWork.vue index 6dc34552..1239950d 100644 --- a/src/views/home/components/keyWork.vue +++ b/src/views/home/components/keyWork.vue @@ -15,7 +15,7 @@ 未完成 - diff --git a/src/views/home/depreciationAnalysis/depreciationAnalysis.vue b/src/views/home/depreciationAnalysis/depreciationAnalysis.vue index 3b343d4e..dca9f825 100644 --- a/src/views/home/depreciationAnalysis/depreciationAnalysis.vue +++ b/src/views/home/depreciationAnalysis/depreciationAnalysis.vue @@ -59,6 +59,7 @@ export default { selectDate:{}, monthData: {}, ytdData:{}, + dateData:{} }; }, diff --git a/src/views/home/depreciationAnalysisComponents/operatingLineBarSale.vue b/src/views/home/depreciationAnalysisComponents/operatingLineBarSale.vue index 5c46ad38..d9fbbb95 100644 --- a/src/views/home/depreciationAnalysisComponents/operatingLineBarSale.vue +++ b/src/views/home/depreciationAnalysisComponents/operatingLineBarSale.vue @@ -169,7 +169,7 @@ export default { yAxis: [ { type: 'value', - name: '万元', + name: '元', nameTextStyle: { color: 'rgba(0, 0, 0, 0.45)', fontSize: 12, diff --git a/src/views/home/depreciationAnalysisComponents/operatingLineBarSaleGroup.vue b/src/views/home/depreciationAnalysisComponents/operatingLineBarSaleGroup.vue index 91e81381..63d00c29 100644 --- a/src/views/home/depreciationAnalysisComponents/operatingLineBarSaleGroup.vue +++ b/src/views/home/depreciationAnalysisComponents/operatingLineBarSaleGroup.vue @@ -112,7 +112,7 @@ export default { // 左侧Y轴:营业收入、成本(单位万元) { type: 'value', - name: '万元', + name: '元', nameTextStyle: { color: 'rgba(0, 0, 0, 0.45)', fontSize: 12, diff --git a/src/views/home/depreciationAnalysisComponents/operatingLineChart.vue b/src/views/home/depreciationAnalysisComponents/operatingLineChart.vue index d58d92bd..c4337c48 100644 --- a/src/views/home/depreciationAnalysisComponents/operatingLineChart.vue +++ b/src/views/home/depreciationAnalysisComponents/operatingLineChart.vue @@ -100,7 +100,7 @@ getRateFlag(rate, real, target) { if (rate >= 100) return 1; // 2. 完成率 = 0 且 (目标值=0 或 实际值=目标值=0) => 达标 - if (rate === 0 && target === 0) return 1; + // if (rate === 0 && target === 0) return 1; // 其他情况 => 未达标 return 0; diff --git a/src/views/home/electricityCostAnalysis/electricityCostAnalysis.vue b/src/views/home/electricityCostAnalysis/electricityCostAnalysis.vue index f13b7952..48706fa5 100644 --- a/src/views/home/electricityCostAnalysis/electricityCostAnalysis.vue +++ b/src/views/home/electricityCostAnalysis/electricityCostAnalysis.vue @@ -36,12 +36,12 @@ import ReportHeader from "../components/noRouterHeader.vue"; import { Sidebar } from "../../../layout/components"; import screenfull from "screenfull"; import { mapState } from "vuex"; -import operatingLineChart from "../accountsReceivableComponents/operatingLineChart"; -import operatingLineChartCumulative from "../accountsReceivableComponents/operatingLineChartCumulative.vue"; +import operatingLineChart from "../electricityCostAnalysisComponents/operatingLineChart"; +import operatingLineChartCumulative from "../electricityCostAnalysisComponents/operatingLineChartCumulative.vue"; import { getElectricityCostAnalysisData } from '@/api/cockpit' export default { - name: "AccountsReceivable", + name: "electricityCostAnalysis", components: { ReportHeader, operatingLineChartCumulative, @@ -140,19 +140,11 @@ export default { index: undefined, factory: undefined }).then((res) => { - console.log('res==============================',res); this.monthData= res.data.month this.ytdData = res.data.ytd - - // this.saleData = res.data.SaleData - // this.premiumProduct = res.data.premiumProduct - // this.salesTrendMap = res.data.salesTrendMap - // this.grossMarginTrendMap = res.data.grossMarginTrendMap - // this.salesProportion = res.data.salesProportion ? res.data.salesProportion : {} }) }, handleTimeChange(obj) { - console.log(obj, 'obj'); this.dateData= obj this.getData() }, diff --git a/src/views/home/electricityCostAnalysis/electricityCostAnalysisBase.vue b/src/views/home/electricityCostAnalysis/electricityCostAnalysisBase.vue index c40b1c45..d6e50d39 100644 --- a/src/views/home/electricityCostAnalysis/electricityCostAnalysisBase.vue +++ b/src/views/home/electricityCostAnalysis/electricityCostAnalysisBase.vue @@ -84,7 +84,7 @@ import moment from "moment"; // import html2canvas from 'html2canvas' // import JsPDF from 'jspdf' export default { - name: "DayReport", + name: "electricityCostAnalysisBase", components: { ReportHeader, changeBase, @@ -107,7 +107,7 @@ export default { monData: {}, totalData: {}, trend: [], - relatedData: [], + relatedData: {}, trendName: '原片电费', // cusProData: {}, }; @@ -201,7 +201,7 @@ export default { endTime: this.dateData.endTime, sort: 1, index: this.trendName, - factory: null + factory: this.factory }; // 调用接口 getElectricityCostAnalysisFData(requestParams).then((res) => { @@ -211,7 +211,7 @@ export default { relatedMon: res.data.monthAnalysis, relatedTotal: res.data.ytdAnalysis } - this.trend = res.data.dataTrend + this.trend = res.data.trend }); }, handleTimeChange(obj) { diff --git a/src/views/home/electricityCostAnalysisComponents/dataTrend.vue b/src/views/home/electricityCostAnalysisComponents/dataTrend.vue index 80ec8679..ed3a4a95 100644 --- a/src/views/home/electricityCostAnalysisComponents/dataTrend.vue +++ b/src/views/home/electricityCostAnalysisComponents/dataTrend.vue @@ -51,16 +51,14 @@ export default { // 遍历传入的 trendData 数组(响应式依赖,变化时自动重算) this.trendData.forEach((item) => { - // 1. 格式化时间并推入时间数组 - const yearMonth = this.formatTimeToYearMonth(item.time); - timeArr.push(yearMonth); + timeArr.push(item.title); // 2. 提取其他字段,兜底为0(防止null/undefined影响图表渲染) - valueArr.push(item.value ?? 0); - diffValueArr.push(item.diffValue ?? 0); - targetValueArr.push(item.targetValue ?? 0); - proportionArr.push(item.proportion ?? 0); - completedArr.push(item.completed ?? 0); + valueArr.push(item.real ?? 0); + diffValueArr.push(item.diff ?? 0); + targetValueArr.push(item.budget ?? 0); + proportionArr.push(item.rate ?? 0); + completedArr.push(item.rate && item.rate>=100 ? 1 : 0); }); // 组装并返回格式化后的数据(结构与原一致) @@ -81,15 +79,6 @@ export default { * @param {Number} timestamp 13位毫秒级时间戳 * @returns {String} 格式化后的年月字符串(如:2025-10) */ - formatTimeToYearMonth(timestamp) { - if (!timestamp || isNaN(timestamp)) { - return ""; // 容错:非有效时间戳返回空字符串 - } - const date = new Date(timestamp); - const year = date.getFullYear(); - const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始,补0至2位 - return `${year}-${month}`; - }, getData(value) { this.$emit('getData', value) }, diff --git a/src/views/home/electricityCostAnalysisComponents/dataTrendBar.vue b/src/views/home/electricityCostAnalysisComponents/dataTrendBar.vue index f59a7702..18cacf2d 100644 --- a/src/views/home/electricityCostAnalysisComponents/dataTrendBar.vue +++ b/src/views/home/electricityCostAnalysisComponents/dataTrendBar.vue @@ -35,7 +35,7 @@ @@ -60,20 +60,19 @@ export default { data() { return { isDropdownShow: false, - selectedProfit: '原片电费', // 选中的名称,初始为null - profitOptions: [ - '原片电费', - '加工电费', - '外围电费', - '发电量', - '日均发电量' - ] + selectedProfit: '总电费', // 选中的名称,初始为null + profitOptions:[ + {name:'总电费',unit:'万元'}, + {name:'原片电费',unit:'万元'}, + {name:'加工电费',unit:'万元'}, + {name:'外围电费',unit:'万元'}, + {name:'发电量',unit:'度'}, + {name:'日均发电量',unit:'度'} + ], + unit:'万元', }; }, computed: { - // profitOptions() { - // return this.categoryData.map(item => item.name) || []; - // }, currentDataSource() { return this.chartData }, @@ -89,6 +88,7 @@ export default { const salesData = { allPlaceNames: this.locations, + unit: this.unit, series: [ // 1. 完成率(折线图) { @@ -247,9 +247,10 @@ export default { }, methods: { selectProfit(item) { - this.selectedProfit = item; + this.selectedProfit = item.name; + this.unit = item.unit; this.isDropdownShow = false; - this.$emit('handleGetItemData', item) + this.$emit('handleGetItemData', item.name) } }, }; diff --git a/src/views/home/electricityCostAnalysisComponents/operatingBar.vue b/src/views/home/electricityCostAnalysisComponents/operatingBar.vue index 0f6ea951..5a9e3438 100644 --- a/src/views/home/electricityCostAnalysisComponents/operatingBar.vue +++ b/src/views/home/electricityCostAnalysisComponents/operatingBar.vue @@ -123,6 +123,7 @@ export default { const data = this.currentDataSource; const salesData = { allPlaceNames: this.locations, + unit:'万元', series: [ // 完成率(折线图) { diff --git a/src/views/home/electricityCostAnalysisComponents/operatingLineBarSale.vue b/src/views/home/electricityCostAnalysisComponents/operatingLineBarSale.vue index ed40b4dd..a2aa43e5 100644 --- a/src/views/home/electricityCostAnalysisComponents/operatingLineBarSale.vue +++ b/src/views/home/electricityCostAnalysisComponents/operatingLineBarSale.vue @@ -93,7 +93,7 @@ export default { // 路由跳转时携带序号(或名称+序号) this.$router.push({ - path: 'totalProfitBase', + path: 'electricityCostAnalysisBase', query: { // 使用query传递参数(推荐),也可使用params // baseName: itemName, factory: baseIndex, @@ -119,7 +119,7 @@ export default { return; // 实例未初始化则返回 } - const { allPlaceNames, series } = this.chartData || {}; + const { allPlaceNames,unit, series } = this.chartData || {}; const xData = allPlaceNames || []; const chartSeries = series || []; @@ -166,7 +166,7 @@ export default { yAxis: [ { type: 'value', - name: '万元', + name: unit, nameTextStyle: { color: 'rgba(0, 0, 0, 0.45)', fontSize: 12, diff --git a/src/views/home/electricityCostAnalysisComponents/operatingLineChart.vue b/src/views/home/electricityCostAnalysisComponents/operatingLineChart.vue index 45e78682..e38aff26 100644 --- a/src/views/home/electricityCostAnalysisComponents/operatingLineChart.vue +++ b/src/views/home/electricityCostAnalysisComponents/operatingLineChart.vue @@ -59,9 +59,9 @@ export default { name: "ProductionStatus", components: { Container, operatingBar, operatingTopBar }, props: { - monData: { - type: Array, - default: () => [], + monthData: { + type: Object, + default: () => {}, }, dateData: { type: Object, @@ -92,7 +92,7 @@ export default { }; }, watch: { - monData: { + monthData: { handler() { this.processChartData(); }, @@ -104,52 +104,48 @@ export default { /** * 核心方法:按levelId匹配地名生成locations */ + getRateFlag(rate, real, target) { + if (isNaN(rate) || rate === null || rate === undefined) return 0; + + // 1. 完成率 >= 100 => 达标 + if (rate >= 100) return 1; + + // 2. 完成率 = 0 且 (目标值=0 或 实际值=目标值=0) => 达标 + // if (rate === 0 && target === 0) return 1; + + // 其他情况 => 未达标 + return 0; + }, processChartData() { // 初始化空数据结构 const initTopBarData = { locations: [], diff: [], targets: [], reals: [], rate: [], flags: [] }; const initBarData = { locations: [], diff: [], targets: [], reals: [], rate: [], flags: [] }; - - if (!Array.isArray(this.monData) || this.monData.length === 0) { - this.chartData = { topBarData: initTopBarData, barData: initBarData }; - return; - } - // 1. 处理levelId=1的整合数据(逻辑不变) - const level1Data = this.monData.filter(item => item.levelId === 1); + const level1Data = this.monthData.group; + if (!level1Data) return; const topBarData = { ...initTopBarData }; - level1Data.forEach(item => { - if (!item.name) return; - topBarData.locations = ["凯盛新能"]; // levelId=1固定为凯盛新能 - topBarData.diff.push(item.diffValue || 0); - topBarData.targets.push(item.targetValue || 0); - topBarData.reals.push(item.value || 0); - topBarData.rate.push(item.proportion || 0); - topBarData.flags.push(item.completed ? 1 : 0); - }); - + topBarData.locations = ["凯盛新能"]; + topBarData.diff.push(level1Data.diff || 0); + + topBarData.targets.push(level1Data.target || 0); + topBarData.reals.push(level1Data.real || 0); + topBarData.rate.push(level1Data.rate || 0); + topBarData.flags.push(this.getRateFlag(level1Data.rate, level1Data.real, level1Data.target)); // 2. 处理levelId≠1的整合数据(核心:levelId匹配地名) const barData = { ...initBarData }; // 筛选有效数据:levelId≠1 且 levelId在baseIndexToNameMap中 - const validOtherData = this.monData.filter(item => { - return item.levelId !== 1 && baseIndexToNameMap.hasOwnProperty(item.levelId); - }); + const validOtherData = this.monthData.factory // 遍历有效数据,填充locations(levelId→地名) validOtherData.forEach(item => { - // 根据levelId(序号)从映射表获取对应地名 - const baseName = baseIndexToNameMap[item.levelId]; - if (baseName) { // 确保地名和原始名称有效 - // barData.names.push(item.name); // 保留monData中的原始名称 - barData.locations.push(baseName); // locations=levelId对应的地名(如levelId=7→宜兴) - barData.diff.push(item.diffValue || 0); - barData.targets.push(item.targetValue || 0); - barData.reals.push(item.value || 0); - barData.rate.push(item.proportion || 0); - barData.flags.push(item.completed ? 1 : 0); - // barData.baseIndexes.push(Number(item.levelId) || 0); // 序号转数字 - } + barData.locations.push(item.title); // locations=levelId对应的地名(如levelId=7→宜兴) + barData.diff.push(item.diff || 0); + barData.targets.push(item.target || 0); + barData.reals.push(item.real || 0); + barData.rate.push(item.rate || 0); + barData.flags.push(this.getRateFlag(item.rate, item.real, item.target)); }); // 3. 更新chartData diff --git a/src/views/home/electricityCostAnalysisComponents/operatingLineChartCumulative.vue b/src/views/home/electricityCostAnalysisComponents/operatingLineChartCumulative.vue index 2c65cd99..225df986 100644 --- a/src/views/home/electricityCostAnalysisComponents/operatingLineChartCumulative.vue +++ b/src/views/home/electricityCostAnalysisComponents/operatingLineChartCumulative.vue @@ -59,9 +59,9 @@ export default { name: "ProductionStatus", components: { Container, operatingBar, operatingTopBar }, props: { - totalData: { - type: Array, - default: () => [], + ytdData: { + type: Object, + default: () => {}, }, dateData: { type: Object, @@ -92,7 +92,7 @@ export default { }; }, watch: { - totalData: { + ytdData: { handler() { this.processChartData(); }, @@ -104,6 +104,18 @@ export default { /** * 核心方法:按levelId匹配地名生成locations */ + getRateFlag(rate, real, target) { + if (isNaN(rate) || rate === null || rate === undefined) return 0; + + // 1. 完成率 >= 100 => 达标 + if (rate >= 100) return 1; + + // 2. 完成率 = 0 且 (目标值=0 或 实际值=目标值=0) => 达标 + // if (rate === 0 && target === 0) return 1; + + // 其他情况 => 未达标 + return 0; + }, processChartData() { // 初始化空数据结构 const initTopBarData = { @@ -111,45 +123,30 @@ export default { }; const initBarData = { locations: [], diff: [], targets: [], reals: [], rate: [], flags: [] }; - if (!Array.isArray(this.totalData) || this.totalData.length === 0) { - this.chartData = { topBarData: initTopBarData, barData: initBarData }; - return; - } - // 1. 处理levelId=1的整合数据(逻辑不变) - const level1Data = this.totalData.filter(item => item.levelId === 1); + const level1Data = this.ytdData.group; + if (!level1Data) return; const topBarData = { ...initTopBarData }; - level1Data.forEach(item => { - if (!item.name) return; - topBarData.locations = ["凯盛新能"]; // levelId=1固定为凯盛新能 - topBarData.diff.push(item.diffValue || 0); - topBarData.targets.push(item.targetValue || 0); - topBarData.reals.push(item.value || 0); - topBarData.rate.push(item.proportion || 0); - topBarData.flags.push(item.completed ? 1 : 0); - }); + topBarData.locations = ["凯盛新能"]; + topBarData.diff.push(level1Data.diff || 0); + topBarData.targets.push(level1Data.target || 0); + topBarData.reals.push(level1Data.real || 0); + topBarData.rate.push(level1Data.rate || 0); + topBarData.flags.push(this.getRateFlag(level1Data.rate, level1Data.real, level1Data.target)); // 2. 处理levelId≠1的整合数据(核心:levelId匹配地名) const barData = { ...initBarData }; // 筛选有效数据:levelId≠1 且 levelId在baseIndexToNameMap中 - const validOtherData = this.totalData.filter(item => { - return item.levelId !== 1 && baseIndexToNameMap.hasOwnProperty(item.levelId); - }); + const validOtherData = this.ytdData.factory // 遍历有效数据,填充locations(levelId→地名) validOtherData.forEach(item => { - // 根据levelId(序号)从映射表获取对应地名 - const baseName = baseIndexToNameMap[item.levelId]; - if (baseName) { // 确保地名和原始名称有效 - // barData.names.push(item.name); // 保留monData中的原始名称 - barData.locations.push(baseName); // locations=levelId对应的地名(如levelId=7→宜兴) - barData.diff.push(item.diffValue || 0); - barData.targets.push(item.targetValue || 0); - barData.reals.push(item.value || 0); - barData.rate.push(item.proportion || 0); - barData.flags.push(item.completed ? 1 : 0); - // barData.baseIndexes.push(Number(item.levelId) || 0); // 序号转数字 - } + barData.locations.push(item.title); // locations=levelId对应的地名(如levelId=7→宜兴) + barData.diff.push(item.diff || 0); + barData.targets.push(item.target || 0); + barData.reals.push(item.real || 0); + barData.rate.push(item.rate || 0); + barData.flags.push(this.getRateFlag(item.rate, item.real, item.target)); }); // 3. 更新chartData diff --git a/src/views/home/electricityCostAnalysisComponents/operatingSingleBar.vue b/src/views/home/electricityCostAnalysisComponents/operatingSingleBar.vue index 12032d7b..2f47c197 100644 --- a/src/views/home/electricityCostAnalysisComponents/operatingSingleBar.vue +++ b/src/views/home/electricityCostAnalysisComponents/operatingSingleBar.vue @@ -22,13 +22,13 @@ export default { chartD() { // 背景图片路径(若不需要可注释) // const bgImageUrl = require('@/assets/img/labelBg.png'); - const rate = this.detailData?.proportion? Number(this.detailData?.proportion) : 0 - const diff = this.detailData?.diffValue || 0 + const rate = this.detailData?.rate? Number(this.detailData?.rate) : 0 + const diff = this.detailData?.diff || 0 console.log('diff', diff); const seriesData = [ { - value: this.detailData?.targetValue || 0, + value: this.detailData?.budget || 0, flag: 1, // 实际项:达标(绿色) label: { show: true, @@ -49,8 +49,8 @@ export default { }, }, { - value: this.detailData?.value || 0, - flag: this.detailData?.completed, // 实际项:达标(绿色) + value: this.detailData?.real || 0, + flag: this.detailData?.rate>=100, // 实际项:达标(绿色) label: { show: true, position: 'top', diff --git a/src/views/home/electricityCostAnalysisComponents/relatedIndicatorsAnalysis.vue b/src/views/home/electricityCostAnalysisComponents/relatedIndicatorsAnalysis.vue index 6d701d95..07999cfd 100644 --- a/src/views/home/electricityCostAnalysisComponents/relatedIndicatorsAnalysis.vue +++ b/src/views/home/electricityCostAnalysisComponents/relatedIndicatorsAnalysis.vue @@ -14,8 +14,8 @@ {{ item.name }}·{{ item.unit }}
- 完成率:{{item.data.proportion}}% - 差值:{{item.data.diffValue}} + 完成率:{{item.data.rate}}% + 差值:{{item.data.diff}}
@@ -61,7 +61,8 @@ export default { return { chart: null, // 核心:当前激活的数据集(月度/累计),默认初始化月度数据 - activeData: this.relatedData.relatedMon || [] + activeData: this.relatedData.relatedMon || [], + currentTab: 'month' } }, computed: { @@ -79,11 +80,11 @@ export default { const list = (Array.isArray(this.activeData) ? this.activeData : []) return this.indicatorDefs.map(def => { - const data = list.find(item => item && item.name === def.name) || fallback + const data = list.find(item => item && item.title === def.name) || fallback return { ...def, data, - sortValue: Number((data && data.value) ?? 0) + sortValue: Number((data && data.real) ?? 0) } }) }, @@ -107,7 +108,12 @@ export default { // 可选:监听 relatedData 初始变化(若父组件异步传递数据,确保 activeData 同步更新) relatedData: { handler(newVal) { - this.activeData = newVal.relatedMon || []; + if(this.currentTab === 'month') { + this.activeData = newVal.relatedMon || []; + }else{ + this.activeData = newVal.relatedTotal || []; + } + }, immediate: true, deep: true @@ -132,6 +138,7 @@ export default { */ handleChange(value) { console.log('Tab 切换值:', value); + this.currentTab = value; // 根据 Tab 值更新当前激活的数据集 if (value === 'month') { // 切换为月度数据 diff --git a/src/views/home/fullCostAnalysis/fullCostAnalysisBase.vue b/src/views/home/fullCostAnalysis/fullCostAnalysisBase.vue index c73588ca..58030ff3 100644 --- a/src/views/home/fullCostAnalysis/fullCostAnalysisBase.vue +++ b/src/views/home/fullCostAnalysis/fullCostAnalysisBase.vue @@ -106,7 +106,7 @@ export default { dateData: {}, monData: {}, totalData: {}, - trend: [], + trend: {}, relatedData: {}, // cusProData: {}, }; diff --git a/src/views/home/grossMarginComponents/yearRelatedMetrics.vue b/src/views/home/grossMarginComponents/yearRelatedMetrics.vue index 73446142..e724a0ee 100644 --- a/src/views/home/grossMarginComponents/yearRelatedMetrics.vue +++ b/src/views/home/grossMarginComponents/yearRelatedMetrics.vue @@ -119,7 +119,7 @@ export default { // 数据兜底:确保是数组且长度≥2 const validData = Array.isArray(data) && data.length >= 2 ? data - : this.$props.ytdAnalysis.default(); + : this.$props.ytdAnalysis; // 提取收入(第0项)、全成本(第1项)数据 const incomeItem = validData[0] || { title: "营业收入", budget: 0, real: 0, rate: 0, diff: 0 }; diff --git a/src/views/home/inputOutputRatio/inputOutputRatio.vue b/src/views/home/inputOutputRatio/inputOutputRatio.vue index 10c1d16f..30d4a523 100644 --- a/src/views/home/inputOutputRatio/inputOutputRatio.vue +++ b/src/views/home/inputOutputRatio/inputOutputRatio.vue @@ -25,7 +25,7 @@ gap: 12px; grid-template-columns: 1624px; "> - + @@ -152,12 +152,6 @@ export default { console.log(res); this.monthData = res.data.month this.ytdData = res.data.ytd - - // this.saleData = res.data.SaleData - // this.premiumProduct = res.data.premiumProduct - // this.salesTrendMap = res.data.salesTrendMap - // this.grossMarginTrendMap = res.data.grossMarginTrendMap - // this.salesProportion = res.data.salesProportion ? res.data.salesProportion : {} }) }, handleTimeChange(obj) { diff --git a/src/views/home/inputOutputRatioComponents/operatingLineChartCumulative.vue b/src/views/home/inputOutputRatioComponents/operatingLineChartCumulative.vue index 94daa24a..a2044677 100644 --- a/src/views/home/inputOutputRatioComponents/operatingLineChartCumulative.vue +++ b/src/views/home/inputOutputRatioComponents/operatingLineChartCumulative.vue @@ -48,10 +48,6 @@ export default { name: "ProductionStatus", components: { Container, operatingBar, operatingTopBar }, props: { - salesTrendMap: { - type: Object, - default: () => ({}), - }, ytdData: { type: Object, default: () => ({}), diff --git a/src/views/home/inventoryAnalysisComponents/operatingLineChart.vue b/src/views/home/inventoryAnalysisComponents/operatingLineChart.vue index d58d92bd..c4337c48 100644 --- a/src/views/home/inventoryAnalysisComponents/operatingLineChart.vue +++ b/src/views/home/inventoryAnalysisComponents/operatingLineChart.vue @@ -100,7 +100,7 @@ getRateFlag(rate, real, target) { if (rate >= 100) return 1; // 2. 完成率 = 0 且 (目标值=0 或 实际值=目标值=0) => 达标 - if (rate === 0 && target === 0) return 1; + // if (rate === 0 && target === 0) return 1; // 其他情况 => 未达标 return 0; diff --git a/src/views/home/inventoryAnalysisComponents/operatingLineChartCumulative.vue b/src/views/home/inventoryAnalysisComponents/operatingLineChartCumulative.vue index 7b048e33..c3bbdda9 100644 --- a/src/views/home/inventoryAnalysisComponents/operatingLineChartCumulative.vue +++ b/src/views/home/inventoryAnalysisComponents/operatingLineChartCumulative.vue @@ -95,7 +95,7 @@ getRateFlag(rate, real, target) { if (rate >= 100) return 1; // 2. 完成率 = 0 且 (目标值=0 或 实际值=目标值=0) => 达标 - if (rate === 0 && target === 0) return 1; + // if (rate === 0 && target === 0) return 1; // 其他情况 => 未达标 return 0; diff --git a/src/views/home/procurementGainAnalysis/procurementGainAnalysisBase.vue b/src/views/home/procurementGainAnalysis/procurementGainAnalysisBase.vue index 1788f5e3..d97df0b3 100644 --- a/src/views/home/procurementGainAnalysis/procurementGainAnalysisBase.vue +++ b/src/views/home/procurementGainAnalysis/procurementGainAnalysisBase.vue @@ -83,7 +83,7 @@ import moment from "moment"; // import html2canvas from 'html2canvas' // import JsPDF from 'jspdf' export default { - name: "DayReport", + name: "procurementGainAnalysisBase", components: { ReportHeader, changeBase, @@ -105,9 +105,8 @@ export default { dateData: {}, monData: {}, totalData: {}, - trend: [], - relatedData: {}, - // cusProData: {}, + trend: {}, + relatedData: {} }; }, diff --git a/src/views/home/salesVolumeAnalysis/doublePlatedBase.vue b/src/views/home/salesVolumeAnalysis/doublePlatedBase.vue index 3384e3c1..e0498568 100644 --- a/src/views/home/salesVolumeAnalysis/doublePlatedBase.vue +++ b/src/views/home/salesVolumeAnalysis/doublePlatedBase.vue @@ -52,14 +52,6 @@ -