feat:tkx fix bug

This commit is contained in:
zty 2024-10-15 14:36:31 +08:00
parent cb0a492bbc
commit 6e4a817324
4 changed files with 45 additions and 23 deletions

View File

@ -113,14 +113,34 @@ export default {
if (res.length > 0) {
res.forEach((item) => {
if (item.goal_cate_name == "单位产品分布电耗KW·h/t") {
that.getData(item);
that.getGoalData();
}
})
}
});
});
},
methods: {
getGoalData() {
const self = this;
let params = {};
params.page = 0;
params.year = self.query.year_s;
params.mgroup = self.query.mgroup;
this.$API.mtm.goal.list.req(params).then((res) => {
if (res.length > 0) {
res.forEach((item) => {
if (item.goal_cate_name == "单位产品分布电耗KW·h/t") {
this.getData(item);
}
})
}
})
.catch((error) => {
console.error('获取目标数据失败:', error);
});
},
getData(goalData) {
let that = this;
let query0 = {};
@ -320,7 +340,7 @@ export default {
},
handleQuery() {
this.tableDatas = [];
this.getData(this.goalDatas);
this.getGoalData();
},
itemClick(type, item) {
this.type = type;

View File

@ -14,7 +14,6 @@
v-model="query.type"
placeholder="查询类型"
clearable
@change="typeCange"
>
<el-option
v-for="item in options"
@ -97,7 +96,7 @@
:key="1"
id="myTable"
class="myTable"
v-else
v-if="query.type == 2"
>
<thead class="myTableHead">
<tr>
@ -128,7 +127,7 @@
class="numCell"
>
<div :class="bindClass(item1, ind)">
<span v-if="item1 < 0 && ind == 6"
<span v-if="item1 > 0 && ind == 6"
></span
>
<span v-if="item1 < 0 && ind == 6"
@ -314,6 +313,10 @@ export default {
that.monthGoal[ind] !== undefined
? that.monthGoal[ind]
: "/";
arr.push(item.cen_consume_unit); //KW·h/t
arr[4] = that.monthGoal2[ind] !== undefined
? that.monthGoal2[ind]
: "/";
wrapArr.push(arr);
});
wrapArr.forEach((item, index) => {
@ -380,26 +383,23 @@ export default {
}
arrs[8] = sameRate;
wrapArrs.push(arrs);
arrs2[0] = item[0];
arrs2[1] = item.cen_consume_unit;
arrs2[2] =
that.monthGoal2[ind] !== undefined
? that.monthGoal2[ind]
: "/";
arrs2[1] = item[3];
arrs2[2] = item[4];
arrs2[3] = 80;
arrs2[4] = 87;
arrs2[5] = 94;
//KW·h/t
let lastNum2 = 0,
lastDiff2 = 0;
if (index > 1) {
if (index >= 1) {
let num = index - 1;
if (
wrapArr[num] &&
wrapArr[num].cen_consume_unit
wrapArr[num][3]
) {
lastNum2 = wrapArr[num].cen_consume_unit;
lastNum2 = wrapArr[num][3];
} else {
lastNum2 = "/";
}
@ -409,7 +409,7 @@ export default {
: "/";
}
if (arrs2[1] !== "/" && lastNum2 !== "/") {
lastDiff2 = arrs2[1] - lastNum2;
lastDiff2 = (arrs2[1] - lastNum2).toFixed(2);
} else {
lastDiff2 = "/";
}
@ -417,7 +417,7 @@ export default {
//%
let lastRate2 = 0;
if (
lastDiff2 == "/" &&
lastDiff2 !== "/" &&
lastNum2 !== "/" &&
lastNum2 !== 0
) {
@ -456,8 +456,8 @@ export default {
},
handleQuery() {
this.getMonthGoal();
this.getData();
},
typeCange() {},
handlePrint() {
this.$PRINT("#myReport");
},

View File

@ -267,7 +267,8 @@ export default {
if (
lastDiff !== "/" &&
lastNum !== "/" &&
lastNum !== 0
lastNum != 0 &&
lastDiff != 0
) {
lastRate = ((lastDiff / lastNum) * 100).toFixed(2);
} else {

View File

@ -166,7 +166,8 @@ export default {
bindClass(item, index) {
let classInfo = { redColor: false, greenColor: false };
if (index == 3 || index == 5) {
if (typeof item == "number") {
if ( item != "/") {
item = Number(item);
if (item > 0) {
classInfo.greenColor = true;
classInfo.redColor = false;
@ -227,7 +228,7 @@ export default {
//KW·h/t
let diff = 0;
if (item[2] !== "/") {
diff = item[1] - item[2];
diff = (item[1] - item[2]).toFixed(2);
} else {
diff = "/";
}
@ -262,11 +263,11 @@ export default {
//%
let lastRate = 0;
if (
lastDiff == "/" &&
lastDiff !== "/" &&
lastNum !== "/" &&
lastNum !== 0
lastNum != 0
) {
lastRate = (lastDiff / lastNum) * 100;
lastRate = ((lastDiff / lastNum) * 100).toFixed(2);
} else {
lastRate = "/";
}