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/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); 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) => (