修改
This commit is contained in:
@@ -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 !== '天然气成本';
|
||||
}
|
||||
}) // 兜底累计数据
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user