refactor(track): 重构知识信息页面

- 引入 TextModel 和 QAModel 组件用于展示不同类型的文档内容
- 修改 _getSplitResultPreview 方法,根据文档类型动态渲染内容
- 优化文档内容展示布局,移除不必要的 prop 属性
This commit is contained in:
du.meimei
2025-04-17 18:08:41 +08:00
parent 4af6fee9ee
commit ca8a13fcb7
3 changed files with 27 additions and 25 deletions

View File

@@ -54,15 +54,7 @@ export default {
visible: Boolean,
descriptions: {
type: Object,
default: () => ({ data: [{}] })
},
documentDetail: {
type: Object,
default: () => ({})
},
activeSegment: {
type: Number,
default: 0
default: () => ({ data: [] })
}
}
}

View File

@@ -43,14 +43,11 @@ export default {
descriptions: {
type: Object,
default: () => ({ data: [] })
}
},
documentDetail: {
type: Object,
default: () => ({})
},
activeSegment: {
type: Number,
default: 0
data() {
return {
activeSegment: 0
}
}
}

View File

@@ -1,12 +1,16 @@
<script>
import { datasetQuerySegments, getPdfUrl, queryTask } from '@/api/generatedApi'
import TextModel from '@/views/knowledge/detail/components/documentDetail/TextModel.vue'
import QAModel from '@/views/knowledge/detail/components/documentDetail/QAModel.vue'
export default {
name: 'index',
components: { QAModel, TextModel },
data() {
return {
iframeSrc: window.location.origin,
newForm: {}
newForm: {},
descriptions: null
}
},
props: {
@@ -62,10 +66,10 @@ export default {
_getSplitResultPreview() {
console.log(this.form)
datasetQuerySegments({ documentId: '1361713754874679296' }).then(res => {
const { content } = res.content
datasetQuerySegments({ documentId: this.form.id }).then(res => {
const descriptions = res.content.content
console.log(`datasetQuerySegments`, res)
this.descriptions = descriptions
// this.form.knowledgeContent = content
})
}
@@ -142,15 +146,24 @@ export default {
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="知识内容"> </el-form-item>
<el-col :span="24">
<el-form-item label="知识内容">
<div class="is-always-shadow" v-if="descriptions">
<text-model v-if="descriptions.doc_form === 'text_model'" :descriptions="descriptions" />
<q-a-model v-else-if="descriptions.doc_form === 'qa_model'" :descriptions="descriptions" />
</div>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="原文内容" />
<iframe id="iframe"
<iframe
id="iframe"
:src="`${iframeSrc}/pdfjs-dist/web/viewer.html?file=${encodeURIComponent(getPdfUrl({ documentId: newForm.id }))}`"
class="miner-u el-card is-always-shadow ml20" style="width: 98%; height: 800px;"></iframe>
class="miner-u el-card is-always-shadow ml20"
style="width: 98%; height: 800px;"
></iframe>
</el-col>
</el-row>
</el-form>