From 1d837b9b0a3b47e77f38c01e62a273056ae468a3 Mon Sep 17 00:00:00 2001 From: zty Date: Fri, 24 Jan 2025 17:17:04 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E8=B4=A8?= =?UTF-8?q?=E9=87=8F=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/enm_report/quality.vue | 168 ++++++++++++------------------- 1 file changed, 67 insertions(+), 101 deletions(-) diff --git a/src/views/enm_report/quality.vue b/src/views/enm_report/quality.vue index fa45e235..dc7b5d60 100644 --- a/src/views/enm_report/quality.vue +++ b/src/views/enm_report/quality.vue @@ -103,7 +103,6 @@ title="设置合格率的阈值" v-model="dialogVisible" width="30%" - @close="resetDialog" >
@@ -139,28 +138,6 @@ deptName:'', typeName:'质检日报表', tableName:'', - // tableDatas:[ - // ['原料车间','辅料','细度', , , , , , ], - // ['原料车间','辅料','Fe2O3', , , , , , ], - // ['原料车间','辅料','水分', , , , , , ], - // ['原料车间','干混生料','细度', , , , , , ], - // ['原料车间','干混生料','Fe2O3', , , , , , ], - // ['原料车间','干混生料','水分', , , , , , ], - // ['原料车间','干混生料','CaO', , , , , , ], - - // ['烧成车间','入窑生料','CaO', , , , , , ], - // ['烧成车间','入窑生料','Fe2O3', , , , , , ], - // ['烧成车间','入窑生料','细度'], - // ['烧成车间','入窑生料','水分'], - // ['烧成车间','熟料','立升重'], - // ['烧成车间','熟料','f-CaO'], - // ['烧成车间','煤粉','细度'], - // ['烧成车间','煤粉','水分'], - - // ['水泥车间','出磨水泥','比表面积'], - // ['水泥车间','出磨水泥','SO3'], - // ['水泥车间','出磨水泥','掺量'], - // ], tableDatas3:[], exportLoading:false, header2:[], @@ -170,14 +147,12 @@ header2Obj:[], deptOptions:[], dialogVisible: false, // 控制对话框显示 - currentColumnIndex: null, // 当前编辑的列索引 // thresholds: {}, // 存储每列的阈值,key 为列索引 thresholdobj:{}, materialTestItemMap:{}, - currentMaterialNameClass: '', - currentMaterialName: '', // 当前物料名称 - currentTestItemName: '', // 当前检测项名称 - currentTestItemNameClass: '', // 当前检测项名称 + currentMaterialName: null, // 当前物料名称 + currentTestItemName: null, // 当前检测项名称 + }; }, mounted() { @@ -205,10 +180,11 @@ that.tableName = that.deptName+that.typeName; }, updateThreshold() { - const num = parseFloat(this.currentThreshold); + let that = this; + const num = parseFloat(that.currentThreshold); if (!isNaN(num)){ - const key = `${this.currentMaterialName}-${this.currentTestItemName}`; - const mapEntry = this.materialTestItemMap[key]; + const key = `${that.currentMaterialName}-${that.currentTestItemName}`; + const mapEntry = that.materialTestItemMap[key]; if (!mapEntry) { return; } @@ -216,27 +192,26 @@ material_id: mapEntry.material_id, testitem_id: mapEntry.testitem_id, rate_pass_t: num, - update_start_time: mapEntry.update_start_time, - update_end_time: mapEntry.update_end_time, + update_start_time: mapEntry.start_time, + update_end_time: mapEntry.end_time, }; - this.$API.qm.updateQuastatGoal.post(payload) + that.$API.qm.updateQuastatGoal.post(payload) .then((res) => { - this.$message.success("阈值更新成功"); + that.$message.success("阈值更新成功"); // this.thresholds[this.currentColumnIndex] = res.rate_pass_t; // 更新本地阈值 - this.dialogVisible = false; // 关闭对话框 + that.dialogVisible = false; // 关闭对话框 }) .catch((error) => { - this.$message.error("阈值更新失败:" + error.message); + that.$message.error("阈值更新失败:" + error.message); }); }else { - this.$message.error("请输入有效的阈值,例如:80%"); + that.$message.error("请输入有效的阈值,例如:80%"); } }, // 关闭对话框时重置状态 - resetDialog() { - this.currentColumnIndex = null; - this.currentThreshold = ""; - }, + // resetDialog() { + // this.currentThreshold = ""; + // }, // 动态样式计算 getCellClass(cell, cellIndex) { let that = this; @@ -244,26 +219,27 @@ // 假设合格率在每组数据的第四列 const cellValue = String(cell); const value = parseFloat(cellValue.replace("%", "")); - this.currentColumnIndex = cellIndex; const header4Index = cellIndex - 1; // 假设第 0 列是日期列 const header3Index = Math.floor(header4Index / 4); let cumulativeLength = 0; let header2Index = -1; - for (let i = 0; i < this.header2Obj.length; i++) { - cumulativeLength += this.header2Obj[i].lengths * 4; + for (let i = 0; i < that.header2Obj.length; i++) { + cumulativeLength += that.header2Obj[i].lengths * 4; if (header4Index < cumulativeLength) { header2Index = i; break; } } + let currentMaterialNameClass = '' + let currentTestItemNameClass = '' if (header2Index !== -1 && header3Index !== -1){ - that.currentMaterialNameClass = this.header2Obj[header2Index].name; // header2Obj - that.currentTestItemNameClass = this.header3[header3Index]; // header3 + currentMaterialNameClass = that.header2Obj[header2Index].name; // header2Obj + currentTestItemNameClass = that.header3[header3Index]; // header3 }else { - this.currentMaterialNameClass = ''; - this.currentTestItemNameClass = ''; + currentMaterialNameClass = ''; + currentTestItemNameClass = ''; } - const keyName = `${that.currentMaterialNameClass}-${that.currentTestItemNameClass}`; + const keyName = `${currentMaterialNameClass}-${currentTestItemNameClass}`; const rate_g = that.thresholdobj[keyName] || 0; if (rate_g >= value) { return 'red-text'; @@ -294,77 +270,68 @@ }, handleCellClick(cell, rowIndex, cellIndex){ let that = this; - this.currentColumnIndex = cellIndex; - const header4Index = cellIndex - 1 ; // 假设第 0 列是日期列 - const header3Index = Math.floor(header4Index / 4) ; + const header4Index_hd = cellIndex - 1 ; // 假设第 0 列是日期列 + const header3Index_hd = Math.floor(header4Index_hd / 4) ; let cumulativeLength = 0; let header2Index = -1; // 根据每个物料有多少个检测项,计算检测项目开始结束索引是否在当前列中 for (let i = 0; i < this.header2Obj.length; i++) { cumulativeLength += this.header2Obj[i].lengths * 4; - if (header4Index < cumulativeLength) { + if (header4Index_hd < cumulativeLength) { header2Index = i; break; } } - if (header2Index !== -1 && header3Index !== -1){ + if (header2Index !== -1 && header3Index_hd !== -1){ that.currentMaterialName = this.header2Obj[header2Index].name; // header2Obj - that.currentTestItemName = this.header3[header3Index]; // header3 + that.currentTestItemName = this.header3[header3Index_hd]; // header3 }else { - this.currentMaterialName = ''; - this.currentTestItemName = ''; + that.currentMaterialName = ''; + that.currentTestItemName = ''; } const keyName = `${that.currentMaterialName}-${that.currentTestItemName}`; - this.currentThreshold = that.thresholdobj[keyName] || 0; - this.dialogVisible = true; + that.currentThreshold = that.thresholdobj[keyName] || 0; + that.dialogVisible = true; }, getTableData(){ let that = this; that.tableDatas3 = []; that.materialTestItemMap = {}; + that.thresholdobj = {}; that.header3 = []; - debugger; - if(that.deptName=='原料车间'){ - that.header2Obj=[{name:'辅料',lengths:3},{name:'干混生料',lengths:4}]; - that.header2 = ['辅料','干混生料'];//物料 - // that.header3 = ['细度','Fe2O3','水分','细度','Fe2O3','水分','CaO'];//检测项 - // that.header4 = ['平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率'];//检测项 - }else if(that.deptName=='烧成车间'){ - that.header2Obj=[{name:'入窑生料',lengths:4},{name:'熟料',lengths:4}]; - that.header2 = ['入窑生料','熟料'];//物料 - // that.header3 = ['CaO','Fe2O3','细度','水分','立升重','f-CaO','细度','水分'];//检测项 - // that.header4 = ['平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率'];//检测项 - }else{ - that.header2Obj=[{name:'出磨水泥',lengths:3}]; - that.header2 = ['出磨水泥'];//物料 - // that.header3 = ['比表面积','SO3','掺量'];//检测项 - // that.header4 = ['平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率'];//检测项 - } - let params = {page: 0}; let arr = []; let update_start_time = ''; let update_end_time = ''; + if(that.deptName=='原料车间'){ + that.header2Obj=[{name:'辅料',lengths:3},{name:'干混生料',lengths:4}]; + that.header2 = ['辅料','干混生料'];//物料 + + }else if(that.deptName=='烧成车间'){ + that.header2Obj=[{name:'入窑生料',lengths:4},{name:'熟料',lengths:4}]; + that.header2 = ['入窑生料','熟料'];//物料 + }else{ + that.header2Obj=[{name:'出磨水泥',lengths:3}]; + that.header2 = ['出磨水泥'];//物料 + } + let params = {page: 0}; if(that.query.type==0){//日 arr = that.query.month.split('-'); params.year_s = arr[0]; - params.month_s = arr[1]; + params.month_s = parseInt(arr[1]); params.type = 'day_s' + // const updateStartDate = new Date(params.year_s, params.month_s - 1, 1); // 月份从 0 开始 + // const updateEndDate = new Date(params.year_s, params.month_s, 0); + // update_start_time = updateStartDate.toISOString().split('T')[0]; // 格式化为 'YYYY-MM-DD' + // update_end_time = updateEndDate.toISOString().split('T')[0]; // }else if(that.query.type==1){//月 params.type = 'month_s' params.year_s = that.query.year; + // const updateStartDate = new Date(params.year_s, 0, 1); // 1 月 1 日 + // const updateEndDate = new Date(params.year_s, 11, 31); // 12 月 31 日 + // update_start_time = updateStartDate.toISOString().split('T')[0]; // 格式化为 'YYYY-MM-DD' + // update_end_time = updateEndDate.toISOString().split('T')[0]; } params.mgroup__belong_dept = that.query.belong_dept; - if(params.month_s){ - const updateStartDate = new Date(params.year_s, params.month_s - 1, 1); // 月份从 0 开始 - const updateEndDate = new Date(params.year_s, params.month_s, 0); - update_start_time = updateStartDate.toISOString().split('T')[0]; // 格式化为 'YYYY-MM-DD' - update_end_time = updateEndDate.toISOString().split('T')[0]; // - }else if(params.year_s){ - const updateStartDate = new Date(params.year_s, 0, 1); // 1 月 1 日 - const updateEndDate = new Date(params.year_s, 11, 31); // 12 月 31 日 - update_start_time = updateStartDate.toISOString().split('T')[0]; // 格式化为 'YYYY-MM-DD' - update_end_time = updateEndDate.toISOString().split('T')[0]; - } this.$API.enm.enstat.req(params).then((res) => { let data = res; let wrapArr = []; @@ -373,17 +340,6 @@ //1、将相同日期或月份/年份的数据放到一组 let header2=[],header2Obj=[],header3=[],header4=[]; data.forEach(item => { - item.qua_data.forEach((qua)=>{ - let key = `${qua.material_name}-${qua.testitem_name}`; - if (!that.materialTestItemMap[key]) { - that.materialTestItemMap[key] = { - material_id: qua.material, - testitem_id: qua.testitem, - update_start_time:update_start_time, - update_end_time:update_end_time - }; - } - }) if(that.query.type==0){//日统计 ind = item.day_s-1; }else if(that.query.type==1){//月统计 @@ -410,6 +366,7 @@ } }); wrapArr = wrapArr.filter(item => item && item.length > 0); + console.log(wrapArr, "-------------wrapArr") wrapArr.forEach((item1,index1)=>{ if(item1!=undefined){//一天的数据 let itemArr = []; @@ -423,6 +380,15 @@ //遍历一个工段的物料检验数据 data2.forEach((item3,index3)=>{ //item3一个检验数据 + let key = `${item3.material_name}-${item3.testitem_name}`; + if (!that.materialTestItemMap[key]) { + that.materialTestItemMap[key] = { + material_id: item3.material, + testitem_id: item3.testitem, + month_s:params.month_s, + // end_time:update_end_time + }; + } if(header2tem.indexOf(item3.material_name)>-1){ let indexObj = header2tem.indexOf(item3.material_name); header2Objtem[indexObj].lengths = header2Objtem[indexObj].lengths+1; From e7b4df54cee83364e9fb7acaef6463dbec4b3780 Mon Sep 17 00:00:00 2001 From: zty Date: Sun, 26 Jan 2025 09:44:31 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20tkx=20=E4=BF=AE=E6=94=B9=E8=B4=A8?= =?UTF-8?q?=E9=87=8F=20=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/enm_report/quality.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/enm_report/quality.vue b/src/views/enm_report/quality.vue index dc7b5d60..c3f82288 100644 --- a/src/views/enm_report/quality.vue +++ b/src/views/enm_report/quality.vue @@ -307,8 +307,8 @@ that.header2 = ['辅料','干混生料'];//物料 }else if(that.deptName=='烧成车间'){ - that.header2Obj=[{name:'入窑生料',lengths:4},{name:'熟料',lengths:4}]; - that.header2 = ['入窑生料','熟料'];//物料 + that.header2Obj=[{name:'出窑熟料',lengths:4},{name:'熟料',lengths:4}]; + that.header2 = ['出窑熟料','熟料'];//物料 }else{ that.header2Obj=[{name:'出磨水泥',lengths:3}]; that.header2 = ['出磨水泥'];//物料 From 5594b2c982009154ba8aebdb1da6a181517c4c51 Mon Sep 17 00:00:00 2001 From: zty Date: Sun, 26 Jan 2025 11:26:22 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20tkx=20=E4=BF=AE=E6=94=B9=E8=B4=A8?= =?UTF-8?q?=E9=87=8F=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/enm_kiln/teamAnalysis.vue | 30 ++++++++++++++--------------- src/views/enm_report/quality.vue | 3 +-- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/views/enm_kiln/teamAnalysis.vue b/src/views/enm_kiln/teamAnalysis.vue index 206776dd..f862e87f 100644 --- a/src/views/enm_kiln/teamAnalysis.vue +++ b/src/views/enm_kiln/teamAnalysis.vue @@ -201,7 +201,7 @@ export default { production_cost_unit:item.production_cost_unit, CaO:item.出窑熟料_fCaO_rate_pass, coal_consume_unit:item.coal_consume_unit, - Fe2o3:item.入窑生料_Fe2O3_rate_pass, + lisz:item.出窑熟料_立升重_rate_pass, elec:item.elec_consume_unit, } ); @@ -411,20 +411,20 @@ export default { } arr[29] += 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)); - // const production_cost_unit_index = production_cost_unit_sortedData.findIndex(obj => parseFloat(obj.production_cost_unit) === parseFloat(production_cost_unit_itemValue)); - // let production_cost_unit_score = 0; - // if (production_cost_unit_index === 0){ - // production_cost_unit_score= 10; - // } else if (production_cost_unit_index === 1) { - // production_cost_unit_score= 7; - // } else if (production_cost_unit_index === 2) { - // production_cost_unit_score= 3; - // } else if (production_cost_unit_index === 3) { - // production_cost_unit_score= 0; - // } - // arr[29] += production_cost_unit_score; + const lisz_itemValue = item.出窑熟料_立升重_rate_pass; // 立升重的值 + const lisz_sortedData = monthData.sort((a, b) => parseFloat(b.lisz) - parseFloat(a.lisz)); + const lisz_index = lisz_sortedData.findIndex(obj => parseFloat(obj.lisz) === parseFloat(lisz_itemValue)); + let production_cost_unit_score = 0; + if (lisz_index === 0){ + production_cost_unit_score= 7; + } else if (lisz_index === 1) { + production_cost_unit_score= 4; + } else if (lisz_index === 2) { + production_cost_unit_score= 3; + } else if (lisz_index === 3) { + production_cost_unit_score= 2; + } + arr[29] += production_cost_unit_score; const CaO_itemValue = item.出窑熟料_fCaO_rate_pass; // CaO的值 const CaO_sortedData = monthData.sort((a, b) => parseFloat(b.CaO) - parseFloat(a.CaO)); diff --git a/src/views/enm_report/quality.vue b/src/views/enm_report/quality.vue index c3f82288..50f89c4e 100644 --- a/src/views/enm_report/quality.vue +++ b/src/views/enm_report/quality.vue @@ -192,8 +192,7 @@ material_id: mapEntry.material_id, testitem_id: mapEntry.testitem_id, rate_pass_t: num, - update_start_time: mapEntry.start_time, - update_end_time: mapEntry.end_time, + month_s: mapEntry.month_s, }; that.$API.qm.updateQuastatGoal.post(payload) .then((res) => { From 44db345ae7731f6ee791301047e83496857859a2 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 5 Feb 2025 15:50:10 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat:=20=E8=AF=81=E4=B9=A6=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=A2=9E=E5=8A=A0=E7=8A=B6=E6=80=81=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/enum.js | 6 ++++++ src/views/hrm/certificate.vue | 23 ++++++++++++++++++++++- src/views/hrm/certificates.vue | 15 +++++++++++++-- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/utils/enum.js b/src/utils/enum.js index df6f5d13..acecc11a 100644 --- a/src/utils/enum.js +++ b/src/utils/enum.js @@ -206,4 +206,10 @@ export const wmState = new EnumFactory({ 30: { text: '返修', type: 'warning' }, 40: { text: '检验', type: 'primary' }, 50: { text: '报废', type: 'danger' }, +}, parseInt) + +export const certStateEnum = new EnumFactory({ + 10: { text: '正常', type: 'success' }, + 20: { text: '临期', type: 'warning' }, + 30: { text: '过期', type: 'danger' } }, parseInt) \ No newline at end of file diff --git a/src/views/hrm/certificate.vue b/src/views/hrm/certificate.vue index 3c3be5e2..11bb3b10 100644 --- a/src/views/hrm/certificate.vue +++ b/src/views/hrm/certificate.vue @@ -35,6 +35,15 @@ :label="item.label" :value="item.value" > + + +
@@ -79,6 +88,16 @@ + + + @@ -185,7 +204,8 @@ -