forked from yoone/WEB
1
0
Fork 0

refactor(product): site skus 的后端进行了分表重构,前端跟随修改。

This commit is contained in:
tikkhun 2026-01-24 18:19:54 +08:00 committed by longbot
parent ec57d7c476
commit 236d0a85bf
4 changed files with 5 additions and 13 deletions

View File

@ -180,7 +180,7 @@ export default defineConfig({
component: './Product/Permutation',
},
{
name: '产品品牌空间',
name: '产品聚合空间',
path: '/product/groupBy',
component: './Product/GroupBy',
},

View File

@ -238,7 +238,7 @@ const ProductGroupBy: React.FC = () => {
const { Title, Text } = Typography;
return (
<PageContainer title="品牌空间">
<PageContainer title="聚合空间">
<div style={{ padding: '16px', background: '#fff' }}>
{/* Filter Section */}
<div style={{ marginBottom: '24px' }}>

View File

@ -35,7 +35,6 @@ const EditForm: React.FC<{
const [stockStatus, setStockStatus] = useState<
'in-stock' | 'out-of-stock' | null
>(null);
const [sites, setSites] = useState<any[]>([]);
const [categories, setCategories] = useState<any[]>([]);
const [activeAttributes, setActiveAttributes] = useState<any[]>([]);
@ -44,10 +43,6 @@ const EditForm: React.FC<{
productcontrollerGetcategoriesall().then((res: any) => {
setCategories(res?.data || []);
});
// 获取站点列表用于站点SKU选择
sitecontrollerAll().then((res: any) => {
setSites(res?.data || []);
});
}, []);
useEffect(() => {
@ -118,9 +113,6 @@ const EditForm: React.FC<{
components: components,
type: type,
categoryId: (record as any).categoryId || (record as any).category?.id,
// 初始化站点SKU为字符串数组
// 修改后代码:
siteSkus: (record.siteSkus || []).map((code) => ({ code })),
};
}, [record, components, type]);
return (
@ -187,7 +179,7 @@ const EditForm: React.FC<{
attributes,
type: values.type, // 直接使用 type
categoryId: values.categoryId,
siteSkus: values.siteSkus.map((v: { code: string }) => v.code) || [], // 直接传递字符串数组
siteSkus: values.siteSkus.map((v: { sku: string }) => v.sku) || [], // 直接传递字符串数组
// 连带更新 components
components:
values.type === 'bundle'
@ -251,7 +243,7 @@ const EditForm: React.FC<{
)}
>
<ProFormText
name="code"
name="sku"
width="md"
placeholder="请输入站点SKU"
rules={[{ required: true, message: '请输入站点SKU' }]}

View File

@ -228,7 +228,7 @@ const List: React.FC = () => {
<>
{record.siteSkus?.map((siteSku, index) => (
<Tag key={index} color="cyan">
{siteSku}
{siteSku.sku}
</Tag>
))}
</>