+ {/* Filter Section */}
+
+
筛选条件
+
+ {/* Category Filter */}
+
+ 选择分类:
+
+
+
+ {/* Attribute Filters */}
+ {categoryAttributes.length > 0 && (
+
+
属性筛选:
+
+ {categoryAttributes.map(attr => (
+
+
{attr.title}:
+
handleAttributeFilterChange(attr.name, value)}
+ allowClear
+ showSearch
+ optionFilterProp="children"
+ request={async (params) => {
+ try {
+ console.log('params', params,attr);
+ const response = await dictcontrollerGetdictitems({ dictId: attr.name });
+ const rawValues = Array.isArray(response) ? response : response?.data?.items || [];
+ const filteredValues = rawValues.filter((value: any) =>
+ value.dictId === attr.name || value.dict?.id === attr.name || value.dict?.name === attr.name
+ );
+ return {
+ options: filteredValues.map((value: any) => ({
+ label: `${value.name}${value.titleCN || value.title}`,
+ value: value.id
+ }))
+ };
+ } catch (error) {
+ console.error(`Failed to fetch ${attr.title} values:`, error);
+ message.error(`获取${attr.title}属性值失败`);
+ return { options: [] };
+ }
+ }}
+ />
+
+ ))}
+
+
+ )}
+
+ {/* Group By Attribute */}
+ {categoryAttributes.length > 0 && (
+
+ 分组依据:
+
+
+ )}
+
+
+
+
+
+ {/* Products Section */}
+
+
产品列表 ({products.length} 个产品)
+
+ {loading ? (
+
+ 加载中...
+
+ ) : groupByAttribute && Object.keys(groupedProducts).length > 0 ? (
+
+ {Object.entries(groupedProducts).map(([attrValueId, groupProducts]) => {
+ return (
+
+ );
+ })}
+
+ ) : (
+
+ 暂无产品
+
+ )}
+
+
+