projects/mesxc-zhp #372

Merged
juzi merged 4 commits from projects/mesxc-zhp into projects/mesxc-test 2024-04-26 09:54:08 +08:00
3 changed files with 49 additions and 37 deletions
Showing only changes of commit 317d01934b - Show all commits

View File

@ -32,11 +32,11 @@ export default {
return { return {
timestr: '', timestr: '',
config: { config: {
header: ['序号', '设备名称', '产线名', '设备状态'], header: ['序号', '产线名', '设备名称', '设备状态'],
headerBGC: 'rgba(32, 55, 96, 0.8)', headerBGC: 'rgba(32, 55, 96, 0.8)',
oddRowBGC: 'rgba(32, 55, 96, 0.8)', oddRowBGC: 'rgba(32, 55, 96, 0.8)',
evenRowBGC: 'rgba(14, 32, 62, 0.8)', evenRowBGC: 'rgba(14, 32, 62, 0.8)',
columnWidth: [60, 280, 120], columnWidth: [60, 120, 280],
align: ['center'], align: ['center'],
data: [], data: [],
// data: [ // data: [
@ -63,8 +63,8 @@ export default {
handler(newVal, oldVal) { handler(newVal, oldVal) {
let outArr = this.sjgEquipment.map((item, index) => [ let outArr = this.sjgEquipment.map((item, index) => [
index + 1, index + 1,
`<span title=${item.name || ''}>${item.name || ''}</span>`,
`<span title=${item.lineName || ''}>${item.lineName || ''}</span>`, `<span title=${item.lineName || ''}>${item.lineName || ''}</span>`,
`<span title=${item.name || ''}>${item.name || ''}</span>`,
`<span><div style="${ `<span><div style="${
item.status == '运行' item.status == '运行'
? 'box-shadow: 0px 0px 2px 1px #2760FF;width:6px;height:6px;border-radius: 50%;background-color: #2760FF;float:left;margin:13px 10px 0 0 ' ? 'box-shadow: 0px 0px 2px 1px #2760FF;width:6px;height:6px;border-radius: 50%;background-color: #2760FF;float:left;margin:13px 10px 0 0 '

View File

@ -75,7 +75,7 @@ export default {
selectOptions: [ selectOptions: [
{ id: '1', name: '当前班次' }, { id: '1', name: '当前班次' },
{ id: '2', name: '近24小时' }, { id: '2', name: '近24小时' },
{ id: '3', name: '日报' }, { id: '3', name: '昨日日报' },
], ],
defaultSelect: '1', defaultSelect: '1',
param: 'timeType', param: 'timeType',
@ -112,7 +112,7 @@ export default {
selectOptions: [ selectOptions: [
{ id: '1', name: '当前班次' }, { id: '1', name: '当前班次' },
{ id: '2', name: '近24小时' }, { id: '2', name: '近24小时' },
{ id: '3', name: '日报' }, { id: '3', name: '昨日日报' },
], ],
param: 'timeType', param: 'timeType',
clearable: false, clearable: false,
@ -196,6 +196,7 @@ export default {
this.tableProp = []; this.tableProp = [];
let timeArr = this.uniqueTime(data, 'timeStr'); let timeArr = this.uniqueTime(data, 'timeStr');
let arr = []; let arr = [];
let arr1 = [];
timeArr.map((item) => { timeArr.map((item) => {
let obj = {}; let obj = {};
obj.prop = item.timeStr; obj.prop = item.timeStr;
@ -203,7 +204,17 @@ export default {
obj.minWidth = 140; obj.minWidth = 140;
arr.push(obj); arr.push(obj);
}); });
this.tableProp = this.tableProp1.concat(arr); // let obj1 = {};
obj1.children = arr.length > 0 ? arr : [{ label: '合计' }];
obj1.label =
'24小时原片工段产量表(' +
moment(this.queryParams.startTime).format('YYYY-MM-DD HH:mm:ss') +
'-' +
moment(this.queryParams.endTime).format('YYYY-MM-DD HH:mm:ss') +
')';
arr1.push(obj1);
this.tableProp = this.tableProp1.concat(arr1); //
console.log(this.tableProp);
this.transferData(data); this.transferData(data);
}); });
}, },
@ -286,7 +297,6 @@ export default {
transferData(data) { transferData(data) {
let tempData = []; let tempData = [];
let lineNum = 0; //线 let lineNum = 0; //线
let sumArr = [];
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
if (i === 0) { if (i === 0) {
this.procedureName.map((item) => { this.procedureName.map((item) => {
@ -299,37 +309,28 @@ export default {
}); });
lineNum++; lineNum++;
} else { } else {
if (data[i].timeStr === '总计') { if (data[i].lineName === data[i - 1].lineName) {
sumArr.push(data[i]); //线,
} else { let startNum = 5 * (lineNum - 1);
if (data[i].lineName === data[i - 1].lineName) { let endNum = 5 * lineNum - 1;
//线, for (let k = startNum; k <= endNum; k++) {
let startNum = 5 * (lineNum - 1); let str = this.procedureName[k % 5];
let endNum = 5 * lineNum - 1; tempData[k][data[i].timeStr] = data[i][str.ename];
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++;
} }
} 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.tableData = tempData;
this.$nextTick(() => { this.$nextTick(() => {
@ -395,7 +396,17 @@ export default {
arr.push(obj); arr.push(obj);
}); });
arr.push({ prop: 'sum', label: '合计' }); arr.push({ prop: 'sum', label: '合计' });
this.tableProp2 = this.tableProp1.concat(arr); // let arr1 = [];
let obj1 = {};
obj1.children = arr;
obj1.label =
'24小时深加工工段产量表(' +
moment(this.queryParams2.startTime).format('YYYY-MM-DD HH:mm:ss') +
'-' +
moment(this.queryParams2.endTime).format('YYYY-MM-DD HH:mm:ss') +
')';
arr1.push(obj1);
this.tableProp2 = this.tableProp1.concat(arr1); //
this.getSpanArr(this.tableData2); this.getSpanArr(this.tableData2);
this.$nextTick(() => { this.$nextTick(() => {
this.reTable2(); this.reTable2();

View File

@ -25,7 +25,7 @@ const tableProp1 = [
{ {
prop: 'lineName', prop: 'lineName',
label: '生产线', label: '生产线',
width: 110, width: 90,
fixed: true, fixed: true,
}, },
{ {
@ -71,6 +71,7 @@ export default {
label: '产线', label: '产线',
selectOptions: [], selectOptions: [],
param: 'lineId', param: 'lineId',
multiple: true,
}, },
{ {
type: 'button', type: 'button',
@ -92,7 +93,7 @@ export default {
queryParams: { queryParams: {
startTime: '', startTime: '',
endTime: '', endTime: '',
lineId: '', lineId: [],
}, },
tableProp1, tableProp1,
tableProp: [], tableProp: [],