This commit is contained in:
shijing 2025-02-05 16:55:44 +08:00
commit 7eac479d9c
5 changed files with 122 additions and 119 deletions

View File

@ -206,4 +206,10 @@ export const wmState = new EnumFactory({
30: { text: '返修', type: 'warning' }, 30: { text: '返修', type: 'warning' },
40: { text: '检验', type: 'primary' }, 40: { text: '检验', type: 'primary' },
50: { text: '报废', type: 'danger' }, 50: { text: '报废', type: 'danger' },
}, parseInt)
export const certStateEnum = new EnumFactory({
10: { text: '正常', type: 'success' },
20: { text: '临期', type: 'warning' },
30: { text: '过期', type: 'danger' }
}, parseInt) }, parseInt)

View File

@ -201,7 +201,7 @@ export default {
production_cost_unit:item.production_cost_unit, production_cost_unit:item.production_cost_unit,
CaO:item.出窑熟料_fCaO_rate_pass, CaO:item.出窑熟料_fCaO_rate_pass,
coal_consume_unit:item.coal_consume_unit, coal_consume_unit:item.coal_consume_unit,
Fe2o3:item.入窑生料_Fe2O3_rate_pass, lisz:item.出窑熟料_立升重_rate_pass,
elec:item.elec_consume_unit, elec:item.elec_consume_unit,
} }
); );
@ -411,20 +411,20 @@ export default {
} }
arr[29] += production_hour_score; arr[29] += production_hour_score;
// const production_cost_unit_itemValue = item.production_cost_unit; // const lisz_itemValue = item.出窑熟料_立升重_rate_pass; //
// const production_cost_unit_sortedData = monthData.sort((a, b) => parseFloat(b.production_cost_unit) - parseFloat(a.production_cost_unit)); const lisz_sortedData = monthData.sort((a, b) => parseFloat(b.lisz) - parseFloat(a.lisz));
// const production_cost_unit_index = production_cost_unit_sortedData.findIndex(obj => parseFloat(obj.production_cost_unit) === parseFloat(production_cost_unit_itemValue)); const lisz_index = lisz_sortedData.findIndex(obj => parseFloat(obj.lisz) === parseFloat(lisz_itemValue));
// let production_cost_unit_score = 0; let production_cost_unit_score = 0;
// if (production_cost_unit_index === 0){ if (lisz_index === 0){
// production_cost_unit_score= 10; production_cost_unit_score= 7;
// } else if (production_cost_unit_index === 1) { } else if (lisz_index === 1) {
// production_cost_unit_score= 7; production_cost_unit_score= 4;
// } else if (production_cost_unit_index === 2) { } else if (lisz_index === 2) {
// production_cost_unit_score= 3; production_cost_unit_score= 3;
// } else if (production_cost_unit_index === 3) { } else if (lisz_index === 3) {
// production_cost_unit_score= 0; production_cost_unit_score= 2;
// } }
// arr[29] += production_cost_unit_score; arr[29] += production_cost_unit_score;
const CaO_itemValue = item.出窑熟料_fCaO_rate_pass; // CaO const CaO_itemValue = item.出窑熟料_fCaO_rate_pass; // CaO
const CaO_sortedData = monthData.sort((a, b) => parseFloat(b.CaO) - parseFloat(a.CaO)); const CaO_sortedData = monthData.sort((a, b) => parseFloat(b.CaO) - parseFloat(a.CaO));

View File

@ -103,7 +103,6 @@
title="设置合格率的阈值" title="设置合格率的阈值"
v-model="dialogVisible" v-model="dialogVisible"
width="30%" width="30%"
@close="resetDialog"
> >
<div> <div>
<label>当前阈值:</label> <label>当前阈值:</label>
@ -139,28 +138,6 @@
deptName:'', deptName:'',
typeName:'质检日报表', typeName:'质检日报表',
tableName:'', tableName:'',
// tableDatas:[
// ['','','', , , , , , ],
// ['','','Fe2O3', , , , , , ],
// ['','','', , , , , , ],
// ['','','', , , , , , ],
// ['','','Fe2O3', , , , , , ],
// ['','','', , , , , , ],
// ['','','CaO', , , , , , ],
// ['','','CaO', , , , , , ],
// ['','','Fe2O3', , , , , , ],
// ['','',''],
// ['','',''],
// ['','',''],
// ['','','f-CaO'],
// ['','',''],
// ['','',''],
// ['','',''],
// ['','','SO3'],
// ['','',''],
// ],
tableDatas3:[], tableDatas3:[],
exportLoading:false, exportLoading:false,
header2:[], header2:[],
@ -170,14 +147,12 @@
header2Obj:[], header2Obj:[],
deptOptions:[], deptOptions:[],
dialogVisible: false, // dialogVisible: false, //
currentColumnIndex: null, //
// thresholds: {}, // key // thresholds: {}, // key
thresholdobj:{}, thresholdobj:{},
materialTestItemMap:{}, materialTestItemMap:{},
currentMaterialNameClass: '', currentMaterialName: null, //
currentMaterialName: '', // currentTestItemName: null, //
currentTestItemName: '', //
currentTestItemNameClass: '', //
}; };
}, },
mounted() { mounted() {
@ -205,10 +180,11 @@
that.tableName = that.deptName+that.typeName; that.tableName = that.deptName+that.typeName;
}, },
updateThreshold() { updateThreshold() {
const num = parseFloat(this.currentThreshold); let that = this;
const num = parseFloat(that.currentThreshold);
if (!isNaN(num)){ if (!isNaN(num)){
const key = `${this.currentMaterialName}-${this.currentTestItemName}`; const key = `${that.currentMaterialName}-${that.currentTestItemName}`;
const mapEntry = this.materialTestItemMap[key]; const mapEntry = that.materialTestItemMap[key];
if (!mapEntry) { if (!mapEntry) {
return; return;
} }
@ -216,27 +192,25 @@
material_id: mapEntry.material_id, material_id: mapEntry.material_id,
testitem_id: mapEntry.testitem_id, testitem_id: mapEntry.testitem_id,
rate_pass_t: num, rate_pass_t: num,
update_start_time: mapEntry.update_start_time, month_s: mapEntry.month_s,
update_end_time: mapEntry.update_end_time,
}; };
this.$API.qm.updateQuastatGoal.post(payload) that.$API.qm.updateQuastatGoal.post(payload)
.then((res) => { .then((res) => {
this.$message.success("阈值更新成功"); that.$message.success("阈值更新成功");
// this.thresholds[this.currentColumnIndex] = res.rate_pass_t; // // this.thresholds[this.currentColumnIndex] = res.rate_pass_t; //
this.dialogVisible = false; // that.dialogVisible = false; //
}) })
.catch((error) => { .catch((error) => {
this.$message.error("阈值更新失败:" + error.message); that.$message.error("阈值更新失败:" + error.message);
}); });
}else { }else {
this.$message.error("请输入有效的阈值例如80%"); that.$message.error("请输入有效的阈值例如80%");
} }
}, },
// //
resetDialog() { // resetDialog() {
this.currentColumnIndex = null; // this.currentThreshold = "";
this.currentThreshold = ""; // },
},
// //
getCellClass(cell, cellIndex) { getCellClass(cell, cellIndex) {
let that = this; let that = this;
@ -244,26 +218,27 @@
// //
const cellValue = String(cell); const cellValue = String(cell);
const value = parseFloat(cellValue.replace("%", "")); const value = parseFloat(cellValue.replace("%", ""));
this.currentColumnIndex = cellIndex;
const header4Index = cellIndex - 1; // 0 const header4Index = cellIndex - 1; // 0
const header3Index = Math.floor(header4Index / 4); const header3Index = Math.floor(header4Index / 4);
let cumulativeLength = 0; let cumulativeLength = 0;
let header2Index = -1; let header2Index = -1;
for (let i = 0; i < this.header2Obj.length; i++) { for (let i = 0; i < that.header2Obj.length; i++) {
cumulativeLength += this.header2Obj[i].lengths * 4; cumulativeLength += that.header2Obj[i].lengths * 4;
if (header4Index < cumulativeLength) { if (header4Index < cumulativeLength) {
header2Index = i; header2Index = i;
break; break;
} }
} }
let currentMaterialNameClass = ''
let currentTestItemNameClass = ''
if (header2Index !== -1 && header3Index !== -1){ if (header2Index !== -1 && header3Index !== -1){
that.currentMaterialNameClass = this.header2Obj[header2Index].name; // header2Obj currentMaterialNameClass = that.header2Obj[header2Index].name; // header2Obj
that.currentTestItemNameClass = this.header3[header3Index]; // header3 currentTestItemNameClass = that.header3[header3Index]; // header3
}else { }else {
this.currentMaterialNameClass = ''; currentMaterialNameClass = '';
this.currentTestItemNameClass = ''; currentTestItemNameClass = '';
} }
const keyName = `${that.currentMaterialNameClass}-${that.currentTestItemNameClass}`; const keyName = `${currentMaterialNameClass}-${currentTestItemNameClass}`;
const rate_g = that.thresholdobj[keyName] || 0; const rate_g = that.thresholdobj[keyName] || 0;
if (rate_g >= value) { if (rate_g >= value) {
return 'red-text'; return 'red-text';
@ -294,77 +269,68 @@
}, },
handleCellClick(cell, rowIndex, cellIndex){ handleCellClick(cell, rowIndex, cellIndex){
let that = this; let that = this;
this.currentColumnIndex = cellIndex; const header4Index_hd = cellIndex - 1 ; // 0
const header4Index = cellIndex - 1 ; // 0 const header3Index_hd = Math.floor(header4Index_hd / 4) ;
const header3Index = Math.floor(header4Index / 4) ;
let cumulativeLength = 0; let cumulativeLength = 0;
let header2Index = -1; let header2Index = -1;
// //
for (let i = 0; i < this.header2Obj.length; i++) { for (let i = 0; i < this.header2Obj.length; i++) {
cumulativeLength += this.header2Obj[i].lengths * 4; cumulativeLength += this.header2Obj[i].lengths * 4;
if (header4Index < cumulativeLength) { if (header4Index_hd < cumulativeLength) {
header2Index = i; header2Index = i;
break; break;
} }
} }
if (header2Index !== -1 && header3Index !== -1){ if (header2Index !== -1 && header3Index_hd !== -1){
that.currentMaterialName = this.header2Obj[header2Index].name; // header2Obj that.currentMaterialName = this.header2Obj[header2Index].name; // header2Obj
that.currentTestItemName = this.header3[header3Index]; // header3 that.currentTestItemName = this.header3[header3Index_hd]; // header3
}else { }else {
this.currentMaterialName = ''; that.currentMaterialName = '';
this.currentTestItemName = ''; that.currentTestItemName = '';
} }
const keyName = `${that.currentMaterialName}-${that.currentTestItemName}`; const keyName = `${that.currentMaterialName}-${that.currentTestItemName}`;
this.currentThreshold = that.thresholdobj[keyName] || 0; that.currentThreshold = that.thresholdobj[keyName] || 0;
this.dialogVisible = true; that.dialogVisible = true;
}, },
getTableData(){ getTableData(){
let that = this; let that = this;
that.tableDatas3 = []; that.tableDatas3 = [];
that.materialTestItemMap = {}; that.materialTestItemMap = {};
that.thresholdobj = {};
that.header3 = []; 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 arr = [];
let update_start_time = ''; let update_start_time = '';
let update_end_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){// if(that.query.type==0){//
arr = that.query.month.split('-'); arr = that.query.month.split('-');
params.year_s = arr[0]; params.year_s = arr[0];
params.month_s = arr[1]; params.month_s = parseInt(arr[1]);
params.type = 'day_s' 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){// }else if(that.query.type==1){//
params.type = 'month_s' params.type = 'month_s'
params.year_s = that.query.year; 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; 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) => { this.$API.enm.enstat.req(params).then((res) => {
let data = res; let data = res;
let wrapArr = []; let wrapArr = [];
@ -373,17 +339,6 @@
//1/ //1/
let header2=[],header2Obj=[],header3=[],header4=[]; let header2=[],header2Obj=[],header3=[],header4=[];
data.forEach(item => { 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){// if(that.query.type==0){//
ind = item.day_s-1; ind = item.day_s-1;
}else if(that.query.type==1){// }else if(that.query.type==1){//
@ -410,6 +365,7 @@
} }
}); });
wrapArr = wrapArr.filter(item => item && item.length > 0); wrapArr = wrapArr.filter(item => item && item.length > 0);
console.log(wrapArr, "-------------wrapArr")
wrapArr.forEach((item1,index1)=>{ wrapArr.forEach((item1,index1)=>{
if(item1!=undefined){// if(item1!=undefined){//
let itemArr = []; let itemArr = [];
@ -423,6 +379,15 @@
// //
data2.forEach((item3,index3)=>{ data2.forEach((item3,index3)=>{
//item3 //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){ if(header2tem.indexOf(item3.material_name)>-1){
let indexObj = header2tem.indexOf(item3.material_name); let indexObj = header2tem.indexOf(item3.material_name);
header2Objtem[indexObj].lengths = header2Objtem[indexObj].lengths+1; header2Objtem[indexObj].lengths = header2Objtem[indexObj].lengths+1;

View File

@ -35,6 +35,15 @@
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
></el-option> ></el-option>
</el-select>
<el-select
v-model="query.state"
placeholder="证书状态"
@change="handleQuery"
clearable
style="margin-left: 2px"
>
</el-select> </el-select>
</div> </div>
<div class="right-panel"> <div class="right-panel">
@ -79,6 +88,16 @@
</el-table-column> </el-table-column>
<el-table-column label="证书编号" prop="number"> </el-table-column> <el-table-column label="证书编号" prop="number"> </el-table-column>
<el-table-column label="证书类型" prop="type"><template #default="scope">{{type_[scope.row.type]}} </template></el-table-column> <el-table-column label="证书类型" prop="type"><template #default="scope">{{type_[scope.row.type]}} </template></el-table-column>
<el-table-column label="状态" prop="state" width="80">
<template #default="scope">
<el-tag
:type="certStateEnum[scope.row.state]?.type"
>{{
certStateEnum[scope.row.state]?.text
}}</el-tag
>
</template>
</el-table-column>
<el-table-column label="发证日期" prop="issue_date"></el-table-column> <el-table-column label="发证日期" prop="issue_date"></el-table-column>
<el-table-column label="有效期" prop="expiration_date"> </el-table-column> <el-table-column label="有效期" prop="expiration_date"> </el-table-column>
<el-table-column label="下一次复审日期" prop="review_date"></el-table-column> <el-table-column label="下一次复审日期" prop="review_date"></el-table-column>
@ -185,7 +204,8 @@
</template> </template>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { certStateEnum } from "@/utils/enum.js";
const defaultform= const defaultform=
{ id: "", { id: "",
name: "", name: "",
@ -197,6 +217,7 @@ export default {
components: {}, components: {},
data() { data() {
return { return {
certStateEnum,
apiObj: this.$API.hrm.certificate.list, apiObj: this.$API.hrm.certificate.list,
form:defaultform, form:defaultform,
typeoptions: [ typeoptions: [

View File

@ -43,11 +43,20 @@
<el-table-column label="证书名称" fixed="left" prop="name"></el-table-column> <el-table-column label="证书名称" fixed="left" prop="name"></el-table-column>
<el-table-column label="证书编号" prop="number"> </el-table-column> <el-table-column label="证书编号" prop="number"> </el-table-column>
<el-table-column label="证书类型" prop="type"><template #default="scope">{{type_[scope.row.type]}} </template></el-table-column> <el-table-column label="证书类型" prop="type"><template #default="scope">{{type_[scope.row.type]}} </template></el-table-column>
<el-table-column label="状态" prop="state">
<template #default="scope">
<el-tag
:type="certStateEnum[scope.row.state]?.type"
>{{
certStateEnum[scope.row.state]?.text
}}</el-tag
>
</template>
</el-table-column>
<el-table-column label="发证日期" prop="issue_date"></el-table-column> <el-table-column label="发证日期" prop="issue_date"></el-table-column>
<el-table-column label="有效期" prop="expiration_date"> </el-table-column> <el-table-column label="有效期" prop="expiration_date"> </el-table-column>
<el-table-column label="下一次复审日期" prop="review_date"></el-table-column> <el-table-column label="下一次复审日期" prop="review_date"></el-table-column>
<el-table-column label="证书文件" prop="file"></el-table-column> <el-table-column label="证书文件" prop="file"></el-table-column>
</scTable> </scTable>
</el-main> </el-main>
</el-container> </el-container>
@ -144,7 +153,8 @@
</template> </template>
</sc-dialog> </sc-dialog>
</template> </template>
<script> <script>
import { certStateEnum } from "@/utils/enum.js";
const defaultform= const defaultform=
{ id: "", { id: "",
name: "", name: "",
@ -156,6 +166,7 @@ export default {
components: {}, components: {},
data() { data() {
return { return {
certStateEnum,
form:defaultform, form:defaultform,
typeoptions: [ typeoptions: [
{ id: 10, name: "特种作业证书" }, { id: 10, name: "特种作业证书" },