217 lines
4.8 KiB
Vue
217 lines
4.8 KiB
Vue
<template>
|
||
<div style="flex: 1">
|
||
<Container name="成本概览·元/m²" icon="cockpitItemIcon" size="costBasicBg" topSize="psiTopTitleBasic">
|
||
<div class="kpi-content" style="padding: 14px 16px; display: flex;flex-direction: column; width: 100%;">
|
||
<div class="top" style="display: flex; width: 100%;">
|
||
<cost-item :height="376" :itemList="finalItemList" />
|
||
</div>
|
||
</div>
|
||
</Container>
|
||
</div>
|
||
</template>
|
||
<script>
|
||
import Container from './container.vue'
|
||
import costItem from './cost-item.vue'
|
||
|
||
export default {
|
||
name: 'ProductionStatus',
|
||
components: { Container, costItem },
|
||
props: {
|
||
costOverviews: {
|
||
type: Array,
|
||
default: () => []
|
||
},
|
||
},
|
||
data() {
|
||
return {
|
||
chart: null,
|
||
// 固定3条默认数据,作为展示模板
|
||
parentItemList: [
|
||
{ name: "制造成本", targetValue: 0, value: 0, proportion: 0, flag: 0 },
|
||
{ name: "原片成本", targetValue: 0, value: 0, proportion: 0, flag: 0 },
|
||
{ name: "加工成本", targetValue: 0, value: 0, proportion: 0, flag: 0 },
|
||
]
|
||
}
|
||
},
|
||
computed: {
|
||
finalItemList() {
|
||
// 核心逻辑:以 parentItemList 为模板,用 costOverviews 数据覆盖,保持3条长度
|
||
return this.parentItemList.map((defaultItem, index) => {
|
||
// 找到 costOverviews 中同名称的条目(优先按名称匹配,无匹配则按索引匹配)
|
||
const matchedItem = this.costOverviews.find(item => item.name === defaultItem.name)
|
||
|| this.parentItemList[index];
|
||
|
||
// 用匹配到的数据覆盖默认值,无匹配则保留默认值
|
||
return {
|
||
name: defaultItem.name, // 名称固定为默认模板的名称,不随传入数据改变
|
||
flag: matchedItem?.flag ?? defaultItem.flag,
|
||
proportion: matchedItem?.proportion ?? defaultItem.proportion,
|
||
targetValue: matchedItem?.target ?? defaultItem.targetValue,
|
||
value: matchedItem?.value ?? defaultItem.value
|
||
};
|
||
});
|
||
}
|
||
},
|
||
watch: {
|
||
costOverviews: {
|
||
handler(newValue) {
|
||
console.log('costOverviews 数据更新:', newValue);
|
||
console.log('最终展示数据:', this.finalItemList); // 调试用,可删除
|
||
},
|
||
deep: true
|
||
}
|
||
},
|
||
mounted() {
|
||
console.log('初始展示数据:', this.finalItemList); // 调试用,可删除
|
||
},
|
||
methods: {
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang='scss' scoped>
|
||
.scroll-container {
|
||
max-height: 210px;
|
||
overflow-y: auto;
|
||
overflow-x: hidden;
|
||
padding: 10px 0;
|
||
|
||
&::-webkit-scrollbar {
|
||
display: none;
|
||
}
|
||
|
||
scrollbar-width: none;
|
||
-ms-overflow-style: none;
|
||
}
|
||
|
||
.proBarInfo {
|
||
display: flex;
|
||
flex-direction: column;
|
||
padding: 8px 27px;
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
.proBarInfoEqInfo {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
}
|
||
|
||
.slot {
|
||
width: 21px;
|
||
height: 23px;
|
||
background: rgba(0, 106, 205, 0.22);
|
||
backdrop-filter: blur(1.5px);
|
||
font-family: PingFangSC, PingFang SC;
|
||
font-weight: 400;
|
||
font-size: 16px;
|
||
color: #68B5FF;
|
||
line-height: 23px;
|
||
text-align: center;
|
||
font-style: normal;
|
||
}
|
||
|
||
.eq-name {
|
||
margin-left: 8px;
|
||
font-family: PingFangSC, PingFang SC;
|
||
font-weight: 400;
|
||
font-size: 16px;
|
||
color: #FFFFFF;
|
||
line-height: 18px;
|
||
letter-spacing: 1px;
|
||
text-align: left;
|
||
font-style: normal;
|
||
}
|
||
|
||
.eqStatus {
|
||
font-family: PingFangSC, PingFang SC;
|
||
font-weight: 400;
|
||
font-size: 16px;
|
||
color: #FFFFFF;
|
||
line-height: 18px;
|
||
text-align: right;
|
||
font-style: normal;
|
||
}
|
||
|
||
.splitLine {
|
||
width: 1px;
|
||
height: 14px;
|
||
border: 1px solid #ADADAD;
|
||
margin: 0 8px;
|
||
}
|
||
|
||
.yield {
|
||
height: 18px;
|
||
font-family: PingFangSC, PingFang SC;
|
||
font-weight: 400;
|
||
font-size: 16px;
|
||
color: #00FFFF;
|
||
line-height: 18px;
|
||
text-align: right;
|
||
font-style: normal;
|
||
}
|
||
|
||
.proBarInfoEqInfoLeft {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.proBarInfoEqInfoRight {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.proBarWrapper {
|
||
position: relative;
|
||
height: 10px;
|
||
margin-top: 6px;
|
||
border-radius: 5px;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.proBarLine {
|
||
width: 100%;
|
||
height: 100%;
|
||
background: linear-gradient(65deg, rgba(82, 82, 82, 0) 0%, #ACACAC 100%);
|
||
opacity: 0.2;
|
||
}
|
||
|
||
.proBarLineTop {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
height: 100%;
|
||
background: linear-gradient(65deg, rgba(53, 223, 247, 0) 0%, rgba(54, 220, 246, 0.92) 92%, #36F6E5 100%, #37ACF5 100%);
|
||
border-radius: 5px;
|
||
transition: width 0.3s ease;
|
||
}
|
||
|
||
.chartImgBottom {
|
||
position: absolute;
|
||
bottom: 45px;
|
||
left: 58px;
|
||
}
|
||
|
||
.line {
|
||
display: inline-block;
|
||
position: absolute;
|
||
left: 57px;
|
||
bottom: 42px;
|
||
width: 1px;
|
||
height: 20px;
|
||
background-color: #00E8FF;
|
||
}
|
||
</style>
|
||
|
||
<style>
|
||
.production-status-chart-tooltip {
|
||
background: #0a2b4f77 !important;
|
||
border: none !important;
|
||
backdrop-filter: blur(12px);
|
||
}
|
||
|
||
.production-status-chart-tooltip * {
|
||
color: #fff !important;
|
||
}
|
||
</style>
|