|
|
|
@ -69,21 +69,21 @@ const ProductsTree = ({ onNodeSelect, ...props }) => {
|
|
|
|
|
children: (agencyProducts[ele.value] || []).map((product) => {
|
|
|
|
|
const lgc_map = product.lgc_details.reduce((rlgc, clgc) => ({...rlgc, [clgc.lgc]: clgc}), {});
|
|
|
|
|
return {
|
|
|
|
|
title: product.info.title || lgc_map?.['2']?.title || lgc_map?.['1']?.title || '',
|
|
|
|
|
// title: `【${product.info.city_name}】` + (product.info.title || lgc_map?.['2']?.title || lgc_map?.['1']?.title || ''),
|
|
|
|
|
// title: product.info.title || lgc_map?.['2']?.title || lgc_map?.['1']?.title || '',
|
|
|
|
|
title: `【${product.info.city_name}】` + (product.info.title || lgc_map?.['2']?.title || lgc_map?.['1']?.title || ''),
|
|
|
|
|
// key: `${ele.value}-${product.info.id}`,
|
|
|
|
|
key: product.info.id,
|
|
|
|
|
_raw: product,
|
|
|
|
|
isLeaf: true,
|
|
|
|
|
}}),
|
|
|
|
|
// 增加`城市`层级
|
|
|
|
|
_children: Object.keys(copyAgencyProducts[ele.value] || []).map(city => {
|
|
|
|
|
return {
|
|
|
|
|
title: city,
|
|
|
|
|
key: `${ele.value}-${city}`,
|
|
|
|
|
children: copyAgencyProducts[ele.value][city],
|
|
|
|
|
};
|
|
|
|
|
}),
|
|
|
|
|
// _children: Object.keys(copyAgencyProducts[ele.value] || []).map(city => {
|
|
|
|
|
// return {
|
|
|
|
|
// title: city,
|
|
|
|
|
// key: `${ele.value}-${city}`,
|
|
|
|
|
// children: copyAgencyProducts[ele.value][city],
|
|
|
|
|
// };
|
|
|
|
|
// }),
|
|
|
|
|
}));
|
|
|
|
|
setTreeData(_show);
|
|
|
|
|
setRawTreeData(_show);
|
|
|
|
|