This commit is contained in:
shijing 2024-10-15 10:49:36 +08:00
commit 77224cdbd4
10 changed files with 136 additions and 54 deletions

View File

@ -57,6 +57,23 @@
placeholder="主要产品"
clearable
style="width: 100%"
@clear="() => { form.product=null } "
>
<el-option
v-for="item in materials"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="成本计算">
<el-select
v-model="form.product_cost"
placeholder="成本计算"
clearable
style="width: 100%"
@clear="() => { form.product_cost=null } "
>
<el-option
v-for="item in materials"
@ -136,10 +153,9 @@
const defaultForm = {
name: "",
cate: "",
product: "",
belong_dept: "",
test_materials: "",
input_materials: "",
test_materials: [],
input_materials: [],
};
export default {
emits: ["success", "closed"],
@ -222,6 +238,7 @@ export default {
open(mode = "add") {
this.mode = mode;
this.visible = true;
this.form = Object.assign({}, this.defaultForm);
return this;
},
//

View File

@ -225,8 +225,8 @@ export default {
}
arr[12] = huanqicha; //KW·h/t
// arr[13] =
if (arr[11] !=="/" && arr[11]!==0 && arr[12] !==0 && arr[12] !== "undefined"){
arr[13] = ((arr[11]/arr[12])*100).toFixed(2);
if (arr[11] !=="/" && arr[11]!=0 && arr[12] !=0 && arr[12] !== "undefined"){
arr[13] = ((arr[12]/arr[11])*100).toFixed(2);
}else{
arr[13] = "/"; //%= KW·h/t/KW·h/t*100%
}
@ -234,7 +234,6 @@ export default {
// arr[15] = 0.0; //
arr[15] = 0;
if (month_obj[n]) {
console.log("month_obj[n]",month_obj[n])
const monthData = month_obj[n];
const itemValue = item.elec_consume_unit; //
const sortedData = monthData.sort((a, b) => parseFloat(b.elec) - parseFloat(a.elec));
@ -332,7 +331,6 @@ export default {
this.$API.bi.dataset.exec.req("3322567213885833216").then((res) => {
this.myOption = JSON.parse(res.echart_options);
debugger;
console.log(this.myOption);
this.chartShow = true;
});
},

View File

@ -159,7 +159,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;
@ -290,6 +291,7 @@ export default {
wrapArrs.push(arrs);
});
that.tableDatas = wrapArrs;
console.log(that.tableDatas);
} else {
}
});

View File

@ -321,7 +321,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;

View File

@ -37,7 +37,7 @@
>
<thead class="myTableHead">
<tr>
<th colspan="18">水泥磨工段班组月度对比分析</th>
<th colspan="19">水泥磨工段班组月度对比分析</th>
</tr>
<tr>
<th rowspan="2">月份</th>
@ -46,7 +46,7 @@
<th>运转率</th>
<th>成本</th>
<th colspan="3">质量</th>
<th colspan="8">单位产品电耗</th>
<th colspan="9">单位产品电耗</th>
<th rowspan="2">得分</th>
</tr>
<tr>
@ -60,6 +60,7 @@
<th>循环风机1906KW·h/t</th>
<th>系统风机KW·h/t</th>
<th>目标值kW·h/t</th>
<th>当期值kW·h/t</th>
<th>当期与目标值差值kW·h/t</th>
<th>环期值kW·h/t</th>
<th>当期与环期差值kW·h/t</th>
@ -118,8 +119,26 @@ export default {
});
},
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) {
console.log("goalData", goalData);
let that = this;
let query0 = {};
query0.page = 0;
@ -202,23 +221,16 @@ export default {
item.系统风机_consume_unit != null
? item.系统风机_consume_unit
: "/";
// arr[11] =
// item.1915_consume_unit != null
// ? item.1915_consume_unit
// : "/";
// arr[12]=item._consume_unit!=null?item._consume_unit:'/';
// arr[13]=item.elec_consume_unit//KW·h/t
let keyVale = "goal_val_" + n;
// arr[12] = goalData[keyVale]; //KW·h/t//
if (goalData.length > 0){
goalData.forEach((item) => {
if (item.goal_cate_name == "单位产品分布电耗KW·h/t"){
arr[11] = item[keyVale]; //KW·h/t//
}
});
};
arr[12] = item.celec_consume_unit - arr[11]; //KW·h/t
};
arr[12] = item.elec_consume_unit; //KW·h/t
arr[13] = (item.elec_consume_unit - arr[11]).toFixed(2); //KW·h/t
let ind_pre = 0,
huanqi = 0,
huanqicha = 0,
@ -237,15 +249,15 @@ export default {
}
})
}
arr[13] = huanqi; //KW·h/t
arr[14] = huanqi; //KW·h/t
if (huanqi !== "/") {
huanqicha = item.celec_consume_unit - huanqi;
huanqicha = (item.elec_consume_unit - huanqi).toFixed(2);
} else {
huanqicha = item.celec_consume_unit;
huanqicha = item.elec_consume_unit;
}
arr[14] = huanqicha; //KW·h/t
arr[15] =
huanqi != "/" ? (huanqicha / huanqi) * 100 : 0; //%
arr[15] = huanqicha; //KW·h/t
arr[16] =
huanqi != "/" && huanqicha!=0 && huanqi!=0 ? ((huanqicha / huanqi) * 100).toFixed(2) :"/" ; //%
if (wrapArr0[n]) {
tongqicha =
item.celec_consume_unit -
@ -256,9 +268,9 @@ export default {
tongqi = 0;
}
arr[16] = tongqi; //%:-/
arr[17] = tongqi; //%:-/
// arr[18] = 0.0; //%
arr[17] = 0;
arr[18] = 0;
if (month_obj[n]) {
const monthData = month_obj[n];
const itemValue = item.elec_consume_unit; //
@ -274,7 +286,7 @@ export default {
} else if (index === 3) {
elec_score= 0;
}
arr[17] += elec_score;
arr[18] += elec_score;
const run_rate_itemValue = item.run_rate; //
const run_rate_sortedData = monthData.sort((a, b) => parseFloat(b.run_rate) - parseFloat(a.run_rate));
@ -289,7 +301,7 @@ export default {
} else if (run_rate_index === 3) {
run_rate_score= 0;
}
arr[17] += run_rate_score;
arr[18] += run_rate_score;
const production_hour_itemValue = item.production_hour; //
const production_hour_sortedData = monthData.sort((a, b) => parseFloat(b.production_hour) - parseFloat(a.production_hour));
@ -304,7 +316,7 @@ export default {
} else if (production_hour_index === 3) {
production_hour_score= 0;
}
arr[17] += production_hour_score;
arr[18] += production_hour_score;
const production_cost_unit_itemValue = item.production_cost_unit; //
const production_cost_unit_sortedData = monthData.sort((a, b) => parseFloat(b.production_cost_unit) - parseFloat(a.production_cost_unit));
@ -319,7 +331,7 @@ export default {
} else if (production_cost_unit_index === 3) {
production_cost_unit_score= 0;
}
arr[17] += production_cost_unit_score;
arr[18] += production_cost_unit_score;
const surface_area_itemValue = item.出磨水泥_比表面积_rate_pass; //
const surface_area_sortedData = monthData.sort((a, b) => parseFloat(b.surface_area) - parseFloat(a.surface_area));
@ -334,7 +346,7 @@ export default {
} else if (surface_area_index === 3) {
surface_area_score= 0;
}
arr[17] += surface_area_score;
arr[18] += surface_area_score;
const SO3_itemValue = item.出磨水泥_SO3_rate_pass; // SO3
const SO3_sortedData = monthData.sort((a, b) => parseFloat(b.SO3) - parseFloat(a.SO3));
@ -349,7 +361,7 @@ export default {
} else if (SO3_index === 3) {
SO3_score= 0;
}
arr[17] += SO3_score;
arr[18] += SO3_score;
const CLitemValue = item.出磨水泥_掺量_rate_pass; // SO3
const CL_sortedData = monthData.sort((a, b) => parseFloat(b.chanliang) - parseFloat(a.chanliang));
@ -364,7 +376,7 @@ export default {
} else if (CL_index === 3) {
CL_score= 0;
}
arr[17] += CL_score;
arr[18] += CL_score;
}
wrapArr.push(arr);
});

View File

@ -208,8 +208,9 @@ export default {
// Class
bindClass(item, index) {
let classInfo = { redColor: false, greenColor: false };
if (index == 6) {
if (typeof item == "number") {
if (index == 6 || index == 7) {
if ( item != "/") {
item = Number(item);
if (item > 0) {
classInfo.greenColor = true;
classInfo.redColor = false;
@ -354,8 +355,9 @@ export default {
let lastRate = 0;
if (
lastDiff !== "/" &&
lastDiff !=0 &&
lastNum !== "/" &&
lastNum !== 0
lastNum != 0
) {
lastRate = ((lastDiff / lastNum) * 100).toFixed(2);
} else {

View File

@ -133,7 +133,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;

View File

@ -105,7 +105,6 @@ export default {
{ id: 1, name: '日统计' },
{ id: 2, name: '月统计' },
],
tableNmae: '',
tableData1: [],
optionsShift: [],
sourceData: {}
@ -133,6 +132,7 @@ export default {
})
this.mgroupOptions = this.mgroupOptions.reverse();
this.query.mgroup = this.mgroupOptions[0].id;
this.query.mgroup_name = this.mgroupOptions[0].name;
this.tableName = this.mgroupOptions[0].name;
this.getTableData();
})
@ -184,6 +184,7 @@ export default {
let arr = [];
params.page = 0;
params.mgroup = that.query.mgroup;
params.mgroup_name = that.query.mgroup_name;
if (that.query.type == 0) {//
arr = that.query.day.split('-');
params.year_s = Number(arr[0]);
@ -264,7 +265,12 @@ export default {
dataArr.push(itemData.shift);
dataArr.push(itemData.team_name);
}
dataArr.push(itemData.total_production);
if (itemData.mgroup_name === "原料磨"){
dataArr.push(itemData.total_production_cost
);
} else {
dataArr.push(itemData.total_production);
}
// dataArr.push(itemData.coal_consume_unit);
dataArr.push(itemData.production_cost_unit);
let sub1data = itemData.imaterial_data;

View File

@ -112,7 +112,6 @@ export default {
this.$API.mtm.mgroup.list
.req({ page: 0, search: "原料磨" })
.then((res) => {
console.log("原料磨", res);
that.query.mgroup = res[0].id;
let params = {};
params.page = 0;
@ -130,6 +129,26 @@ export default {
});
},
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 = {};
@ -230,7 +249,7 @@ export default {
arr[15] = item.elec_consume_unit; //KW·h/t
let keyVale = "goal_val_" + n;
arr[16] = goalData[keyVale]?goalData[keyVale]:0; //KW·h/t//
arr[17] = item.celec_consume_unit - arr[16]; //KW·h/t
arr[17] = (arr[15] - arr[16]).toFixed(2); //KW·h/t
let ind_pre = 0,
huanbi = 0;
if (item.month_s == 1) {
@ -253,9 +272,9 @@ export default {
}else{
arr[19] = "/"; //KW·h/t
}
arr[20] = item.celec_consume_unit; //%
if (arr[18] !=="/" && arr[19] !==0 && arr[19] !== "undefined"){
arr[20] = ((arr[18]/arr[19])*100).toFixed(2);
arr[20] = 0; //%
if (arr[18] !=="/" && arr[19] !==0 && arr[19] !== "undefined" && arr[18] !== 0){
arr[20] = ((arr[19]/arr[18])*100).toFixed(2);
}else{
arr[20] = "/"; //%= KW·h/t/KW·h/t*100%
}
@ -263,7 +282,6 @@ export default {
arr[22] = 0;
if (month_obj[n]) {
console.log("month_obj[n]",month_obj[n])
const monthData = month_obj[n];
const itemValue = item.elec_consume_unit; //
const sortedData = monthData.sort((a, b) => parseFloat(b.elec) - parseFloat(a.elec));
@ -364,7 +382,7 @@ export default {
},
handleQuery() {
this.tableDatas = [];
this.getData(this.goalDatas);
this.getGoalData();
},
itemClick(type, item) {
this.type = type;

View File

@ -114,6 +114,25 @@ export default {
});
},
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 = {};
@ -164,7 +183,7 @@ export default {
arr[4] = item.elec_consume_unit; //KW·h/t
let keyVale = "goal_val_" + n;
arr[5] = goalData[keyVale]; //KW·h/t//
arr[6] = arr[4] - item.celec_consume_unit; //KW·h/t
arr[6] = arr[4] - arr[5]; //KW·h/t
let ind_pre = 0,
huanqi = 0,
huanqicha = 0,
@ -190,7 +209,13 @@ export default {
arr[8] = "/"; //KW·h/t
}
// arr[8] = huanqicha; //KW·h/t
arr[9] = arr[8] != "/" ? ((arr[7] / arr[8]) * 100).toFixed(2) : 0; //%
let growthRate = 0;
if (arr[8]!== "/" && arr[7]!== 0 && arr[8]!== 0 ) {
growthRate = ((arr[8] / arr[7]) * 100).toFixed(2);
} else{
growthRate = "/";
}
arr[9] = growthRate; //%
if (wrapArr0[n]) {
tongqicha =
item.celec_consume_unit -
@ -226,7 +251,7 @@ export default {
},
handleQuery() {
this.tableDatas = [];
this.getData(this.goalDatas);
this.getGoalData();
},
itemClick(type, item) {
this.type = type;