This commit is contained in:
‘937886381’
2025-12-30 19:36:05 +08:00
parent 7b3873f9ea
commit 20ef2b9763
158 changed files with 3059 additions and 462 deletions

View File

@@ -1,32 +1,35 @@
<template>
<div style="flex: 1">
<Container :name="title" icon="cockpitItemIcon" size="operatingRevenueBg" topSize="middle">
<!-- 1. 移除 .kpi-content 的固定高度改为自适应 -->
<!-- 1. 移除 .kpi-content 的固定高度改为自适应样式不变仅保留结构 -->
<div class="kpi-content" style="padding: 14px 16px; display: flex; width: 100%;">
<!-- 新增topItem 专属包裹容器统一控制样式和布局 -->
<!-- 新增topItem 专属包裹容器统一控制样式和布局原有行内样式不变 -->
<div class="topItem-container" style="display: flex; gap: 8px;">
<div class="dashboard left">
<div class="dashboard left" @click="handleDashboardClick('备件丶机物料')">
<div class="title">
备件丶机物料·单位/万元
</div>
<div class="line">
<operatingSingleBar></operatingSingleBar>
<!-- 绑定备件丶机物料对应数据新增数据绑定样式不变 -->
<operatingSingleBar :detailData="sparePartsData"></operatingSingleBar>
</div>
</div>
<div class="dashboard right">
<div class="dashboard right" @click="handleDashboardClick('折旧')">
<div class="title">
折旧·单位/万元
</div>
<div class="line">
<operatingSingleBar></operatingSingleBar>
<!-- 绑定折旧对应数据新增数据绑定样式不变 -->
<operatingSingleBar :detailData="depreciationData"></operatingSingleBar>
</div>
</div>
<div class="dashboard right">
<div class="dashboard right" @click="handleDashboardClick('其他')">
<div class="title">
其他·单位/万元
</div>
<div class="line">
<operatingSingleBar></operatingSingleBar>
<!-- 绑定其他对应数据新增数据绑定样式不变 -->
<operatingSingleBar :detailData="otherData"></operatingSingleBar>
</div>
</div>
</div>
@@ -37,63 +40,106 @@
<script>
import Container from './container.vue'
import operatingSingleBar from './operatingSingleBar.vue'
import verticalBarChart from './verticalBarChart.vue'
// import * as echarts from 'echarts'
// import rawItem from './raw-Item.vue'
export default {
name: 'ProductionStatus',
components: { Container, operatingSingleBar, verticalBarChart },
// mixins: [resize],
components: { Container, operatingSingleBar },
props: {
itemData: { // 接收父组件传递的设备数据数组
// 接收父组件传递的 月度+累计 组合数据(原有配置保留,仅优化注释)
relatedData: {
type: Array,
default: () => [] // 默认空数组,避免报错
default: () => []
},
title: { // 接收父组件传递的设备数据数组
factory: {
type: [String, Number],
default: ''
},
// 可选:动态标题(原有配置保留)
title: {
type: String,
default: () => '' // 默认空数组,避免报错
},
month: { // 接收父组件传递的设备数据数组
type: String,
default: () => '' // 默认空数组,避免报错
},
default: ''
}
},
data() {
return {
chart: null,
chart: null
// 注释无效的activeData保持数据简洁样式不变
// activeData: this.relatedData || []
}
},
watch: {
itemData: {
handler(newValue, oldValue) {
// this.updateChart()
},
deep: true // 若对象内属性变化需触发,需加 deep: true
}
computed: {
// 1. 备件丶机物料数据:精准筛选对应名称数据,兜底值统一
sparePartsData() {
return this.relatedData.find(item => (item.name || '').includes('备件丶机物料')) || {
targetValue: 0,
value: 0,
completed: 0,
diffValue: 0
};
},
// 2. 折旧数据:精准筛选对应名称数据,兜底值统一
depreciationData() {
return this.relatedData.find(item => (item.name || '').includes('折旧')) || {
targetValue: 0,
value: 0,
completed: 0,
diffValue: 0
};
},
// 3. 其他数据:精准筛选对应名称数据,兜底值统一
otherData() {
return this.relatedData.find(item => (item.name || '').includes('其他')) || {
targetValue: 0,
value: 0,
completed: 0,
diffValue: 0
};
},
// 保留原有电成本、水成本计算属性(若需使用可直接启用,样式不变)
// dianData() {
// return (this.relatedData.find(item => item.name === "电成本")) || {
// targetValue: 0,
// value: 0,
// completed: 0,
// diffValue: 0
// };
// },
// shuiData() {
// return (this.relatedData.find(item => item.name === "水成本")) || {
// targetValue: 0,
// value: 0,
// completed: 0,
// diffValue: 0
// };
// }
},
// 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];
// 保留原有watch注释若需恢复可直接启用样式不变
// watch: {
// // 可选:监听 relatedData 初始变化(若父组件异步传递数据,确保 activeData 同步更新)
// relatedData: {
// handler(newVal) {
// this.activeData = newVal.relatedMon || [];
// },
// immediate: true,
// deep: true
// }
// },
mounted() {
// 初始化图表(若需展示图表,需在模板中添加对应 DOM
// this.$nextTick(() => this.updateChart())
// 优化打印日志输出有效数据移除无效的activeData打印样式不变
console.log('组件挂载时的相关数据:', this.relatedData);
},
methods: {
handleDashboardClick(name) {
this.$router.push({
path: 'singleProcMfgOverheadCost',
query: {
name,
factory: this.$route.query.factory ? this.$route.query.factory : this.factory
}
})
}
}
}
</script>