From dedc3ee7f0f8b9839bb7a0bb57ad2dbc14e27250 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 31 Jul 2025 12:06:10 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BA=A7=E5=93=81=E7=AE=A1=E7=90=86:?= =?UTF-8?q?=20=E5=A4=9A=E5=9F=8E=E5=B8=82=20=E5=8F=AA=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=BB=E5=9F=8E=E5=B8=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/products/Detail/ProductsTree.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/views/products/Detail/ProductsTree.jsx b/src/views/products/Detail/ProductsTree.jsx index fbd44fc..1ddc24d 100644 --- a/src/views/products/Detail/ProductsTree.jsx +++ b/src/views/products/Detail/ProductsTree.jsx @@ -80,9 +80,14 @@ const ProductsTree = ({ onNodeSelect, ...props }) => { key: ele.value, children: (agencyProducts[ele.value] || []).reduce((arr, product) => { const lgc_map = product.lgc_details.reduce((rlgc, clgc) => ({ ...rlgc, [clgc.lgc]: clgc }), {}); - const combindCityList = product.info.city_list.indexOf(city => city.id === product.info.city_id) !== -1 ? product.info.city_list : [...product.info.city_list, { id: product.info.city_id, name: product.info.city_name }]; + // const combindCityList = product.info.city_list.indexOf(city => city.id === product.info.city_id) !== -1 ? product.info.city_list : [...product.info.city_list, { id: product.info.city_id, name: product.info.city_name }]; + // const cityListName = product.info.city_list.reduce((acc, city) => { + // return acc.concat([city.name]); + // }, []).join(','); + const hasCityList = !isEmpty(product.info.city_list) && product.info.city_list.some(cc => cc.id !== product.info.city_id) ? ` (含多城市)` : ``; + const combindCityList = [{ id: product.info.city_id, name: product.info.city_name }]; const flatCityP = combindCityList.map(city => ({ - title: `【${city.name}】` + (product.info.title || lgc_map?.['2']?.title || lgc_map?.['1']?.title || product.info.product_title || ''), + title: `【${city.name}${hasCityList}】` + (product.info.title || lgc_map?.['2']?.title || lgc_map?.['1']?.title || product.info.product_title || ''), // key: `${ele.value}-${product.info.id}`, key: `${product.info.id}-${city.id}`, _raw: product,