feat: 修改质量报表
This commit is contained in:
parent
ae3e6aa1ec
commit
56334fc718
|
@ -34,6 +34,7 @@
|
||||||
"html2canvas": "^1.4.1",
|
"html2canvas": "^1.4.1",
|
||||||
"json-editor-vue3": "^1.0.6",
|
"json-editor-vue3": "^1.0.6",
|
||||||
"jspdf": "^2.5.1",
|
"jspdf": "^2.5.1",
|
||||||
|
"moment": "^2.30.1",
|
||||||
"node-polyfill-webpack-plugin": "^4.0.0",
|
"node-polyfill-webpack-plugin": "^4.0.0",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"print-js": "^1.6.0",
|
"print-js": "^1.6.0",
|
||||||
|
|
|
@ -26,6 +26,13 @@ export default {
|
||||||
return await http.post(this.url, data);
|
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: {
|
getTestItem: {
|
||||||
url: `${config.API_URL}/qm/testitem/`,
|
url: `${config.API_URL}/qm/testitem/`,
|
||||||
|
|
|
@ -101,13 +101,13 @@
|
||||||
width="120"
|
width="120"
|
||||||
>
|
>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<!-- <el-table-column
|
||||||
label="合计"
|
label="合计"
|
||||||
prop="sum"
|
prop="sum"
|
||||||
width="130"
|
width="130"
|
||||||
fixed="right"
|
fixed="right"
|
||||||
>
|
>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-table
|
<el-table
|
||||||
v-if="query.type==1"
|
v-if="query.type==1"
|
||||||
|
@ -116,7 +116,7 @@
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
border
|
border
|
||||||
:height="tableHeight"
|
:height="tableHeight"
|
||||||
@cell-click="handleCellClick1"
|
|
||||||
>
|
>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="分类"
|
label="分类"
|
||||||
|
@ -135,13 +135,13 @@
|
||||||
width="120"
|
width="120"
|
||||||
>
|
>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<!-- <el-table-column
|
||||||
label="合计"
|
label="合计"
|
||||||
prop="sum"
|
prop="sum"
|
||||||
width="130"
|
width="130"
|
||||||
fixed="right"
|
fixed="right"
|
||||||
>
|
>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-table
|
<el-table
|
||||||
v-if="query.type==2"
|
v-if="query.type==2"
|
||||||
|
@ -150,7 +150,7 @@
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
border
|
border
|
||||||
:height="tableHeight"
|
:height="tableHeight"
|
||||||
@cell-click="handleCellClick_month"
|
|
||||||
>
|
>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="分类"
|
label="分类"
|
||||||
|
@ -169,13 +169,13 @@
|
||||||
width="120"
|
width="120"
|
||||||
>
|
>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<!-- <el-table-column
|
||||||
label="合计"
|
label="合计"
|
||||||
prop="sum"
|
prop="sum"
|
||||||
width="130"
|
width="130"
|
||||||
fixed="right"
|
fixed="right"
|
||||||
>
|
>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-table
|
<el-table
|
||||||
v-if="query.type==3"
|
v-if="query.type==3"
|
||||||
|
@ -184,7 +184,7 @@
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
border
|
border
|
||||||
:height="tableHeight"
|
:height="tableHeight"
|
||||||
@cell-click="handleCellClick_range"
|
|
||||||
>
|
>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="分类"
|
label="分类"
|
||||||
|
@ -242,9 +242,49 @@
|
||||||
<script>
|
<script>
|
||||||
let legend = {
|
let legend = {
|
||||||
top: "2%",
|
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";
|
import scEcharts from "@/components/scEcharts";
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
@ -278,7 +318,6 @@ export default {
|
||||||
{id:0,name:'日统计'},
|
{id:0,name:'日统计'},
|
||||||
{id:1,name:'月统计'},
|
{id:1,name:'月统计'},
|
||||||
{id:2,name:'年统计'},
|
{id:2,name:'年统计'},
|
||||||
{id:3,name:'时间段'},
|
|
||||||
],
|
],
|
||||||
tableDatas2: [],
|
tableDatas2: [],
|
||||||
tableDatas_day:[],
|
tableDatas_day:[],
|
||||||
|
@ -389,13 +428,14 @@ export default {
|
||||||
xAxisData_month: [],
|
xAxisData_month: [],
|
||||||
xTtimeRange: [],
|
xTtimeRange: [],
|
||||||
gyhourlyData : [],
|
gyhourlyData : [],
|
||||||
lvhourlyData : [],
|
mpointList_code:"3750125939653558272,3759456603624382464,3636975194725527552",
|
||||||
|
StrengthData : [],
|
||||||
shhourlyData : [], // 用于存储每小时的数据
|
shhourlyData : [], // 用于存储每小时的数据
|
||||||
gyhourlyData_month : [],
|
gyhourlyData_month : [],
|
||||||
lvhourlyData_month : [],
|
StrengthData_month : [],
|
||||||
shhourlyData_month : [], // 用于存储每小时的数据
|
ProductionData_month : [], // 用于存储每小时的数据
|
||||||
gyhourlyData_year : [],
|
gyhourlyData_year : [],
|
||||||
lvhourlyData_year : [],
|
StrengthData_year : [],
|
||||||
shhourlyData_year : [], // 用于存储每小时的数据
|
shhourlyData_year : [], // 用于存储每小时的数据
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -450,10 +490,10 @@ export default {
|
||||||
},
|
},
|
||||||
changeDate(){
|
changeDate(){
|
||||||
let obj = {};
|
let obj = {};
|
||||||
obj.type = "day";
|
obj.type = "hour";
|
||||||
obj.start_time = this.daterange[0];
|
obj.start_time = this.daterange[0];
|
||||||
obj.end_time = this.daterange[1];
|
obj.end_time = this.daterange[1];
|
||||||
obj.mpoint__in = "3750125939653558272";
|
obj.mpoint__in = '3750125939653558272,3759456603624382464';
|
||||||
obj.page = 0;
|
obj.page = 0;
|
||||||
this.$API.enm.mpointstat.groupValues.req(obj).then((res) => {
|
this.$API.enm.mpointstat.groupValues.req(obj).then((res) => {
|
||||||
//处理res数组中的 total_val 字段 保留两位
|
//处理res数组中的 total_val 字段 保留两位
|
||||||
|
@ -501,7 +541,7 @@ export default {
|
||||||
// enabled: 1,
|
// enabled: 1,
|
||||||
// need_display: 1,
|
// need_display: 1,
|
||||||
ordering: "report_sortstr",
|
ordering: "report_sortstr",
|
||||||
code__in: "tpfl",
|
code__in: "tanpfqd, tpfl",
|
||||||
query: "{ id, name, nickname, mgroup_name, unit, report_sortstr }",
|
query: "{ id, name, nickname, mgroup_name, unit, report_sortstr }",
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
@ -518,6 +558,7 @@ export default {
|
||||||
_nameLength = [],
|
_nameLength = [],
|
||||||
indexList = [];
|
indexList = [];
|
||||||
let mgroupObj = {};
|
let mgroupObj = {};
|
||||||
|
console.log(that.mpointList);
|
||||||
that.mpointList.forEach((item, index) => {
|
that.mpointList.forEach((item, index) => {
|
||||||
let indexs = _mgroup.indexOf(item.mgroup_name);
|
let indexs = _mgroup.indexOf(item.mgroup_name);
|
||||||
if (indexs > -1) {
|
if (indexs > -1) {
|
||||||
|
@ -551,12 +592,14 @@ export default {
|
||||||
that.tableDatas2.push(obj);
|
that.tableDatas2.push(obj);
|
||||||
that.getData(item.id, index);
|
that.getData(item.id, index);
|
||||||
});
|
});
|
||||||
that.updateChart(that.gyhourlyData, that.shhourlyData, that.lvhourlyData);
|
that.updateChart(that.gyhourlyData, that.StrengthData);
|
||||||
that.mgroupObj = mgroupObj;
|
that.mgroupObj = mgroupObj;
|
||||||
that.indexList = indexList;
|
that.indexList = indexList;
|
||||||
},
|
},
|
||||||
getData(id, index) {
|
getData(id, index) {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
that.StrengthData = [];
|
||||||
|
that.gyhourlyData = [];
|
||||||
let obj = {};
|
let obj = {};
|
||||||
obj.type = "hour";
|
obj.type = "hour";
|
||||||
obj.year = that.year;
|
obj.year = that.year;
|
||||||
|
@ -574,6 +617,10 @@ export default {
|
||||||
that.tableDatas2[index][keyName] = item.val;
|
that.tableDatas2[index][keyName] = item.val;
|
||||||
if (item.mpoint_nickname == "碳排放量"){
|
if (item.mpoint_nickname == "碳排放量"){
|
||||||
that.gyhourlyData[item.hour] = item.val;
|
that.gyhourlyData[item.hour] = item.val;
|
||||||
|
}else if(
|
||||||
|
item.mpoint_nickname == "碳排放强度"
|
||||||
|
){
|
||||||
|
that.StrengthData[item.hour] = item.val;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sum = sum * 100;
|
sum = sum * 100;
|
||||||
|
@ -585,11 +632,12 @@ export default {
|
||||||
that.$forceUpdate();
|
that.$forceUpdate();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateChart(gyhourlyData, shhourlyData, lvhourlyData) {
|
updateChart(gyhourlyData, StrengthData) {
|
||||||
let that = this;
|
let that = this;
|
||||||
// 创建 ECharts 配置
|
// 创建 ECharts 配置
|
||||||
let option = {
|
let option = {
|
||||||
legend: legend,
|
legend: legend,
|
||||||
|
grid: grid,
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
axisPointer: {
|
axisPointer: {
|
||||||
|
@ -600,80 +648,84 @@ export default {
|
||||||
type: 'category',
|
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时'],
|
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: {
|
yAxis: yAxis,
|
||||||
type: 'value',
|
|
||||||
name: ''
|
|
||||||
},
|
|
||||||
series: [{
|
series: [{
|
||||||
name: '碳排放量(t)', // 此处修改为对应分类的名称
|
name: '碳排放量(t)', // 此处修改为对应分类的名称
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: gyhourlyData, // 每小时的用水量
|
data: gyhourlyData,
|
||||||
|
yAxisIndex: 0,
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#518A3A',
|
color: '#518A3A',
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: '碳排放强度(t/t)',
|
||||||
|
type: 'bar',
|
||||||
|
data: StrengthData,
|
||||||
|
yAxisIndex: 1,
|
||||||
|
itemStyle: {
|
||||||
|
color: colors[1],
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
that.optionHour = option;
|
that.optionHour = option;
|
||||||
},
|
},
|
||||||
dataLoop1() {
|
dataLoop1() {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.tableDatas = [];
|
that.tableDatas = [];
|
||||||
that.tableDatas_day = [];
|
that.tableDatas_day = [];
|
||||||
let _mgroup = [],
|
let _mgroup = [], _nameLength = [], indexList = [];
|
||||||
_nameLength = [],
|
let mgroupObj = {};
|
||||||
indexList = [];
|
that.mpointList.forEach((item, index) => {
|
||||||
let mgroupObj = {};
|
let indexs = _mgroup.indexOf(item.mgroup_name);
|
||||||
that.mpointList.forEach((item, index) => {
|
if (indexs > -1) {
|
||||||
let indexs = _mgroup.indexOf(item.mgroup_name);
|
_nameLength[indexs] += 1;
|
||||||
if (indexs > -1) {
|
} else {
|
||||||
_nameLength[indexs] += 1;
|
_mgroup.push(item.mgroup_name);
|
||||||
} else {
|
_nameLength.push(1);
|
||||||
_mgroup.push(item.mgroup_name);
|
indexList.push(index);
|
||||||
_nameLength.push(1);
|
}
|
||||||
indexList.push(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < _mgroup.length; i++) {
|
for (let i = 0; i < _mgroup.length; i++) {
|
||||||
mgroupObj[_mgroup[i]] = _nameLength[i];
|
mgroupObj[_mgroup[i]] = _nameLength[i];
|
||||||
}
|
}
|
||||||
let arr = [];
|
|
||||||
arr[0] =
|
let arr = [];
|
||||||
item.mgroup_name != null
|
arr[0] = item.mgroup_name != null ? item.mgroup_name : item.nickname != null ? item.nickname : item.name;
|
||||||
? item.mgroup_name
|
arr[1] = item.nickname != null ? item.nickname : item.name;
|
||||||
: item.nickname != null
|
arr[2] = item.unit;
|
||||||
? item.nickname
|
for (let i = 0; i < that.days; i++) {
|
||||||
: item.name;
|
arr[i + 2] = 0;
|
||||||
arr[1] = item.nickname != null ? item.nickname : item.name;
|
}
|
||||||
arr[2] = item.unit;
|
|
||||||
for (let i = 0; i < that.days; i++) {
|
that.tableDatas.push(arr);
|
||||||
arr[i + 2] = 0;
|
let obj = {};
|
||||||
}
|
obj.mgroupName = item.mgroup_name != null ? item.mgroup_name : item.name;
|
||||||
that.tableDatas.push(arr);
|
obj.nickname = item.nickname != null && item.nickname != "" ? item.nickname : item.name;
|
||||||
let obj = {};
|
obj.unit = item.unit;
|
||||||
obj.mgroupName =
|
|
||||||
item.mgroup_name != null ? item.mgroup_name : item.name;
|
that.tableDatas_day.push(obj);
|
||||||
obj.nickname =
|
|
||||||
item.nickname != null && item.nickname != ""
|
// 在每次循环调用 getData1(index),确保异步操作独立
|
||||||
? item.nickname
|
that.getData1(index);
|
||||||
: item.name;
|
});
|
||||||
obj.unit = item.unit;
|
|
||||||
|
that.updateMonthChart(that.gyhourlyData_month, that.StrengthData_month, that.ProductionData_month);
|
||||||
|
that.mgroupObj = mgroupObj;
|
||||||
|
that.indexList = indexList;
|
||||||
|
},
|
||||||
|
|
||||||
that.tableDatas_day.push(obj);
|
|
||||||
that.getData1(item.id, index);
|
|
||||||
});
|
|
||||||
that.updateMonthChart(that.gyhourlyData_month);
|
|
||||||
that.mgroupObj = mgroupObj;
|
|
||||||
that.indexList = indexList;
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
updateMonthChart(gyhourlyData) {
|
updateMonthChart(gyhourlyData, StrengthData, ) {
|
||||||
let that = this;
|
let that = this;
|
||||||
// 创建 ECharts 配置
|
// 创建 ECharts 配置
|
||||||
let option1 = {
|
let option1 = {
|
||||||
legend: legend,
|
legend: legend,
|
||||||
|
grid: grid,
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
axisPointer: {
|
axisPointer: {
|
||||||
|
@ -684,55 +736,90 @@ export default {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data: [],
|
data: [],
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: yAxis,
|
||||||
type: 'value',
|
|
||||||
name: ''
|
|
||||||
},
|
|
||||||
series: [{
|
series: [{
|
||||||
name: '碳排放量(t)', // 此处修改为对应分类的名称
|
name: '碳排放量(t)',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: gyhourlyData, // 每小时的用水量
|
data: gyhourlyData,
|
||||||
|
yAxisIndex: 0,
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#518A3A',
|
color: '#518A3A',
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: '碳排放强度(t/t)',
|
||||||
|
type: 'bar',
|
||||||
|
data: StrengthData,
|
||||||
|
yAxisIndex: 1,
|
||||||
|
itemStyle: {
|
||||||
|
color: colors[1],
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
option1.xAxis.data = that.xAxisData_day;
|
option1.xAxis.data = that.xAxisData_day;
|
||||||
that.optionDay = option1;
|
that.optionDay = option1;
|
||||||
},
|
},
|
||||||
getData1(id, index) {
|
getData1(index) {
|
||||||
let that = this;
|
let that = this;
|
||||||
let obj = {};
|
that.StrengthData_month = [];
|
||||||
obj.type = "day";
|
that.gyhourlyData_month = [];
|
||||||
obj.year = that.year;
|
let carbonEmission = []; // 存储每一天的碳排放量
|
||||||
obj.month = that.month;
|
let outputKiln = []; // 存储每一天的出窑熟料产量
|
||||||
obj.mpoint = id;
|
let emissionIntensity = []; // 存储每一天的碳排放强度
|
||||||
obj.page = 0;
|
let obj = {};
|
||||||
this.$API.enm.mpoint.stat.req(obj).then((res) => {
|
obj.type = "day";
|
||||||
let sum = 0;
|
obj.year = that.year;
|
||||||
res.forEach((item) => {
|
obj.month = that.month;
|
||||||
let ind = item.day+2;
|
obj.mpoint__in = this.mpointList_code;
|
||||||
that.tableDatas[index][ind] = item.val;
|
obj.page = 0;
|
||||||
sum += Number(item.val);
|
|
||||||
let keyName = item.day + "日";
|
this.$API.enm.mpoint.stat.req(obj).then((res) => {
|
||||||
that.tableDatas_day[index][keyName] = item.val;
|
let sum = 0;
|
||||||
if (item.mpoint_nickname == "碳排放量"){
|
res.forEach((item) => {
|
||||||
that.gyhourlyData_month[item.day-1] = item.val;
|
let ind = item.day + 2;
|
||||||
}
|
that.tableDatas[index][ind] = item.val;
|
||||||
});
|
sum += Number(item.val);
|
||||||
sum = sum * 100;
|
if (item.mpoint_nickname === "碳排放量") {
|
||||||
sum = Math.round(sum);
|
carbonEmission[item.day - 1] = item.val; // 存储每日的碳排放量
|
||||||
sum = sum / 100;
|
} else if (item.mpoint_nickname === "出窑熟料产量") {
|
||||||
let dayss = 0;
|
outputKiln[item.day - 1] = item.val; // 存储每日的出窑熟料产量
|
||||||
dayss = this.days + 3;
|
}
|
||||||
that.tableDatas[index][dayss] = sum.toFixed(2);
|
if(item.mpoint_nickname == "碳排放强度"){
|
||||||
that.tableDatas_day[index].sum = sum.toFixed(2);
|
return;
|
||||||
that.$forceUpdate();
|
}
|
||||||
});
|
// 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() {
|
dataLoop_month() {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.tableDatas = [];
|
that.tableDatas = [];
|
||||||
|
@ -772,16 +859,17 @@ export default {
|
||||||
: item.name;
|
: item.name;
|
||||||
obj.unit = item.unit;
|
obj.unit = item.unit;
|
||||||
that.tableDatas_month.push(obj);
|
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.mgroupObj = mgroupObj;
|
||||||
that.indexList = indexList;
|
that.indexList = indexList;
|
||||||
},
|
},
|
||||||
updateMonthChart_month(gyhourlyData) {
|
updateMonthChart_month(gyhourlyData_year, StrengthData_year) {
|
||||||
let that = this;
|
let that = this;
|
||||||
let option2 = {
|
let option2 = {
|
||||||
legend: legend,
|
legend: legend,
|
||||||
|
grid: grid,
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
axisPointer: {
|
axisPointer: {
|
||||||
|
@ -792,30 +880,42 @@ export default {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data: [],
|
data: [],
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: yAxis,
|
||||||
type: 'value',
|
|
||||||
name: ''
|
|
||||||
},
|
|
||||||
series: [{
|
series: [{
|
||||||
name: '工业水', // 此处修改为对应分类的名称
|
name: '碳排放量(t)',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: gyhourlyData, // 每小时的用水量
|
data: gyhourlyData_year,
|
||||||
|
yAxisIndex: 0,
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#518A3A',
|
color: '#518A3A',
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '碳排放强度(t/t)',
|
||||||
|
type: 'bar',
|
||||||
|
data: StrengthData_year,
|
||||||
|
yAxisIndex: 1,
|
||||||
|
itemStyle: {
|
||||||
|
color: colors[1],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
option2.xAxis.data = that.xAxisData_month;
|
option2.xAxis.data = that.xAxisData_month;
|
||||||
that.optionMonth = option2;
|
that.optionMonth = option2;
|
||||||
},
|
},
|
||||||
getData_month(id, index) {
|
getData_month(index) {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
that.StrengthData_year = [];
|
||||||
|
that.gyhourlyData_year = [];
|
||||||
|
let carbonEmission = []; // 存储每一天的碳排放量
|
||||||
|
let outputKiln = []; // 存储每一天的出窑熟料产量
|
||||||
|
let emissionIntensity = []; // 存储每一天的碳排放强度
|
||||||
let obj = {};
|
let obj = {};
|
||||||
obj.type = "month";
|
obj.type = "month";
|
||||||
obj.year = that.year;
|
obj.year = that.year;
|
||||||
obj.mpoint = id;
|
obj.mpoint__in = that.mpointList_code;
|
||||||
obj.page = 0;
|
obj.page = 0;
|
||||||
this.$API.enm.mpoint.stat.req(obj).then((res) => {
|
this.$API.enm.mpoint.stat.req(obj).then((res) => {
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
|
@ -824,11 +924,34 @@ export default {
|
||||||
that.tableDatas[index][ind] = item.val;
|
that.tableDatas[index][ind] = item.val;
|
||||||
sum += Number(item.val);
|
sum += Number(item.val);
|
||||||
let keyName = item.month + "月";
|
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 == "碳排放量"){
|
if (item.mpoint_nickname == "碳排放量"){
|
||||||
that.gyhourlyData_year[item.month-1] = item.val;
|
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 = sum * 100;
|
||||||
sum = Math.round(sum);
|
sum = Math.round(sum);
|
||||||
sum = sum / 100;
|
sum = sum / 100;
|
||||||
|
@ -853,9 +976,10 @@ export default {
|
||||||
handleCellClick1(row, column, cell, event) {
|
handleCellClick1(row, column, cell, event) {
|
||||||
let that = this;
|
let that = this;
|
||||||
let index = that.tableDatas_day.indexOf(row);
|
let index = that.tableDatas_day.indexOf(row);
|
||||||
console.log('row', row)
|
console.log("row", row, that.tableDatas_day, index);
|
||||||
that.tableName = `${row.nickname}-电量日统计`
|
that.tableName = `${row.nickname}`
|
||||||
let lineData = that.tableDatas[index].slice(3, that.days + 3);
|
console.log("tableDatas", that.tableDatas);
|
||||||
|
let lineData = that.tableDatas_day[index].slice(2, 13);
|
||||||
that.option.xAxis.data = that.xAxisData_day;
|
that.option.xAxis.data = that.xAxisData_day;
|
||||||
that.option.series[0].data = lineData;
|
that.option.series[0].data = lineData;
|
||||||
this.itemVisible = true;
|
this.itemVisible = true;
|
||||||
|
@ -863,7 +987,7 @@ export default {
|
||||||
handleCellClick_month(row, column, cell, event) {
|
handleCellClick_month(row, column, cell, event) {
|
||||||
let that = this;
|
let that = this;
|
||||||
let index = that.tableDatas_month.indexOf(row);
|
let index = that.tableDatas_month.indexOf(row);
|
||||||
that.tableName = `${row.nickname}-电量日统计`
|
that.tableName = `${row.nickname}`
|
||||||
//获取图数据
|
//获取图数据
|
||||||
let lineData = that.tableDatas[index].slice(2, 13);
|
let lineData = that.tableDatas[index].slice(2, 13);
|
||||||
that.option.xAxis.data = that.xAxisData_month;
|
that.option.xAxis.data = that.xAxisData_month;
|
||||||
|
|
|
@ -338,6 +338,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
const colors = ["#5b9bd5", "#ed7d31", "#70ad47", "#ffc000", "#5f6694", "#cb9bff", "#7DDA58"];
|
const colors = ["#5b9bd5", "#ed7d31", "#70ad47", "#ffc000", "#5f6694", "#cb9bff", "#7DDA58"];
|
||||||
|
const colors_hour = ["#5b9bd5", "#ffc000", "#5f6694", "#cb9bff", "#7DDA58"];
|
||||||
// 产量/台时/运转率/分布电耗/单位产品标煤耗/成本
|
// 产量/台时/运转率/分布电耗/单位产品标煤耗/成本
|
||||||
let tooltip = {
|
let tooltip = {
|
||||||
show: true,
|
show: true,
|
||||||
|
@ -723,7 +724,7 @@ export default {
|
||||||
{id:2,name:'年统计'}
|
{id:2,name:'年统计'}
|
||||||
],
|
],
|
||||||
option1: {
|
option1: {
|
||||||
color: colors,
|
color: colors_hour,
|
||||||
tooltip: tooltip,
|
tooltip: tooltip,
|
||||||
grid: grid,
|
grid: grid,
|
||||||
toolbox: toolbox,
|
toolbox: toolbox,
|
||||||
|
|
|
@ -290,7 +290,8 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<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 = {
|
let tooltip = {
|
||||||
show: true,
|
show: true,
|
||||||
trigger: "axis",
|
trigger: "axis",
|
||||||
|
@ -337,7 +338,7 @@ let yAxis = [
|
||||||
axisLine: {
|
axisLine: {
|
||||||
show: true,
|
show: true,
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
color: colors[0],
|
color: colors[7],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
|
@ -353,7 +354,7 @@ let yAxis = [
|
||||||
axisLine: {
|
axisLine: {
|
||||||
show: true,
|
show: true,
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
color: colors[1],
|
color: colors[8],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
|
@ -478,12 +479,18 @@ export default {
|
||||||
yAxisIndex: 0,
|
yAxisIndex: 0,
|
||||||
data: [],
|
data: [],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "分布电耗",
|
||||||
|
type: "bar",
|
||||||
|
yAxisIndex: 1,
|
||||||
|
data: [],
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
option2: {
|
option2: {
|
||||||
color: colors,
|
color: colors1,
|
||||||
tooltip: tooltip,
|
tooltip: tooltip,
|
||||||
legend: Object.assign(legend, {data:["袋装合计", "散装合计", "熟料出厂合计", "出厂水泥合计", "复合水泥合计", "分布电耗目标值","分布电耗"]}),
|
legend: Object.assign(legend, {data:["袋装合计", "散装合计", "熟料出厂合计", "出厂水泥合计", "复合水泥合计", "分布电耗目标值","分布电耗"]}),
|
||||||
grid: grid,
|
grid: grid,
|
||||||
|
@ -550,7 +557,7 @@ export default {
|
||||||
{
|
{
|
||||||
name: "分布电耗",
|
name: "分布电耗",
|
||||||
type: "bar",
|
type: "bar",
|
||||||
yAxisIndex: 0,
|
yAxisIndex: 1,
|
||||||
data: [],
|
data: [],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -878,7 +885,8 @@ export default {
|
||||||
seriesData2 = [],
|
seriesData2 = [],
|
||||||
seriesData3 = [],
|
seriesData3 = [],
|
||||||
seriesData4 = [],
|
seriesData4 = [],
|
||||||
seriesData5 = [];
|
seriesData5 = [],
|
||||||
|
seriesData6 = [];
|
||||||
let data = response;
|
let data = response;
|
||||||
data.forEach((item) => {
|
data.forEach((item) => {
|
||||||
let ind = item.day_s - 1;
|
let ind = item.day_s - 1;
|
||||||
|
@ -892,6 +900,8 @@ export default {
|
||||||
seriesData4[ind] = item.val;
|
seriesData4[ind] = item.val;
|
||||||
}else if (item.mpoint_name == "复合水泥合计" || item.mpoint_name == "复合硅酸盐水泥;42.5R;袋装水泥") {
|
}else if (item.mpoint_name == "复合水泥合计" || item.mpoint_name == "复合硅酸盐水泥;42.5R;袋装水泥") {
|
||||||
seriesData5[ind] = item.val;
|
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[2].data = seriesData3;
|
||||||
options.series[3].data = seriesData4;
|
options.series[3].data = seriesData4;
|
||||||
options.series[4].data = seriesData5;
|
options.series[4].data = seriesData5;
|
||||||
|
options.series[5].data = seriesData6;
|
||||||
let dayXAxis = [];
|
let dayXAxis = [];
|
||||||
for (let i = 1; i <= that.days; i++) {
|
for (let i = 1; i <= that.days; i++) {
|
||||||
let item = i + "日";
|
let item = i + "日";
|
||||||
|
|
|
@ -70,16 +70,6 @@
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-card style="margin-top:5px">
|
<el-card style="margin-top:5px">
|
||||||
<div class="tableContainer">
|
<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">
|
<table border="1" cellspacing="0" :key="timeStamp" id="myTable" class="myTable">
|
||||||
<thead class="myTableHead">
|
<thead class="myTableHead">
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -128,6 +118,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import moment from 'moment';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -144,8 +135,7 @@
|
||||||
],
|
],
|
||||||
titleLength:1,
|
titleLength:1,
|
||||||
mgroupOptions:[],
|
mgroupOptions:[],
|
||||||
threshold: 80, // 数值类型的阈值
|
currentThreshold: null, // 当前编辑的阈值
|
||||||
currentThreshold: "80%", // 当前编辑的阈值
|
|
||||||
tableTime:'',
|
tableTime:'',
|
||||||
deptName:'',
|
deptName:'',
|
||||||
typeName:'质检日报表',
|
typeName:'质检日报表',
|
||||||
|
@ -183,6 +173,12 @@
|
||||||
dialogVisible: false, // 控制对话框显示
|
dialogVisible: false, // 控制对话框显示
|
||||||
currentColumnIndex: null, // 当前编辑的列索引
|
currentColumnIndex: null, // 当前编辑的列索引
|
||||||
thresholds: {}, // 存储每列的阈值,key 为列索引
|
thresholds: {}, // 存储每列的阈值,key 为列索引
|
||||||
|
thresholdobj:{},
|
||||||
|
materialTestItemMap:{},
|
||||||
|
currentMaterialNameClass: '',
|
||||||
|
currentMaterialName: '', // 当前物料名称
|
||||||
|
currentTestItemName: '', // 当前检测项名称
|
||||||
|
currentTestItemNameClass: '', // 当前检测项名称
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -217,14 +213,33 @@
|
||||||
that.tableName = that.deptName+that.typeName;
|
that.tableName = that.deptName+that.typeName;
|
||||||
},
|
},
|
||||||
updateThreshold() {
|
updateThreshold() {
|
||||||
const num = parseFloat(this.currentThreshold.replace("%", ""));
|
const num = parseFloat(this.currentThreshold);
|
||||||
if (!isNaN(num)) {
|
if (!isNaN(num)){
|
||||||
// 保存阈值
|
const key = `${this.currentMaterialName}-${this.currentTestItemName}`;
|
||||||
this.thresholds[this.currentColumnIndex] = num;
|
console.log("---------------key", key, this.materialTestItemMap)
|
||||||
this.dialogVisible = false; // 关闭对话框
|
const mapEntry = this.materialTestItemMap[key];
|
||||||
} else {
|
if (!mapEntry) {
|
||||||
this.$message.error("请输入有效的阈值,例如:80%");
|
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() {
|
resetDialog() {
|
||||||
|
@ -233,15 +248,38 @@
|
||||||
},
|
},
|
||||||
// 动态样式计算
|
// 动态样式计算
|
||||||
getCellClass(cell, cellIndex) {
|
getCellClass(cell, cellIndex) {
|
||||||
if (cellIndex > 0 && ((cellIndex - 1) % 4 === 3)) {
|
let that = this;
|
||||||
|
if (typeof cell === 'string' && cell.includes('%')) {
|
||||||
// 假设合格率在每组数据的第四列
|
// 假设合格率在每组数据的第四列
|
||||||
const cellValue = String(cell);
|
const cellValue = String(cell);
|
||||||
const value = parseFloat(cellValue.replace("%", ""));
|
const value = parseFloat(cellValue.replace("%", ""));
|
||||||
const threshold = this.thresholds[cellIndex] || 0; // 获取对应列的阈值
|
this.currentColumnIndex = cellIndex;
|
||||||
if (!isNaN(value)) {
|
const header4Index = cellIndex - 1; // 假设第 0 列是日期列
|
||||||
return value > threshold ? "green-text" : "red-text";
|
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 "";
|
return "";
|
||||||
},
|
},
|
||||||
deptChange(e){
|
deptChange(e){
|
||||||
|
@ -264,16 +302,38 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleCellClick(cell, rowIndex, cellIndex){
|
handleCellClick(cell, rowIndex, cellIndex){
|
||||||
if ((cellIndex - 1) % 4 === 3) { //合格率列
|
let that = this;
|
||||||
this.currentColumnIndex = cellIndex; // 记录列索引
|
this.currentColumnIndex = cellIndex;
|
||||||
this.currentThreshold = this.thresholds[cellIndex] || ""; // 获取当前阈值
|
const header4Index = cellIndex - 1 ; // 假设第 0 列是日期列
|
||||||
this.dialogVisible = true; // 显示对话框
|
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(){
|
getTableData(){
|
||||||
let that = this;
|
let that = this;
|
||||||
that.tableDatas3 = [];
|
that.tableDatas3 = [];
|
||||||
|
that.materialTestItemMap = {};
|
||||||
that.header3 = [];
|
that.header3 = [];
|
||||||
if(that.deptName=='原料车间'){
|
if(that.deptName=='原料车间'){
|
||||||
that.header2Obj=[{name:'辅料',lengths:3},{name:'干混生料',lengths:4}];
|
that.header2Obj=[{name:'辅料',lengths:3},{name:'干混生料',lengths:4}];
|
||||||
|
@ -307,10 +367,30 @@
|
||||||
let data = res;
|
let data = res;
|
||||||
let wrapArr = [];
|
let wrapArr = [];
|
||||||
let innerArr = [];
|
let innerArr = [];
|
||||||
|
let update_start_time = '';
|
||||||
|
let update_end_time = '';
|
||||||
let ind = 0;
|
let ind = 0;
|
||||||
//1、将相同日期或月份/年份的数据放到一组
|
//1、将相同日期或月份/年份的数据放到一组
|
||||||
let header2=[],header2Obj=[],header3=[],header4=[];
|
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 => {
|
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){//月统计
|
||||||
|
@ -321,12 +401,15 @@
|
||||||
wrapArr[ind] = [];
|
wrapArr[ind] = [];
|
||||||
}
|
}
|
||||||
if(that.deptName=='原料车间'){
|
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=='烧成车间'){
|
}else if(that.deptName=='烧成车间'){
|
||||||
if(item.mgroup_name=='回转窑'){
|
if(item.mgroup_name=='回转窑'){
|
||||||
wrapArr[ind][1]=item
|
wrapArr[ind][1]=item
|
||||||
}else{
|
}else if(item.mgroup_name=='煤磨'){
|
||||||
wrapArr[ind][0]=item
|
wrapArr[ind][0]=item
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
@ -339,12 +422,15 @@
|
||||||
wrapArr.forEach((item1,index1)=>{
|
wrapArr.forEach((item1,index1)=>{
|
||||||
if(item1!=undefined){//一天的数据
|
if(item1!=undefined){//一天的数据
|
||||||
let itemArr = [];
|
let itemArr = [];
|
||||||
|
// 物料名称_检测项为唯一标识
|
||||||
let header2tem=[],header2Objtem=[],header3tem=[],header4tem=[];
|
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;
|
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)
|
itemArr.push(time)
|
||||||
//遍历每个工段
|
//遍历每个工段
|
||||||
item1.forEach(item2=>{
|
item1.forEach(item2=>{
|
||||||
|
|
||||||
let data2 =item2.qua_data;
|
let data2 =item2.qua_data;
|
||||||
|
// console.log("-----data2-----", data2)
|
||||||
//遍历一个工段的物料检验数据
|
//遍历一个工段的物料检验数据
|
||||||
data2.forEach((item3,index3)=>{
|
data2.forEach((item3,index3)=>{
|
||||||
//item3一个检验数据
|
//item3一个检验数据
|
||||||
|
@ -356,6 +442,7 @@
|
||||||
header2Objtem.push({name:item3.material_name,lengths:1})
|
header2Objtem.push({name:item3.material_name,lengths:1})
|
||||||
}
|
}
|
||||||
header3tem.push(item3.testitem_name)
|
header3tem.push(item3.testitem_name)
|
||||||
|
|
||||||
header4tem.push('平均值')
|
header4tem.push('平均值')
|
||||||
header4tem.push('检次')
|
header4tem.push('检次')
|
||||||
header4tem.push('合次')
|
header4tem.push('合次')
|
||||||
|
@ -369,7 +456,6 @@
|
||||||
}else{
|
}else{
|
||||||
itemArr[ind] = 0;
|
itemArr[ind] = 0;
|
||||||
}
|
}
|
||||||
// itemArr[ind] = (item3.val_avg).toFixed(2);
|
|
||||||
itemArr.push(item3.num_test)
|
itemArr.push(item3.num_test)
|
||||||
itemArr.push(item3.num_ok)
|
itemArr.push(item3.num_ok)
|
||||||
let pass = 0;
|
let pass = 0;
|
||||||
|
@ -380,8 +466,9 @@
|
||||||
pass = Number(item3.rate_pass).toFixed(2) + '%';
|
pass = Number(item3.rate_pass).toFixed(2) + '%';
|
||||||
itemArr.push(pass)
|
itemArr.push(pass)
|
||||||
}
|
}
|
||||||
|
if(!that.thresholdobj[item3.material_name+"-"+item3.testitem_name]){
|
||||||
// pass= pass+'%';
|
that.thresholdobj[item3.material_name+"-"+item3.testitem_name] = item3.rate_g;
|
||||||
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
itemArr.push(Number(item3.val_avg).toFixed(2));
|
itemArr.push(Number(item3.val_avg).toFixed(2));
|
||||||
|
@ -389,6 +476,9 @@
|
||||||
itemArr.push(item3.num_ok)
|
itemArr.push(item3.num_ok)
|
||||||
let pass = Number(item3.rate_pass).toFixed(2);
|
let pass = Number(item3.rate_pass).toFixed(2);
|
||||||
pass= pass+'%';
|
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)
|
itemArr.push(pass)
|
||||||
}
|
}
|
||||||
that.titleLength =itemArr.length;
|
that.titleLength =itemArr.length;
|
||||||
|
|
|
@ -691,7 +691,6 @@ export default {
|
||||||
|
|
||||||
let form = this.$TOOL.data.get("sflogItem");
|
let form = this.$TOOL.data.get("sflogItem");
|
||||||
this.form = JSON.parse(form);
|
this.form = JSON.parse(form);
|
||||||
console.log('----------------',this.form);
|
|
||||||
this.querystlog.mgroup = this.mgroupId;
|
this.querystlog.mgroup = this.mgroupId;
|
||||||
this.querystlog.sflogs = this.form.id;
|
this.querystlog.sflogs = this.form.id;
|
||||||
this.apiObjStlog = this.$API.wpm.stlog.list;
|
this.apiObjStlog = this.$API.wpm.stlog.list;
|
||||||
|
@ -903,7 +902,6 @@ export default {
|
||||||
},
|
},
|
||||||
//点击stlog,展示sflogexp
|
//点击stlog,展示sflogexp
|
||||||
stlogRowClick(row) {
|
stlogRowClick(row) {
|
||||||
console.log(row);
|
|
||||||
this.clickItem = row;
|
this.clickItem = row;
|
||||||
this.getSflogexp(row.id);
|
this.getSflogexp(row.id);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1164,7 +1164,7 @@ export default {
|
||||||
);
|
);
|
||||||
that.tableDatas[6][5] =
|
that.tableDatas[6][5] =
|
||||||
data1.production_cost_unit;
|
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] - that.tableDatas[6][5]),
|
||||||
that.tableDatas[6][8]
|
that.tableDatas[6][8]
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue