2026-04-23 11:09:06 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<section class="mapping-panel config-panel">
|
|
|
|
|
|
<div class="panel-header">
|
|
|
|
|
|
<div>
|
2026-05-08 09:54:52 +08:00
|
|
|
|
<h2 class="panel-title">人工索引配置</h2>
|
|
|
|
|
|
<p class="panel-description">展示现有的人工索引配置,并允许继续编辑。</p>
|
2026-05-06 08:47:39 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="panel-actions">
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
v-if="showConfirmButton"
|
|
|
|
|
|
type="primary"
|
2026-05-08 09:54:52 +08:00
|
|
|
|
:icon="EditPen"
|
2026-05-06 08:47:39 +08:00
|
|
|
|
:disabled="!canConfirm"
|
|
|
|
|
|
@click="emit('confirm-config')"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ confirmButtonText }}
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
v-if="showGenerateButton"
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
:icon="Connection"
|
2026-05-08 09:54:52 +08:00
|
|
|
|
:loading="isGenerating"
|
2026-05-06 08:47:39 +08:00
|
|
|
|
:disabled="!canGenerate"
|
|
|
|
|
|
@click="emit('generate')"
|
|
|
|
|
|
>
|
2026-05-08 09:54:52 +08:00
|
|
|
|
生成JSON映射
|
2026-05-06 08:47:39 +08:00
|
|
|
|
</el-button>
|
2026-04-23 11:09:06 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="panel-content">
|
|
|
|
|
|
<div class="panel-section result-card">
|
|
|
|
|
|
<el-alert v-if="jsonError" :title="jsonError" type="error" :closable="false" class="json-alert" />
|
|
|
|
|
|
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
type="textarea"
|
|
|
|
|
|
class="index-selection-textarea"
|
|
|
|
|
|
:model-value="indexSelectionJson"
|
|
|
|
|
|
:disabled="isSubmitting"
|
|
|
|
|
|
:rows="18"
|
|
|
|
|
|
resize="none"
|
2026-05-08 09:54:52 +08:00
|
|
|
|
placeholder="人工索引配置完成后,这里会自动回填索引配置,仍可继续直接编辑。"
|
2026-04-23 11:09:06 +08:00
|
|
|
|
@update:model-value="value => emit('update:indexSelectionJson', String(value || ''))"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<el-empty v-if="!hasDefaultJson" :description="emptyDescription" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-05-08 09:54:52 +08:00
|
|
|
|
import { Connection, EditPen } from '@element-plus/icons-vue'
|
2026-04-23 11:09:06 +08:00
|
|
|
|
|
|
|
|
|
|
defineOptions({
|
|
|
|
|
|
name: 'MappingConfigPanel'
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
defineProps<{
|
|
|
|
|
|
indexSelectionJson: string
|
|
|
|
|
|
isSubmitting: boolean
|
2026-05-08 09:54:52 +08:00
|
|
|
|
isGenerating: boolean
|
2026-04-23 11:09:06 +08:00
|
|
|
|
canGenerate: boolean
|
|
|
|
|
|
jsonError: string
|
|
|
|
|
|
showGenerateButton: boolean
|
2026-05-06 08:47:39 +08:00
|
|
|
|
showConfirmButton: boolean
|
|
|
|
|
|
confirmButtonText: string
|
|
|
|
|
|
canConfirm: boolean
|
2026-04-23 11:09:06 +08:00
|
|
|
|
hasDefaultJson: boolean
|
|
|
|
|
|
emptyDescription: string
|
|
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
|
(event: 'update:indexSelectionJson', value: string): void
|
2026-05-06 08:47:39 +08:00
|
|
|
|
(event: 'confirm-config'): void
|
2026-04-23 11:09:06 +08:00
|
|
|
|
(event: 'generate'): void
|
|
|
|
|
|
}>()
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
.mapping-panel {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
gap: 16px;
|
|
|
|
|
|
min-height: 0;
|
|
|
|
|
|
padding: 24px;
|
|
|
|
|
|
border: 1px solid #e5e7eb;
|
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
background: #ffffff;
|
|
|
|
|
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.config-panel {
|
|
|
|
|
|
min-height: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.panel-header {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
gap: 16px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-06 08:47:39 +08:00
|
|
|
|
.panel-actions {
|
|
|
|
|
|
display: flex;
|
2026-05-08 09:54:52 +08:00
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
|
|
align-items: center;
|
2026-05-06 08:47:39 +08:00
|
|
|
|
gap: 12px;
|
2026-05-08 09:54:52 +08:00
|
|
|
|
white-space: nowrap;
|
2026-05-06 08:47:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-23 11:09:06 +08:00
|
|
|
|
.panel-title {
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
font-size: 22px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
line-height: 1.4;
|
|
|
|
|
|
color: #1f2937;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.panel-description {
|
|
|
|
|
|
margin: 8px 0 0;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
line-height: 1.7;
|
|
|
|
|
|
color: #4b5563;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.panel-content {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
gap: 16px;
|
|
|
|
|
|
min-height: 0;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.panel-section {
|
2026-05-08 09:54:52 +08:00
|
|
|
|
border: none;
|
|
|
|
|
|
border-radius: 0;
|
|
|
|
|
|
background: transparent;
|
2026-04-23 11:09:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.result-card {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
min-height: 0;
|
2026-05-08 09:54:52 +08:00
|
|
|
|
padding: 0;
|
2026-04-23 11:09:06 +08:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.index-selection-textarea {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-height: 0;
|
2026-05-08 09:54:52 +08:00
|
|
|
|
margin-top: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.json-alert + .index-selection-textarea {
|
2026-04-23 11:09:06 +08:00
|
|
|
|
margin-top: 16px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.index-selection-textarea :deep(.el-textarea) {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.index-selection-textarea :deep(.el-textarea__inner) {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
font-family: Consolas, 'Courier New', monospace;
|
|
|
|
|
|
line-height: 1.6;
|
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.json-alert {
|
|
|
|
|
|
margin: 16px 0 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@media (max-width: 768px) {
|
|
|
|
|
|
.mapping-panel {
|
|
|
|
|
|
padding: 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.panel-header {
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
|
}
|
2026-05-06 08:47:39 +08:00
|
|
|
|
|
|
|
|
|
|
.panel-actions {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
2026-04-23 11:09:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|