|
|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<RefferenceFileNameItem
|
|
|
- v-for="(item, index) of doc_aggs"
|
|
|
+ v-for="(item, index) of document_list"
|
|
|
:knowledge="item"
|
|
|
:key="index"
|
|
|
:knowledgeIndex="index"
|
|
|
@@ -9,14 +9,54 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
+import { onMounted, computed } from 'vue';
|
|
|
import RefferenceFileNameItem from './RefferenceFileNameItem.vue';
|
|
|
|
|
|
const props = defineProps({
|
|
|
- doc_aggs: Array
|
|
|
+ doc_aggs: Array,
|
|
|
+ chunks: Array
|
|
|
});
|
|
|
|
|
|
const emit = defineEmits(['showDocDetail']);
|
|
|
|
|
|
+const document_list = computed(() => {
|
|
|
+ const doc_list = props.doc_aggs;
|
|
|
+ const chunks = props.chunks;
|
|
|
+
|
|
|
+ const res_list = [];
|
|
|
+
|
|
|
+ const len = doc_list.length;
|
|
|
+ for (let i = 0; i < len; i++) {
|
|
|
+ const doc = doc_list[i];
|
|
|
+
|
|
|
+ const res_doc = {
|
|
|
+ doc_id: doc.doc_id,
|
|
|
+ doc_name: doc.doc_name,
|
|
|
+ count: doc.count,
|
|
|
+ page: i
|
|
|
+ };
|
|
|
+
|
|
|
+ const cur_doc_id = doc.doc_id;
|
|
|
+
|
|
|
+ const cur_doc_peaces = [];
|
|
|
+ if (chunks && Array.isArray(chunks)) {
|
|
|
+ chunks.forEach((item, index) => {
|
|
|
+ const chunk_doc_id = item.doc_id;
|
|
|
+
|
|
|
+ if (cur_doc_id === chunk_doc_id) {
|
|
|
+ cur_doc_peaces.push(item.content_ltks);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ res_doc.content_ltks = cur_doc_peaces;
|
|
|
+
|
|
|
+ res_list.push(res_doc);
|
|
|
+ }
|
|
|
+
|
|
|
+ return res_list;
|
|
|
+});
|
|
|
+
|
|
|
/**
|
|
|
* 展示文档详情
|
|
|
* @param item
|
|
|
@@ -24,4 +64,19 @@ const emit = defineEmits(['showDocDetail']);
|
|
|
const handleShowDocument = (item) => {
|
|
|
emit('showDocDetail', item);
|
|
|
};
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ // console.log(props.doc_aggs, '文档信息');
|
|
|
+ // console.log(props.chunks, '文档碎片');
|
|
|
+ // const cur_doc_id = props.doc_aggs.doc_id;
|
|
|
+ // const cur_doc_peaces = [];
|
|
|
+ // if (props.chunks && Array.isArray(props.chunks)) {
|
|
|
+ // props.chunks.forEach((item, index) => {
|
|
|
+ // const chunk_doc_id = item.doc_id;
|
|
|
+ // if (cur_doc_id === chunk_doc_id) {
|
|
|
+ // cur_doc_peaces.push(item);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+});
|
|
|
</script>
|