Merge branch 'master' of https://e.coding.net/ctcdevteam/ehs/ehs_web
This commit is contained in:
commit
7eac479d9c
|
@ -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)
|
|
@ -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));
|
||||
|
|
|
@ -103,7 +103,6 @@
|
|||
title="设置合格率的阈值"
|
||||
v-model="dialogVisible"
|
||||
width="30%"
|
||||
@close="resetDialog"
|
||||
>
|
||||
<div>
|
||||
<label>当前阈值:</label>
|
||||
|
@ -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,25 @@
|
|||
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,
|
||||
month_s: mapEntry.month_s,
|
||||
};
|
||||
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 +218,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 +269,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 +339,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 +365,7 @@
|
|||
}
|
||||
});
|
||||
wrapArr = wrapArr.filter(item => item && item.length > 0);
|
||||
console.log(wrapArr, "-------------wrapArr")
|
||||
wrapArr.forEach((item1,index1)=>{
|
||||
if(item1!=undefined){//一天的数据
|
||||
let itemArr = [];
|
||||
|
@ -423,6 +379,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;
|
||||
|
|
|
@ -35,6 +35,15 @@
|
|||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
<el-select
|
||||
v-model="query.state"
|
||||
placeholder="证书状态"
|
||||
@change="handleQuery"
|
||||
clearable
|
||||
style="margin-left: 2px"
|
||||
>
|
||||
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="right-panel">
|
||||
|
@ -79,6 +88,16 @@
|
|||
</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="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="expiration_date"> </el-table-column>
|
||||
<el-table-column label="下一次复审日期" prop="review_date"></el-table-column>
|
||||
|
@ -185,7 +204,8 @@
|
|||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
<script>
|
||||
import { certStateEnum } from "@/utils/enum.js";
|
||||
const defaultform=
|
||||
{ id: "",
|
||||
name: "",
|
||||
|
@ -197,6 +217,7 @@ export default {
|
|||
components: {},
|
||||
data() {
|
||||
return {
|
||||
certStateEnum,
|
||||
apiObj: this.$API.hrm.certificate.list,
|
||||
form:defaultform,
|
||||
typeoptions: [
|
||||
|
|
|
@ -43,11 +43,20 @@
|
|||
<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="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="expiration_date"> </el-table-column>
|
||||
<el-table-column label="下一次复审日期" prop="review_date"></el-table-column>
|
||||
<el-table-column label="证书文件" prop="file"></el-table-column>
|
||||
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
|
@ -144,7 +153,8 @@
|
|||
</template>
|
||||
</sc-dialog>
|
||||
</template>
|
||||
<script>
|
||||
<script>
|
||||
import { certStateEnum } from "@/utils/enum.js";
|
||||
const defaultform=
|
||||
{ id: "",
|
||||
name: "",
|
||||
|
@ -156,6 +166,7 @@ export default {
|
|||
components: {},
|
||||
data() {
|
||||
return {
|
||||
certStateEnum,
|
||||
form:defaultform,
|
||||
typeoptions: [
|
||||
{ id: 10, name: "特种作业证书" },
|
||||
|
|
Loading…
Reference in New Issue