2025-11-06 19:47:22 +08:00
|
|
|
<template>
|
2025-12-09 22:11:27 +08:00
|
|
|
<a-modal
|
|
|
|
|
:open="props.modelValue"
|
|
|
|
|
title="检索配置"
|
|
|
|
|
width="800px"
|
2026-05-18 09:41:12 +08:00
|
|
|
:confirm-loading="saving"
|
2025-12-09 22:11:27 +08:00
|
|
|
@ok="handleSave"
|
|
|
|
|
@cancel="handleCancel"
|
|
|
|
|
ok-text="保存"
|
|
|
|
|
cancel-text="取消"
|
|
|
|
|
>
|
2026-05-18 09:41:12 +08:00
|
|
|
<SearchConfigPanel
|
|
|
|
|
v-if="props.modelValue"
|
|
|
|
|
ref="searchConfigPanelRef"
|
2026-05-21 19:33:00 +08:00
|
|
|
:kb-id="props.kbId"
|
2026-05-18 09:41:12 +08:00
|
|
|
@save="handlePanelSave"
|
|
|
|
|
/>
|
2025-12-09 22:11:27 +08:00
|
|
|
</a-modal>
|
2025-11-06 19:47:22 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-05-18 09:41:12 +08:00
|
|
|
import { ref } from 'vue'
|
|
|
|
|
import SearchConfigPanel from '@/components/SearchConfigPanel.vue'
|
2025-11-06 19:47:22 +08:00
|
|
|
|
|
|
|
|
const props = defineProps({
|
2025-12-09 22:11:27 +08:00
|
|
|
modelValue: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false
|
|
|
|
|
},
|
2026-05-21 19:33:00 +08:00
|
|
|
kbId: {
|
2025-11-06 19:47:22 +08:00
|
|
|
type: String,
|
2025-12-10 19:42:58 +08:00
|
|
|
default: ''
|
2025-11-06 19:47:22 +08:00
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
})
|
2025-11-06 19:47:22 +08:00
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
const emit = defineEmits(['update:modelValue', 'save'])
|
2025-12-09 22:11:27 +08:00
|
|
|
|
2026-05-18 09:41:12 +08:00
|
|
|
const searchConfigPanelRef = ref(null)
|
|
|
|
|
const saving = ref(false)
|
2026-03-26 13:53:35 +08:00
|
|
|
|
2025-12-09 22:11:27 +08:00
|
|
|
const handleSave = async () => {
|
2026-05-18 09:41:12 +08:00
|
|
|
if (!searchConfigPanelRef.value) return
|
|
|
|
|
saving.value = true
|
2025-12-09 16:21:18 +08:00
|
|
|
try {
|
2026-05-18 09:41:12 +08:00
|
|
|
const success = await searchConfigPanelRef.value.save()
|
|
|
|
|
if (success) {
|
2026-01-15 06:01:34 +08:00
|
|
|
emit('update:modelValue', false)
|
2025-12-09 16:21:18 +08:00
|
|
|
}
|
2026-05-18 09:41:12 +08:00
|
|
|
} finally {
|
|
|
|
|
saving.value = false
|
2025-12-09 16:21:18 +08:00
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
}
|
2025-12-09 16:21:18 +08:00
|
|
|
|
2026-05-18 09:41:12 +08:00
|
|
|
const handlePanelSave = (config) => {
|
|
|
|
|
emit('save', config)
|
2026-01-15 06:01:34 +08:00
|
|
|
emit('update:modelValue', false)
|
|
|
|
|
}
|
2025-11-06 19:47:22 +08:00
|
|
|
|
2026-05-18 09:41:12 +08:00
|
|
|
const handleCancel = () => {
|
|
|
|
|
emit('update:modelValue', false)
|
2025-11-06 19:47:22 +08:00
|
|
|
}
|
2026-05-31 13:40:15 +08:00
|
|
|
</script>
|