feat(knowledge): add batch tag dialog for selected documents
parent
3f94895d60
commit
0f667e0fd8
|
|
@ -678,6 +678,14 @@ export default {
|
|||
confirmBatchDeleteDocument: 'Delete {count} selected documents? This action cannot be undone.',
|
||||
batchDeleteSuccess: 'Deleted {count} documents',
|
||||
batchDeleteFailed: 'Batch delete failed',
|
||||
batchTag: 'Batch Tag',
|
||||
batchTagDialogHeading: 'Batch Tag',
|
||||
batchTagSubtitle: 'Set tags for {count} selected documents (will replace existing tags)',
|
||||
batchTagSelectedSection: 'Selected',
|
||||
batchTagAvailableSection: 'Available',
|
||||
batchTagNoSelected: 'None selected',
|
||||
batchTagSuccess: 'Tags applied to {count} documents',
|
||||
batchTagFailed: 'Batch tag failed',
|
||||
confirmBatchReparseDocument: 'Rebuild {count} selected documents? Existing content will be cleared and each document will be re-parsed.',
|
||||
confirmBatchReparse: 'Confirm and reparse',
|
||||
batchReparseSuccess: 'Submitted {count} rebuild tasks',
|
||||
|
|
|
|||
|
|
@ -681,6 +681,14 @@ export default {
|
|||
confirmBatchDeleteDocument: "선택한 {count}개 문서를 삭제하시겠습니까? 삭제 후 복구할 수 없습니다.",
|
||||
batchDeleteSuccess: "{count}개 문서가 삭제되었습니다",
|
||||
batchDeleteFailed: "일괄 삭제 실패",
|
||||
batchTag: "일괄 태그",
|
||||
batchTagDialogHeading: "일괄 태그 지정",
|
||||
batchTagSubtitle: "선택한 {count}개 문서에 태그를 일괄 설정합니다 (기존 태그는 대체됩니다)",
|
||||
batchTagSelectedSection: "선택된 태그",
|
||||
batchTagAvailableSection: "선택 가능",
|
||||
batchTagNoSelected: "선택 없음",
|
||||
batchTagSuccess: "{count}개 문서에 태그가 적용되었습니다",
|
||||
batchTagFailed: "일괄 태그 실패",
|
||||
confirmBatchReparseDocument: "선택한 {count}개 문서를 재구축하시겠습니까? 기존 내용이 삭제되고 각 문서가 다시 파싱됩니다.",
|
||||
confirmBatchReparse: "확인 후 재파싱",
|
||||
batchReparseSuccess: "재구축 작업 {count}개가 제출되었습니다",
|
||||
|
|
|
|||
|
|
@ -603,6 +603,14 @@ export default {
|
|||
confirmBatchDeleteDocument: 'Удалить {count} выбранных документов? Это действие нельзя отменить.',
|
||||
batchDeleteSuccess: 'Удалено документов: {count}',
|
||||
batchDeleteFailed: 'Ошибка пакетного удаления',
|
||||
batchTag: 'Пакетная метка',
|
||||
batchTagDialogHeading: 'Пакетное назначение меток',
|
||||
batchTagSubtitle: 'Установить метки для {count} выбранных документов (заменит существующие метки)',
|
||||
batchTagSelectedSection: 'Выбранные',
|
||||
batchTagAvailableSection: 'Доступные',
|
||||
batchTagNoSelected: 'Ничего не выбрано',
|
||||
batchTagSuccess: 'Метки применены к {count} документам',
|
||||
batchTagFailed: 'Ошибка пакетного назначения меток',
|
||||
confirmBatchReparseDocument: 'Пересобрать {count} выбранных документов? Существующее содержимое будет удалено, и каждый документ будет обработан заново.',
|
||||
confirmBatchReparse: 'Подтвердить и обработать заново',
|
||||
batchReparseSuccess: 'Отправлено задач пересборки: {count}',
|
||||
|
|
|
|||
|
|
@ -679,6 +679,14 @@ export default {
|
|||
confirmBatchDeleteDocument: "确认删除选中的 {count} 个文档?删除后将无法恢复。",
|
||||
batchDeleteSuccess: "成功删除 {count} 个文档",
|
||||
batchDeleteFailed: "批量删除失败",
|
||||
batchTag: "批量打标签",
|
||||
batchTagDialogHeading: "批量打标签",
|
||||
batchTagSubtitle: "为选中的 {count} 个文档统一设置标签(将替换文档原有标签)",
|
||||
batchTagSelectedSection: "已选标签",
|
||||
batchTagAvailableSection: "可选标签",
|
||||
batchTagNoSelected: "暂未选择",
|
||||
batchTagSuccess: "已为 {count} 个文档成功设置标签",
|
||||
batchTagFailed: "批量打标签失败",
|
||||
confirmBatchReparseDocument: "确认重建选中的 {count} 个文档?现有内容将被清除并重新解析。",
|
||||
confirmBatchReparse: "确认并重新解析",
|
||||
batchReparseSuccess: "已提交 {count} 个重建任务",
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import DocumentCardView from './components/DocumentCardView.vue';
|
|||
import DocumentBatchBar from './components/DocumentBatchBar.vue';
|
||||
import KbUploadSourceDropdown from './components/KbUploadSourceDropdown.vue';
|
||||
import TagEditDialog from './components/TagEditDialog.vue';
|
||||
import BatchTagDialog from './components/BatchTagDialog.vue';
|
||||
import KbTagManageDrawer from './components/KbTagManageDrawer.vue';
|
||||
import type { KnowledgeProcessOverrides } from '@/types/knowledgeProcess';
|
||||
import { useUploadConfirmStore, type UploadConfirmResult } from '@/stores/uploadConfirm';
|
||||
|
|
@ -420,6 +421,8 @@ const selectedIds = ref<Set<string>>(new Set());
|
|||
let lastSelectedIndex = -1;
|
||||
const batchDeleting = ref(false);
|
||||
const batchReparsing = ref(false);
|
||||
const batchTagging = ref(false);
|
||||
const batchTagDialogVisible = ref(false);
|
||||
// IDs submitted for async batch reparse; hold optimistic pending until the worker updates DB.
|
||||
const pendingReparseAck = ref<Set<string>>(new Set());
|
||||
|
||||
|
|
@ -779,6 +782,11 @@ const openTagManageFromEditDialog = () => {
|
|||
tagManageDrawerVisible.value = true;
|
||||
};
|
||||
|
||||
const openTagManageFromBatchDialog = () => {
|
||||
batchTagDialogVisible.value = false;
|
||||
tagManageDrawerVisible.value = true;
|
||||
};
|
||||
|
||||
const onTagManageChanged = (payload?: { deletedTagId?: string }) => {
|
||||
if (!kbId.value) return;
|
||||
void loadTags(kbId.value, true);
|
||||
|
|
@ -1892,6 +1900,32 @@ const confirmBatchDelete = async () => {
|
|||
}
|
||||
};
|
||||
|
||||
const handleBatchTag = () => {
|
||||
if (batchDeleting.value || batchReparsing.value || batchTagging.value || selectedIds.value.size === 0) return;
|
||||
batchTagDialogVisible.value = true;
|
||||
};
|
||||
|
||||
const onBatchTagConfirm = async (tagIds: string[]) => {
|
||||
const ids = Array.from(selectedIds.value);
|
||||
const updateMap: Record<string, string[]> = {};
|
||||
for (const id of ids) {
|
||||
updateMap[id] = tagIds;
|
||||
}
|
||||
batchTagging.value = true;
|
||||
try {
|
||||
await updateKnowledgeTagBatch({ updates: updateMap });
|
||||
MessagePlugin.success(t('knowledgeBase.batchTagSuccess', { count: ids.length }));
|
||||
clearSelection();
|
||||
batchMode.value = false;
|
||||
loadKnowledgeFiles(kbId.value);
|
||||
loadTags(kbId.value, true);
|
||||
} catch (e: any) {
|
||||
MessagePlugin.error(e?.message || t('knowledgeBase.batchTagFailed'));
|
||||
} finally {
|
||||
batchTagging.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const confirmCancelParseKnowledge = async (item: KnowledgeCard) => {
|
||||
if (!item?.id) return;
|
||||
try {
|
||||
|
|
@ -2337,8 +2371,9 @@ async function createNewSession(value: string): Promise<void> {
|
|||
</div>
|
||||
<div class="doc-batch-bar-anchor" v-show="batchMode || selectedIds.size > 0">
|
||||
<DocumentBatchBar :count="selectedIds.size" :delete-loading="batchDeleting"
|
||||
:reparse-loading="batchReparsing" :visible="batchMode || selectedIds.size > 0"
|
||||
@cancel="handleBatchCancel" @delete="confirmBatchDelete" @reparse="confirmBatchReparse" />
|
||||
:reparse-loading="batchReparsing" :tag-loading="batchTagging" :visible="batchMode || selectedIds.size > 0"
|
||||
@cancel="handleBatchCancel" @delete="confirmBatchDelete" @reparse="confirmBatchReparse"
|
||||
@batch-tag="handleBatchTag" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -2372,6 +2407,12 @@ async function createNewSession(value: string): Promise<void> {
|
|||
@update:visible="tagEditDialogVisible = $event" @confirm="onTagEditConfirm" @tag-created="loadTags(kbId, true)"
|
||||
@open-manage="openTagManageFromEditDialog" />
|
||||
|
||||
<!-- 批量打标签弹窗 -->
|
||||
<BatchTagDialog :visible="batchTagDialogVisible"
|
||||
:count="selectedIds.size" :kb-id="kbId" :tag-list="tagList" :can-manage="canEdit"
|
||||
@update:visible="batchTagDialogVisible = $event" @confirm="onBatchTagConfirm"
|
||||
@tag-created="loadTags(kbId, true)" @open-manage="openTagManageFromBatchDialog" />
|
||||
|
||||
<KbTagManageDrawer
|
||||
v-if="!isFAQ"
|
||||
v-model:visible="tagManageDrawerVisible"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,530 @@
|
|||
<template>
|
||||
<t-dialog :visible="visible" :footer="false" width="420px" dialog-class-name="batch-tag-dialog"
|
||||
:close-on-overlay-click="false" destroy-on-close @close="handleClose">
|
||||
<template #header>
|
||||
<div class="batch-tag-heading">
|
||||
<div class="batch-tag-heading-row">
|
||||
<t-icon name="discount" size="16px" class="batch-tag-heading-icon" aria-hidden="true" />
|
||||
<span class="batch-tag-title">{{ $t('knowledgeBase.batchTagDialogHeading') }}</span>
|
||||
</div>
|
||||
<p class="batch-tag-subtitle">{{ $t('knowledgeBase.batchTagSubtitle', { count }) }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="batch-tag-body">
|
||||
<section class="setting-drawer__section">
|
||||
<div class="batch-tag-section-head">
|
||||
<h4 class="setting-drawer__section-title">{{ $t('knowledgeBase.batchTagSelectedSection') }}</h4>
|
||||
<t-button v-if="selectedSet.size > 0" variant="text" size="small" theme="default" @click="clearAll">
|
||||
{{ $t('knowledgeBase.tagClearAction') }}
|
||||
</t-button>
|
||||
</div>
|
||||
<div v-if="selectedTagsList.length > 0" class="batch-tag-chips">
|
||||
<button v-for="tag in selectedTagsList" :key="tag.id" type="button" class="batch-tag-chip is-selected"
|
||||
:title="tag.name" @click="toggleTag(tag.id)">
|
||||
{{ tag.name }}
|
||||
</button>
|
||||
</div>
|
||||
<p v-else class="batch-tag-section-empty">{{ $t('knowledgeBase.batchTagNoSelected') }}</p>
|
||||
</section>
|
||||
|
||||
<section class="setting-drawer__section">
|
||||
<div class="batch-tag-section-head">
|
||||
<h4 class="setting-drawer__section-title">{{ $t('knowledgeBase.batchTagAvailableSection') }}</h4>
|
||||
<t-button
|
||||
v-if="canManage"
|
||||
variant="text"
|
||||
size="small"
|
||||
theme="default"
|
||||
class="batch-tag-manage-link"
|
||||
@click="handleOpenManage"
|
||||
>
|
||||
{{ $t('knowledgeBase.tagManageLink') }}
|
||||
</t-button>
|
||||
</div>
|
||||
<div class="batch-tag-search-bar">
|
||||
<t-input v-model="searchQuery" :placeholder="$t('knowledgeBase.tagEditSearch')" clearable size="small">
|
||||
<template #prefix-icon>
|
||||
<t-icon name="search" size="14px" />
|
||||
</template>
|
||||
</t-input>
|
||||
</div>
|
||||
<div v-if="availableTagsList.length > 0" class="batch-tag-chips">
|
||||
<button v-for="tag in availableTagsList" :key="tag.id" type="button" class="batch-tag-chip"
|
||||
:title="tag.knowledge_count !== undefined ? `${tag.name} (${tag.knowledge_count})` : tag.name"
|
||||
@click="toggleTag(tag.id)">
|
||||
{{ tag.name }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else class="batch-tag-section-empty batch-tag-section-empty--row">
|
||||
<span>{{ searchQuery.trim() ? $t('knowledgeBase.tagEmptyResult') : $t('knowledgeBase.noTags') }}</span>
|
||||
<t-button v-if="searchQuery.trim()" variant="text" theme="default" size="small" :loading="creatingTag"
|
||||
@click="handleCreateTag">
|
||||
{{ $t('knowledgeBase.tagCreateAction') }} "{{ searchQuery.trim() }}"
|
||||
</t-button>
|
||||
</div>
|
||||
<div class="batch-tag-create-row">
|
||||
<t-input v-model="newTagName" :placeholder="$t('knowledgeBase.tagNewPlaceholder')" size="small"
|
||||
:maxlength="40" :disabled="creatingTag" @enter="handleAddNewTag" />
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="batch-tag-footer">
|
||||
<span class="batch-tag-selected-count">
|
||||
{{ $t('knowledgeBase.tagSelectedCount', { count: selectedSet.size }) }}
|
||||
</span>
|
||||
<div class="batch-tag-footer-right">
|
||||
<t-button variant="outline" size="small" @click="handleClose">
|
||||
{{ $t('common.cancel') }}
|
||||
</t-button>
|
||||
<t-button theme="primary" size="small" :loading="saving" @click="handleConfirm">
|
||||
{{ $t('common.confirm') }}
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
</t-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { MessagePlugin } from 'tdesign-vue-next';
|
||||
import { createKnowledgeBaseTag } from '@/api/knowledge-base';
|
||||
|
||||
interface Tag {
|
||||
id: string;
|
||||
name: string;
|
||||
color?: string;
|
||||
knowledge_count?: number;
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean;
|
||||
count: number;
|
||||
kbId: string;
|
||||
tagList: Tag[];
|
||||
canManage?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:visible', value: boolean): void;
|
||||
(e: 'confirm', tagIds: string[]): void;
|
||||
(e: 'tag-created'): void;
|
||||
(e: 'open-manage'): void;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const searchQuery = ref('');
|
||||
const selectedSet = ref<Set<string>>(new Set());
|
||||
const creatingTag = ref(false);
|
||||
const saving = ref(false);
|
||||
const newTagName = ref('');
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(val) => {
|
||||
if (val) {
|
||||
selectedSet.value = new Set();
|
||||
searchQuery.value = '';
|
||||
newTagName.value = '';
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const tagMap = computed(() => new Map(props.tagList.map((tag) => [tag.id, tag])));
|
||||
|
||||
const selectedTagsList = computed(() => {
|
||||
return Array.from(selectedSet.value)
|
||||
.map((id) => tagMap.value.get(id))
|
||||
.filter((tag): tag is Tag => Boolean(tag));
|
||||
});
|
||||
|
||||
const availableTagsList = computed(() => {
|
||||
const query = searchQuery.value.trim().toLowerCase();
|
||||
return props.tagList.filter((tag) => {
|
||||
if (selectedSet.value.has(tag.id)) return false;
|
||||
if (query && !(tag.name || '').toLowerCase().includes(query)) return false;
|
||||
return true;
|
||||
});
|
||||
});
|
||||
|
||||
function toggleTag(tagId: string) {
|
||||
const next = new Set(selectedSet.value);
|
||||
if (next.has(tagId)) {
|
||||
next.delete(tagId);
|
||||
} else {
|
||||
next.add(tagId);
|
||||
}
|
||||
selectedSet.value = next;
|
||||
}
|
||||
|
||||
function clearAll() {
|
||||
selectedSet.value = new Set();
|
||||
}
|
||||
|
||||
async function handleCreateTag() {
|
||||
const name = searchQuery.value.trim();
|
||||
if (!name) return;
|
||||
creatingTag.value = true;
|
||||
try {
|
||||
const res: any = await createKnowledgeBaseTag(props.kbId, { name });
|
||||
const newTag = res?.data || res;
|
||||
const next = new Set(selectedSet.value);
|
||||
next.add(newTag.id);
|
||||
selectedSet.value = next;
|
||||
searchQuery.value = '';
|
||||
emit('tag-created');
|
||||
MessagePlugin.success(t('knowledgeBase.tagCreateSuccess'));
|
||||
} catch (error: any) {
|
||||
MessagePlugin.error(error?.message || t('common.operationFailed'));
|
||||
} finally {
|
||||
creatingTag.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleAddNewTag() {
|
||||
const name = newTagName.value.trim();
|
||||
if (!name) return;
|
||||
const exists = props.tagList.find((t) => t.name === name);
|
||||
if (exists) {
|
||||
const next = new Set(selectedSet.value);
|
||||
next.add(exists.id);
|
||||
selectedSet.value = next;
|
||||
newTagName.value = '';
|
||||
return;
|
||||
}
|
||||
creatingTag.value = true;
|
||||
try {
|
||||
const res: any = await createKnowledgeBaseTag(props.kbId, { name });
|
||||
const newTag = res?.data || res;
|
||||
const next = new Set(selectedSet.value);
|
||||
next.add(newTag.id);
|
||||
selectedSet.value = next;
|
||||
newTagName.value = '';
|
||||
emit('tag-created');
|
||||
MessagePlugin.success(t('knowledgeBase.tagCreateSuccess'));
|
||||
} catch (error: any) {
|
||||
MessagePlugin.error(error?.message || t('common.operationFailed'));
|
||||
} finally {
|
||||
creatingTag.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleConfirm() {
|
||||
saving.value = true;
|
||||
try {
|
||||
emit('confirm', Array.from(selectedSet.value));
|
||||
emit('update:visible', false);
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function handleClose() {
|
||||
emit('update:visible', false);
|
||||
}
|
||||
|
||||
function handleOpenManage() {
|
||||
emit('update:visible', false);
|
||||
emit('open-manage');
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.batch-tag-dialog {
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.batch-tag-dialog .t-dialog__header {
|
||||
min-height: auto;
|
||||
padding: 20px 20px 0;
|
||||
}
|
||||
|
||||
.batch-tag-dialog .t-dialog__body {
|
||||
padding: 0 20px 20px;
|
||||
}
|
||||
|
||||
.batch-tag-dialog .t-dialog__close {
|
||||
top: 16px;
|
||||
right: 16px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 4px;
|
||||
color: var(--td-text-color-secondary);
|
||||
transition: background 0.18s ease;
|
||||
}
|
||||
|
||||
.batch-tag-dialog .t-dialog__close:hover {
|
||||
color: var(--td-text-color-primary);
|
||||
background: var(--td-bg-color-container-hover);
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.batch-tag-dialog {
|
||||
width: calc(100vw - 24px) !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
.batch-tag-heading {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
padding-right: 28px;
|
||||
}
|
||||
|
||||
.batch-tag-heading-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.batch-tag-heading-icon {
|
||||
flex-shrink: 0;
|
||||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
|
||||
.batch-tag-title {
|
||||
color: var(--td-text-color-primary);
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
line-height: 22px;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
|
||||
.batch-tag-subtitle {
|
||||
margin: 0;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
color: var(--td-text-color-placeholder);
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
line-height: 18px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.batch-tag-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.batch-tag-body .setting-drawer__section {
|
||||
padding: 12px 0 16px;
|
||||
border-bottom: 1px solid var(--td-component-stroke);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.batch-tag-body .setting-drawer__section:first-child {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.batch-tag-body .setting-drawer__section:last-child {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.batch-tag-body .setting-drawer__section-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--td-text-color-primary);
|
||||
margin: 0 0 4px;
|
||||
user-select: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.batch-tag-body .setting-drawer__section-title::before {
|
||||
content: '';
|
||||
width: 3px;
|
||||
height: 14px;
|
||||
background: var(--td-brand-color);
|
||||
border-radius: 2px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.batch-tag-section-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.batch-tag-section-head .setting-drawer__section-title {
|
||||
margin-bottom: 0;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.batch-tag-section-head :deep(.t-button) {
|
||||
height: auto;
|
||||
padding: 0;
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
flex-shrink: 0;
|
||||
border: none !important;
|
||||
background: transparent !important;
|
||||
box-shadow: none !important;
|
||||
transition: color 0.15s ease;
|
||||
}
|
||||
|
||||
.batch-tag-section-head :deep(.batch-tag-manage-link.t-button:hover),
|
||||
.batch-tag-section-head :deep(.batch-tag-manage-link.t-button:focus-visible) {
|
||||
color: var(--td-brand-color) !important;
|
||||
background: transparent !important;
|
||||
border-color: transparent !important;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.batch-tag-search-bar {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.batch-tag-search-bar :deep(.t-input) {
|
||||
font-size: 12px;
|
||||
background-color: var(--td-bg-color-secondarycontainer);
|
||||
border-color: transparent;
|
||||
border-radius: 4px;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.batch-tag-search-bar :deep(.t-input:hover),
|
||||
.batch-tag-search-bar :deep(.t-input.t-is-focused) {
|
||||
border-color: var(--td-component-border);
|
||||
background-color: var(--td-bg-color-container);
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.batch-tag-chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
max-height: min(120px, 24vh);
|
||||
overflow-y: auto;
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
|
||||
.batch-tag-chips::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
.batch-tag-chips::-webkit-scrollbar-thumb {
|
||||
border-radius: 2px;
|
||||
background: var(--td-scrollbar-color);
|
||||
}
|
||||
|
||||
.batch-tag-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
max-width: 100%;
|
||||
height: 22px;
|
||||
padding: 0 8px;
|
||||
border: 1px solid var(--td-component-stroke);
|
||||
border-radius: 4px;
|
||||
background: transparent;
|
||||
color: var(--td-text-color-secondary);
|
||||
font-family: var(--app-font-family);
|
||||
font-size: 11px;
|
||||
line-height: 22px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
.batch-tag-chip:hover {
|
||||
border-color: var(--td-component-stroke);
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-text-color-primary);
|
||||
}
|
||||
|
||||
.batch-tag-chip:focus-visible {
|
||||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--td-component-stroke) 60%, transparent);
|
||||
}
|
||||
|
||||
.batch-tag-chip.is-selected {
|
||||
border-color: transparent;
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-text-color-primary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.batch-tag-chip.is-selected:hover {
|
||||
background: color-mix(in srgb, var(--td-bg-color-secondarycontainer) 70%, var(--td-bg-color-container));
|
||||
}
|
||||
|
||||
.batch-tag-section-empty {
|
||||
margin: 0;
|
||||
min-height: 22px;
|
||||
font-size: 12px;
|
||||
line-height: 22px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
}
|
||||
|
||||
.batch-tag-section-empty--row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.batch-tag-create-row {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.batch-tag-create-row :deep(.t-input) {
|
||||
font-size: 12px;
|
||||
background-color: transparent;
|
||||
border-style: dashed;
|
||||
border-color: var(--td-component-stroke);
|
||||
border-radius: 4px;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.batch-tag-create-row :deep(.t-input:hover),
|
||||
.batch-tag-create-row :deep(.t-input.t-is-focused) {
|
||||
border-color: var(--td-component-border);
|
||||
border-style: dashed;
|
||||
background-color: var(--td-bg-color-secondarycontainer);
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.batch-tag-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-top: 14px;
|
||||
padding-top: 14px;
|
||||
border-top: 1px solid var(--td-component-stroke);
|
||||
}
|
||||
|
||||
.batch-tag-selected-count {
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.batch-tag-footer-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -5,6 +5,7 @@ defineProps<{
|
|||
count: number;
|
||||
deleteLoading?: boolean;
|
||||
reparseLoading?: boolean;
|
||||
tagLoading?: boolean;
|
||||
// When true the bar stays visible even with 0 selections, so users can exit
|
||||
// batch mode from here without selecting anything first.
|
||||
visible?: boolean;
|
||||
|
|
@ -14,6 +15,7 @@ const emit = defineEmits<{
|
|||
(e: 'cancel'): void;
|
||||
(e: 'delete'): void;
|
||||
(e: 'reparse'): void;
|
||||
(e: 'batchTag'): void;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
|
@ -35,17 +37,24 @@ const { t } = useI18n();
|
|||
:confirm-btn="{ content: t('knowledgeBase.confirmBatchReparse'), theme: 'warning' }"
|
||||
:cancel-btn="{ content: t('common.cancel') }" placement="top" @confirm="emit('reparse')">
|
||||
<t-button theme="default" variant="outline" size="small"
|
||||
:disabled="count === 0 || deleteLoading || reparseLoading" :loading="reparseLoading" @click.stop>
|
||||
:disabled="count === 0 || deleteLoading || reparseLoading || tagLoading" :loading="reparseLoading" @click.stop>
|
||||
<template #icon><t-icon name="refresh" size="14px" /></template>
|
||||
{{ t('knowledgeBase.rebuildDocument') }}
|
||||
</t-button>
|
||||
</t-popconfirm>
|
||||
|
||||
<t-button theme="default" variant="outline" size="small"
|
||||
:disabled="count === 0 || deleteLoading || reparseLoading || tagLoading" :loading="tagLoading"
|
||||
@click="emit('batchTag')">
|
||||
<template #icon><t-icon name="discount" size="14px" /></template>
|
||||
{{ t('knowledgeBase.batchTag') }}
|
||||
</t-button>
|
||||
|
||||
<t-popconfirm theme="warning" :content="t('knowledgeBase.confirmBatchDeleteDocument', { count })"
|
||||
:confirm-btn="{ content: t('knowledgeBase.confirmDelete'), theme: 'danger' }"
|
||||
:cancel-btn="{ content: t('common.cancel') }" placement="top" @confirm="emit('delete')">
|
||||
<t-button theme="danger" variant="outline" size="small"
|
||||
:disabled="count === 0 || deleteLoading || reparseLoading" :loading="deleteLoading" @click.stop>
|
||||
:disabled="count === 0 || deleteLoading || reparseLoading || tagLoading" :loading="deleteLoading" @click.stop>
|
||||
<template #icon><t-icon name="delete" size="14px" /></template>
|
||||
{{ t('knowledgeBase.batchDelete') }}
|
||||
</t-button>
|
||||
|
|
|
|||
Loading…
Reference in New Issue