260 lines
6.7 KiB
Vue
260 lines
6.7 KiB
Vue
<template>
|
||
<div style="flex: 1">
|
||
<Container :isShowTab="true" :name="title" icon="cockpitItemIcon" size="opLargeBg" topSize="large"
|
||
@tabChange="handleChange">
|
||
<!-- 1. 移除 .kpi-content 的固定高度,改为自适应 -->
|
||
<div class="kpi-content" style="padding: 14px 16px; display: flex; width: 100%;">
|
||
<!-- 新增:topItem 专属包裹容器,统一控制样式和布局 -->
|
||
<div class="topItem-container" style="display: flex; gap: 8px;">
|
||
<div class="dashboard left">
|
||
<div class="title">
|
||
制造成本·单位/万元
|
||
</div>
|
||
<div class="line">
|
||
<operatingSingleBar :detailData="{
|
||
...(relatedDetailData.制造成本 || defaultData),
|
||
flag: getRateFlag((relatedDetailData.制造成本 || defaultData).completeRate)
|
||
}" />
|
||
</div>
|
||
</div>
|
||
<div class="dashboard right">
|
||
<div class="title">
|
||
财务费用·单位/万元
|
||
</div>
|
||
<div class="line">
|
||
<operatingSingleBar :detailData="{
|
||
...(relatedDetailData.财务费用 || defaultData),
|
||
flag: getRateFlag((relatedDetailData.财务费用 || defaultData).completeRate)
|
||
}" />
|
||
</div>
|
||
</div>
|
||
<div class="dashboard right">
|
||
<div class="title">
|
||
销售费用·单位/万元
|
||
</div>
|
||
<div class="line">
|
||
<operatingSingleBar :detailData="{
|
||
...(relatedDetailData.销售费用 || defaultData),
|
||
flag: getRateFlag((relatedDetailData.销售费用 || defaultData).completeRate)
|
||
}" />
|
||
</div>
|
||
</div>
|
||
<div class="dashboard right">
|
||
<div class="title">
|
||
管理费用·单位/万元
|
||
</div>
|
||
<div class="line">
|
||
<operatingSingleBar :detailData="{
|
||
...(relatedDetailData.管理费用 || defaultData),
|
||
flag: getRateFlag((relatedDetailData.管理费用 || defaultData).completeRate)
|
||
}" />
|
||
</div>
|
||
</div>
|
||
<div class="dashboard right">
|
||
<div class="title">
|
||
运费·单位/万元
|
||
</div>
|
||
<div class="line">
|
||
<operatingSingleBar :detailData="{
|
||
...(relatedDetailData.运费 || defaultData),
|
||
flag: getRateFlag((relatedDetailData.运费 || defaultData).completeRate)
|
||
}" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</Container>
|
||
</div>
|
||
</template>
|
||
<script>
|
||
import Container from '../components/container.vue'
|
||
import operatingSingleBar from './operatingSingleBar.vue'
|
||
|
||
// import * as echarts from 'echarts'
|
||
// import rawItem from './raw-Item.vue'
|
||
|
||
export default {
|
||
name: 'ProductionStatus',
|
||
components: { Container, operatingSingleBar },
|
||
props: {
|
||
relatedData: {
|
||
type: Object,
|
||
default: () => ({
|
||
relatedMon: {}, // 兜底月度数据
|
||
relatedTotal: {} // 兜底累计数据
|
||
})
|
||
},
|
||
title: {
|
||
type: String,
|
||
default: ''
|
||
},
|
||
month: {
|
||
type: String,
|
||
default: ''
|
||
},
|
||
},
|
||
data() {
|
||
return {
|
||
chart: null,
|
||
// 关键优化:初始化时直接赋值为月度数据(relatedMon)
|
||
relatedDetailData: this.relatedData.relatedMon || {},
|
||
defaultData: {
|
||
completeRate: 0,
|
||
diff: 0,
|
||
real: 0,
|
||
target: 0,
|
||
thb: 0
|
||
}
|
||
}
|
||
},
|
||
watch: {
|
||
// 监听 relatedData 变化(异步加载场景),同步更新月度数据
|
||
relatedData: {
|
||
handler(newVal) {
|
||
this.relatedDetailData = newVal.relatedMon || {};
|
||
},
|
||
immediate: true,
|
||
deep: true
|
||
},
|
||
itemData: {
|
||
handler(newValue, oldValue) {
|
||
// 保留原有逻辑(若有需要)
|
||
},
|
||
deep: true
|
||
}
|
||
},
|
||
mounted() {
|
||
// 无需额外操作,初始化数据已赋值
|
||
},
|
||
methods: {
|
||
handleRoute(path) {
|
||
this.$router.push({
|
||
path: path
|
||
})
|
||
},
|
||
getRateFlag(rate) {
|
||
if (isNaN(rate) || rate === null || rate === undefined) return 0;
|
||
return +(rate >= 100 || rate === 0);
|
||
},
|
||
handleChange(value) {
|
||
console.log('value', value, this.relatedData);
|
||
if (value === 'month') {
|
||
this.relatedDetailData = this.relatedData.relatedMon || {};
|
||
} else {
|
||
this.relatedDetailData = this.relatedData.relatedTotal || {};
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang='scss' scoped>
|
||
/* 3. 核心:滚动容器样式(固定高度+溢出滚动+隐藏滚动条) */
|
||
.scroll-container {
|
||
/* 1. 固定容器高度:根据页面布局调整(示例300px,超出则滚动) */
|
||
max-height: 210px;
|
||
/* 2. 溢出滚动:内容超出高度时显示滚动功能 */
|
||
overflow-y: auto;
|
||
/* 3. 隐藏横向滚动条(防止设备名过长导致横向滚动) */
|
||
overflow-x: hidden;
|
||
/* 4. 内边距:与标题栏和容器边缘对齐 */
|
||
padding: 10px 0;
|
||
|
||
/* 5. 隐藏滚动条(兼容主流浏览器) */
|
||
/* Chrome/Safari */
|
||
&::-webkit-scrollbar {
|
||
display: none;
|
||
}
|
||
|
||
/* Firefox */
|
||
scrollbar-width: none;
|
||
/* IE/Edge */
|
||
-ms-overflow-style: none;
|
||
}
|
||
|
||
.dashboard {
|
||
width: 310px;
|
||
height: 205px;
|
||
background: #F9FCFF;
|
||
padding: 16px 0 0 16px;
|
||
|
||
.title {
|
||
// width: 190px;
|
||
height: 18px;
|
||
font-family: PingFangSC, PingFang SC;
|
||
font-weight: 400;
|
||
font-size: 18px;
|
||
color: #000000;
|
||
line-height: 18px;
|
||
letter-spacing: 1px;
|
||
text-align: left;
|
||
font-style: normal;
|
||
letter-spacing: 2px;
|
||
}
|
||
|
||
.number {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 30px;
|
||
// width: 190px;
|
||
height: 32px;
|
||
font-family: YouSheBiaoTiHei;
|
||
font-size: 32px;
|
||
color: #0B58FF;
|
||
line-height: 32px;
|
||
letter-spacing: 2px;
|
||
text-align: left;
|
||
font-style: normal;
|
||
}
|
||
|
||
.mom {
|
||
width: 97px;
|
||
height: 18px;
|
||
font-family: PingFangSC, PingFang SC;
|
||
font-weight: 400;
|
||
font-size: 18px;
|
||
color: #000000;
|
||
line-height: 18px;
|
||
letter-spacing: 1px;
|
||
text-align: left;
|
||
font-style: normal;
|
||
}
|
||
}
|
||
|
||
// .line {
|
||
// width: 500px;
|
||
// height: 205px;
|
||
// background: #F9FCFF;
|
||
// }
|
||
|
||
// .leftTitle {
|
||
// .item {
|
||
// width: 67px;
|
||
// height: 180px;
|
||
// padding: 37px 23px;
|
||
// background: #F9FCFF;
|
||
// font-family: PingFangSC, PingFang SC;
|
||
// font-weight: 400;
|
||
// font-size: 18px;
|
||
// color: #000000;
|
||
// line-height: 25px;
|
||
// letter-spacing: 1px;
|
||
// // text-align: left;
|
||
// font-style: normal;
|
||
// }
|
||
// }
|
||
</style>
|
||
|
||
<!-- <style>
|
||
/* 全局 tooltip 样式(不使用 scoped,确保生效) */
|
||
.production-status-chart-tooltip {
|
||
background: #0a2b4f77 !important;
|
||
border: none !important;
|
||
backdrop-filter: blur(12px);
|
||
}
|
||
|
||
.production-status-chart-tooltip * {
|
||
color: #fff !important;
|
||
}
|
||
</style> -->
|