fix: 修复删除后点击取消报错,增加智能检索输入框字符数量限制
This commit is contained in:
parent
f247efbb79
commit
60cb1eef62
|
|
@ -16,8 +16,12 @@
|
|||
type="text"
|
||||
placeholder="请输入您要搜索的内容..."
|
||||
class="search-input"
|
||||
maxlength="50"
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
<div class="char-counter" v-if="searchQuery">
|
||||
{{ searchQuery.length }}/50
|
||||
</div>
|
||||
<button class="search-btn" @click="handleSearch" :disabled="loading">
|
||||
<svg v-if="!loading" class="search-icon" viewBox="0 0 24 24">
|
||||
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
|
||||
|
|
@ -426,6 +430,11 @@ const handleSearch = async () => {
|
|||
return
|
||||
}
|
||||
|
||||
if (searchQuery.value.length > 50) {
|
||||
ElMessage.warning('搜索内容不能超过50个字符')
|
||||
return
|
||||
}
|
||||
|
||||
if (!searchMethod.value) {
|
||||
ElMessage.warning('请选择搜索方法')
|
||||
return
|
||||
|
|
@ -889,6 +898,22 @@ onMounted(() => {
|
|||
background: transparent;
|
||||
}
|
||||
|
||||
.char-counter {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
white-space: nowrap;
|
||||
margin-right: 8px;
|
||||
padding: 2px 6px;
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
border-radius: 10px;
|
||||
font-family: monospace;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.char-counter:hover {
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.search-btn {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
border: none;
|
||||
|
|
|
|||
|
|
@ -812,10 +812,6 @@ const handleBatchDelete = async () => {
|
|||
}
|
||||
)
|
||||
|
||||
const handleClose = () => {
|
||||
previewDrawerVisible.value = false,
|
||||
segmentList.value = []
|
||||
}
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: t('vabI18n.knowledge.document.messages.deleteing'),
|
||||
|
|
@ -842,6 +838,11 @@ const handleBatchDelete = async () => {
|
|||
loading.close()
|
||||
}
|
||||
} catch (error) {
|
||||
// 检查是否是用户取消操作
|
||||
if (error === 'cancel') {
|
||||
// 用户取消删除,不显示错误信息
|
||||
return
|
||||
}
|
||||
console.error('批量删除失败:', error)
|
||||
ElNotification({
|
||||
title: t('vabI18n.knowledge.document.errors.deleteFailed'),
|
||||
|
|
@ -1292,6 +1293,11 @@ const handleDelete = async (row: FileItem) => {
|
|||
// 刷新文件列表
|
||||
await fetchDocuments()
|
||||
} catch (error) {
|
||||
// 检查是否是用户取消操作
|
||||
if (error === 'cancel') {
|
||||
// 用户取消删除,不显示错误信息
|
||||
return
|
||||
}
|
||||
console.error('删除文件失败:', error)
|
||||
ElNotification({
|
||||
title: t('vabI18n.knowledge.document.errors.deleteFailed'),
|
||||
|
|
|
|||
Loading…
Reference in New Issue