const getStockTableColumns = () => {
const columns = [
{
title: '',
children: [
{
title: '基础信息',
children: [
{ title: '公司', dataIndex: 'COMPANY_NAME', key: 'COMPANY_NAME', width: 180 },
{ title: '品牌', dataIndex: 'NC_BRAND_NO', key: 'NC_BRAND_NO', width: 120 },
{ title: '年份', dataIndex: 'YEAR_NAME', key: 'YEAR_NAME', width: 120 },
{ title: '季节', dataIndex: 'SEASON_NAME', key: 'SEASON_NAME', width: 120 },
],
},
],
},
{
title: 'A)POS 系统数字',
children: [
{
title: '鞋',
children: [
{ title: '数量', dataIndex: 'I41qty', key: 'I41qty', width: 120 },
{ title: '金额', dataIndex: 'I41amount', key: 'I41amount', width: 120 },
],
},
{
title: '服',
children: [
{ title: '数量', dataIndex: 'I46qty', key: 'I46qty', width: 120 },
{ title: '金额', dataIndex: 'I46amount', key: 'I46amount', width: 120 },
],
},
{
title: '配',
children: [
{ title: '数量', dataIndex: 'I47qty', key: 'I47qty', width: 120 },
{ title: '金额', dataIndex: 'I47amount', key: 'I47amount', width: 120 },
],
},
{
title: '总数',
children: [
{ title: '数量', dataIndex: 'Iqtytotal', key: 'Iqtytotal', width: 120 },
{ title: '金额', dataIndex: 'Iamounttotal', key: 'Iamounttotal', width: 120 },
],
},
],
},
{
title: 'B)调整批发退货及在途货品',
children: [
{
title: '鞋',
children: [
{ title: '数量', dataIndex: 'A41qty', key: 'A41qty', width: 120 },
{ title: '金额', dataIndex: 'A41amount', key: 'A41amount', width: 120 },
],
},
{
title: '服',
children: [
{ title: '数量', dataIndex: 'A46qty', key: 'A46qty', width: 120 },
{ title: '金额', dataIndex: 'A46amount', key: 'A46amount', width: 120 },
],
},
{
title: '配',
children: [
{ title: '数量', dataIndex: 'A47qty', key: 'A47qty', width: 120 },
{ title: '金额', dataIndex: 'A47amount', key: 'A47amount', width: 120 },
],
},
{
title: '总数',
children: [
{ title: '数量', dataIndex: 'Aqtytotal', key: 'Aqtytotal', width: 120 },
{ title: '金额', dataIndex: 'Aamounttotal', key: 'Aamounttotal', width: 120 },
],
},
],
},
]
return columns
}
// 广度遍历, 创建一个执行队列, 当队列为空的时候则结束
function getName2(data) {
let result = []
let level = 0
let queue = data
while (queue.length > 0) {
level += 1
;[...queue].forEach((child, i) => {
queue.shift()
child.index = i
child.level = level
result = result.concat([child])
child.children && queue.push(...child.children)
})
}
return result
}