diff --git a/.env.dev b/.env.dev index 7c7b6af3..7c750412 100644 --- a/.env.dev +++ b/.env.dev @@ -12,9 +12,9 @@ VUE_APP_TITLE = 洛玻集团驾驶舱 # 杨姗姗 # 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://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' # 路由懒加载 diff --git a/src/permission.js b/src/permission.js index 2411ca6a..ae41dce2 100644 --- a/src/permission.js +++ b/src/permission.js @@ -8,11 +8,8 @@ import { isRelogin } from '@/utils/request' NProgress.configure({ showSpinner: false }) -/** - * 从菜单树中查找 jumpFlag===1 的默认跳转路径 - * 若打标在父节点则取其下第一个可见叶子路径;若在叶子则直接返回该路径 - */ -function findDefaultPathFromMenus(menus) { +// 从菜单树中查找第一个可见叶子菜单路径(按接口返回顺序) +function findFirstLeafPathFromMenus(menus) { if (!Array.isArray(menus) || menus.length === 0) return null function dfs(list, parentPath = '') { @@ -23,16 +20,11 @@ function findDefaultPathFromMenus(menus) { ? rawPath : `${parentPath}/${rawPath}`.replace(/\/+/g, '/') - if (item.jumpFlag === 1) { - if (item.children && item.children.length > 0) { - const childPath = dfs(item.children, currentPath) - return childPath != null ? childPath : currentPath - } - return currentPath - } if (item.children && item.children.length > 0) { const found = dfs(item.children, currentPath) if (found != null) return found + } else { + return currentPath } } return null @@ -40,6 +32,24 @@ function findDefaultPathFromMenus(menus) { return dfs(menus) } +function findFirstLeafPathFromRoutes(routes) { + if (!Array.isArray(routes) || routes.length === 0) return null + const stack = [...routes] + while (stack.length) { + const route = stack.shift() + if (!route || route.hidden === true) continue + if (Array.isArray(route.children) && route.children.length > 0) { + stack.unshift(...route.children) + continue + } + const p = route.path || '' + if (typeof p === 'string' && p.startsWith('/') && p !== '/404') { + return p + } + } + return null +} + // 增加三方登陆 update by 芋艿 const whiteList = ['/login', '/social-login', '/auth-redirect', '/bind', '/register', '/oauthLogin/gitee'] @@ -65,11 +75,16 @@ router.beforeEach((to, from, next) => { store.dispatch('GenerateRoutes', userInfo.menus).then(accessRoutes => { // 根据 roles 权限生成可访问的路由表 router.addRoutes(accessRoutes) // 动态添加可访问路由表 - const defaultPath = findDefaultPathFromMenus(userInfo.menus) || '/' + const menuDefaultPath = findFirstLeafPathFromMenus(userInfo.menus) + const routeFallbackPath = findFirstLeafPathFromRoutes(accessRoutes) + const defaultPath = menuDefaultPath || routeFallbackPath || '/' store.dispatch('SetDefaultPath', defaultPath) // 仅当目标为根路径 '/' 时跳默认页;否则保持当前路径(含刷新场景),避免刷新被误判为“未匹配”而跳到默认页 if (to.path === '/') { - next({ path: defaultPath, replace: true }) + const matched = router.match(defaultPath) + const hasMatch = matched && Array.isArray(matched.matched) && matched.matched.length > 0 + const safePath = hasMatch ? defaultPath : (routeFallbackPath || '/') + next({ path: safePath, replace: true }) } else { next({ ...to, replace: true }) // hack方法 确保addRoutes已完成,当前页刷新时保留 to 的路径 } diff --git a/src/views/error/404.vue b/src/views/error/404.vue index 96f075c1..79849629 100644 --- a/src/views/error/404.vue +++ b/src/views/error/404.vue @@ -17,8 +17,8 @@
对不起,您正在寻找的页面不存在。尝试检查URL的错误,然后按浏览器上的刷新按钮或尝试在我们的应用程序中找到其他内容。
- - 返回首页 + + 返回登录页 diff --git a/src/views/home/basicInfoConfiguration/components/customerInfoAdd.vue b/src/views/home/basicInfoConfiguration/components/customerInfoAdd.vue new file mode 100644 index 00000000..1bd50042 --- /dev/null +++ b/src/views/home/basicInfoConfiguration/components/customerInfoAdd.vue @@ -0,0 +1,87 @@ + + diff --git a/src/views/home/basicInfoConfiguration/components/groupKeyAdd.vue b/src/views/home/basicInfoConfiguration/components/groupKeyAdd.vue new file mode 100644 index 00000000..1f798558 --- /dev/null +++ b/src/views/home/basicInfoConfiguration/components/groupKeyAdd.vue @@ -0,0 +1,100 @@ + + diff --git a/src/views/home/basicInfoConfiguration/components/productInfoAdd.vue b/src/views/home/basicInfoConfiguration/components/productInfoAdd.vue new file mode 100644 index 00000000..2f864b68 --- /dev/null +++ b/src/views/home/basicInfoConfiguration/components/productInfoAdd.vue @@ -0,0 +1,87 @@ + + diff --git a/src/views/home/basicInfoConfiguration/customerInfoConfiguration.vue b/src/views/home/basicInfoConfiguration/customerInfoConfiguration.vue index cc4dc4bc..df2ff447 100644 --- a/src/views/home/basicInfoConfiguration/customerInfoConfiguration.vue +++ b/src/views/home/basicInfoConfiguration/customerInfoConfiguration.vue @@ -7,10 +7,21 @@ @clickBtn="handleClick" /> + + + + diff --git a/src/views/home/basicInfoConfiguration/groupKeyTaskConfiguration.vue b/src/views/home/basicInfoConfiguration/groupKeyTaskConfiguration.vue index 4149ce5e..7b7e8edf 100644 --- a/src/views/home/basicInfoConfiguration/groupKeyTaskConfiguration.vue +++ b/src/views/home/basicInfoConfiguration/groupKeyTaskConfiguration.vue @@ -7,15 +7,30 @@ @clickBtn="handleClick" /> + + + + diff --git a/src/views/home/basicInfoConfiguration/productInfoConfiguration.vue b/src/views/home/basicInfoConfiguration/productInfoConfiguration.vue index cd93deaa..bcf608b8 100644 --- a/src/views/home/basicInfoConfiguration/productInfoConfiguration.vue +++ b/src/views/home/basicInfoConfiguration/productInfoConfiguration.vue @@ -7,10 +7,21 @@ @clickBtn="handleClick" /> + + + + diff --git a/src/views/home/electricityCostAnalysis/electricityCostAnalysis.vue b/src/views/home/electricityCostAnalysis/electricityCostAnalysis.vue index ce457430..9a443a21 100644 --- a/src/views/home/electricityCostAnalysis/electricityCostAnalysis.vue +++ b/src/views/home/electricityCostAnalysis/electricityCostAnalysis.vue @@ -16,7 +16,7 @@ gap: 12px; grid-template-columns:1624px; "> - +
@@ -25,27 +25,40 @@ gap: 12px; grid-template-columns: 1624px; "> - + +
+ + diff --git a/src/views/home/electricityCostAnalysisComponents/container.vue b/src/views/home/electricityCostAnalysisComponents/container.vue index 1a680670..d9663d14 100644 --- a/src/views/home/electricityCostAnalysisComponents/container.vue +++ b/src/views/home/electricityCostAnalysisComponents/container.vue @@ -43,37 +43,35 @@ export default { .content-top { height: 60px; +.title-wrapper { + display: flex; + align-items: center; + margin-left: 10px; + /* 垂直居中关键属性 */ + height: 100%; + /* 继承父容器高度,确保垂直居中范围 */ + } - .title-wrapper { - display: flex; - align-items: center; - margin-left: 10px; - /* 垂直居中关键属性 */ - height: 100%; - /* 继承父容器高度,确保垂直居中范围 */ - } - - .title-icon { - font-size: 30px; - margin-right: 12px; - margin-top: 4px; - /* 图标和文字之间的间距 */ - flex-shrink: 0; - /* 防止图标被压缩 */ - } - - .title-text { - font-family: PingFangSC, PingFang SC; - font-weight: 400; - font-size: 24px; - color: #000000; - letter-spacing: 3px; - text-align: left; - font-style: normal; - // 移除固定行高,避免影响垂直对齐 - // line-height: 60px; - } + .title-icon { + font-size: 30px; + margin-right: 12px; + margin-top: 4px; + /* 图标和文字之间的间距 */ + flex-shrink: 0; + /* 防止图标被压缩 */ + } + .title-text { + font-family: PingFangSC, PingFang SC; + font-weight: 400; + font-size: 24px; + color: #000000; + letter-spacing: 3px; + text-align: left; + font-style: normal; + // 移除固定行高,避免影响垂直对齐 + // line-height: 60px; + } // width: 547px; // background: url(../../../assets/img/contentTopBasic.png) no-repeat; // background-size: 100% 100%; @@ -108,12 +106,11 @@ export default { background-size: 100% 100%; background-position: 0 0; } - - &__rawTopTitleLarge { - background: url(../../../assets/img/rawTopTitleLarge.png) no-repeat; - background-size: 100% 100%; - background-position: 0 0; - } + &__rawTopTitleLarge { + background: url(../../../assets/img/rawTopTitleLarge.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + } } @@ -165,30 +162,22 @@ export default { background-position: 0 0; } - &__operatingRevenueBg { - background: url(../../../assets/img/operatingRevenueBg.png) no-repeat; - background-size: 100% 100%; - background-position: 0 0; - } + &__operatingRevenueBg { + background: url(../../../assets/img/operatingRevenueBg.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + } &__costBasicBg { background: url(../../../assets/img/costBasicBg.png) no-repeat; background-size: 100% 100%; background-position: 0 0; } - - &__rawTopBg { - background: url(../../../assets/img/rawTopBg.png) no-repeat; - background-size: 100% 100%; - background-position: 0 0; - } - - &__opLargeBg { - background: url(../../../assets/img/opLargeBg.png) no-repeat; - background-size: 100% 100%; - background-position: 0 0; - } - + &__rawTopBg { + background: url(../../../assets/img/rawTopBg.png) no-repeat; + background-size: 100% 100%; + background-position: 0 0; + } // &__left { // background: url(../../../../../../../assets/img/left.png) no-repeat; // background-size: 100% 100%; diff --git a/src/views/home/electricityCostAnalysisComponents/dataTrend.vue b/src/views/home/electricityCostAnalysisComponents/dataTrend.vue index d5252997..80ec8679 100644 --- a/src/views/home/electricityCostAnalysisComponents/dataTrend.vue +++ b/src/views/home/electricityCostAnalysisComponents/dataTrend.vue @@ -8,7 +8,8 @@ width: 1595px; background-color: rgba(249, 252, 255, 1); "> - + + @@ -23,128 +24,81 @@ export default { name: "ProductionStatus", components: { Container, dataTrendBar }, props: { - trend: { + trendData: { type: Array, - // 默认值与实际数据结构一致(12个月) - default: () => [ - // { title: "2025年01月", budget: 0, real: 0, rate: 0, diff: 0 }, - // { title: "2025年02月", budget: 0, real: 0, rate: 0, diff: 0 }, - // { title: "2025年03月", budget: 0, real: 0, rate: 0, diff: 0 }, - // { title: "2025年04月", budget: 0, real: 0, rate: 0, diff: 0 }, - // { title: "2025年05月", budget: 0, real: 0, rate: 0, diff: 0 }, - // { title: "2025年06月", budget: 0, real: 0, rate: 0, diff: 0 }, - // { title: "2025年07月", budget: 0, real: 0, rate: 0, diff: 0 }, - // { title: "2025年08月", budget: 0, real: 0, rate: 0, diff: 0 }, - // { title: "2025年09月", budget: 0, real: 0, rate: 0, diff: 0 }, - // { title: "2025年10月", budget: 0, real: 0, rate: 0, diff: 0 }, - // { title: "2025年11月", budget: 0, real: 0, rate: 0, diff: 0 }, - // { title: "2025年12月", budget: 0, real: 0, rate: 0, diff: 0 } - ] + default: () => [], }, }, data() { return { - chartData: { - months: [], // 月份数组(2025年01月 - 2025年12月) - rates: [], // 每月完成率(百分比) - reals: [], // 每月实际值 - budgets: [],// 每月预算值 - diffs: [], // 每月差值 - flags: [] // 每月达标标识(≥100 → 1,<100 → 0) - } + // 移除:原 chartData 定义,改为计算属性 }; }, - watch: { - trend: { - handler(newVal) { - this.processTrendData(newVal); - }, - immediate: true, - deep: true, - }, - }, - mounted() { - this.processTrendData(this.trend); - }, - methods: { - handleChange(value) { - this.$emit("handleChange", value); - }, + // 移除:原 watch 监听配置,计算属性自动响应 trendData 变化 + computed: { /** - * 处理趋势数据(适配12个月的数组结构) - * @param {Array} trendData - 原始趋势数组(12个月) + * chartData 计算属性:自动响应 trendData 变化,格式化并提取各字段数组 + * @returns {Object} 包含6个独立数组的格式化数据 */ - processTrendData(trendData) { - // 数据兜底:确保是数组且长度为12 - const validTrend = Array.isArray(trendData) - ? trendData - : [] + chartData() { + // 初始化6个独立数组 + const timeArr = []; // 格式化后的年月数组 + const valueArr = []; // 实际值数组 + const diffValueArr = []; // 差异值数组 + const targetValueArr = []; // 预算值数组 + const proportionArr = []; // 占比数组 + const completedArr = []; // 完成率数组 - // 初始化空数组 - const months = []; - const rates = []; - const reals = []; - const budgets = []; - const diffs = []; - const flags = []; + // 遍历传入的 trendData 数组(响应式依赖,变化时自动重算) + this.trendData.forEach((item) => { + // 1. 格式化时间并推入时间数组 + const yearMonth = this.formatTimeToYearMonth(item.time); + timeArr.push(yearMonth); - // 遍历12个月数据 - validTrend.forEach(item => { - // 基础数据提取(兜底处理) - const month = item.title ?? ''; - const budget = Number(item.budget) || 0; - const real = Number(item.real) || 0; - const rate = Number(item.rate) || 0; - const diff = Number(item.diff) || 0; - - // 计算达标标识(≥100 → 1,<100 → 0) - const flag = this.getRateFlag(rate, real, budget); - - // 填充数组 - months.push(month); - rates.push(rate); // 转为百分比并取整 - reals.push(real); - budgets.push(budget); - diffs.push(diff); - flags.push(flag); + // 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); }); - // 更新chartData(响应式) - this.chartData = { - months, - rates, - reals, - budgets, - diffs, - flags + // 组装并返回格式化后的数据(结构与原一致) + return { + time: timeArr, + value: valueArr, + diffValue: diffValueArr, + targetValue: targetValueArr, + proportion: proportionArr, + completed: completedArr, + rawData: this.trendData, // 透传原始数据,方便子组件使用 }; - - console.log('处理后的趋势数据:', this.chartData); }, - + }, + methods: { /** - * 计算达标标识 - * @param {Number} rate - 完成率(原始值,如1.2 → 120%) - * @returns {Number} 1: 达标(≥100%),0: 未达标(<100%) + * 格式化时间戳为年月格式(YYYY-MM) + * @param {Number} timestamp 13位毫秒级时间戳 + * @returns {String} 格式化后的年月字符串(如:2025-10) */ -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; -}, + 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/monthlyOverview.vue b/src/views/home/electricityCostAnalysisComponents/monthlyOverview.vue index 892bc82b..6dd8a9ea 100644 --- a/src/views/home/electricityCostAnalysisComponents/monthlyOverview.vue +++ b/src/views/home/electricityCostAnalysisComponents/monthlyOverview.vue @@ -1,9 +1,7 @@ + - - diff --git a/src/views/home/electricityCostAnalysisComponents/monthlyRelatedMetrics.vue b/src/views/home/electricityCostAnalysisComponents/monthlyRelatedMetrics.vue index 2477de1a..68792250 100644 --- a/src/views/home/electricityCostAnalysisComponents/monthlyRelatedMetrics.vue +++ b/src/views/home/electricityCostAnalysisComponents/monthlyRelatedMetrics.vue @@ -1,36 +1,24 @@ - + + diff --git a/src/views/home/electricityCostAnalysisComponents/operatingBar.vue b/src/views/home/electricityCostAnalysisComponents/operatingBar.vue index 8429afc9..0f6ea951 100644 --- a/src/views/home/electricityCostAnalysisComponents/operatingBar.vue +++ b/src/views/home/electricityCostAnalysisComponents/operatingBar.vue @@ -51,7 +51,7 @@ import * as echarts from 'echarts'; export default { name: "Container", components: { operatingLineBar }, - props: ["chartData", 'dateData'], + props: ["chartData",'dateData'], emits: ['sort-change'], // 声明事件(Vue3 推荐) data() { return { @@ -70,10 +70,10 @@ export default { computed: { // 排序后的数据源(核心:根据selectedSortValue重新排序) currentDataSource() { - if (!this.chartData?.factory) return {}; + if (!this.chartData) return {}; // 深拷贝原始数据,避免修改原数据 - const factory = JSON.parse(JSON.stringify(this.chartData.factory)); + const factory = JSON.parse(JSON.stringify(this.chartData)); if (!factory.locations.length || !this.selectedSortValue) return factory; // 构建带索引的数组,方便同步所有字段排序 @@ -82,7 +82,7 @@ export default { name, real: factory.reals[index], target: factory.targets[index], - rate: factory.rates[index], + rate: factory.rate[index], diff: factory.diff[index], flag: factory.flags[index] })); @@ -143,7 +143,7 @@ export default { { offset: 1, color: 'rgba(40, 138, 255, 0)' } ]) }, - data: data.rates || [], + data: data.rate || [], symbol: 'circle', symbolSize: 6 }, @@ -219,14 +219,14 @@ export default { padding: [5, 10, 5, 0], align: 'center', color: '#464646', - fontSize: 14, + fontSize: 14 }, achieved: { width: 'auto', padding: [5, 0, 5, 10], align: 'center', color: '#76DABE', // 与达标的 offset: 1 颜色一致 - fontSize: 14, + fontSize: 14 }, // 未达标样式 unachieved: { @@ -234,7 +234,7 @@ export default { padding: [5, 0, 5, 10], align: 'center', color: '#F9A44A', // 与未达标的 offset: 1 颜色一致 - fontSize: 14, + fontSize: 14 } } }, @@ -413,7 +413,7 @@ export default { height: 24px; font-family: PingFangSC, PingFang SC; font-weight: 400; - fontSize: 12px; + font-size: 12px; line-height: 24px; font-style: normal; letter-spacing: 2px; @@ -485,7 +485,7 @@ export default { .dropdown-option { padding: 6px 12px; - fontSize: 12px; + font-size: 12px; color: #333; cursor: pointer; text-align: left; diff --git a/src/views/home/electricityCostAnalysisComponents/operatingLineBarSale.vue b/src/views/home/electricityCostAnalysisComponents/operatingLineBarSale.vue index 5c46ad38..ed40b4dd 100644 --- a/src/views/home/electricityCostAnalysisComponents/operatingLineBarSale.vue +++ b/src/views/home/electricityCostAnalysisComponents/operatingLineBarSale.vue @@ -62,11 +62,7 @@ export default { console.error('图表容器未找到!'); return; } - - // 只创建一次图表实例 this.myChart = echarts.init(chartDom); - - // 绑定点击事件(只绑定一次,永久生效) this.myChart.getZr().on('click', (params) => { console.log('params', params); @@ -94,9 +90,10 @@ export default { if (itemName === undefined) { return; } + // 路由跳转时携带序号(或名称+序号) this.$router.push({ - path: 'operatingRevenueBase', + path: 'totalProfitBase', query: { // 使用query传递参数(推荐),也可使用params // baseName: itemName, factory: baseIndex, @@ -136,7 +133,7 @@ export default { } } }, - grid: { + grid: { top: 30, bottom: 5, right: 20, @@ -175,6 +172,7 @@ export default { fontSize: 12, align: 'right' }, + splitNumber: 4, axisTick: { show: false }, axisLabel: { @@ -183,7 +181,7 @@ export default { formatter: '{value}' }, splitLine: { lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } }, - axisLine: { show: true, show: true, lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } } + axisLine: { show: true, lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } } }, { type: 'value', @@ -199,7 +197,7 @@ export default { formatter: '{value}%' }, splitLine: { show: false }, - axisLine: { show: true, show: true, lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } }, + axisLine: { show: true, lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } }, splitNumber: 4 } ], diff --git a/src/views/home/electricityCostAnalysisComponents/operatingLineBarSaleGroup.vue b/src/views/home/electricityCostAnalysisComponents/operatingLineBarSaleGroup.vue index 91e81381..674cf190 100644 --- a/src/views/home/electricityCostAnalysisComponents/operatingLineBarSaleGroup.vue +++ b/src/views/home/electricityCostAnalysisComponents/operatingLineBarSaleGroup.vue @@ -34,7 +34,7 @@ export default { // 深度监听数据变化,仅更新图表配置(不销毁实例) chartData: { handler() { - console.log(this.chartData,'chartData'); + console.log(this.chartData, 'chartData'); this.updateChart(); }, deep: true, @@ -83,9 +83,9 @@ export default { // return html; // } }, - grid: { + grid: { top: 30, - bottom:20, + bottom: 20, right: 10, left: 25, containLabel: true @@ -118,6 +118,7 @@ export default { fontSize: 12, align: 'right' }, + splitNumber: 4, axisTick: { show: false }, axisLabel: { @@ -126,7 +127,7 @@ export default { formatter: '{value}' }, splitLine: { lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } }, - axisLine: { show: true, show: true, lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } }, + axisLine: { show: true, lineStyle: { color: 'rgba(0, 0, 0, 0.15)' } }, }, // 右侧Y轴:利润占比(百分比) { diff --git a/src/views/home/electricityCostAnalysisComponents/operatingLineBarSaleSingle.vue b/src/views/home/electricityCostAnalysisComponents/operatingLineBarSaleSingle.vue index f4d6d502..ce622ef4 100644 --- a/src/views/home/electricityCostAnalysisComponents/operatingLineBarSaleSingle.vue +++ b/src/views/home/electricityCostAnalysisComponents/operatingLineBarSaleSingle.vue @@ -1,5 +1,5 @@ diff --git a/src/views/home/electricityCostAnalysisComponents/totalOverview.vue b/src/views/home/electricityCostAnalysisComponents/totalOverview.vue index acc15d77..89456518 100644 --- a/src/views/home/electricityCostAnalysisComponents/totalOverview.vue +++ b/src/views/home/electricityCostAnalysisComponents/totalOverview.vue @@ -11,22 +11,21 @@
- {{ ytdData?.rate || 0}}% + {{ formatRate(factoryData?.completeRate) }}%
- 同比{{ ytdData?.yoyRate || 0}}% - - + 同比{{ formatRate(factoryData?.thb) }}% + 上升 + 下降
- - - + +
@@ -44,55 +43,56 @@ import verticalBarChart from './verticalBarChart.vue' export default { name: 'ProductionStatus', components: { Container, electricityGauge, verticalBarChart }, - // mixins: [resize], props: { - ytdData: { // 接收父组件传递的设备数据数组 + totalData: { type: Object, - default: () => {} // 默认空数组,避免报错 + default: () => ({}) }, - title: { // 接收父组件传递的设备数据数组 + title: { type: String, - default: () => '' // 默认空数组,避免报错 + default: '' }, - month: { // 接收父组件传递的设备数据数组 + month: { type: String, - default: () => '' // 默认空数组,避免报错 + default: '' }, }, data() { return { chart: null, - } }, - watch: { - itemData: { - handler(newValue, oldValue) { - // this.updateChart() - }, - deep: true // 若对象内属性变化需触发,需加 deep: true + computed: { + /** + * 自动提取monData中的工厂数据,并新增flag字段 + */ + factoryData() { // 整合原始数据 + 计算flag + return { + completeRate: this.totalData.proportion ? Number(this.totalData.proportion) : 0, + diff: this.totalData.diffValue, + real: this.totalData.value, + target: this.totalData.targetValue, + thb: this.totalData.thb, + // ...rawData, + flag: this.totalData.completed// 新增flag字段 + }; } }, - // computed: { - // // 处理排序:包含“总成本”的项放前面,其余项按原顺序排列 - // sortedItemData() { - // // 过滤出包含“总成本”的项(不区分大小写) - // const totalCostItems = this.itemData.filter(item => - // item.name && item.name.includes('总成本') - // ); - // // 过滤出不包含“总成本”的项 - // const otherItems = this.itemData.filter(item => - // !item.name || !item.name.includes('总成本') - // ); - // // 合并:总成本项在前,其他项在后 - // return [...totalCostItems, ...otherItems]; - // } - // }, - mounted() { - // 初始化图表(若需展示图表,需在模板中添加对应 DOM) - // this.$nextTick(() => this.updateChart()) - }, methods: { + /** + * 格式化百分比数值:处理空值/非数字,兜底为0 + */ + formatRate(value) { + if (isNaN(value) || value === null || value === undefined) { + return 0; + } + return value; + }, + /** + * 判断完成率对应的flag值(<100为0,≥100为1) + * @param {number} rate 完成率(原始值,如89代表89%) + * @returns {0|1} flag值 + */ } } @@ -126,6 +126,7 @@ export default { height: 205px; background: #F9FCFF; padding: 16px 0 0 10px; + .title { // width: 190px; height: 18px; diff --git a/src/views/home/electricityCostAnalysisComponents/verticalBarChart.vue b/src/views/home/electricityCostAnalysisComponents/verticalBarChart.vue index ec9643f0..6a72b359 100644 --- a/src/views/home/electricityCostAnalysisComponents/verticalBarChart.vue +++ b/src/views/home/electricityCostAnalysisComponents/verticalBarChart.vue @@ -1,8 +1,8 @@ + + diff --git a/src/views/home/productionCostAnalysis/fuelCostAnalysis.vue b/src/views/home/productionCostAnalysis/fuelCostAnalysis.vue index ff3b4e91..fb4f5807 100644 --- a/src/views/home/productionCostAnalysis/fuelCostAnalysis.vue +++ b/src/views/home/productionCostAnalysis/fuelCostAnalysis.vue @@ -33,7 +33,7 @@
diff --git a/src/views/home/productionCostAnalysis/procMfgOverheadCost.vue b/src/views/home/productionCostAnalysis/procMfgOverheadCost.vue index d3ff72ce..325812d7 100644 --- a/src/views/home/productionCostAnalysis/procMfgOverheadCost.vue +++ b/src/views/home/productionCostAnalysis/procMfgOverheadCost.vue @@ -37,8 +37,8 @@ grid-template-columns: 804px 804px; "> - + :title="'月度·相关指标分析'" /> +
diff --git a/src/views/home/productionCostAnalysis/processingFuel.vue b/src/views/home/productionCostAnalysis/processingFuel.vue index f4b9ea5f..86900f85 100644 --- a/src/views/home/productionCostAnalysis/processingFuel.vue +++ b/src/views/home/productionCostAnalysis/processingFuel.vue @@ -2,7 +2,7 @@
-
+ +
+
+ +
+
+ + + 完成率 + + + + 目标 + + + + 实际·达标 + + + + 实际·未达标 + +
+
+
+ 类目选择 +
+ +
+
+
+
+
+ +
+
+ + + + + diff --git a/src/views/home/productionCostAnalysisComponents/dataTrendBarFuel.vue b/src/views/home/productionCostAnalysisComponents/dataTrendBarFuel.vue index 50594cbf..019f165f 100644 --- a/src/views/home/productionCostAnalysisComponents/dataTrendBarFuel.vue +++ b/src/views/home/productionCostAnalysisComponents/dataTrendBarFuel.vue @@ -64,10 +64,13 @@ export default { profitOptions: [ '原片原料成本', '硅砂', - '海砂', '纯碱', '白云石', '石灰石', + '复合澄清剂', + '氢氧化铝', + '助溶剂', + '碎玻璃' ] }; }, diff --git a/src/views/home/productionCostAnalysisComponents/dataTrendBarSingleFuel.vue b/src/views/home/productionCostAnalysisComponents/dataTrendBarSingleFuel.vue index c7d0c077..f3e9ce0f 100644 --- a/src/views/home/productionCostAnalysisComponents/dataTrendBarSingleFuel.vue +++ b/src/views/home/productionCostAnalysisComponents/dataTrendBarSingleFuel.vue @@ -66,6 +66,7 @@ export default { '产量', '单耗', '消耗量', + '日均消耗量' ] }; }, diff --git a/src/views/home/productionCostAnalysisComponents/dataTrendSingleCCA.vue b/src/views/home/productionCostAnalysisComponents/dataTrendSingleCCA.vue new file mode 100644 index 00000000..20cd05d9 --- /dev/null +++ b/src/views/home/productionCostAnalysisComponents/dataTrendSingleCCA.vue @@ -0,0 +1,250 @@ + + + + + + + diff --git a/src/views/home/productionCostAnalysisComponents/monthlyThreeRelatedMetricsCCA.vue b/src/views/home/productionCostAnalysisComponents/monthlyThreeRelatedMetricsCCA.vue new file mode 100644 index 00000000..36738503 --- /dev/null +++ b/src/views/home/productionCostAnalysisComponents/monthlyThreeRelatedMetricsCCA.vue @@ -0,0 +1,239 @@ + + + + + + diff --git a/src/views/home/productionCostAnalysisComponents/operatingLineBarSale.vue b/src/views/home/productionCostAnalysisComponents/operatingLineBarSale.vue index 45d303cd..0bfb96bc 100644 --- a/src/views/home/productionCostAnalysisComponents/operatingLineBarSale.vue +++ b/src/views/home/productionCostAnalysisComponents/operatingLineBarSale.vue @@ -140,7 +140,7 @@ export default { top: 30, bottom: 5, right: 20, - left: 25, + left: 35, containLabel: true }, xAxis: [ diff --git a/src/views/home/productionCostAnalysisComponents/operatingSingleBar.vue b/src/views/home/productionCostAnalysisComponents/operatingSingleBar.vue index a7f28c63..6457cf87 100644 --- a/src/views/home/productionCostAnalysisComponents/operatingSingleBar.vue +++ b/src/views/home/productionCostAnalysisComponents/operatingSingleBar.vue @@ -71,7 +71,7 @@ export default { series: [ { type: 'bar', - barWidth: 60, + barWidth: 40, barCategoryGap: '50%', data: seriesData, itemStyle: { diff --git a/src/views/home/productionCostAnalysisComponents/relateFuelCostAnalysis.vue b/src/views/home/productionCostAnalysisComponents/relateFuelCostAnalysis.vue index 03e46ae0..5a058093 100644 --- a/src/views/home/productionCostAnalysisComponents/relateFuelCostAnalysis.vue +++ b/src/views/home/productionCostAnalysisComponents/relateFuelCostAnalysis.vue @@ -13,7 +13,7 @@
{{ item.name }}·{{ item.unit }}
-
+
完成率:{{item.data.proportion}}% 差值:{{item.data.diffValue}}
@@ -65,10 +65,14 @@ export default { indicatorDefs() { return [ { key: 'silicaSand', name: '硅砂', unit: '元/㎡', route: 'SIMFRMCostAnalysis'}, - { key: 'seaSand', name: '海砂', unit: '元/㎡', route: 'SIMFRMCostAnalysis'}, + // { key: 'seaSand', name: '海砂', unit: '元/㎡', route: 'SIMFRMCostAnalysis'}, { key: 'sodaAsh', name: '纯碱', unit: '元/㎡', route: 'SIMFRMCostAnalysis'}, { key: 'dolomite', name: '白云石', unit: '元/㎡', route: 'SIMFRMCostAnalysis'}, { key: 'limestone', name: '石灰石', unit: '元/㎡', route: 'SIMFRMCostAnalysis'}, + { key: 'compoundClarifyingAgent', name: '复合澄清剂', unit: '元/㎡', route: 'compositeClarifyingAgentCostAnalysis'}, + { key: 'ATH', name: '氢氧化铝', unit: '元/㎡', route: null}, + { key: 'cosolvent', name: '助溶剂', unit: '元/㎡', route: null}, + { key: 'brokenGlass', name: '碎玻璃', unit: '元/㎡', route: null}, ] }, indicators() { @@ -166,7 +170,7 @@ export default { } .dashboard { - width: 310px; + width: 194px; height: 205px; background: #F9FCFF; padding: 16px 0 0 10px; diff --git a/src/views/home/productionCostAnalysisComponents/relateSingleFuelCostAnalysis.vue b/src/views/home/productionCostAnalysisComponents/relateSingleFuelCostAnalysis.vue index a6bc2a60..1102a7ba 100644 --- a/src/views/home/productionCostAnalysisComponents/relateSingleFuelCostAnalysis.vue +++ b/src/views/home/productionCostAnalysisComponents/relateSingleFuelCostAnalysis.vue @@ -68,7 +68,8 @@ export default { { key: 'rawMaterialCost', name: '采购单价', unit: '元/吨'}, { key: 'fuelCost', name: '产量', unit: '吨'}, { key: 'electricityCost', name: '单耗', unit: '吨'}, - { key: 'laborCost', name: '消耗量', unit: '吨'} + { key: 'laborCost', name: '消耗量', unit: '吨'}, + { key: 'laborCostDay', name: '日均消耗量', unit: '吨'} ] }, indicators() { @@ -156,7 +157,7 @@ export default { } .dashboard { - width: 390px; + width: 312px; height: 205px; background: #F9FCFF; padding: 16px 0 0 10px; diff --git a/src/views/home/productionCostAnalysisComponents/yearThreeRelatedMetricsCCA.vue b/src/views/home/productionCostAnalysisComponents/yearThreeRelatedMetricsCCA.vue new file mode 100644 index 00000000..36738503 --- /dev/null +++ b/src/views/home/productionCostAnalysisComponents/yearThreeRelatedMetricsCCA.vue @@ -0,0 +1,239 @@ + + + + + + diff --git a/src/views/home/salesVolumeAnalysisComponents/monthlyRelatedMetrics.vue b/src/views/home/salesVolumeAnalysisComponents/monthlyRelatedMetrics.vue index c122e08f..b9bec254 100644 --- a/src/views/home/salesVolumeAnalysisComponents/monthlyRelatedMetrics.vue +++ b/src/views/home/salesVolumeAnalysisComponents/monthlyRelatedMetrics.vue @@ -1,31 +1,21 @@