|
|
@ -1,10 +1,12 @@
|
|
|
|
import { createContext, useEffect, useState } from 'react';
|
|
|
|
import { createContext, useEffect, useState } from 'react';
|
|
|
|
import { Tree, Input } from 'antd';
|
|
|
|
import { Tree, Input, Divider } from 'antd';
|
|
|
|
import { CaretDownOutlined } from '@ant-design/icons';
|
|
|
|
import { CaretDownOutlined } from '@ant-design/icons';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import useProductsStore from '@/stores/Products/Index';
|
|
|
|
import useProductsStore from '@/stores/Products/Index';
|
|
|
|
import { useProductsTypes, useProductsAuditStatesMapVal } from '@/hooks/useProductsSets';
|
|
|
|
import { useProductsTypes, useProductsAuditStatesMapVal } from '@/hooks/useProductsSets';
|
|
|
|
import { groupBy, sortBy } from '@/utils/commons';
|
|
|
|
import { groupBy, sortBy } from '@/utils/commons';
|
|
|
|
|
|
|
|
import NewProductModal from './NewProductModal';
|
|
|
|
|
|
|
|
import ContractRemarksModal from './ContractRemarksModal'
|
|
|
|
|
|
|
|
|
|
|
|
const flattenTreeFun = (tree) => {
|
|
|
|
const flattenTreeFun = (tree) => {
|
|
|
|
let flatList = [];
|
|
|
|
let flatList = [];
|
|
|
@ -40,6 +42,8 @@ const getParentKey = (key, tree) => {
|
|
|
|
|
|
|
|
|
|
|
|
const ProductsTree = ({ onNodeSelect, ...props }) => {
|
|
|
|
const ProductsTree = ({ onNodeSelect, ...props }) => {
|
|
|
|
const { t } = useTranslation();
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isEditPage = location.pathname.includes('edit');
|
|
|
|
const [agencyProducts, editingProduct, setEditingProduct] = useProductsStore((state) => [state.agencyProducts, state.editingProduct, state.setEditingProduct]);
|
|
|
|
const [agencyProducts, editingProduct, setEditingProduct] = useProductsStore((state) => [state.agencyProducts, state.editingProduct, state.setEditingProduct]);
|
|
|
|
const [activeAgency] = useProductsStore((state) => [state.activeAgency]);
|
|
|
|
const [activeAgency] = useProductsStore((state) => [state.activeAgency]);
|
|
|
|
const productsTypes = useProductsTypes();
|
|
|
|
const productsTypes = useProductsTypes();
|
|
|
@ -150,6 +154,12 @@ const ProductsTree = ({ onNodeSelect, ...props }) => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className={`${props.className} relative`} style={props.style}>
|
|
|
|
<div className={`${props.className} relative`} style={props.style}>
|
|
|
|
<Input.Search placeholder='Search' onChange={onSearch} allowClear className='sticky top-1 z-20 mb-3' />
|
|
|
|
<Input.Search placeholder='Search' onChange={onSearch} allowClear className='sticky top-1 z-20 mb-3' />
|
|
|
|
|
|
|
|
{/* 编辑 */}
|
|
|
|
|
|
|
|
{isEditPage && (
|
|
|
|
|
|
|
|
<NewProductModal />
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
<Divider type='vertical' />
|
|
|
|
|
|
|
|
<ContractRemarksModal />
|
|
|
|
<Tree
|
|
|
|
<Tree
|
|
|
|
blockNode
|
|
|
|
blockNode
|
|
|
|
showLine defaultExpandAll expandAction={'doubleClick'}
|
|
|
|
showLine defaultExpandAll expandAction={'doubleClick'}
|
|
|
|