|
|
@@ -5,7 +5,7 @@
|
|
|
<div class="btn-show-related-all" @click="showAllRelated">查看全部关联 <icon-double-right /></div>
|
|
|
</header>
|
|
|
|
|
|
- <RefferenceFileNameList :doc_aggs="doc_aggs" :chunks="chunks" @showDocDetail="handleShowDocDetail" />
|
|
|
+ <RefferenceFileNameList :document_list="document_list" @showDocDetail="handleShowDocDetail" />
|
|
|
|
|
|
<a-drawer
|
|
|
:width="'90%'"
|
|
|
@@ -26,7 +26,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref } from 'vue';
|
|
|
+import { ref, computed } from 'vue';
|
|
|
|
|
|
import RefferenceFileNameList from './RefferenceFileNameList.vue';
|
|
|
|
|
|
@@ -40,6 +40,44 @@ const props = defineProps({
|
|
|
const visible = ref(false);
|
|
|
const position = ref('right');
|
|
|
|
|
|
+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;
|
|
|
+});
|
|
|
+
|
|
|
/**
|
|
|
* 目标数据
|
|
|
*/
|
|
|
@@ -58,14 +96,48 @@ const handleCancel = () => {
|
|
|
visible.value = false;
|
|
|
};
|
|
|
|
|
|
-const handleShowDocDetail = (doc_item) => {
|
|
|
+const handleShowDocDetail = (item) => {
|
|
|
+ console.log(item, '查看文档详情');
|
|
|
+
|
|
|
// TODO:组装参数数据
|
|
|
+ const cur_tar = targetDocument.value;
|
|
|
+
|
|
|
+ const obj = {
|
|
|
+ doc_aggs: cur_tar.doc_aggs,
|
|
|
+ chunks: cur_tar.chunks,
|
|
|
+ doc_id: item.doc_id,
|
|
|
+ doc_name: item.doc_name,
|
|
|
+ count: item.count,
|
|
|
+ content_ltks: item.content_ltks
|
|
|
+ };
|
|
|
+
|
|
|
+ targetDocument.value = obj;
|
|
|
|
|
|
// 展示文档详情
|
|
|
handleClick();
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ * 显示第一个
|
|
|
+ */
|
|
|
const showAllRelated = () => {
|
|
|
+ const item = document_list.value[0];
|
|
|
+
|
|
|
+ console.log('显示第一个');
|
|
|
+
|
|
|
+ const cur_tar = targetDocument.value;
|
|
|
+
|
|
|
+ const obj = {
|
|
|
+ doc_aggs: cur_tar.doc_aggs,
|
|
|
+ chunks: cur_tar.chunks,
|
|
|
+ doc_id: item.doc_id,
|
|
|
+ doc_name: item.doc_name,
|
|
|
+ count: item.count,
|
|
|
+ content_ltks: item.content_ltks
|
|
|
+ };
|
|
|
+
|
|
|
+ targetDocument.value = obj;
|
|
|
+
|
|
|
handleClick();
|
|
|
};
|
|
|
|