修改集团及基地图表样式

This commit is contained in:
2026-03-20 16:13:53 +08:00
parent 2465f89d26
commit bb66f97b95
257 changed files with 25365 additions and 6814 deletions

View File

@@ -3,35 +3,21 @@
<Container :isShowTab="true" :name="title" icon="cockpitItemIcon" size="opLargeBg" topSize="large"
@tabChange="handleChange">
<div class="kpi-content" style="padding: 14px 16px; display: flex; width: 100%;">
<!-- 横向滚动容器和第二个组件样式统一防止溢出 -->
<div class="topItem-container" style="display: flex; gap: 8px;">
<!-- 天然气组件绑定对应筛选数据点击传递物料名和路由 -->
<div class="dashboard left" @click="handleDashboardClick('天然气', 'singleCombustible')">
<div class="title">天然气·/</div>
<div class="line">
<operatingSingleBar :detailData="naturalGasData"></operatingSingleBar>
<div class="topItem-container" style="display: flex; gap: 8px">
<div
v-for="item in sortedIndicators"
:key="item.key"
class="dashboard"
@click="item.route && handleDashboardClick(item.name,item.route)"
>
<div class="title">
{{ item.name }}·{{ item.unit }}
</div>
</div>
<!-- LNG液化天然气组件绑定对应筛选数据 -->
<div class="dashboard right" @click="handleDashboardClick('LNG液化天然气', 'singleCombustible')">
<div class="title">LNG液化天然气·/</div>
<div class="line">
<operatingSingleBar :detailData="lngData"></operatingSingleBar>
</div>
</div>
<!-- 重油组件绑定对应筛选数据 -->
<div class="dashboard right" @click="handleDashboardClick('重油', 'singleCombustible')">
<div class="title">重油·/</div>
<div class="line">
<operatingSingleBar :detailData="heavyOilData"></operatingSingleBar>
</div>
</div>
<!-- 水组件绑定对应筛选数据 -->
<div class="dashboard right" @click="handleDashboardClick('水', 'singleCombustible')">
<div class="title">·/</div>
<div class="line">
<operatingSingleBar :detailData="waterData"></operatingSingleBar>
<div style='font-size: 16px;text-align: right;padding-right: 5px;'>
<span>完成率:<span style='color: #0B58FF;'>{{item.data.proportion}}%</span></span>
<span style='display: inline-block;margin-left: 10px;'>差值:<span :style="{color:item.data.completed>0?'#30B590':'#FF9423'}" >{{item.data.diffValue}}</span></span>
</div>
<operatingSingleBar :detailData="item.data"></operatingSingleBar>
</div>
</div>
</div>
@@ -76,48 +62,45 @@ export default {
return {
chart: null,
activeData: this.relatedData.relatedMon || [], // 核心激活数据集(默认月度,与第二个组件一致)
activeMaterial: '' // 记录选中物料状态,与第二个组件统一
}
},
// 新增计算属性:和第二个组件逻辑一致,精准筛选各物料数据
computed: {
// 天然气数据:从激活数据集中筛选,兜底值统一
naturalGasData() {
return this.activeData.find(item => (item.name || '').includes('天然气')) || {
targetValue: 0,
value: 0,
completed: 0,
diffValue: 0
};
indicatorDefs() {
return [
{ key: 'naturalGas', name: '天然气', unit: '元/吨',route:'singleCombustible'},
{ key: 'lng', name: 'LNG液化天然气', unit: '元/吨',route:'singleCombustible'},
{ key: 'heavyOil', name: '重油', unit: '元/吨',route:'singleCombustible'},
{ key: 'water', name: '水', unit: '元/吨',route:'singleCombustible'}
]
},
// LNG液化天然气数据精准筛选
lngData() {
return this.activeData.find(item => (item.name || '').includes('LNG液化天然气')) || {
targetValue: 0,
value: 0,
completed: 0,
diffValue: 0
};
indicators() {
const fallback = { targetValue: 0, value: 0, completed: 0, diffValue: 0 }
const list = (Array.isArray(this.activeData) ? this.activeData : [])
return this.indicatorDefs.map(def => {
const data = list.find(item => item && item.name.includes(def.name)) || fallback
return {
...def,
data,
sortValue: Number((data && data.value) ?? 0)
}
})
},
// 重油数据:精准筛选
heavyOilData() {
return this.activeData.find(item => (item.name || '').includes('重油')) || {
targetValue: 0,
value: 0,
completed: 0,
diffValue: 0
};
},
// 水数据:精准筛选
waterData() {
return this.activeData.find(item => (item.name || '').includes('水')) || {
targetValue: 0,
value: 0,
completed: 0,
diffValue: 0
};
},
// 移除原无效的itemData统一使用activeData
sortedIndicators() {
const unitOrder = ['元/吨']
const unitRank = (u) => {
const idx = unitOrder.indexOf(u)
return idx === -1 ? 999 : idx
}
return this.indicators.slice().sort((a, b) => {
const ur = unitRank(a.unit) - unitRank(b.unit)
if (ur !== 0) return ur
const vr = (b.sortValue ?? -Infinity) - (a.sortValue ?? -Infinity)
if (vr !== 0) return vr
return String(a.key).localeCompare(String(b.key))
})
}
},
watch: {
// 对齐第二个组件深度监听relatedData变化同步更新激活数据集
@@ -147,10 +130,6 @@ export default {
// 优化点击事件:对齐第二个组件,接收物料名和路由路径,修复原路由参数错误
handleDashboardClick(material, path) {
// 1. 记录选中状态
this.activeMaterial = material;
console.log(`点击了【${material}】,月份:${this.month}`, '物料数据:', this.activeData);
// 2. 修复原路由跳转错误month放入query中原代码month直接写在路由配置里无效
this.$router.push({
@@ -214,7 +193,6 @@ export default {
letter-spacing: 2px;
text-align: left;
font-style: normal;
margin-bottom: 16px; // 与第二个组件标题间距一致
}
.number {