diff --git a/frontend/src/assets/dropdown-menu.less b/frontend/src/assets/dropdown-menu.less index e9ae0def..f657d223 100644 --- a/frontend/src/assets/dropdown-menu.less +++ b/frontend/src/assets/dropdown-menu.less @@ -296,13 +296,113 @@ } } +/* 文档卡片标签选择弹窗 */ +.card-tag-popup { + z-index: 99 !important; + + .t-popup__content { + padding: 4px !important; + margin-top: 4px !important; + border-radius: 10px !important; + background: var(--td-bg-color-container) !important; + border: 0.5px solid var(--td-component-stroke) !important; + box-shadow: + 0 0 0 0.5px rgba(0, 0, 0, 0.03), + 0 2px 4px rgba(0, 0, 0, 0.04), + 0 8px 24px rgba(0, 0, 0, 0.1) !important; + backdrop-filter: blur(20px) saturate(180%) !important; + -webkit-backdrop-filter: blur(20px) saturate(180%) !important; + animation: dropdownSlideIn 0.18s cubic-bezier(0.2, 0, 0, 1) both; + overflow: hidden; + } + + .tag-popup-list { + min-width: 160px; + max-width: 240px; + max-height: 280px; + overflow-y: auto; + display: flex; + flex-direction: column; + gap: 2px; + } + + .tag-popup-item { + display: flex; + align-items: center; + gap: 6px; + padding: 6px 8px; + border-radius: 6px; + font-size: 13px; + color: var(--td-text-color-primary); + cursor: pointer; + line-height: 1.2; + transition: background-color 0.15s ease; + + &:hover { + background: var(--td-bg-color-container-hover); + } + + &.is-selected { + color: var(--td-brand-color); + background: var(--td-bg-color-secondarycontainer); + } + } + + .tag-popup-check { + font-size: 14px; + color: var(--td-brand-color); + visibility: hidden; + flex-shrink: 0; + + &.visible { + visibility: visible; + } + } + + .tag-popup-name { + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + + &.muted { + color: var(--td-text-color-secondary); + } + } + + .tag-popup-item.is-action { + color: var(--td-text-color-secondary); + + .tag-popup-check { + visibility: visible; + color: var(--td-text-color-secondary); + } + + &:hover { + color: var(--td-error-color); + background: var(--td-error-color-1); + + .tag-popup-check { + color: var(--td-error-color); + } + } + } + + .tag-popup-divider { + height: 1px; + margin: 4px 4px; + background: var(--td-component-stroke); + } +} + /* ============================================ 五、暗色模式增强 ============================================ */ :root[theme-mode="dark"] { .card-more-popup .t-popup__content, .card-more .t-popup__content, - .tag-more-popup .t-popup__content { + .tag-more-popup .t-popup__content, + .card-tag-popup .t-popup__content { background: rgba(36, 36, 36, 0.85) !important; border-color: rgba(255, 255, 255, 0.08) !important; box-shadow: diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index a92aa33c..c4533d1e 100755 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -95,6 +95,7 @@ export default { category: 'Category', faqCategoryTitle: 'FAQ Categories', untagged: 'Uncategorized', + tagClearAction: 'Clear category', tagSearchTooltip: 'Search tags', tagCreateAction: 'Create tag', tagSearchPlaceholder: 'Type to filter tags', diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts index 8caca9c0..f11e758f 100755 --- a/frontend/src/i18n/locales/ko-KR.ts +++ b/frontend/src/i18n/locales/ko-KR.ts @@ -93,6 +93,7 @@ export default { documentCategoryTitle: "문서 분류", faqCategoryTitle: "질문 분류", untagged: "미분류", + tagClearAction: "분류 해제", tagUpdateSuccess: "태그 업데이트 성공", tagSearchTooltip: "태그 검색", category: "분류", diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts index 79694ee1..dd0a3b91 100755 --- a/frontend/src/i18n/locales/ru-RU.ts +++ b/frontend/src/i18n/locales/ru-RU.ts @@ -55,6 +55,7 @@ export default { documentCategoryTitle: 'Категории документов', faqCategoryTitle: 'Категории FAQ', untagged: 'Без метки', + tagClearAction: 'Снять категорию', tagSearchTooltip: 'Поиск тегов', tagUpdateSuccess: 'Тег успешно обновлен', category: 'Категория', diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index 7ec37837..5f2bca92 100755 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -93,6 +93,7 @@ export default { documentCategoryTitle: "文档分类", faqCategoryTitle: "问题分类", untagged: "未分类", + tagClearAction: "取消分类", tagUpdateSuccess: "标签更新成功", tagSearchTooltip: "搜索标签", category: "分类", diff --git a/frontend/src/views/knowledge/KnowledgeBase.vue b/frontend/src/views/knowledge/KnowledgeBase.vue index 538489a4..d7e7d98c 100644 --- a/frontend/src/views/knowledge/KnowledgeBase.vue +++ b/frontend/src/views/knowledge/KnowledgeBase.vue @@ -427,12 +427,13 @@ const filterParams = computed(() => { }; }); type TagInputInstance = ComponentPublicInstance<{ focus: () => void; select: () => void }>; -const tagDropdownOptions = computed(() => - tagList.value.map((tag: any) => ({ - content: tag.name, - value: tag.id, - })), -); +const onPickTag = (item: any, tagId: string | number) => { + if (item) item.isTagPopup = false; + const currentId = item?.tag_id ? String(item.tag_id) : ''; + const nextId = tagId ? String(tagId) : ''; + if (currentId === nextId) return; + handleKnowledgeTagChange(item.id, nextId); +}; const tagMap = computed>(() => { const map: Record = {}; tagList.value.forEach((tag) => { @@ -2389,13 +2390,37 @@ async function createNewSession(value: string): Promise { {{ formatDocTime(item.updated_at) }}
- - + + + {{ getTagName(item.tag_id) }} - - + + + {{ t('knowledgeBase.tagLabel') }} + + + {{ getTagName(item.tag_id) }}
@@ -3463,8 +3488,34 @@ async function createNewSession(value: string): Promise { vertical-align: middle; font-size: 11px; } + + .card-tag-add { + display: inline-flex; + align-items: center; + gap: 2px; + height: 18px; + padding: 0 6px; + border-radius: 999px; + border: 1px dashed var(--td-component-stroke); + color: var(--td-text-color-placeholder); + font-size: 11px; + cursor: pointer; + transition: all 0.2s ease; + + .t-icon { + font-size: 12px; + } + + &:hover { + border-color: var(--td-brand-color); + color: var(--td-brand-color-active); + background: var(--td-bg-color-secondarycontainer); + border-style: solid; + } + } } + .card-bottom-right { display: flex; align-items: center;