制造成本分析bug修改

This commit is contained in:
2026-04-21 09:40:57 +08:00
parent 835d4efd5b
commit f6aa736bff
19 changed files with 112 additions and 39 deletions

View File

@@ -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'
# 闫阳
# VUE_APP_BASE_API = 'http://172.16.19.131:7070'

View File

@@ -229,6 +229,7 @@ export default {
this.getData()
},
handleMeterialChange(val) {
console.log('val=================',val)
this.meterialName = val
this.getData()
},

View File

@@ -188,7 +188,6 @@ export default {
],
// paramList: ['制造成本', '财务费用', '销售费用', '管理费用', '运费'],
levelId: this.factory,
// baseId: Number(this.factory),
};
// 调用接口
getCostAnalysisData(requestParams).then((res) => {

View File

@@ -36,7 +36,7 @@
gap: 12px;
grid-template-columns: 1624px;
">
<relateFuCostAnalysis :relatedData="relatedData" :title="'相关指标分析'" />
<relateFuCostAnalysis :factory="factory" :relatedData="relatedData" :title="'相关指标分析'" />
</div>
</div>
<div class="bottom" style="display: flex; gap: 16px;margin-top: 6px;">

View File

@@ -132,7 +132,7 @@ export default {
}
.content-top-left {
width: 320px;
width: 312px;
height: 60px;
background: #FFFFFF;
position: relative;

View File

@@ -35,7 +35,7 @@
<div class="dropdown-options" v-if="isDropdownShow">
<div class="dropdown-option" v-for="(item, index) in profitOptions" :key="index"
@click.stop="selectProfit(item)">
{{ item }}
{{ item.label }}
</div>
</div>
</div>
@@ -62,15 +62,15 @@ export default {
isDropdownShow: false,
selectedProfit: '原片原料', // 选中的名称初始为null
profitOptions: [
'原片原料',
'氢氧化铝',
'碎玻璃',
'复合澄清剂',
'助熔剂',
'白云石',
'石灰石',
'硅砂',
'纯碱'
{label:'原片原料',value:'原片原料'},
{label:'氢氧化铝',value:'氢氧化铝'},
{label:'碎玻璃',value:'碎玻璃(外购)'},
{label:'复合澄清剂',value:'复合澄清剂'},
{label:'助熔剂',value:'助熔剂'},
{label:'白云石',value:'白云石'},
{label:'石灰石',value:'石灰石'},
{label:'硅砂',value:'硅砂'},
{label:'纯碱',value:'纯碱'}
]
};
},
@@ -256,9 +256,9 @@ export default {
},
methods: {
selectProfit(item) {
this.selectedProfit = item;
this.selectedProfit = item.label;
this.isDropdownShow = false;
this.$emit('handleGetItemData', item)
this.$emit('handleGetItemData', item.value);
}
},
};

View File

@@ -78,6 +78,7 @@ export default {
showRelated:true,
titleName:'指标分析',
activeData: this.relatedData.current || [],
currentTab: 'month'
};
},
mounted() {
@@ -87,7 +88,11 @@ export default {
// 对齐第二个组件:监听物料数据变化,同步更新激活数据集
relatedData: {
handler(newVal) {
this.activeData = newVal.current || {};
if (this.currentTab === 'month') {
this.activeData = newVal.relatedMon || [];
}else{
this.activeData = newVal.relatedTotal || [];
}
},
immediate: true, // 组件挂载时立即执行
deep: true // 深度监听对象内部变化
@@ -219,6 +224,7 @@ export default {
methods: {
handleChange(value) {
console.log('Tab 切换值:', value);
this.currentTab = value;
// 根据 Tab 值更新当前激活的数据集
if (value === 'month') {
// 切换为月度数据

View File

@@ -118,7 +118,7 @@ export default {
query: {
name: material,
month: this.month,
factory: this.$route.query.factory ? this.$route.query.factory :5,
factory: this.$route.query.factory ? this.$route.query.factory :this.factory,
dateData: this.dateData
}
});

View File

@@ -62,6 +62,7 @@ export default {
return {
chart: null,
activeData: this.relatedData.relatedMon || [], // 核心激活数据集(默认月度,与第二个组件一致)
currentTab: 'month'
}
},
computed: {
@@ -106,7 +107,11 @@ export default {
// 对齐第二个组件深度监听relatedData变化同步更新激活数据集
relatedData: {
handler(newVal) {
this.activeData = newVal.relatedMon || [];
if (this.currentTab === 'month') {
this.activeData = newVal.relatedMon || [];
}else{
this.activeData = newVal.relatedTotal || [];
}
},
immediate: true, // 挂载时立即执行
deep: true // 深度监听对象内部变化
@@ -119,6 +124,7 @@ export default {
// 新增tab切换处理函数和第二个组件逻辑完全一致切换月度/累计数据
handleChange(value) {
console.log('Tab 切换值:', value);
this.currentTab = value;
// 根据tab值更新激活数据集
if (value === 'month') {
this.activeData = this.relatedData.relatedMon || [];

View File

@@ -61,13 +61,18 @@ export default {
return {
chart: null,
activeData: this.relatedData.relatedMon || [], // 核心激活数据集(默认月度,与第二个组件一致)
currentTab: 'month'
}
},
watch: {
// 对齐第二个组件深度监听relatedData变化同步更新激活数据集
relatedData: {
handler(newVal) {
this.activeData = newVal.relatedMon || [];
if (this.currentTab === 'month') {
this.activeData = newVal.relatedMon || [];
}else{
this.activeData = newVal.relatedTotal || [];
}
},
immediate: true, // 挂载时立即执行
deep: true // 深度监听对象内部变化
@@ -118,6 +123,7 @@ export default {
methods: {
handleChange(value) {
console.log('Tab 切换值:', value);
this.currentTab = value;
// 根据tab值更新激活数据集
if (value === 'month') {
this.activeData = this.relatedData.relatedMon || [];

View File

@@ -49,6 +49,10 @@ export default {
type: String,
default: ''
},
factory: {
type: [String,Number],
default: ''
},
month: {
type: String,
default: ''
@@ -59,6 +63,7 @@ export default {
chart: null,
// 核心:当前激活的物料数据集(默认月度数据,与第二个组件逻辑一致)
activeData: this.relatedData.relatedMon || [],
currentTab: 'month'
}
},
computed: {
@@ -104,7 +109,11 @@ export default {
// 对齐第二个组件:监听物料数据变化,同步更新激活数据集
relatedData: {
handler(newVal) {
this.activeData = newVal.relatedMon || [];
if (this.currentTab === 'month') {
this.activeData = newVal.relatedMon || [];
}else{
this.activeData = newVal.relatedTotal || [];
}
},
immediate: true, // 组件挂载时立即执行
deep: true // 深度监听对象内部变化
@@ -116,6 +125,7 @@ export default {
methods: {
handleChange(value) {
console.log('Tab 切换值:', value);
this.currentTab = value;
// 根据 Tab 值更新当前激活的数据集
if (value === 'month') {
// 切换为月度数据
@@ -128,14 +138,13 @@ export default {
},
// 对齐第二个组件:优化点击事件,接收物料名和路由路径参数
handleDashboardClick(material, path) {
// 2. 优化路由跳转month放入query中修复原代码参数错误与第二个组件一致
this.$router.push({
path: path,
query: {
name: material,
month: this.month,
factory: this.$route.query.factory ? this.$route.query.factory :5,
factory: this.$route.query.factory ? this.$route.query.factory :this.factory,
dateData: this.dateData
}
});

View File

@@ -49,6 +49,10 @@ export default {
type: String,
default: ''
},
factory: {
type: [String,Number],
default: ''
},
month: {
type: String,
default: ''
@@ -59,6 +63,7 @@ export default {
chart: null,
// 核心:当前激活的物料数据集(默认月度数据,与第二个组件逻辑一致)
activeData: this.relatedData.relatedMon || [],
currentTab: 'month'
}
},
computed: {
@@ -107,7 +112,11 @@ export default {
// 对齐第二个组件:监听物料数据变化,同步更新激活数据集
relatedData: {
handler(newVal) {
this.activeData = newVal.relatedMon || [];
if (this.currentTab === 'month') {
this.activeData = newVal.relatedMon || [];
}else{
this.activeData = newVal.relatedTotal || [];
}
},
immediate: true, // 组件挂载时立即执行
deep: true // 深度监听对象内部变化
@@ -119,6 +128,7 @@ export default {
methods: {
handleChange(value) {
console.log('Tab 切换值:', value);
this.currentTab = value;
// 根据 Tab 值更新当前激活的数据集
if (value === 'month') {
// 切换为月度数据
@@ -136,9 +146,9 @@ export default {
this.$router.push({
path: path,
query: {
name: material,
name: material==='碎玻璃'?'碎玻璃(外购)':material,
month: this.month,
factory: this.$route.query.factory ? this.$route.query.factory :5,
factory: this.$route.query.factory ? this.$route.query.factory :this.factory,
dateData: this.dateData
}
});

View File

@@ -60,7 +60,8 @@ export default {
data() {
return {
chart: null,
activeData: this.relatedData.relatedMon || []
activeData: this.relatedData.relatedMon || [],
currentTab: 'month'
}
},
computed: {
@@ -70,7 +71,7 @@ export default {
{ key: 'fuelCost', name: '燃料成本', unit: '元/㎡', route: 'processingFuel/processingFuel'},
{ key: 'auxiliaryMaterialCost', name: '辅料成本', unit: '元/㎡', route: 'procAuxMatCost/procAuxMatCost'},
{ key: 'packagingMaterialCost', name: '包材成本', unit: '元/㎡', route: 'procPackMatCost'},
{ key: 'manufacturingCost', name: '制造费用', unit: '元/㎡', route: 'mfgOverheadCostAnalysis/mfgOverheadCostAnalysis'},
{ key: 'manufacturingCost', name: '制造费用', unit: '元/㎡', route: 'procMfgOverheadCost/procMfgOverheadCost'},
]
},
indicators() {
@@ -106,7 +107,11 @@ export default {
// 替换无效的itemData监听新增relatedData深度监听数据逻辑优化样式不变
relatedData: {
handler(newVal) {
this.activeData = newVal.relatedMon || [];
if (this.currentTab === 'month') {
this.activeData = newVal.relatedMon || [];
}else{
this.activeData = newVal.relatedTotal || [];
}
},
immediate: true, // 组件挂载时立即执行
deep: true // 深度监听对象内部变化
@@ -142,6 +147,7 @@ export default {
// 新增Tab切换处理函数与第一个成本组件逻辑对齐样式不变
handleChange(value) {
console.log('Tab 切换值:', value);
this.currentTab = value;
// 根据Tab值切换月度/累计数据
if (value === 'month') {
this.activeData = this.relatedData.relatedMon || [];

View File

@@ -59,14 +59,19 @@ export default {
return {
chart: null,
// 新增:当前激活的数据集(默认月度,和第一个组件逻辑对齐,样式无变化)
activeData: this.relatedData.relatedMon || []
activeData: this.relatedData.relatedMon || [],
currentTab: 'month'
}
},
watch: {
// 移除无效的itemData监听新增relatedData深度监听数据逻辑补充样式不变
relatedData: {
handler(newVal) {
this.activeData = newVal.relatedMon || [];
if (this.currentTab === 'month') {
this.activeData = newVal.relatedMon || [];
}else{
this.activeData = newVal.relatedTotal || [];
}
},
immediate: true, // 组件挂载时立即执行
deep: true // 深度监听对象内部变化
@@ -136,6 +141,7 @@ export default {
// 新增Tab切换处理函数同步切换月度/累计数据(仅数据逻辑,样式不变)
handleChange(value) {
console.log('Tab 切换值:', value);
this.currentTab = value;
// 根据 Tab 值更新当前激活的数据集
if (value === 'month') {
// 切换为月度数据

View File

@@ -60,6 +60,7 @@ export default {
chart: null,
// 核心:当前激活的物料数据集(默认月度数据,与第二个组件逻辑一致)
activeData: this.relatedData.relatedMon || [],
currentTab: 'month'
}
},
computed: {
@@ -105,7 +106,11 @@ export default {
// 对齐第二个组件:监听物料数据变化,同步更新激活数据集
relatedData: {
handler(newVal) {
this.activeData = newVal.relatedMon || [];
if (this.currentTab === 'month') {
this.activeData = newVal.relatedMon || [];
}else{
this.activeData = newVal.relatedTotal || [];
}
},
immediate: true, // 组件挂载时立即执行
deep: true // 深度监听对象内部变化
@@ -117,6 +122,7 @@ export default {
methods: {
handleChange(value) {
console.log('Tab 切换值:', value);
this.currentTab = value;
// 根据 Tab 值更新当前激活的数据集
if (value === 'month') {
// 切换为月度数据

View File

@@ -100,7 +100,8 @@ export default {
chart: null,
// 核心:当前激活的物料数据集(默认月度数据,与第二个组件逻辑一致)
activeData: this.relatedData.relatedMon || [],
activeMaterial: '' // 记录选中的物料状态,与第二个组件一致
activeMaterial: '', // 记录选中的物料状态,与第二个组件一致
currentTab: 'month'
}
},
// 对齐第二个组件:添加计算属性,精准筛选各物料数据
@@ -153,7 +154,11 @@ export default {
// 对齐第二个组件:监听物料数据变化,同步更新激活数据集
relatedData: {
handler(newVal) {
this.activeData = newVal.relatedMon || [];
if (this.currentTab === 'month') {
this.activeData = newVal.relatedMon || [];
}else{
this.activeData = newVal.relatedTotal || [];
}
},
immediate: true, // 组件挂载时立即执行
deep: true // 深度监听对象内部变化
@@ -165,6 +170,7 @@ export default {
methods: {
handleChange(value) {
console.log('Tab 切换值:', value);
this.currentTab = value;
// 根据 Tab 值更新当前激活的数据集
if (value === 'month') {
// 切换为月度数据

View File

@@ -60,6 +60,7 @@ export default {
chart: null,
// 核心:当前激活的物料数据集(默认月度数据,与第二个组件逻辑一致)
activeData: this.relatedData.relatedMon || [],
currentTab: 'month'
}
},
computed: {
@@ -104,7 +105,11 @@ export default {
// 对齐第二个组件:监听物料数据变化,同步更新激活数据集
relatedData: {
handler(newVal) {
this.activeData = newVal.relatedMon || [];
if (this.currentTab === 'month') {
this.activeData = newVal.relatedMon || [];
}else{
this.activeData = newVal.relatedTotal || [];
}
},
immediate: true, // 组件挂载时立即执行
deep: true // 深度监听对象内部变化
@@ -116,6 +121,7 @@ export default {
methods: {
handleChange(value) {
console.log('Tab 切换值:', value);
this.currentTab = value;
// 根据 Tab 值更新当前激活的数据集
if (value === 'month') {
// 切换为月度数据

View File

@@ -62,7 +62,8 @@ export default {
return {
chart: null,
// 核心:当前激活的成本数据集(默认月度数据,与第二个组件逻辑一致)
activeData: this.relatedData.relatedMon || []
activeData: this.relatedData.relatedMon || [],
currentTab: 'month'
}
},
computed: {
@@ -108,7 +109,11 @@ export default {
// 监听父组件传递的itemData变化同步更新激活数据集与第二个组件逻辑一致
relatedData: {
handler(newVal) {
this.activeData = newVal.relatedMon || [];
if (this.currentTab === 'month') {
this.activeData = newVal.relatedMon || [];
}else{
this.activeData = newVal.relatedTotal || [];
}
},
immediate: true,
deep: true
@@ -121,6 +126,7 @@ export default {
handleChange(value) {
console.log('Tab 切换值:', value);
this.currentTab = value;
// 根据 Tab 值更新当前激活的数据集
if (value === 'month') {
// 切换为月度数据

View File

@@ -118,7 +118,7 @@ export default {
query: {
name: material,
month: this.month,
factory: this.$route.query.factory ? this.$route.query.factory :5,
factory: this.$route.query.factory ? this.$route.query.factory :this.factory,
dateData: this.dateData
}
});