在制金属数量帆软js代码:
var rowList =$.data;
var table = [];
var column = ["纵坐标","铸轧卷待开坯卷数","铸轧卷待开坯重量","待冷轧1卷数","待冷轧1重量","冷轧1中卷数","冷轧1中重量","待冷轧2卷数","待冷轧2重量","冷轧2中卷数","冷轧2中重量","待冷轧3卷数","待冷轧3重量","冷轧3中卷数","冷轧3中重量","待退火1卷数","待退火1重量","退火1中卷数","退火1中重量","待退火2卷数","待退火2重量","退火2中卷数","退火2中重量","待重卷卷数","待重卷重量","重卷中卷数","重卷中重量"];
var str1 = {};
var str2 = {};
var str3 = {};
var str4 = {};
var row1 = ['双零箔坯'];
var row2 = ['单零箔坯'];
var row3 = ['冷轧卷1'];
var row4 = ['冷轧卷2'];
rowList.map(item=>{
if (item.y == "双零箔坯") {
str1[item.x] = { value: item.value };
}
if (item.y == "单零箔坯") {
str2[item.x] = { value: item.value };
}
if (item.y == "冷轧卷1") {
str3[item.x] = { value: item.value };
}
if (item.y == "冷轧卷2") {
str4[item.x] = { value: item.value };
}
})
column.slice(1).map(v=>{
var a1 = (str1[v] && str1[v].value) || 0
var a2 = (str2[v] && str2[v].value) || 0
var a3 = (str3[v] && str3[v].value) || 0
var a4 = (str4[v] && str4[v].value) || 0
//var a5 = (str5[v] && str5[v].value) || 0
row1.push(a1)
row2.push(a2)
row3.push(a3)
row4.push(a4)
})
table.push(row1);
table.push(row2);
table.push(row3);
table.push(row4);
console.log(table);
return merge(table,unique(column));