|
|
|
@ -41,6 +41,7 @@ const getParentKey = (key, tree) => {
|
|
|
|
|
const ProductsTree = ({ onNodeSelect, ...props }) => {
|
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
const [agencyProducts, editingProduct, setEditingProduct] = useProductsStore((state) => [state.agencyProducts, state.editingProduct, state.setEditingProduct]);
|
|
|
|
|
const [activeAgency] = useProductsStore((state) => [state.activeAgency]);
|
|
|
|
|
const productsTypes = useProductsTypes();
|
|
|
|
|
|
|
|
|
|
const [treeData, setTreeData] = useState([]);
|
|
|
|
@ -49,6 +50,11 @@ const ProductsTree = ({ onNodeSelect, ...props }) => {
|
|
|
|
|
const [expandedKeys, setExpandedKeys] = useState([]);
|
|
|
|
|
const [autoExpandParent, setAutoExpandParent] = useState(true);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setExpandedKeys(productsTypes.map((item) => item.key)); // 全部展开
|
|
|
|
|
return () => {}
|
|
|
|
|
}, [productsTypes, activeAgency]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
// 只显示有产品的类型;
|
|
|
|
|
// const title = text || r.lgc_details?.['2']?.title || r.lgc_details?.['1']?.title || '';
|
|
|
|
@ -89,7 +95,7 @@ const ProductsTree = ({ onNodeSelect, ...props }) => {
|
|
|
|
|
setRawTreeData(_show);
|
|
|
|
|
setFlattenTreeData(flattenTreeFun(_show));
|
|
|
|
|
|
|
|
|
|
setExpandedKeys(productsTypes.map((item) => item.key)); // 全部展开
|
|
|
|
|
// setExpandedKeys(productsTypes.map((item) => item.key)); // 全部展开
|
|
|
|
|
|
|
|
|
|
// setActiveKey(isEmpty(_show) ? [] : [_show[0].key]);
|
|
|
|
|
return () => {};
|
|
|
|
|