diff --git a/src/components/scEnm/lineChartsdialog.vue b/src/components/scEnm/lineChartsdialog.vue index a1b70c78..55549c27 100644 --- a/src/components/scEnm/lineChartsdialog.vue +++ b/src/components/scEnm/lineChartsdialog.vue @@ -307,12 +307,13 @@ export default { this.option.series[0].name = that.cate; console.log(that.mgroup) if (that.mgroup) { - if (that.cate == "总产量(t)" || that.cate == "出厂水泥合计(t)") { + if (that.cate == "总产量(t)" || that.cate == "出厂水泥合计(t)" || that.cate == "电石渣干粉总产量(t)") { that.cateName = "total_production"; } else if ( that.cate == "单位产品分布电耗(kW·h/t)" || that.cate == "生料分布电耗(kW·h/t)" || - that.cate == "煤磨分布电耗(kW·h/t)" + that.cate == "煤磨分布电耗(kW·h/t)" || + that.cate == "电石渣干粉分布电耗(kW·h/t)" ) { that.cateName = "elec_consume_unit"; } else if (that.cate == "台时产量(t/h)") { @@ -338,7 +339,10 @@ export default { that.cateName = "production_hour"; } else if (that.cate == "吨熟料发电量(kW·h/t)") { that.cateName = "production_elec_unit"; - } else if (that.cate == "总电耗(kW·h)"||that.cate =="总电量(kW·h)") { + } else if (that.cate == "总电耗(kW·h)"|| + that.cate =="总电量(kW·h)" || + that.cate == "电石渣工段总电量(kW·h)" + ) { that.cateName = "elec_consume"; }else if (that.cate == "消耗") { that.cateName = "amount_consume"; diff --git a/src/views/enm_coal/teamAnalysis.vue b/src/views/enm_coal/teamAnalysis.vue index d58c9977..c0a34fd0 100644 --- a/src/views/enm_coal/teamAnalysis.vue +++ b/src/views/enm_coal/teamAnalysis.vue @@ -38,7 +38,7 @@ > - 煤磨工序班组月度对比分析 + 煤磨工序班组月度对比分析 月份 @@ -49,6 +49,7 @@ 质量 单位产品电耗 得分 + 排名 细度(%) @@ -342,13 +343,35 @@ export default { } wrapArr.push(arr); }); - that.tableDatas = wrapArr; - } else { - } - }); - }); - - + // 深拷贝数组,防止原始数据被修改 + const sortArr = [...wrapArr]; + // 将数组按每4个元素进行分组 + const groupSize = 4; + const groupedArr = []; + for (let i = 0; i < sortArr.length; i += groupSize) { + groupedArr.push(sortArr.slice(i, i + groupSize)); + } + groupedArr.forEach(group => { + group.sort((a, b) => b[b.length - 1] - a[a.length - 1]); // 按最后一项值排序(忽略排名) + // 为每个分组内的元素计算排名 + let currentRank = 1; + let previousValue = null; + group.forEach((item, index) => { + if (previousValue !== item[item.length - 1]) { + currentRank = index + 1; + previousValue = item[item.length - 1]; // 保留上一个排名 + // 当前排名为索引加1 + } + item.push(`${currentRank}名`); + }); + }); + // 扁平化分组数组 + const flattenedArr = groupedArr.flat(); + // 将排序并添加排名后的数据赋值给 tableDatas + that.tableDatas = flattenedArr; + } + }); + }); }, handleQuery() { this.tableDatas = []; diff --git a/src/views/enm_kiln/teamAnalysis.vue b/src/views/enm_kiln/teamAnalysis.vue index eb986cec..8975712a 100644 --- a/src/views/enm_kiln/teamAnalysis.vue +++ b/src/views/enm_kiln/teamAnalysis.vue @@ -443,10 +443,8 @@ export default { } wrapArr.push(arr); }); - console.log(wrapArr),'------------------'; // 深拷贝数组,防止原始数据被修改 const sortArr = [...wrapArr]; - // 将数组按每4个元素进行分组 const groupSize = 4; const groupedArr = []; @@ -467,11 +465,11 @@ export default { item.push(`${currentRank}名`); }); }); - // 扁平化分组数组 - const flattenedArr = groupedArr.flat(); - // 将排序并添加排名后的数据赋值给 tableDatas - that.tableDatas = flattenedArr; - } + // 扁平化分组数组 + const flattenedArr = groupedArr.flat(); + // 将排序并添加排名后的数据赋值给 tableDatas + that.tableDatas = flattenedArr; + } }); }); diff --git a/src/views/enm_mill/teamAnalysis.vue b/src/views/enm_mill/teamAnalysis.vue index 4981d4b9..1dec1b39 100644 --- a/src/views/enm_mill/teamAnalysis.vue +++ b/src/views/enm_mill/teamAnalysis.vue @@ -38,7 +38,7 @@ > - 水泥粉磨工序班组月度对比分析 + 水泥粉磨工序班组月度对比分析 月份 @@ -49,6 +49,7 @@ 质量 单位产品电耗 得分 + 排名 总产量(t) @@ -396,12 +397,35 @@ export default { newArr.push(wrapArr[i]); } } - that.tableDatas = newArr; - } else { - } - }); - }); - + // 深拷贝数组,防止原始数据被修改 + const sortArr = [...wrapArr]; + // 将数组按每4个元素进行分组 + const groupSize = 4; + const groupedArr = []; + for (let i = 0; i < sortArr.length; i += groupSize) { + groupedArr.push(sortArr.slice(i, i + groupSize)); + } + groupedArr.forEach(group => { + group.sort((a, b) => b[b.length - 1] - a[a.length - 1]); // 按最后一项值排序(忽略排名) + // 为每个分组内的元素计算排名 + let currentRank = 1; + let previousValue = null; + group.forEach((item, index) => { + if (previousValue !== item[item.length - 1]) { + currentRank = index + 1; + previousValue = item[item.length - 1]; // 保留上一个排名 + // 当前排名为索引加1 + } + item.push(`${currentRank}名`); + }); + }); + // 扁平化分组数组 + const flattenedArr = groupedArr.flat(); + // 将排序并添加排名后的数据赋值给 tableDatas + that.tableDatas = flattenedArr; + } + }); + }); }, handleQuery() { this.tableDatas = []; diff --git a/src/views/enm_pack/teamAnalysis.vue b/src/views/enm_pack/teamAnalysis.vue index 0bf16401..e4ecef51 100644 --- a/src/views/enm_pack/teamAnalysis.vue +++ b/src/views/enm_pack/teamAnalysis.vue @@ -38,7 +38,7 @@ > - + 水泥包装工序班组月度对比分析 @@ -48,6 +48,7 @@ 总产量(t) 当期单位产品电耗 得分 + 排名 当期值(kW·h/t) @@ -267,12 +268,35 @@ export default { wrapArr.push(arr); // console.log(wrapArr); }); - that.tableDatas = wrapArr; - } else { - } - }); - }); - + // 深拷贝数组,防止原始数据被修改 + const sortArr = [...wrapArr]; + // 将数组按每4个元素进行分组 + const groupSize = 4; + const groupedArr = []; + for (let i = 0; i < sortArr.length; i += groupSize) { + groupedArr.push(sortArr.slice(i, i + groupSize)); + } + groupedArr.forEach(group => { + group.sort((a, b) => b[b.length - 1] - a[a.length - 1]); // 按最后一项值排序(忽略排名) + // 为每个分组内的元素计算排名 + let currentRank = 1; + let previousValue = null; + group.forEach((item, index) => { + if (previousValue !== item[item.length - 1]) { + currentRank = index + 1; + previousValue = item[item.length - 1]; // 保留上一个排名 + // 当前排名为索引加1 + } + item.push(`${currentRank}名`); + }); + }); + // 扁平化分组数组 + const flattenedArr = groupedArr.flat(); + // 将排序并添加排名后的数据赋值给 tableDatas + that.tableDatas = flattenedArr; + } + }); + }); }, handleQuery() { this.tableDatas = []; diff --git a/src/views/enm_report/costing.vue b/src/views/enm_report/costing.vue index 2853fa7e..4fd258c1 100644 --- a/src/views/enm_report/costing.vue +++ b/src/views/enm_report/costing.vue @@ -118,7 +118,7 @@ export default { getMgroup() { this.$API.mtm.mgroup.list.req({ page: 0, cate: 'section' }).then(res => { res.forEach(item => { - if (item.name !== '煤磨' && item.name !== '水泥包装') { + if (item.name !== '煤磨' && item.name !== '水泥包装'&& item.name !== '原料磨') { this.mgroupOptions.push(item); } }) diff --git a/src/views/enm_report/reportMonth.vue b/src/views/enm_report/reportMonth.vue index 93cf58f1..04396f28 100644 --- a/src/views/enm_report/reportMonth.vue +++ b/src/views/enm_report/reportMonth.vue @@ -42,9 +42,7 @@ 序号 项目 - 月数据 - 环比增长 - 同比增长 + 月数据 @@ -53,14 +51,12 @@ - + - - - + @@ -73,8 +69,8 @@ - - + +
生产月报生产月报
序号 项目月数据环比增长同比增长月数据
{{item[1]}} {{item[2]}} {{item[3]}}{{item[4]}}{{item[5]}}{{item[4]}}{{item[5]}}
@@ -294,7 +290,7 @@ that.tableDatas[24][3] = res1[0].bag_cement_val; } }).then(res=>{ - this.getHuanbiData(); + // this.getHuanbiData(); })}); }, canCompute(a,b){ @@ -310,172 +306,172 @@ return 0 } }, - getHuanbiData(){ - let that = this; - let params = {}; - params.page = 0; - params.year_s = that.year_h; - params.month_s = that.month_h; - let m_goal_val = "goal_val_" + that.month - params.type = 'month_s'; - this.$API.enm.enstat.req(params).then((res) => { - let dataList = {}; - res.forEach(item => { - let label = item.mgroup_name; - dataList[label] = item; - }); + // getHuanbiData(){ + // let that = this; + // let params = {}; + // params.page = 0; + // params.year_s = that.year_h; + // params.month_s = that.month_h; + // let m_goal_val = "goal_val_" + that.month + // params.type = 'month_s'; + // this.$API.enm.enstat.req(params).then((res) => { + // let dataList = {}; + // res.forEach(item => { + // let label = item.mgroup_name; + // dataList[label] = item; + // }); - //台产 - that.tableDatas[0][4] = this.canCompute(that.nowData[0],dataList.原料磨.production_hour); - that.tableDatas[1][4] = this.canCompute(that.nowData[1],dataList.电石渣.production_hour); - that.tableDatas[2][4] = this.canCompute(that.nowData[2],dataList.煤磨.production_hour); - that.tableDatas[3][4] = this.canCompute(that.nowData[3],dataList.回转窑.production_hour); - that.tableDatas[4][4] = this.canCompute(that.nowData[4],dataList.水泥磨.production_hour); - //能耗(kW·h/t) - that.tableDatas[5][4] = this.canCompute(that.nowData[5],dataList.回转窑.celec_consume_unit); - that.tableDatas[6][4] = this.canCompute(that.nowData[6],dataList.回转窑.coal_consume_unit); - that.tableDatas[7][4] = this.canCompute(that.nowData[7],dataList.回转窑.cen_consume_unit); - that.tableDatas[8][4] = this.canCompute(that.nowData[8],dataList.水泥磨.cen_consume_unit); - that.tableDatas[9][4] = this.canCompute(that.nowData[9],dataList.电石渣.elec_consume_unit); - that.tableDatas[10][4] = this.canCompute(that.nowData[10],dataList.原料磨.elec_consume_unit); - that.tableDatas[11][4] = this.canCompute(that.nowData[11],dataList.回转窑.elec_consume_unit); - that.tableDatas[12][4] = this.canCompute(that.nowData[12],dataList.水泥磨.elec_consume_unit); - that.tableDatas[13][4] = this.canCompute(that.nowData[13], dataList.水泥包装.elec_consume_unit); - //产量(t) - that.tableDatas[14][4] = this.canCompute(that.nowData[14],dataList.电石渣.total_production); - that.tableDatas[16][4] = this.canCompute(that.nowData[16],dataList.原料磨.total_production); - that.tableDatas[18][4] = this.canCompute(that.nowData[18],dataList.回转窑.total_production); - that.tableDatas[20][4] = this.canCompute(that.nowData[20],dataList.水泥磨.total_production); - //成本(元/吨) - that.tableDatas[25][4] = this.canCompute(that.nowData[25],dataList.电石渣.production_cost_unit); - that.tableDatas[26][4] = this.canCompute(that.nowData[26],dataList.原料磨.production_cost_unit); - that.tableDatas[27][4] = this.canCompute(that.nowData[27],dataList.回转窑.production_cost_unit); - that.tableDatas[28][4] = this.canCompute(that.nowData[28],dataList.水泥磨.production_cost_unit); - that.tableDatas[29][4] = this.canCompute(that.nowData[29],dataList.水泥包装.production_cost_unit); - //耗电量(kW·h) - // that.tableDatas[30][4] = this.canCompute(that.nowData[30],dataList.电石渣.elec_consume); - that.tableDatas[30][4] = this.canCompute(that.nowData[30],dataList.原料磨.elec_consume); - that.tableDatas[31][4] = this.canCompute(that.nowData[31],dataList.回转窑.elec_consume); - that.tableDatas[32][4] = this.canCompute(that.nowData[32],dataList.水泥磨.elec_consume); - that.tableDatas[33][4] = this.canCompute(that.nowData[33],dataList.水泥包装.elec_consume); - that.tableDatas[34][4] = this.canCompute(that.nowData[34],dataList.生活区.elec_consume); - // that.tableDatas[39][3] = dataList.生活区.elec_consume; - }).then(res=>{ - //获取月和年目标 - let params1 = {}; - params1.page = 0; - params1.goal_cate__code = 'total_production'; - params1.year = that.year_h; - this.$API.mtm.goal.list.req(params1).then((res1) => { - let dataList1 = {};//目标 - res1.forEach(item1 => { - let label = item1.mgroup_name; - dataList1[label] = item1; - }); - that.tableDatas[15][4] = dataList1.电石渣&&dataList1.电石渣[m_goal_val]!==0&&dataList1.电石渣[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[14][4] /dataList1.电石渣[m_goal_val])*100).toFixed(2):'/'; - that.tableDatas[17][4] = dataList1.原料磨&&dataList1.原料磨[m_goal_val]!==0&&dataList1.原料磨[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[16][4] /dataList1.原料磨[m_goal_val])*100).toFixed(5):'/'; - that.tableDatas[19][4] = dataList1.回转窑&&dataList1.回转窑[m_goal_val]!==0&&dataList1.回转窑[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[18][4] /dataList1.回转窑[m_goal_val])*100).toFixed(2):'/'; - that.tableDatas[21][4] = dataList1.水泥磨&&dataList1.水泥磨[m_goal_val]!==0&&dataList1.水泥磨[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[20][4] /dataList1.水泥磨[m_goal_val])*100).toFixed(2):'/'; - }) - }).then(res=>{ - let obj1 = {}; - obj1.page = 0; - obj1.year_s = this.year_h; - obj1.month_s = this.month_h; - obj1.type = 'month_s'; - that.$API.enm.enstat2.req(obj1).then((res1) => { - if(res1.length>0){ - that.tableDatas[22][4]= this.canCompute(that.nowData[22],res1[0].clinker_val); - that.tableDatas[23][4] = this.canCompute(that.nowData[23],res1[0].bulk_cement_val); - that.tableDatas[24][4] = this.canCompute(that.nowData[24],res1[0].bag_cement_val); - } - }).then(res=>{ - this.getTongbiData(); - })}); - }, - getTongbiData(){ - let that = this; - let params = {}; - params.page = 0; - params.year_s = that.year_t; - params.month_s = that.month_t; - let m_goal_val = "goal_val_" + that.month - params.type = 'month_s'; - this.$API.enm.enstat.req(params).then((res) => { - if (res.length>0){ - let dataList = {}; - res.forEach(item => { - let label = item.mgroup_name; - dataList[label] = item; - }); - //台产 - that.tableDatas[0][5] = this.canCompute(that.nowData[0],dataList.原料磨.production_hour); - that.tableDatas[1][5] = this.canCompute(that.nowData[1],dataList.电石渣.production_hour); - that.tableDatas[2][5] = this.canCompute(that.nowData[2],dataList.煤磨.production_hour); - that.tableDatas[3][5] = this.canCompute(that.nowData[3],dataList.回转窑.production_hour); - that.tableDatas[4][5] = this.canCompute(that.nowData[4],dataList.水泥磨.production_hour); - //能耗(kW·h/t) - that.tableDatas[5][5] = this.canCompute(that.nowData[5],dataList.回转窑.celec_consume_unit); - that.tableDatas[6][5] = this.canCompute(that.nowData[6],dataList.回转窑.coal_consume_unit); - that.tableDatas[7][5] = this.canCompute(that.nowData[7],dataList.回转窑.cen_consume_unit); - that.tableDatas[8][5] = this.canCompute(that.nowData[8],dataList.水泥磨.cen_consume_unit); - that.tableDatas[9][5] = this.canCompute(that.nowData[9],dataList.电石渣.elec_consume_unit); - that.tableDatas[10][5] = this.canCompute(that.nowData[10],dataList.原料磨.elec_consume_unit); - that.tableDatas[11][5] = this.canCompute(that.nowData[11],dataList.回转窑.elec_consume_unit); - that.tableDatas[12][5] = this.canCompute(that.nowData[12],dataList.水泥磨.elec_consume_unit); - that.tableDatas[13][5] = this.canCompute(that.nowData[13], dataList.水泥包装.elec_consume_unit); - //产量(t) - that.tableDatas[14][5] = this.canCompute(that.nowData[14],dataList.电石渣.total_production); - that.tableDatas[16][5] = this.canCompute(that.nowData[16],dataList.原料磨.total_production); - that.tableDatas[18][5] = this.canCompute(that.nowData[18],dataList.回转窑.total_production); - that.tableDatas[20][5] = this.canCompute(that.nowData[20],dataList.水泥磨.total_production); - //成本(元/吨) - that.tableDatas[25][5] = this.canCompute(that.nowData[25],dataList.电石渣.production_cost_unit); - that.tableDatas[26][5] = this.canCompute(that.nowData[26],dataList.原料磨.production_cost_unit); - that.tableDatas[27][5] = this.canCompute(that.nowData[27],dataList.回转窑.production_cost_unit); - that.tableDatas[28][5] = this.canCompute(that.nowData[28],dataList.水泥磨.production_cost_unit); - that.tableDatas[29][5] = this.canCompute(that.nowData[29],dataList.水泥包装.production_cost_unit); - //耗电量(kW·h) - // that.tableDatas[30][5] = this.canCompute(that.nowData[30],dataList.电石渣.elec_consume); - that.tableDatas[30][5] = this.canCompute(that.nowData[30],dataList.原料磨.elec_consume); - that.tableDatas[31][5] = this.canCompute(that.nowData[31],dataList.回转窑.elec_consume); - that.tableDatas[32][5] = this.canCompute(that.nowData[32],dataList.水泥磨.elec_consume); - that.tableDatas[33][5] = this.canCompute(that.nowData[33],dataList.水泥包装.elec_consume); - that.tableDatas[34][5] = this.canCompute(that.nowData[34],dataList.生活区.elec_consume); - } - // that.tableDatas[39][4] = dataList.生活区.elec_consume; - }).then(res=>{ - //获取月和年目标 - let params1 = {}; - params1.page = 0; - params1.goal_cate__code = 'total_production'; - params1.year = that.year_h; - this.$API.mtm.goal.list.req(params1).then((res1) => { - let dataList1 = {};//目标 - res1.forEach(item1 => { - let label = item1.mgroup_name; - dataList1[label] = item1; - }); - that.tableDatas[15][5] = dataList1.电石渣&&dataList1.电石渣[m_goal_val]!==0&&dataList1.电石渣[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[14][5] /dataList1.电石渣[m_goal_val])*100:''; - that.tableDatas[17][5] = dataList1.原料磨&&dataList1.原料磨[m_goal_val]!==0&&dataList1.原料磨[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[16][5] /dataList1.原料磨[m_goal_val])*100:''; - that.tableDatas[19][5] = dataList1.回转窑&&dataList1.回转窑[m_goal_val]!==0&&dataList1.回转窑[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[18][5] /dataList1.回转窑[m_goal_val])*100:''; - that.tableDatas[21][5] = dataList1.水泥磨&&dataList1.水泥磨[m_goal_val]!==0&&dataList1.水泥磨[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[20][5] /dataList1.水泥磨[m_goal_val])*100:''; - }) - }).then(res=>{ - let obj1 = {}; - obj1.page = 0; - obj1.year_s = this.year_t; - obj1.month_s = this.month_h; - obj1.type = 'month_s'; - that.$API.enm.enstat2.req(obj1).then((res1) => { - if(res1.length>0){ - that.tableDatas[22][5]= this.canCompute(that.nowData[22],res1[0].clinker_val); - that.tableDatas[23][5] = this.canCompute(that.nowData[23],res1[0].bulk_cement_val); - that.tableDatas[24][5] = this.canCompute(that.nowData[24],res1[0].bag_cement_val); - } - }) - }) - }, + // //台产 + // that.tableDatas[0][4] = this.canCompute(that.nowData[0],dataList.原料磨.production_hour); + // that.tableDatas[1][4] = this.canCompute(that.nowData[1],dataList.电石渣.production_hour); + // that.tableDatas[2][4] = this.canCompute(that.nowData[2],dataList.煤磨.production_hour); + // that.tableDatas[3][4] = this.canCompute(that.nowData[3],dataList.回转窑.production_hour); + // that.tableDatas[4][4] = this.canCompute(that.nowData[4],dataList.水泥磨.production_hour); + // //能耗(kW·h/t) + // that.tableDatas[5][4] = this.canCompute(that.nowData[5],dataList.回转窑.celec_consume_unit); + // that.tableDatas[6][4] = this.canCompute(that.nowData[6],dataList.回转窑.coal_consume_unit); + // that.tableDatas[7][4] = this.canCompute(that.nowData[7],dataList.回转窑.cen_consume_unit); + // that.tableDatas[8][4] = this.canCompute(that.nowData[8],dataList.水泥磨.cen_consume_unit); + // that.tableDatas[9][4] = this.canCompute(that.nowData[9],dataList.电石渣.elec_consume_unit); + // that.tableDatas[10][4] = this.canCompute(that.nowData[10],dataList.原料磨.elec_consume_unit); + // that.tableDatas[11][4] = this.canCompute(that.nowData[11],dataList.回转窑.elec_consume_unit); + // that.tableDatas[12][4] = this.canCompute(that.nowData[12],dataList.水泥磨.elec_consume_unit); + // that.tableDatas[13][4] = this.canCompute(that.nowData[13], dataList.水泥包装.elec_consume_unit); + // //产量(t) + // that.tableDatas[14][4] = this.canCompute(that.nowData[14],dataList.电石渣.total_production); + // that.tableDatas[16][4] = this.canCompute(that.nowData[16],dataList.原料磨.total_production); + // that.tableDatas[18][4] = this.canCompute(that.nowData[18],dataList.回转窑.total_production); + // that.tableDatas[20][4] = this.canCompute(that.nowData[20],dataList.水泥磨.total_production); + // //成本(元/吨) + // that.tableDatas[25][4] = this.canCompute(that.nowData[25],dataList.电石渣.production_cost_unit); + // that.tableDatas[26][4] = this.canCompute(that.nowData[26],dataList.原料磨.production_cost_unit); + // that.tableDatas[27][4] = this.canCompute(that.nowData[27],dataList.回转窑.production_cost_unit); + // that.tableDatas[28][4] = this.canCompute(that.nowData[28],dataList.水泥磨.production_cost_unit); + // that.tableDatas[29][4] = this.canCompute(that.nowData[29],dataList.水泥包装.production_cost_unit); + // //耗电量(kW·h) + // // that.tableDatas[30][4] = this.canCompute(that.nowData[30],dataList.电石渣.elec_consume); + // that.tableDatas[30][4] = this.canCompute(that.nowData[30],dataList.原料磨.elec_consume); + // that.tableDatas[31][4] = this.canCompute(that.nowData[31],dataList.回转窑.elec_consume); + // that.tableDatas[32][4] = this.canCompute(that.nowData[32],dataList.水泥磨.elec_consume); + // that.tableDatas[33][4] = this.canCompute(that.nowData[33],dataList.水泥包装.elec_consume); + // that.tableDatas[34][4] = this.canCompute(that.nowData[34],dataList.生活区.elec_consume); + // // that.tableDatas[39][3] = dataList.生活区.elec_consume; + // }).then(res=>{ + // //获取月和年目标 + // let params1 = {}; + // params1.page = 0; + // params1.goal_cate__code = 'total_production'; + // params1.year = that.year_h; + // this.$API.mtm.goal.list.req(params1).then((res1) => { + // let dataList1 = {};//目标 + // res1.forEach(item1 => { + // let label = item1.mgroup_name; + // dataList1[label] = item1; + // }); + // that.tableDatas[15][4] = dataList1.电石渣&&dataList1.电石渣[m_goal_val]!==0&&dataList1.电石渣[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[14][4] /dataList1.电石渣[m_goal_val])*100).toFixed(2):'/'; + // that.tableDatas[17][4] = dataList1.原料磨&&dataList1.原料磨[m_goal_val]!==0&&dataList1.原料磨[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[16][4] /dataList1.原料磨[m_goal_val])*100).toFixed(5):'/'; + // that.tableDatas[19][4] = dataList1.回转窑&&dataList1.回转窑[m_goal_val]!==0&&dataList1.回转窑[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[18][4] /dataList1.回转窑[m_goal_val])*100).toFixed(2):'/'; + // that.tableDatas[21][4] = dataList1.水泥磨&&dataList1.水泥磨[m_goal_val]!==0&&dataList1.水泥磨[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[20][4] /dataList1.水泥磨[m_goal_val])*100).toFixed(2):'/'; + // }) + // }).then(res=>{ + // let obj1 = {}; + // obj1.page = 0; + // obj1.year_s = this.year_h; + // obj1.month_s = this.month_h; + // obj1.type = 'month_s'; + // that.$API.enm.enstat2.req(obj1).then((res1) => { + // if(res1.length>0){ + // that.tableDatas[22][4]= this.canCompute(that.nowData[22],res1[0].clinker_val); + // that.tableDatas[23][4] = this.canCompute(that.nowData[23],res1[0].bulk_cement_val); + // that.tableDatas[24][4] = this.canCompute(that.nowData[24],res1[0].bag_cement_val); + // } + // }).then(res=>{ + // this.getTongbiData(); + // })}); + // }, + // getTongbiData(){ + // let that = this; + // let params = {}; + // params.page = 0; + // params.year_s = that.year_t; + // params.month_s = that.month_t; + // let m_goal_val = "goal_val_" + that.month + // params.type = 'month_s'; + // this.$API.enm.enstat.req(params).then((res) => { + // if (res.length>0){ + // let dataList = {}; + // res.forEach(item => { + // let label = item.mgroup_name; + // dataList[label] = item; + // }); + // //台产 + // that.tableDatas[0][5] = this.canCompute(that.nowData[0],dataList.原料磨.production_hour); + // that.tableDatas[1][5] = this.canCompute(that.nowData[1],dataList.电石渣.production_hour); + // that.tableDatas[2][5] = this.canCompute(that.nowData[2],dataList.煤磨.production_hour); + // that.tableDatas[3][5] = this.canCompute(that.nowData[3],dataList.回转窑.production_hour); + // that.tableDatas[4][5] = this.canCompute(that.nowData[4],dataList.水泥磨.production_hour); + // //能耗(kW·h/t) + // that.tableDatas[5][5] = this.canCompute(that.nowData[5],dataList.回转窑.celec_consume_unit); + // that.tableDatas[6][5] = this.canCompute(that.nowData[6],dataList.回转窑.coal_consume_unit); + // that.tableDatas[7][5] = this.canCompute(that.nowData[7],dataList.回转窑.cen_consume_unit); + // that.tableDatas[8][5] = this.canCompute(that.nowData[8],dataList.水泥磨.cen_consume_unit); + // that.tableDatas[9][5] = this.canCompute(that.nowData[9],dataList.电石渣.elec_consume_unit); + // that.tableDatas[10][5] = this.canCompute(that.nowData[10],dataList.原料磨.elec_consume_unit); + // that.tableDatas[11][5] = this.canCompute(that.nowData[11],dataList.回转窑.elec_consume_unit); + // that.tableDatas[12][5] = this.canCompute(that.nowData[12],dataList.水泥磨.elec_consume_unit); + // that.tableDatas[13][5] = this.canCompute(that.nowData[13], dataList.水泥包装.elec_consume_unit); + // //产量(t) + // that.tableDatas[14][5] = this.canCompute(that.nowData[14],dataList.电石渣.total_production); + // that.tableDatas[16][5] = this.canCompute(that.nowData[16],dataList.原料磨.total_production); + // that.tableDatas[18][5] = this.canCompute(that.nowData[18],dataList.回转窑.total_production); + // that.tableDatas[20][5] = this.canCompute(that.nowData[20],dataList.水泥磨.total_production); + // //成本(元/吨) + // that.tableDatas[25][5] = this.canCompute(that.nowData[25],dataList.电石渣.production_cost_unit); + // that.tableDatas[26][5] = this.canCompute(that.nowData[26],dataList.原料磨.production_cost_unit); + // that.tableDatas[27][5] = this.canCompute(that.nowData[27],dataList.回转窑.production_cost_unit); + // that.tableDatas[28][5] = this.canCompute(that.nowData[28],dataList.水泥磨.production_cost_unit); + // that.tableDatas[29][5] = this.canCompute(that.nowData[29],dataList.水泥包装.production_cost_unit); + // //耗电量(kW·h) + // // that.tableDatas[30][5] = this.canCompute(that.nowData[30],dataList.电石渣.elec_consume); + // that.tableDatas[30][5] = this.canCompute(that.nowData[30],dataList.原料磨.elec_consume); + // that.tableDatas[31][5] = this.canCompute(that.nowData[31],dataList.回转窑.elec_consume); + // that.tableDatas[32][5] = this.canCompute(that.nowData[32],dataList.水泥磨.elec_consume); + // that.tableDatas[33][5] = this.canCompute(that.nowData[33],dataList.水泥包装.elec_consume); + // that.tableDatas[34][5] = this.canCompute(that.nowData[34],dataList.生活区.elec_consume); + // } + // // that.tableDatas[39][4] = dataList.生活区.elec_consume; + // }).then(res=>{ + // //获取月和年目标 + // let params1 = {}; + // params1.page = 0; + // params1.goal_cate__code = 'total_production'; + // params1.year = that.year_h; + // this.$API.mtm.goal.list.req(params1).then((res1) => { + // let dataList1 = {};//目标 + // res1.forEach(item1 => { + // let label = item1.mgroup_name; + // dataList1[label] = item1; + // }); + // that.tableDatas[15][5] = dataList1.电石渣&&dataList1.电石渣[m_goal_val]!==0&&dataList1.电石渣[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[14][5] /dataList1.电石渣[m_goal_val])*100:''; + // that.tableDatas[17][5] = dataList1.原料磨&&dataList1.原料磨[m_goal_val]!==0&&dataList1.原料磨[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[16][5] /dataList1.原料磨[m_goal_val])*100:''; + // that.tableDatas[19][5] = dataList1.回转窑&&dataList1.回转窑[m_goal_val]!==0&&dataList1.回转窑[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[18][5] /dataList1.回转窑[m_goal_val])*100:''; + // that.tableDatas[21][5] = dataList1.水泥磨&&dataList1.水泥磨[m_goal_val]!==0&&dataList1.水泥磨[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[20][5] /dataList1.水泥磨[m_goal_val])*100:''; + // }) + // }).then(res=>{ + // let obj1 = {}; + // obj1.page = 0; + // obj1.year_s = this.year_t; + // obj1.month_s = this.month_h; + // obj1.type = 'month_s'; + // that.$API.enm.enstat2.req(obj1).then((res1) => { + // if(res1.length>0){ + // that.tableDatas[22][5]= this.canCompute(that.nowData[22],res1[0].clinker_val); + // that.tableDatas[23][5] = this.canCompute(that.nowData[23],res1[0].bulk_cement_val); + // that.tableDatas[24][5] = this.canCompute(that.nowData[24],res1[0].bag_cement_val); + // } + // }) + // }) + // }, getTableData(){ // for(let i=0;i<39;i++){ // this.tableDatas[i][3] = ''; diff --git a/src/views/enm_rm/report.vue b/src/views/enm_rm/report.vue index 7bd8f388..a1555a16 100644 --- a/src/views/enm_rm/report.vue +++ b/src/views/enm_rm/report.vue @@ -2,6 +2,52 @@
+ + + + + + + -
+ -
+
本日生产参数统计图
-
+
本月生产参数统计图
-
+
本年生产参数统计图
- + { let str = "goal_val_" + that.month; - debugger; console.log(str, item5[str]); if (item5.goal_cate_name == "总产量(t)") { @@ -1136,31 +1187,215 @@ export default { }, }) }, - dateChange(val) { + dateChange() { let that = this; - console.log(val); - if (val !== null) { - if (this.typeRadio == "day") { - let year = val.split("-")[0]; - let month = val.split("-")[1]; - let days = val.split("-")[2]; - this.getHourData(year, month, days); - } else if (this.typeRadio == "month") { - let year = val.split("-")[0]; - let month = val.split("-")[1]; - this.getDayData(year, month); - } else { - this.getMonthData(val); - } - } else { - if (this.typeRadio == "day") { - that.getHourData(that.year, that.month, that.days); - } else if (this.typeRadio == "month") { - this.getDayData(that.year, that.month); - } else { - this.getMonthData(that.year); - } + let arr = []; + if(that.query.type==0) { + arr = that.query.day.split('-'); + that.year = Number(arr[0]); + that.month = Number(arr[1]); + that.days = Number(arr[2]); + this.getHourData(that.year, that.month, that.days); + this.get_days(that.year, that.month, that.days); } + else if(that.query.type==1) { + let year = that.query.month.split("-")[0]; + let month = that.query.month.split("-")[1]; + month = Number(month); + this.getDayData(year, month); + this.get_months(year, month); + this.get_month_year_goal(year, month); + }else if (that.query.type==2) { + let year = that.query.year; + this.getMonthData(year); + this.get_years(year); + this.get_month_year_goal(year , 1); + } + }, + get_days(year_d, month_d, days){ + let that = this; + let params4 = {}; + params4.page = 0; + params4.year_s = year_d; + params4.month_s = month_d; + params4.day_s = days; + params4.type = "day_s"; + params4.mgroup = this.query.mgroup; + this.$API.enm.enstat.req(params4).then((res4) => { + if (res4.length > 0) { + let data4 = res4[0]; + that.tableDatas[0][2] = data4.total_production; + if (data4.total_production < 1) { + that.tableDatas[1][2] = 0; + that.tableDatas[2][2] = 0; + that.tableDatas[3][2] = 0; + + }else{ + that.tableDatas[1][2] = data4.elec_consume_unit; + that.tableDatas[2][2] = data4.elec_consume; + that.tableDatas[3][2] = data4.production_cost_unit;} + + if (data4.imaterial_data.length > 0) { + data4.imaterial_data.forEach((item) => { + if (item.material_name == "湿电石渣消耗") { + that.tableDatas[4][2] = item.amount_consume; + }else if(item.material_name == "湿电石渣进厂"){ + that.tableDatas[5][2] = item.amount_consume; + } + }); + } + } + }); + }, + get_months(year, month){ + let that = this; + let params2 = {}; + params2.page = 0; + params2.year_s = year; + params2.month_s = month; + params2.type = "month_s"; + params2.mgroup = this.query.mgroup; + this.$API.enm.enstat.req(params2).then((res2) => { + if (res2.length > 0) { + let data2 = res2[0]; + that.tableDatas[0][4] = data2.total_production; + that.tableDatas[0][7] = precen( + that.tableDatas[0][4], + that.tableDatas[0][6] + ); + that.tableDatas[1][4] = data2.elec_consume_unit; + that.tableDatas[1][7] = consume_precen( + that.tableDatas[1][4], + that.tableDatas[1][6] + ); + that.tableDatas[2][4] = data2.elec_consume; + that.tableDatas[3][4] = + data2.production_cost_unit; + that.tableDatas[3][7] = consume_precen( + that.tableDatas[3][3], + that.tableDatas[3][6] + ); + that.tableDatas[2][7] = consume_precen( + that.tableDatas[2][4], + that.tableDatas[2][6] + ); + if (data2.imaterial_data.length > 0) { + data2.imaterial_data.forEach((item) => { + if (item.material_name == "湿电石渣消耗") { + that.tableDatas[4][4] = (item.amount_consume).toFixed(2); + that.tableDatas[4][7] = precen( + that.tableDatas[4][4], + that.tableDatas[4][6] + ); + }else if(item.material_name == "湿电石渣进厂"){ + that.tableDatas[5][4] = (item.amount_consume).toFixed(2); + that.tableDatas[5][7] = precen( + that.tableDatas[5][4], + that.tableDatas[5][6] + ); + } + }); + } + } + }); + }, + get_month_year_goal(year, month){ + let that = this; + let params5 = {}; + params5.page = 0; + params5.year = year; + params5.mgroup = that.query.mgroup; + this.$API.mtm.goal.list + .req(params5) + .then((res5) => { + if (res5.length > 0) { + let data5 = res5; + data5.forEach((item5) => { + let str = "goal_val_" + month; + if (item5.goal_cate_name == "总产量(t)") { + that.tableDatas[0][6] = item5[str]; + that.tableDatas[0][8] = item5.goal_val; + } else if ( + item5.goal_cate_name == + "单位产品分布电耗(kW·h/t)" + ) { + that.goal_list.push(item5); + that.tableDatas[1][6] = item5[str]; + that.tableDatas[1][8] = item5.goal_val; + } else if ( + item5.goal_cate_name == + "单位产品成本(元/吨)" + ) { + that.tableDatas[3][6] = item5[str]; + that.tableDatas[3][8] = item5.goal_val; + }else if (item5.goal_cate_name == + "总电量(kW·h)"){ + that.tableDatas[2][6] = item5[str]; + that.tableDatas[2][8] = item5.goal_val; + }else if (item5.goal_cate_name == + "湿电石渣消耗(t)"){ + that.tableDatas[4][6] = item5[str]; + that.tableDatas[4][8] = item5.goal_val; + } + else if (item5.goal_cate_name == + "湿电石渣进厂(t)"){ + that.tableDatas[5][6] = item5[str]; + that.tableDatas[5][8] = item5.goal_val; + } + }); + } + }) + }, + get_years(year){ + let that = this; + let params1 = {}; + params1.page = 0; + params1.year_s = year; + params1.type = "year_s"; + params1.mgroup = this.query.mgroup; + this.$API.enm.enstat.req(params1).then((res1) => { + if (res1.length > 0) { + let data1 = res1[0]; + that.tableDatas[0][5] = data1.total_production; + that.tableDatas[0][9] = precen( + that.tableDatas[0][5], + that.tableDatas[0][8] + ); + that.tableDatas[1][5] = data1.elec_consume_unit; + that.tableDatas[1][9] = consume_precen( + that.tableDatas[1][8]-that.tableDatas[1][5], + that.tableDatas[1][8] + ); + that.tableDatas[2][5] = data1.elec_consume; + that.tableDatas[2][9] = consume_precen( + that.tableDatas[2][8]-that.tableDatas[2][5], + that.tableDatas[2][8] + ); + that.tableDatas[3][5] = + data1.production_cost_unit; + that.tableDatas[3][9] = consume_precen( + that.tableDatas[3][8]-that.tableDatas[3][5], + that.tableDatas[3][8] + ); + if (data1.imaterial_data.length > 0) { + data1.imaterial_data.forEach((item) => { + if (item.material_name == "湿电石渣消耗") { + that.tableDatas[4][5] = (item.amount_consume).toFixed(2); + that.tableDatas[4][9] = precen( + that.tableDatas[4][5], + that.tableDatas[4][8] + ); + }else if(item.material_name == "湿电石渣进厂"){ + that.tableDatas[5][5] = (item.amount_consume).toFixed(2); + that.tableDatas[5][9] = precen( + that.tableDatas[5][5], + that.tableDatas[5][8] + ); + } + }); + } + } + }); }, //获取小时数据 getHourData(year, month, days) { diff --git a/src/views/enm_rm/teamAnalysis.vue b/src/views/enm_rm/teamAnalysis.vue index 7b1c3d6f..d833d86f 100644 --- a/src/views/enm_rm/teamAnalysis.vue +++ b/src/views/enm_rm/teamAnalysis.vue @@ -38,7 +38,7 @@ > - 生料辅料工序班组月度对比分析 + 生料辅料工序班组月度对比分析 月份 @@ -48,6 +48,7 @@ 质量 单位产品电耗 得分 + 排名 总产量(t) @@ -365,11 +366,35 @@ export default { } wrapArr.push(arr); }); - that.tableDatas = wrapArr; - } else { - } - });}); - + // 深拷贝数组,防止原始数据被修改 + const sortArr = [...wrapArr]; + // 将数组按每4个元素进行分组 + const groupSize = 4; + const groupedArr = []; + for (let i = 0; i < sortArr.length; i += groupSize) { + groupedArr.push(sortArr.slice(i, i + groupSize)); + } + groupedArr.forEach(group => { + group.sort((a, b) => b[b.length - 1] - a[a.length - 1]); // 按最后一项值排序(忽略排名) + // 为每个分组内的元素计算排名 + let currentRank = 1; + let previousValue = null; + group.forEach((item, index) => { + if (previousValue !== item[item.length - 1]) { + currentRank = index + 1; + previousValue = item[item.length - 1]; // 保留上一个排名 + // 当前排名为索引加1 + } + item.push(`${currentRank}名`); + }); + }); + // 扁平化分组数组 + const flattenedArr = groupedArr.flat(); + // 将排序并添加排名后的数据赋值给 tableDatas + that.tableDatas = flattenedArr; + } + }); + }); }, handleQuery() { diff --git a/src/views/enm_rm_copy/teamAnalysis.vue b/src/views/enm_rm_copy/teamAnalysis.vue index f109546a..bfee9335 100644 --- a/src/views/enm_rm_copy/teamAnalysis.vue +++ b/src/views/enm_rm_copy/teamAnalysis.vue @@ -38,7 +38,7 @@ > - 生料工序班组月度对比分析 + 生料工序班组月度对比分析 月份 @@ -49,6 +49,7 @@ 质量 单位产品电耗 得分 + 排名 总产量(t) @@ -369,10 +370,35 @@ export default { } wrapArr.push(arr); }); - that.tableDatas = wrapArr; - } else { - } - });}); + // 深拷贝数组,防止原始数据被修改 + const sortArr = [...wrapArr]; + // 将数组按每4个元素进行分组 + const groupSize = 4; + const groupedArr = []; + for (let i = 0; i < sortArr.length; i += groupSize) { + groupedArr.push(sortArr.slice(i, i + groupSize)); + } + groupedArr.forEach(group => { + group.sort((a, b) => b[b.length - 1] - a[a.length - 1]); // 按最后一项值排序(忽略排名) + // 为每个分组内的元素计算排名 + let currentRank = 1; + let previousValue = null; + group.forEach((item, index) => { + if (previousValue !== item[item.length - 1]) { + currentRank = index + 1; + previousValue = item[item.length - 1]; // 保留上一个排名 + // 当前排名为索引加1 + } + item.push(`${currentRank}名`); + }); + }); + // 扁平化分组数组 + const flattenedArr = groupedArr.flat(); + // 将排序并添加排名后的数据赋值给 tableDatas + that.tableDatas = flattenedArr; + } + }); + }); }, handleQuery() { diff --git a/src/views/enm_slag/power.vue b/src/views/enm_slag/power.vue index 002e96c5..1d79ab32 100644 --- a/src/views/enm_slag/power.vue +++ b/src/views/enm_slag/power.vue @@ -54,20 +54,24 @@ class="numCell" @click="itemClick('day_s', item)" > + {{ item1 }} -
-

设备电量({{item[6]}})/工段产量({{item[7]}})

-
+ +
+ {{ item1 }} -
-

设备电量({{item[8]}})/工段产量({{item[9]}})

-
+ +
@@ -534,8 +538,10 @@ export default { border-radius: 5px; display: none; padding: 5px; + opacity: 0; } td:hover .tooltip { display: block; + opacity: 1; } diff --git a/src/views/enm_slag/report.vue b/src/views/enm_slag/report.vue index 2257b67b..bedaebca 100644 --- a/src/views/enm_slag/report.vue +++ b/src/views/enm_slag/report.vue @@ -2,6 +2,52 @@
+ + + + + + +
+
-
+ +
本日生产参数统计图
-
+
本月生产参数统计图
-
+
本年生产参数统计图
{ + if (res4.length > 0) { + let data4 = res4[0]; + that.tableDatas[0][2] = data4.total_production; + if (data4.total_production < 1) { + that.tableDatas[1][2] = 0; + that.tableDatas[2][2] = 0; + that.tableDatas[3][2] = 0; + + }else{ + that.tableDatas[1][2] = data4.elec_consume_unit; + that.tableDatas[2][2] = data4.elec_consume; + that.tableDatas[3][2] = data4.production_cost_unit;} + + if (data4.imaterial_data.length > 0) { + data4.imaterial_data.forEach((item) => { + if (item.material_name == "湿电石渣消耗") { + that.tableDatas[4][2] = item.amount_consume; + }else if(item.material_name == "湿电石渣进厂"){ + that.tableDatas[5][2] = item.amount_consume; + } + }); + } + } + }); + }, + get_months(year, month){ + let that = this; + let params2 = {}; + params2.page = 0; + params2.year_s = year; + params2.month_s = month; + params2.type = "month_s"; + params2.mgroup = this.query.mgroup; + this.$API.enm.enstat.req(params2).then((res2) => { + if (res2.length > 0) { + let data2 = res2[0]; + that.tableDatas[0][4] = data2.total_production; + that.tableDatas[0][7] = precen( + that.tableDatas[0][4], + that.tableDatas[0][6] + ); + that.tableDatas[1][4] = data2.elec_consume_unit; + that.tableDatas[1][7] = consume_precen( + that.tableDatas[1][4], + that.tableDatas[1][6] + ); + that.tableDatas[2][4] = data2.elec_consume; + that.tableDatas[3][4] = + data2.production_cost_unit; + that.tableDatas[3][7] = consume_precen( + that.tableDatas[3][3], + that.tableDatas[3][6] + ); + that.tableDatas[2][7] = consume_precen( + that.tableDatas[2][4], + that.tableDatas[2][6] + ); + if (data2.imaterial_data.length > 0) { + data2.imaterial_data.forEach((item) => { + if (item.material_name == "湿电石渣消耗") { + that.tableDatas[4][4] = (item.amount_consume).toFixed(2); + that.tableDatas[4][7] = precen( + that.tableDatas[4][4], + that.tableDatas[4][6] + ); + }else if(item.material_name == "湿电石渣进厂"){ + that.tableDatas[5][4] = (item.amount_consume).toFixed(2); + that.tableDatas[5][7] = precen( + that.tableDatas[5][4], + that.tableDatas[5][6] + ); + } + }); + } + } + }); + }, + get_month_year_goal(year, month){ + let that = this; + let params5 = {}; + params5.page = 0; + params5.year = year; + params5.mgroup = that.query.mgroup; + this.$API.mtm.goal.list + .req(params5) + .then((res5) => { + if (res5.length > 0) { + let data5 = res5; + data5.forEach((item5) => { + let str = "goal_val_" + month; + if (item5.goal_cate_name == "总产量(t)") { + that.tableDatas[0][6] = item5[str]; + that.tableDatas[0][8] = item5.goal_val; + } else if ( + item5.goal_cate_name == + "单位产品分布电耗(kW·h/t)" + ) { + that.goal_list.push(item5); + that.tableDatas[1][6] = item5[str]; + that.tableDatas[1][8] = item5.goal_val; + } else if ( + item5.goal_cate_name == + "单位产品成本(元/吨)" + ) { + that.tableDatas[3][6] = item5[str]; + that.tableDatas[3][8] = item5.goal_val; + }else if (item5.goal_cate_name == + "总电量(kW·h)"){ + that.tableDatas[2][6] = item5[str]; + that.tableDatas[2][8] = item5.goal_val; + }else if (item5.goal_cate_name == + "湿电石渣消耗(t)"){ + that.tableDatas[4][6] = item5[str]; + that.tableDatas[4][8] = item5.goal_val; + } + else if (item5.goal_cate_name == + "湿电石渣进厂(t)"){ + that.tableDatas[5][6] = item5[str]; + that.tableDatas[5][8] = item5.goal_val; + } + }); + } + }) + }, + get_years(year){ + let that = this; + let params1 = {}; + params1.page = 0; + params1.year_s = year; + params1.type = "year_s"; + params1.mgroup = this.query.mgroup; + this.$API.enm.enstat.req(params1).then((res1) => { + if (res1.length > 0) { + let data1 = res1[0]; + that.tableDatas[0][5] = data1.total_production; + that.tableDatas[0][9] = precen( + that.tableDatas[0][5], + that.tableDatas[0][8] + ); + that.tableDatas[1][5] = data1.elec_consume_unit; + that.tableDatas[1][9] = consume_precen( + that.tableDatas[1][8]-that.tableDatas[1][5], + that.tableDatas[1][8] + ); + that.tableDatas[2][5] = data1.elec_consume; + that.tableDatas[2][9] = consume_precen( + that.tableDatas[2][8]-that.tableDatas[2][5], + that.tableDatas[2][8] + ); + that.tableDatas[3][5] = + data1.production_cost_unit; + that.tableDatas[3][9] = consume_precen( + that.tableDatas[3][8]-that.tableDatas[3][5], + that.tableDatas[3][8] + ); + if (data1.imaterial_data.length > 0) { + data1.imaterial_data.forEach((item) => { + if (item.material_name == "湿电石渣消耗") { + that.tableDatas[4][5] = (item.amount_consume).toFixed(2); + that.tableDatas[4][9] = precen( + that.tableDatas[4][5], + that.tableDatas[4][8] + ); + }else if(item.material_name == "湿电石渣进厂"){ + that.tableDatas[5][5] = (item.amount_consume).toFixed(2); + that.tableDatas[5][9] = precen( + that.tableDatas[5][5], + that.tableDatas[5][8] + ); + } + }); + } + } + }); + }, + dateChange() { + let that = this; + let arr = []; + if(that.query.type==0) { + arr = that.query.day.split('-'); + that.year = Number(arr[0]); + that.month = Number(arr[1]); + that.days = Number(arr[2]); + this.getHourData(that.year, that.month, that.days); + this.get_days(that.year, that.month, that.days); } + else if(that.query.type==1) { + let year = that.query.month.split("-")[0]; + let month = that.query.month.split("-")[1]; + month = Number(month); + this.getDayData(year, month); + this.get_months(year, month); + this.get_month_year_goal(year, month); + } else if (that.query.type==2) { + let year = that.query.year; + this.getMonthData(year); + this.get_years(year); + this.get_month_year_goal(year , 1); + } + }, //获取小时数据 getHourData(year, month, days) { diff --git a/src/views/enm_slag/teamAnalysis.vue b/src/views/enm_slag/teamAnalysis.vue index 2059be42..ec3582de 100644 --- a/src/views/enm_slag/teamAnalysis.vue +++ b/src/views/enm_slag/teamAnalysis.vue @@ -38,7 +38,7 @@ > - 电石渣工序班组月度对比分析 + 电石渣工序班组月度对比分析 月份 @@ -47,6 +47,7 @@ 单位产品成本(元/吨) 产品单位电耗 得分 + 排名 当期值(kKW·h/t) @@ -258,10 +259,35 @@ export default { } wrapArr.push(arr); }); - that.tableDatas = wrapArr; - } else { - } - });}); + // 深拷贝数组,防止原始数据被修改 + const sortArr = [...wrapArr]; + // 将数组按每4个元素进行分组 + const groupSize = 4; + const groupedArr = []; + for (let i = 0; i < sortArr.length; i += groupSize) { + groupedArr.push(sortArr.slice(i, i + groupSize)); + } + groupedArr.forEach(group => { + group.sort((a, b) => b[b.length - 1] - a[a.length - 1]); // 按最后一项值排序(忽略排名) + // 为每个分组内的元素计算排名 + let currentRank = 1; + let previousValue = null; + group.forEach((item, index) => { + if (previousValue !== item[item.length - 1]) { + currentRank = index + 1; + previousValue = item[item.length - 1]; // 保留上一个排名 + // 当前排名为索引加1 + } + item.push(`${currentRank}名`); + }); + }); + // 扁平化分组数组 + const flattenedArr = groupedArr.flat(); + // 将排序并添加排名后的数据赋值给 tableDatas + that.tableDatas = flattenedArr; + } + }); + }); }, handleQuery() {