//定义数据
const treeData= [
{
title: '客户基本信息',
key: '1001',
children: [
{
key: '10011',
title: '客户',
dataIndex: 'kh',
width: 60,
},
{
key: '10012',
title: '销售员',
dataIndex: 'xsy',
width: 60,
},
{
key: '10013',
title: '联系人',
dataIndex: 'lxr',
width: 60,
},
{
key: '10014',
title: '来源',
dataIndex: 'ly',
width: 60,
}
],
},
{
title: '推荐信息',
key: '1002',
children: [
{
key: '10021',
title: '存量情况',
dataIndex: 'clqk',
width: 60,
},
{
key: '10022',
title: '渗透情况',
dataIndex: 'stqk',
width: 60,
},
{
key: '10023',
title: '商机情况',
dataIndex: 'sjqk',
width: 60,
},
],
},
{
title: '产值盘点',
key: '1003',
children: [
{
key: '10031',
title: '总产值',
dataIndex: 'zcz',
width: 60,
},
{
key: '10032',
title: '预计日期',
dataIndex: 'yjrq',
width: 60
},
{
key: '10033',
title: '预计方式',
dataIndex: 'yjfs',
width: 60
},
],
},
]
// 封装方法
export const filterData= (treeData = []) => {
let columnsList = treeData .map(item => {
if (item.children && item.children.length) {
item.children = item.children.filter(todo => !todo.key != '10033')
}
return item
})
return columnsList
}
// filterData(treeData) 即可