feat: 修改质量报表

This commit is contained in:
zty 2025-01-23 14:24:02 +08:00
parent ae3e6aa1ec
commit 56334fc718
8 changed files with 405 additions and 173 deletions

View File

@ -34,6 +34,7 @@
"html2canvas": "^1.4.1",
"json-editor-vue3": "^1.0.6",
"jspdf": "^2.5.1",
"moment": "^2.30.1",
"node-polyfill-webpack-plugin": "^4.0.0",
"nprogress": "0.2.0",
"print-js": "^1.6.0",

View File

@ -26,6 +26,13 @@ export default {
return await http.post(this.url, data);
},
},
updateQuastatGoal: {
url: `${config.API_URL}/qm/quastat/update_rate_pass_t/`,
name: "更新合格率目标值",
post: async function (data = {}) {
return await http.post(this.url, data);
},
},
//质检项目
getTestItem: {
url: `${config.API_URL}/qm/testitem/`,

View File

@ -101,13 +101,13 @@
width="120"
>
</el-table-column>
<el-table-column
<!-- <el-table-column
label="合计"
prop="sum"
width="130"
fixed="right"
>
</el-table-column>
</el-table-column> -->
</el-table>
<el-table
v-if="query.type==1"
@ -116,7 +116,7 @@
style="width: 100%"
border
:height="tableHeight"
@cell-click="handleCellClick1"
>
<el-table-column
label="分类"
@ -135,13 +135,13 @@
width="120"
>
</el-table-column>
<el-table-column
<!-- <el-table-column
label="合计"
prop="sum"
width="130"
fixed="right"
>
</el-table-column>
</el-table-column> -->
</el-table>
<el-table
v-if="query.type==2"
@ -150,7 +150,7 @@
style="width: 100%"
border
:height="tableHeight"
@cell-click="handleCellClick_month"
>
<el-table-column
label="分类"
@ -169,13 +169,13 @@
width="120"
>
</el-table-column>
<el-table-column
<!-- <el-table-column
label="合计"
prop="sum"
width="130"
fixed="right"
>
</el-table-column>
</el-table-column> -->
</el-table>
<el-table
v-if="query.type==3"
@ -184,7 +184,7 @@
style="width: 100%"
border
:height="tableHeight"
@cell-click="handleCellClick_range"
>
<el-table-column
label="分类"
@ -242,9 +242,49 @@
<script>
let legend = {
top: "2%",
data: ["碳排放量(t)"],
data: ["碳排放量(t)", "碳排放强度(t/t)"],
};
let colors = ["##36492E", "#4BA328", "#C6F47D"];
let grid = {
right: "11%",
left: "11%",
top: "27%",
};
let colors = ["#518A3A", "#2DAEEF", "#C6F47D"];
let yAxis = [
{
type: "value",
name: "碳排放量(t)",
position: "left",
alignTicks: true,
nameRotate: 50,
axisLine: {
show: true,
lineStyle: {
color: colors[0],
},
},
axisLabel: {
formatter: "{value}",
},
},
{
type: "value",
name: "碳排放强度(t/t)",
position: "right",
alignTicks: true,
nameRotate: 50,
axisLine: {
show: true,
lineStyle: {
color: colors[1],
},
},
axisLabel: {
formatter: "{value}",
},
}
];
import scEcharts from "@/components/scEcharts";
export default {
components: {
@ -278,7 +318,6 @@ export default {
{id:0,name:'日统计'},
{id:1,name:'月统计'},
{id:2,name:'年统计'},
{id:3,name:'时间段'},
],
tableDatas2: [],
tableDatas_day:[],
@ -389,13 +428,14 @@ export default {
xAxisData_month: [],
xTtimeRange: [],
gyhourlyData : [],
lvhourlyData : [],
mpointList_code:"3750125939653558272,3759456603624382464,3636975194725527552",
StrengthData : [],
shhourlyData : [], //
gyhourlyData_month : [],
lvhourlyData_month : [],
shhourlyData_month : [], //
StrengthData_month : [],
ProductionData_month : [], //
gyhourlyData_year : [],
lvhourlyData_year : [],
StrengthData_year : [],
shhourlyData_year : [], //
};
},
@ -450,10 +490,10 @@ export default {
},
changeDate(){
let obj = {};
obj.type = "day";
obj.type = "hour";
obj.start_time = this.daterange[0];
obj.end_time = this.daterange[1];
obj.mpoint__in = "3750125939653558272";
obj.mpoint__in = '3750125939653558272,3759456603624382464';
obj.page = 0;
this.$API.enm.mpointstat.groupValues.req(obj).then((res) => {
//res total_val
@ -501,7 +541,7 @@ export default {
// enabled: 1,
// need_display: 1,
ordering: "report_sortstr",
code__in: "tpfl",
code__in: "tanpfqd, tpfl",
query: "{ id, name, nickname, mgroup_name, unit, report_sortstr }",
})
.then((res) => {
@ -518,6 +558,7 @@ export default {
_nameLength = [],
indexList = [];
let mgroupObj = {};
console.log(that.mpointList);
that.mpointList.forEach((item, index) => {
let indexs = _mgroup.indexOf(item.mgroup_name);
if (indexs > -1) {
@ -551,12 +592,14 @@ export default {
that.tableDatas2.push(obj);
that.getData(item.id, index);
});
that.updateChart(that.gyhourlyData, that.shhourlyData, that.lvhourlyData);
that.updateChart(that.gyhourlyData, that.StrengthData);
that.mgroupObj = mgroupObj;
that.indexList = indexList;
},
getData(id, index) {
let that = this;
that.StrengthData = [];
that.gyhourlyData = [];
let obj = {};
obj.type = "hour";
obj.year = that.year;
@ -574,6 +617,10 @@ export default {
that.tableDatas2[index][keyName] = item.val;
if (item.mpoint_nickname == "碳排放量"){
that.gyhourlyData[item.hour] = item.val;
}else if(
item.mpoint_nickname == "碳排放强度"
){
that.StrengthData[item.hour] = item.val;
}
});
sum = sum * 100;
@ -585,11 +632,12 @@ export default {
that.$forceUpdate();
});
},
updateChart(gyhourlyData, shhourlyData, lvhourlyData) {
updateChart(gyhourlyData, StrengthData) {
let that = this;
// ECharts
let option = {
legend: legend,
grid: grid,
tooltip: {
trigger: 'axis',
axisPointer: {
@ -600,80 +648,84 @@ export default {
type: 'category',
data: ['0时', '1时', '2时', '3时', '4时', '5时', '6时', '7时', '8时', '9时', '10时', '11时', '12时', '13时', '14时', '15时', '16时', '17时', '18时', '19时', '20时', '21时', '22时', '23时'],
},
yAxis: {
type: 'value',
name: ''
},
yAxis: yAxis,
series: [{
name: '碳排放量(t)', //
type: 'bar',
data: gyhourlyData, //
data: gyhourlyData,
yAxisIndex: 0,
itemStyle: {
color: '#518A3A',
},
},
{
name: '碳排放强度(t/t)',
type: 'bar',
data: StrengthData,
yAxisIndex: 1,
itemStyle: {
color: colors[1],
},
},
]
};
that.optionHour = option;
},
dataLoop1() {
let that = this;
that.tableDatas = [];
that.tableDatas_day = [];
let _mgroup = [],
_nameLength = [],
indexList = [];
let mgroupObj = {};
that.mpointList.forEach((item, index) => {
let indexs = _mgroup.indexOf(item.mgroup_name);
if (indexs > -1) {
_nameLength[indexs] += 1;
} else {
_mgroup.push(item.mgroup_name);
_nameLength.push(1);
indexList.push(index);
}
let that = this;
that.tableDatas = [];
that.tableDatas_day = [];
let _mgroup = [], _nameLength = [], indexList = [];
let mgroupObj = {};
that.mpointList.forEach((item, index) => {
let indexs = _mgroup.indexOf(item.mgroup_name);
if (indexs > -1) {
_nameLength[indexs] += 1;
} else {
_mgroup.push(item.mgroup_name);
_nameLength.push(1);
indexList.push(index);
}
for (let i = 0; i < _mgroup.length; i++) {
mgroupObj[_mgroup[i]] = _nameLength[i];
}
let arr = [];
arr[0] =
item.mgroup_name != null
? item.mgroup_name
: item.nickname != null
? item.nickname
: item.name;
arr[1] = item.nickname != null ? item.nickname : item.name;
arr[2] = item.unit;
for (let i = 0; i < that.days; i++) {
arr[i + 2] = 0;
}
that.tableDatas.push(arr);
let obj = {};
obj.mgroupName =
item.mgroup_name != null ? item.mgroup_name : item.name;
obj.nickname =
item.nickname != null && item.nickname != ""
? item.nickname
: item.name;
obj.unit = item.unit;
for (let i = 0; i < _mgroup.length; i++) {
mgroupObj[_mgroup[i]] = _nameLength[i];
}
that.tableDatas_day.push(obj);
that.getData1(item.id, index);
});
that.updateMonthChart(that.gyhourlyData_month);
that.mgroupObj = mgroupObj;
that.indexList = indexList;
let arr = [];
arr[0] = item.mgroup_name != null ? item.mgroup_name : item.nickname != null ? item.nickname : item.name;
arr[1] = item.nickname != null ? item.nickname : item.name;
arr[2] = item.unit;
for (let i = 0; i < that.days; i++) {
arr[i + 2] = 0;
}
},
that.tableDatas.push(arr);
let obj = {};
obj.mgroupName = item.mgroup_name != null ? item.mgroup_name : item.name;
obj.nickname = item.nickname != null && item.nickname != "" ? item.nickname : item.name;
obj.unit = item.unit;
updateMonthChart(gyhourlyData) {
that.tableDatas_day.push(obj);
// getData1(index)
that.getData1(index);
});
that.updateMonthChart(that.gyhourlyData_month, that.StrengthData_month, that.ProductionData_month);
that.mgroupObj = mgroupObj;
that.indexList = indexList;
},
updateMonthChart(gyhourlyData, StrengthData, ) {
let that = this;
// ECharts
let option1 = {
legend: legend,
grid: grid,
tooltip: {
trigger: 'axis',
axisPointer: {
@ -684,55 +736,90 @@ export default {
type: 'category',
data: [],
},
yAxis: {
type: 'value',
name: ''
},
yAxis: yAxis,
series: [{
name: '碳排放量(t)', //
name: '碳排放量(t)',
type: 'bar',
data: gyhourlyData, //
data: gyhourlyData,
yAxisIndex: 0,
itemStyle: {
color: '#518A3A',
},
},
{
name: '碳排放强度(t/t)',
type: 'bar',
data: StrengthData,
yAxisIndex: 1,
itemStyle: {
color: colors[1],
},
},
]
};
option1.xAxis.data = that.xAxisData_day;
that.optionDay = option1;
},
getData1(id, index) {
let that = this;
let obj = {};
obj.type = "day";
obj.year = that.year;
obj.month = that.month;
obj.mpoint = id;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((res) => {
let sum = 0;
res.forEach((item) => {
let ind = item.day+2;
that.tableDatas[index][ind] = item.val;
sum += Number(item.val);
let keyName = item.day + "日";
that.tableDatas_day[index][keyName] = item.val;
if (item.mpoint_nickname == "碳排放量"){
that.gyhourlyData_month[item.day-1] = item.val;
}
});
sum = sum * 100;
sum = Math.round(sum);
sum = sum / 100;
let dayss = 0;
dayss = this.days + 3;
that.tableDatas[index][dayss] = sum.toFixed(2);
that.tableDatas_day[index].sum = sum.toFixed(2);
that.$forceUpdate();
});
},
getData1(index) {
let that = this;
that.StrengthData_month = [];
that.gyhourlyData_month = [];
let carbonEmission = []; //
let outputKiln = []; //
let emissionIntensity = []; //
let obj = {};
obj.type = "day";
obj.year = that.year;
obj.month = that.month;
obj.mpoint__in = this.mpointList_code;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((res) => {
let sum = 0;
res.forEach((item) => {
let ind = item.day + 2;
that.tableDatas[index][ind] = item.val;
sum += Number(item.val);
if (item.mpoint_nickname === "碳排放量") {
carbonEmission[item.day - 1] = item.val; //
} else if (item.mpoint_nickname === "出窑熟料产量") {
outputKiln[item.day - 1] = item.val; //
}
if(item.mpoint_nickname == "碳排放强度"){
return;
}
// that.tableDatas_day[index][keyName] = item.val;
if (item.mpoint_nickname == "碳排放量"){
that.gyhourlyData_month[item.day - 1] = item.val;
} else if(item.mpoint_nickname == "出窑熟料产量"){
that.ProductionData_month[item.day - 1] = item.val;
}
});
// /
for (let i = 0; i < carbonEmission.length; i++) {
let keyName = i + 1 + "日";
if(index==1 && carbonEmission[i] && outputKiln[i]){
emissionIntensity[i] = carbonEmission[i] / outputKiln[i]; //
that.StrengthData_month[i] = emissionIntensity[i].toFixed(2); // StrengthData_month
that.tableDatas_day[index][keyName] = emissionIntensity[i].toFixed(2); // tableDatas_day
} else if(index==0 && carbonEmission[i]){
that.tableDatas_day[index][keyName] = carbonEmission[i];
}
}
sum = sum * 100;
sum = Math.round(sum);
sum = sum / 100;
let dayss = 0;
dayss = this.days + 3;
that.tableDatas[index][dayss] = sum.toFixed(2);
that.tableDatas_day[index].sum = sum.toFixed(2);
that.$forceUpdate();
});
},
dataLoop_month() {
let that = this;
that.tableDatas = [];
@ -772,16 +859,17 @@ export default {
: item.name;
obj.unit = item.unit;
that.tableDatas_month.push(obj);
that.getData_month(item.id, index);
that.getData_month(index);
});
that.updateMonthChart_month(that.gyhourlyData_year, that.shhourlyData_year, that.lvhourlyData_year);
that.updateMonthChart_month(that.gyhourlyData_year, that.StrengthData_year);
that.mgroupObj = mgroupObj;
that.indexList = indexList;
},
updateMonthChart_month(gyhourlyData) {
updateMonthChart_month(gyhourlyData_year, StrengthData_year) {
let that = this;
let option2 = {
legend: legend,
grid: grid,
tooltip: {
trigger: 'axis',
axisPointer: {
@ -792,30 +880,42 @@ export default {
type: 'category',
data: [],
},
yAxis: {
type: 'value',
name: ''
},
yAxis: yAxis,
series: [{
name: '工业水', //
name: '碳排放量(t)',
type: 'bar',
data: gyhourlyData, //
data: gyhourlyData_year,
yAxisIndex: 0,
itemStyle: {
color: '#518A3A',
},
},
{
name: '碳排放强度(t/t)',
type: 'bar',
data: StrengthData_year,
yAxisIndex: 1,
itemStyle: {
color: colors[1],
},
}
]
};
option2.xAxis.data = that.xAxisData_month;
that.optionMonth = option2;
},
getData_month(id, index) {
getData_month(index) {
let that = this;
that.StrengthData_year = [];
that.gyhourlyData_year = [];
let carbonEmission = []; //
let outputKiln = []; //
let emissionIntensity = []; //
let obj = {};
obj.type = "month";
obj.year = that.year;
obj.mpoint = id;
obj.mpoint__in = that.mpointList_code;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((res) => {
let sum = 0;
@ -824,11 +924,34 @@ export default {
that.tableDatas[index][ind] = item.val;
sum += Number(item.val);
let keyName = item.month + "月";
that.tableDatas_month[index][keyName] = item.val;
// that.tableDatas_month[index][keyName] = item.val;
if (item.mpoint_nickname === "碳排放量") {
carbonEmission[item.month - 1] = item.val; //
} else if (item.mpoint_nickname === "出窑熟料产量") {
outputKiln[item.month - 1] = item.val; //
}
if(item.mpoint_nickname == "碳排放强度"){
return;
}
if (item.mpoint_nickname == "碳排放量"){
that.gyhourlyData_year[item.month-1] = item.val;
}else if(item.mpoint_nickname == "碳排放强度"){
that.StrengthData_year[item.month-1] = item.val;
}
});
// /
for (let i = 0; i < carbonEmission.length; i++) {
let keyName = i + 1 + "月";
if(index==1 && carbonEmission[i] && outputKiln[i]){
emissionIntensity[i] = carbonEmission[i] / outputKiln[i]; //
that.StrengthData_year[i] = emissionIntensity[i].toFixed(2); // StrengthData_month
that.tableDatas_month[index][keyName] = emissionIntensity[i].toFixed(2); // tableDatas_day
} else if(index==0 && carbonEmission[i]){
that.tableDatas_month[index][keyName] = carbonEmission[i];
}
}
sum = sum * 100;
sum = Math.round(sum);
sum = sum / 100;
@ -853,9 +976,10 @@ export default {
handleCellClick1(row, column, cell, event) {
let that = this;
let index = that.tableDatas_day.indexOf(row);
console.log('row', row)
that.tableName = `${row.nickname}-电量日统计`
let lineData = that.tableDatas[index].slice(3, that.days + 3);
console.log("row", row, that.tableDatas_day, index);
that.tableName = `${row.nickname}`
console.log("tableDatas", that.tableDatas);
let lineData = that.tableDatas_day[index].slice(2, 13);
that.option.xAxis.data = that.xAxisData_day;
that.option.series[0].data = lineData;
this.itemVisible = true;
@ -863,7 +987,7 @@ export default {
handleCellClick_month(row, column, cell, event) {
let that = this;
let index = that.tableDatas_month.indexOf(row);
that.tableName = `${row.nickname}-电量日统计`
that.tableName = `${row.nickname}`
//
let lineData = that.tableDatas[index].slice(2, 13);
that.option.xAxis.data = that.xAxisData_month;

View File

@ -338,6 +338,7 @@
</template>
<script>
const colors = ["#5b9bd5", "#ed7d31", "#70ad47", "#ffc000", "#5f6694", "#cb9bff", "#7DDA58"];
const colors_hour = ["#5b9bd5", "#ffc000", "#5f6694", "#cb9bff", "#7DDA58"];
// /////
let tooltip = {
show: true,
@ -723,7 +724,7 @@ export default {
{id:2,name:'年统计'}
],
option1: {
color: colors,
color: colors_hour,
tooltip: tooltip,
grid: grid,
toolbox: toolbox,

View File

@ -290,7 +290,8 @@
</div>
</template>
<script>
const colors = ["#5b9bd5", "#cbd3fe", "#91CC75", "#EE6666", "#CC00CC", "#7DDA58", "#BCB69D"];
const colors = ["#5b9bd5", "#cbd3fe", "#B79C2C", "#EE6666", "#CC00CC", "#7DDA58", "#BCB69D","#0AF2FA", "#48D311"];
const colors1 = ["#5b9bd5", "#cbd3fe", "#B79C2C", "#EE6666", "#CC00CC", "#726691", "#48D311"];
let tooltip = {
show: true,
trigger: "axis",
@ -337,7 +338,7 @@ let yAxis = [
axisLine: {
show: true,
lineStyle: {
color: colors[0],
color: colors[7],
},
},
axisLabel: {
@ -353,7 +354,7 @@ let yAxis = [
axisLine: {
show: true,
lineStyle: {
color: colors[1],
color: colors[8],
},
},
axisLabel: {
@ -478,12 +479,18 @@ export default {
yAxisIndex: 0,
data: [],
},
{
name: "分布电耗",
type: "bar",
yAxisIndex: 1,
data: [],
},
],
},
option2: {
color: colors,
color: colors1,
tooltip: tooltip,
legend: Object.assign(legend, {data:["袋装合计", "散装合计", "熟料出厂合计", "出厂水泥合计", "复合水泥合计", "分布电耗目标值","分布电耗"]}),
grid: grid,
@ -550,7 +557,7 @@ export default {
{
name: "分布电耗",
type: "bar",
yAxisIndex: 0,
yAxisIndex: 1,
data: [],
},
],
@ -878,7 +885,8 @@ export default {
seriesData2 = [],
seriesData3 = [],
seriesData4 = [],
seriesData5 = [];
seriesData5 = [],
seriesData6 = [];
let data = response;
data.forEach((item) => {
let ind = item.day_s - 1;
@ -892,6 +900,8 @@ export default {
seriesData4[ind] = item.val;
}else if (item.mpoint_name == "复合水泥合计" || item.mpoint_name == "复合硅酸盐水泥;42.5R;袋装水泥") {
seriesData5[ind] = item.val;
}else if(item.mpoint_name == "包装进线"){
seriesData6[ind] = item.elec_consume_unit;
}
});
@ -901,6 +911,7 @@ export default {
options.series[2].data = seriesData3;
options.series[3].data = seriesData4;
options.series[4].data = seriesData5;
options.series[5].data = seriesData6;
let dayXAxis = [];
for (let i = 1; i <= that.days; i++) {
let item = i + "日";

View File

@ -70,16 +70,6 @@
</el-header>
<el-card style="margin-top:5px">
<div class="tableContainer">
<!-- <div>
<label for="threshold">输入合格率阈值</label>
<input
type="text"
id="threshold"
v-model="currentThreshold"
placeholder="例如80%"
@input="updateThreshold"
/>
</div> -->
<table border="1" cellspacing="0" :key="timeStamp" id="myTable" class="myTable">
<thead class="myTableHead">
<tr>
@ -128,6 +118,7 @@
</div>
</template>
<script>
import moment from 'moment';
export default {
data() {
return {
@ -144,8 +135,7 @@
],
titleLength:1,
mgroupOptions:[],
threshold: 80, //
currentThreshold: "80%", //
currentThreshold: null, //
tableTime:'',
deptName:'',
typeName:'质检日报表',
@ -183,6 +173,12 @@
dialogVisible: false, //
currentColumnIndex: null, //
thresholds: {}, // key
thresholdobj:{},
materialTestItemMap:{},
currentMaterialNameClass: '',
currentMaterialName: '', //
currentTestItemName: '', //
currentTestItemNameClass: '', //
};
},
watch: {
@ -217,14 +213,33 @@
that.tableName = that.deptName+that.typeName;
},
updateThreshold() {
const num = parseFloat(this.currentThreshold.replace("%", ""));
if (!isNaN(num)) {
//
this.thresholds[this.currentColumnIndex] = num;
this.dialogVisible = false; //
} else {
this.$message.error("请输入有效的阈值例如80%");
}
const num = parseFloat(this.currentThreshold);
if (!isNaN(num)){
const key = `${this.currentMaterialName}-${this.currentTestItemName}`;
console.log("---------------key", key, this.materialTestItemMap)
const mapEntry = this.materialTestItemMap[key];
if (!mapEntry) {
return;
}
const payload = {
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,
};
this.$API.qm.updateQuastatGoal.post(payload)
.then((res) => {
this.$message.success("阈值更新成功");
this.thresholds[this.currentColumnIndex] = res.rate_pass_t; //
this.dialogVisible = false; //
})
.catch((error) => {
this.$message.error("阈值更新失败:" + error.message);
});
}else {
this.$message.error("请输入有效的阈值例如80%");
}
},
//
resetDialog() {
@ -233,15 +248,38 @@
},
//
getCellClass(cell, cellIndex) {
if (cellIndex > 0 && ((cellIndex - 1) % 4 === 3)) {
let that = this;
if (typeof cell === 'string' && cell.includes('%')) {
//
const cellValue = String(cell);
const value = parseFloat(cellValue.replace("%", ""));
const threshold = this.thresholds[cellIndex] || 0; //
if (!isNaN(value)) {
return value > threshold ? "green-text" : "red-text";
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;
if (header4Index < cumulativeLength) {
header2Index = i;
break;
}
}
if (header2Index !== -1 && header3Index !== -1){
that.currentMaterialNameClass = this.header2Obj[header2Index].name; // header2Obj
that.currentTestItemNameClass = this.header3[header3Index]; // header3
}else {
this.currentMaterialNameClass = '';
this.currentTestItemNameClass = '';
}
const keyName = `${that.currentMaterialNameClass}-${that.currentTestItemNameClass}`;
const rate_g = that.thresholdobj[keyName] || 0;
if (rate_g >= value) {
return 'red-text';
} else {
return 'green-text';
}
}
return "";
},
deptChange(e){
@ -264,16 +302,38 @@
});
},
handleCellClick(cell, rowIndex, cellIndex){
if ((cellIndex - 1) % 4 === 3) { //
this.currentColumnIndex = cellIndex; //
this.currentThreshold = this.thresholds[cellIndex] || ""; //
this.dialogVisible = true; //
let that = this;
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;
if (header4Index < cumulativeLength) {
header2Index = i;
break;
}
}
if (header2Index !== -1 && header3Index !== -1){
that.currentMaterialName = this.header2Obj[header2Index].name; // header2Obj
console.log('that.currentMaterialName', that.currentMaterialName, header2Index)
that.currentTestItemName = this.header3[header3Index]; // header3
console.log("--that.currentTestItemName--", this.header3, that.currentTestItemName, header3Index)
}else {
this.currentMaterialName = '';
this.currentTestItemName = '';
}
const keyName = `${that.currentMaterialName}-${that.currentTestItemName}`;
this.currentThreshold = that.thresholdobj[keyName] || 0;
console.log("-----------this.currentThreshold------", this.currentThreshold, )
this.dialogVisible = true;
},
getTableData(){
let that = this;
that.tableDatas3 = [];
that.materialTestItemMap = {};
that.header3 = [];
if(that.deptName=='原料车间'){
that.header2Obj=[{name:'辅料',lengths:3},{name:'干混生料',lengths:4}];
@ -307,10 +367,30 @@
let data = res;
let wrapArr = [];
let innerArr = [];
let update_start_time = '';
let update_end_time = '';
let ind = 0;
//1/
let header2=[],header2Obj=[],header3=[],header4=[];
if(params.month_s){
update_start_time = moment(params.year_s + '-' + params.month_s + '-01').format('YYYY-MM-DD');
update_end_time = moment(params.year_s + '-' + params.month_s + '-01').endOf('month').format('YYYY-MM-DD');
}else if(params.year_s){
update_start_time = moment(params.year_s + '-01-01').format('YYYY-MM-DD');
update_end_time = moment(params.year_s + '-12-01').endOf('month').format('YYYY-MM-DD');
}
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){//
@ -321,12 +401,15 @@
wrapArr[ind] = [];
}
if(that.deptName=='原料车间'){
wrapArr[ind].push(item)
if (item.mgroup_name=='生料工序(二次配料)'){
wrapArr[ind][0]=item
}else if(item.mgroup_name=='原料磨'){
wrapArr[ind][1]=item
}
}else if(that.deptName=='烧成车间'){
if(item.mgroup_name=='回转窑'){
wrapArr[ind][1]=item
}else{
}else if(item.mgroup_name=='煤磨'){
wrapArr[ind][0]=item
}
}else{
@ -339,12 +422,15 @@
wrapArr.forEach((item1,index1)=>{
if(item1!=undefined){//
let itemArr = [];
// _
let header2tem=[],header2Objtem=[],header3tem=[],header4tem=[];
let time =item1[0].day_s!=null? item1[0].year_s+'.'+item1[0].month_s+'.'+item1[0].day_s:item1[0].year_s+'.'+item1[0].month_s;
itemArr.push(time)
//
item1.forEach(item2=>{
let data2 =item2.qua_data;
// console.log("-----data2-----", data2)
//
data2.forEach((item3,index3)=>{
//item3
@ -356,6 +442,7 @@
header2Objtem.push({name:item3.material_name,lengths:1})
}
header3tem.push(item3.testitem_name)
header4tem.push('平均值')
header4tem.push('检次')
header4tem.push('合次')
@ -369,7 +456,6 @@
}else{
itemArr[ind] = 0;
}
// itemArr[ind] = (item3.val_avg).toFixed(2);
itemArr.push(item3.num_test)
itemArr.push(item3.num_ok)
let pass = 0;
@ -380,8 +466,9 @@
pass = Number(item3.rate_pass).toFixed(2) + '%';
itemArr.push(pass)
}
// pass= pass+'%';
if(!that.thresholdobj[item3.material_name+"-"+item3.testitem_name]){
that.thresholdobj[item3.material_name+"-"+item3.testitem_name] = item3.rate_g;
}
}else{
itemArr.push(Number(item3.val_avg).toFixed(2));
@ -389,6 +476,9 @@
itemArr.push(item3.num_ok)
let pass = Number(item3.rate_pass).toFixed(2);
pass= pass+'%';
if(!that.thresholdobj[item3.material_name+"-"+item3.testitem_name]){
that.thresholdobj[item3.material_name+"-"+item3.testitem_name] = item3.rate_g;
}
itemArr.push(pass)
}
that.titleLength =itemArr.length;

View File

@ -691,7 +691,6 @@ export default {
let form = this.$TOOL.data.get("sflogItem");
this.form = JSON.parse(form);
console.log('----------------',this.form);
this.querystlog.mgroup = this.mgroupId;
this.querystlog.sflogs = this.form.id;
this.apiObjStlog = this.$API.wpm.stlog.list;
@ -903,7 +902,6 @@ export default {
},
//stlogsflogexp
stlogRowClick(row) {
console.log(row);
this.clickItem = row;
this.getSflogexp(row.id);
},

View File

@ -1164,7 +1164,7 @@ export default {
);
that.tableDatas[6][5] =
data1.production_cost_unit;
that.tableDatas[6][9] = precen(
that.tableDatas[6][9] = consume_precen(
(that.tableDatas[6][8] - that.tableDatas[6][5]),
that.tableDatas[6][8]
);