From 49e3049681be125013376f78ece7e69f3c4ffe41 Mon Sep 17 00:00:00 2001 From: tikkhun Date: Fri, 16 Jan 2026 15:58:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?refactor(DictItemImportButton):=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E5=86=97=E4=BD=99=E7=9A=84=E6=88=90=E5=8A=9F=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 该逻辑已在API层处理,无需在前端重复检查 --- src/pages/Dict/components/DictItemImportButton.tsx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/pages/Dict/components/DictItemImportButton.tsx b/src/pages/Dict/components/DictItemImportButton.tsx index 5d70aab..d1c1bf2 100644 --- a/src/pages/Dict/components/DictItemImportButton.tsx +++ b/src/pages/Dict/components/DictItemImportButton.tsx @@ -52,12 +52,6 @@ const DictItemImportButton: React.FC = ({ }); } - // 检查返回结果是否包含 success 字段 - if (result && result.success !== undefined && !result.success) { - throw new Error(result.message || '导入失败'); - } - onSuccess?.(result); - // 显示导入结果详情 showImportResult(result); -- 2.40.1 From 04b9fed6f70c3d137aaf885c433be7f6a78f2931 Mon Sep 17 00:00:00 2001 From: tikkhun Date: Fri, 16 Jan 2026 15:58:39 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(Product/List):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=88=97=E5=88=B0=E4=BA=A7=E5=93=81=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat(Product/BrandSpace): 重构品牌空间页面布局和逻辑 refactor(.umirc): 调整产品路由顺序 fix(Product/CsvTool): 修复复选框事件处理并移除调试日志 --- .umirc.ts | 10 +- src/pages/Product/BrandSpace/index.tsx | 194 +++++++++++++++---------- src/pages/Product/CsvTool/index.tsx | 5 +- src/pages/Product/List/index.tsx | 7 + 4 files changed, 128 insertions(+), 88 deletions(-) diff --git a/.umirc.ts b/.umirc.ts index 8d7c0e6..0063d2b 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -149,11 +149,6 @@ export default defineConfig({ path: '/product/list', component: './Product/List', }, - { - name: '产品属性排列', - path: '/product/permutation', - component: './Product/Permutation', - }, { name: '产品分类', path: '/product/category', @@ -164,6 +159,11 @@ export default defineConfig({ path: '/product/attribute', component: './Product/Attribute', }, + { + name: '产品属性排列', + path: '/product/permutation', + component: './Product/Permutation', + }, { name: '产品品牌空间', path: '/product/brandspace', diff --git a/src/pages/Product/BrandSpace/index.tsx b/src/pages/Product/BrandSpace/index.tsx index 7d90a55..2f972cd 100644 --- a/src/pages/Product/BrandSpace/index.tsx +++ b/src/pages/Product/BrandSpace/index.tsx @@ -67,6 +67,7 @@ const BrandSpace: React.FC = () => { const [products, setProducts] = useState([]); const [loading, setLoading] = useState(false); + const [attributeValuesLoading, setAttributeValuesLoading] = useState(false); // Fetch brands list const fetchBrands = async () => { @@ -123,6 +124,7 @@ const BrandSpace: React.FC = () => { // Fetch attribute values based on selected attribute const fetchAttributeValues = async (attributeName: string) => { + setAttributeValuesLoading(true); try { const response = await request('/dict/items', { params: { dictId: attributeName }, @@ -132,6 +134,10 @@ const BrandSpace: React.FC = () => { } catch (error) { console.error('Failed to fetch attribute values:', error); message.error('获取属性值列表失败'); + // Clear attribute values on error + setAttributeValues([]); + } finally { + setAttributeValuesLoading(false); } }; @@ -160,13 +166,13 @@ const BrandSpace: React.FC = () => { params, }); - const productList = Array.isArray(response) - ? response - : response?.data || []; + const productList = response?.data?.items || []; setProducts(productList); } catch (error) { console.error('Failed to fetch products:', error); message.error('获取产品列表失败'); + // Clear products on error + setProducts([]); } finally { setLoading(false); } @@ -181,7 +187,7 @@ const BrandSpace: React.FC = () => { // Fetch attribute values when attribute changes useEffect(() => { if (selectedAttribute) { - fetchAttributeValues(selectedAttribute); + fetchAttributeValues(selectedAttribute); setSelectedAttributeValue(null); // Reset selected value when attribute changes } }, [selectedAttribute]); @@ -270,6 +276,7 @@ const BrandSpace: React.FC = () => { value={selectedAttributeValue} onChange={handleAttributeValueChange} allowClear + loading={attributeValuesLoading} > {attributeValues.map((value) => (