update pay function
This commit is contained in:
@@ -87,16 +87,18 @@ export const fetchCategoryTree = async (
|
||||
* 获取特定节点及其子树
|
||||
* @param path 节点完整路径(用 | 分隔)
|
||||
* @param source 数据源类型 ('SMM' | 'Mysteel')
|
||||
* @param maxDepth 返回的子树最大层级深度(默认1层,只返回直接子节点)
|
||||
* @returns 节点数据及其子树
|
||||
*/
|
||||
export const fetchCategoryNode = async (
|
||||
path: string,
|
||||
source: 'SMM' | 'Mysteel'
|
||||
source: 'SMM' | 'Mysteel',
|
||||
maxDepth: number = 1
|
||||
): Promise<TreeNode> => {
|
||||
try {
|
||||
const encodedPath = encodeURIComponent(path);
|
||||
const response = await fetch(
|
||||
`/category-api/api/category-tree/node?path=${encodedPath}&source=${source}`,
|
||||
`/category-api/api/category-tree/node?path=${encodedPath}&source=${source}&max_depth=${maxDepth}`,
|
||||
{
|
||||
method: 'GET',
|
||||
headers: {
|
||||
|
||||
@@ -349,10 +349,11 @@ const DataBrowser: React.FC = () => {
|
||||
return newSet;
|
||||
});
|
||||
} else {
|
||||
// 展开节点 - 检查是否需要加载子节点
|
||||
const needsLoading = !node.children || node.children.length === 0;
|
||||
// 展开节点 - 始终尝试加载子节点(如果还没加载过)
|
||||
const hasChildren = node.children && node.children.length > 0;
|
||||
|
||||
if (needsLoading) {
|
||||
// 如果没有子节点数据,尝试从服务器加载
|
||||
if (!hasChildren) {
|
||||
// 添加加载状态
|
||||
setLoadingNodes((prev) => new Set(prev).add(node.path));
|
||||
|
||||
@@ -711,6 +712,14 @@ const DataBrowser: React.FC = () => {
|
||||
unit: result.unit,
|
||||
description: result.description,
|
||||
};
|
||||
|
||||
// 更新面包屑导航为搜索结果的路径
|
||||
const pathParts = result.category_path.split(' > ');
|
||||
setBreadcrumbs(pathParts);
|
||||
|
||||
// 清空搜索框,显示树结构
|
||||
setSearchQuery('');
|
||||
|
||||
handleMetricClick(metric);
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user