diff --git a/src/views/report/Environmental/sectionProduction/index.vue b/src/views/report/Environmental/sectionProduction/index.vue
index 009fabe1..34a4d83f 100644
--- a/src/views/report/Environmental/sectionProduction/index.vue
+++ b/src/views/report/Environmental/sectionProduction/index.vue
@@ -3,10 +3,11 @@
{
let data = res.data;
- let timeArr = this.uniqueTime(data, 'timeStr');
this.tableProp = [];
+ let timeArr = this.uniqueTime(data, 'timeStr');
let arr = [];
timeArr.map((item) => {
let obj = {};
@@ -200,34 +208,44 @@ export default {
});
},
getTime(val) {
+ let nowTime = moment().valueOf();
+ let dTime = moment(moment().format('YYYY-MM-DD') + ' 07:00:00').valueOf();
switch (val) {
case '1':
- let nowTime = moment().valueOf();
- let dTime = moment(
- moment().format('YYYY-MM-DD') + ' 07:00:00'
+ let fTime = moment(
+ moment(moment().valueOf() - 86400000).format('YYYY-MM-DD') +
+ ' 19:00:00'
).valueOf();
let nTime = moment(
moment().format('YYYY-MM-DD') + ' 19:00:00'
).valueOf();
- let fTime =
- moment(moment().valueOf() - 86400).format('YYYY-MM-DD') +
- ' 19:00:00';
- console.log(fTime);
- // if (nowTime >= dTime) {
- // return [dTime, nowTime]
- // }else if (){
-
- // }
+ if (nowTime <= dTime) {
+ return [fTime, nowTime];
+ } else if (nowTime > dTime && nowTime <= nTime) {
+ return [dTime, nowTime];
+ } else {
+ return [nTime, nowTime];
+ }
break;
case '2':
+ let lastTime = nowTime - 86400000;
+ return [lastTime, nowTime];
break;
default:
+ let f1Time = dTime - 86400000 * 2;
+ let f2Time = dTime - 86400000;
+ if (nowTime <= dTime) {
+ return [f1Time, f2Time];
+ } else {
+ return [f2Time, dTime];
+ }
}
},
buttonClick(val) {
if (val.btnName === 'search') {
this.queryParams.lineId = val.lineId;
- this.getTime(val.timeType);
+ this.queryParams.startTime = this.getTime(val.timeType)[0];
+ this.queryParams.endTime = this.getTime(val.timeType)[1];
this.getList();
} else {
//导出
@@ -268,39 +286,61 @@ export default {
transferData(data) {
let tempData = [];
let lineNum = 0; //第一条产线
+ let sumArr = [];
for (let i = 0; i < data.length; i++) {
if (i === 0) {
this.procedureName.map((item) => {
let obj = {};
obj.lineName = data[i].lineName;
obj.procedure = item.name;
+ obj.eName = item.ename;
obj[data[i].timeStr] = data[i][item.ename];
tempData.push(obj);
});
lineNum++;
} else {
- if (data[i].lineName === data[i - 1].lineName) {
- //相同产线,添加列
- let startNum = 5 * (lineNum - 1);
- let endNum = 5 * lineNum - 1;
- for (let k = startNum; k <= endNum; k++) {
- let str = this.procedureName[k % 5];
- tempData[k][data[i].timeStr] = data[i][str.ename];
- }
+ if (data[i].timeStr === '总计') {
+ sumArr.push(data[i]);
} else {
- //不同产线,同时添加5行
- this.procedureName.map((item) => {
- let obj = {};
- obj.lineName = data[i].lineName;
- obj.procedure = item.name;
- obj[data[i].timeStr] = data[i][item.ename];
- tempData.push(obj);
- });
- lineNum++;
+ if (data[i].lineName === data[i - 1].lineName) {
+ //相同产线,添加列
+ let startNum = 5 * (lineNum - 1);
+ let endNum = 5 * lineNum - 1;
+ for (let k = startNum; k <= endNum; k++) {
+ let str = this.procedureName[k % 5];
+ tempData[k][data[i].timeStr] = data[i][str.ename];
+ }
+ } else {
+ //不同产线,同时添加5行
+ this.procedureName.map((item) => {
+ let obj = {};
+ obj.lineName = data[i].lineName;
+ obj.procedure = item.name;
+ obj.eName = item.ename;
+ obj[data[i].timeStr] = data[i][item.ename];
+ tempData.push(obj);
+ });
+ lineNum++;
+ }
}
}
}
+ for (let j = 0; j < tempData.length; j++) {
+ sumArr.map((item) => {
+ tempData[j]['总计'] = item[tempData[j].eName];
+ });
+ }
this.tableData = tempData;
+
+ this.$nextTick(() => {
+ this.reTable1();
+ });
+ },
+ reTable1() {
+ this.$refs.sectionProductionTable11.doLayout('sectionProductionTable1');
+ },
+ reTable2() {
+ this.$refs.sectionProductionTable22.doLayout('sectionProductionTable2');
},
// 时间去重
uniqueTime(arr, prop) {
@@ -357,12 +397,17 @@ export default {
arr.push({ prop: 'sum', label: '合计' });
this.tableProp2 = this.tableProp1.concat(arr); //表头
this.getSpanArr(this.tableData2);
+ this.$nextTick(() => {
+ this.reTable2();
+ });
});
},
// 表格2
buttonClick2(val) {
if (val.btnName === 'search') {
this.queryParams2.lineId = val.lineId;
+ this.queryParams2.startTime = this.getTime(val.timeType)[0];
+ this.queryParams2.endTime = this.getTime(val.timeType)[1];
this.getList2();
} else {
this.exportTable('.sectionProductionTable2', '深加工工段数据.xlsx', 1);
diff --git a/src/views/report/qcReport/israLineReport/index.vue b/src/views/report/qcReport/israLineReport/index.vue
index 76271d58..c9d898b9 100644
--- a/src/views/report/qcReport/israLineReport/index.vue
+++ b/src/views/report/qcReport/israLineReport/index.vue
@@ -3,10 +3,11 @@
{
+ this.reTable();
+ });
+ },
+ reTable() {
+ this.$refs.israLineReportTable11.doLayout('israLineReportTable1');
},
// 产线去重
uniqueLine(arr, prop) {