//表格表头
a = {
zh: '账号',
hm: '户名',
fc: '房产',
mj: '面积',
ye: '余额',
zr: '昨日'
}
//获取到的表格中每一行,与表头并不对应
b = [{
hm: 'zhj',
fc: 'dx',
ye: '很多',
zr: '回不来',
zh: '123',
mj: '100'
},{
hm: 'zhj1',
fc: 'dx1',
ye: '很多1',
zr: '回不来1',
zh: '1231',
mj: '1001'
},{
hm: 'zhj2',
fc: 'dx2',
ye: '很多2',
zr: '回不来2',
zh: '1232',
mj: '1002'
},{
hm: 'zhj3',
fc: 'dx3',
ye: '很多3',
zr: '回不来3',
zh: '1233',
mj: '1003'
},{
hm: 'zhj4',
fc: 'dx4',
ye: '很多4',
zr: '回不来4',
zh: '1234',
mj: '1004'
},{
hm: 'zhj5',
fc: 'dx5',
ye: '很多5',
zr: '回不来5',
zh: '1235',
mj: '1005'
}]
//后台上送需要二位数组,数组第一项为表头
var all = [['账号','户名','房产','面积','余额','昨日']]
function(a,b) {
b.forEach((item,index,arr)=>{
tempBefore = [] ,tempAfter = []
for(itemA in a) {
tempAfter.push(item[itemA])
}
all.push(tempAfter)
})
}