This commit is contained in:
‘937886381’
2026-01-09 17:53:34 +08:00
parent b76f3bfd37
commit b491f24126
50 changed files with 256 additions and 149 deletions

View File

@@ -209,20 +209,44 @@ export default {
// 调用接口
getSingleMaterialAnalysis(requestParams).then((res) => {
this.monData = res.data.currentMonthData.find(item => {
return item.name === "天然气成本";
if (this.$route.query.name) {
// 如果有查询参数,查找 "原料" + 查询参数 的项
return item.name === this.$route.query.name + '成本';
} else {
// 如果没有查询参数,查找 name 为 "原料硅砂" 的项
return item.name === '天然气成本';
}
});
console.log('this.monData', this.monData);
this.totalData = res.data.totalMonthData.find(item => {
return item.name === "天然气成本";
if (this.$route.query.name) {
// 如果有查询参数,查找 "原料" + 查询参数 的项
return item.name === this.$route.query.name + '成本';
} else {
// 如果没有查询参数,查找 name 为 "原料硅砂" 的项
return item.name === '天然气成本';
}
});
// this.relatedMon = res.data.relatedMon
this.relatedData = {
relatedMon: res.data.currentMonthData.filter(item => {
return item.name !== "天然气成本";
if (this.$route.query.name) {
// 如果有查询参数,查找 "原料" + 查询参数 的项
return item.name !== this.$route.query.name + '成本';
} else {
// 如果没有查询参数,查找 name 为 "原料硅砂" 的项
return item.name !== '天然气成本';
}
}), // 兜底月度数据
relatedTotal: res.data.totalMonthData.filter(item => {
return item.name !== "天然气成本";
if (this.$route.query.name) {
// 如果有查询参数,查找 "原料" + 查询参数 的项
return item.name !== this.$route.query.name + '成本';
} else {
// 如果没有查询参数,查找 name 为 "原料硅砂" 的项
return item.name !== '天然气成本';
}
}) // 兜底累计数据
}