菜单添加标签

This commit is contained in:
liu
2026-08-11 10:46:08 +08:00
parent 1890c5882b
commit 1b8a0f2d0b
7 changed files with 36 additions and 1 deletions
+26 -1
View File
@@ -1,5 +1,5 @@
import XinTable from '@/components/XinTable';
import { Badge, Button, Image, Space, Typography } from 'antd';
import { Badge, Button, Image, Space, Tag, Typography } from 'antd';
import { LeftOutlined } from '@ant-design/icons';
import type { ICategoryItem } from '@/domain/iCategoryItem';
import type { XinTableColumn } from '@/components/XinTable/typings';
@@ -98,6 +98,29 @@ export default function CategoryItemPage() {
placeholder: t('system.category.item.link.placeholder'),
},
},
{
title: t('system.category.item.tag'),
dataIndex: 'tag',
valueType: 'select',
colProps: { span: 24 },
hideInSearch: true,
fieldProps: {
mode: 'tags',
placeholder: t('system.category.item.tag.placeholder'),
},
render: (value: string[] | string | null) => {
if (!value) return '-';
const tags = Array.isArray(value) ? value : [value];
if (tags.length === 0) return '-';
return (
<Space size={[4, 4]} wrap>
{tags.map((tag) => (
<Tag key={tag} color="blue">{tag}</Tag>
))}
</Space>
);
},
},
{
title: t('system.category.item.status'),
dataIndex: 'status',
@@ -188,12 +211,14 @@ export default function CategoryItemPage() {
if (mode === 'create') {
await Create('/system/category/item', {
...values,
tag: values.tag ?? [],
category_id: currentCategory.id,
});
window.$message?.success(t('system.category.item.createSuccess'));
} else {
await Update('/system/category/item/' + defaultValue?.id, {
...values,
tag: values.tag ?? [],
category_id: currentCategory.id,
});
window.$message?.success(t('system.category.item.updateSuccess'));