|
@@ -1,13 +1,13 @@
|
|
<template>
|
|
<template>
|
|
- <div class="kgrt-entry" v-cloak>
|
|
|
|
|
|
+ <div class="kgrt-entry" v-cloak v-loading="loading">
|
|
<header class="entry-topbar">
|
|
<header class="entry-topbar">
|
|
<button class="back" @click="handleBack">返回</button>
|
|
<button class="back" @click="handleBack">返回</button>
|
|
- <span class="title">知识图谱检索工具</span>
|
|
|
|
|
|
+ <span class="title">知识溯源检索</span>
|
|
<input type="text" v-model.trim="keyword" @keydown.enter="handleRetrieval(keyword)" />
|
|
<input type="text" v-model.trim="keyword" @keydown.enter="handleRetrieval(keyword)" />
|
|
<button class="retrieval" @click="handleRetrieval(keyword)">检索</button>
|
|
<button class="retrieval" @click="handleRetrieval(keyword)">检索</button>
|
|
</header>
|
|
</header>
|
|
<div class="entry-content">
|
|
<div class="entry-content">
|
|
- <div class="left" v-loading="loading" ref="leftRef">
|
|
|
|
|
|
+ <div class="left" ref="leftRef">
|
|
<div class="result-num" v-show="pagination.total">
|
|
<div class="result-num" v-show="pagination.total">
|
|
搜索结果:{{ pagination.total }}条
|
|
搜索结果:{{ pagination.total }}条
|
|
</div>
|
|
</div>
|
|
@@ -18,7 +18,7 @@
|
|
<i @click.stop="handleClick(record.name, record.category)" style="cursor: pointer;">
|
|
<i @click.stop="handleClick(record.name, record.category)" style="cursor: pointer;">
|
|
{{ record.name }}
|
|
{{ record.name }}
|
|
</i>
|
|
</i>
|
|
- <i class="distance">{{ record.distance }}</i>
|
|
|
|
|
|
+ <!-- <i class="distance">{{ record.distance }}</i> -->
|
|
<i :class="record.isShow ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
|
|
<i :class="record.isShow ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
|
|
style="margin-left: auto; color: #2780ff"></i>
|
|
style="margin-left: auto; color: #2780ff"></i>
|
|
</h3>
|
|
</h3>
|
|
@@ -29,7 +29,9 @@
|
|
<div class="menu">
|
|
<div class="menu">
|
|
<div style="font-weight: bold;margin-bottom: 20px;" v-show="record.props.length > 0">目录</div>
|
|
<div style="font-weight: bold;margin-bottom: 20px;" v-show="record.props.length > 0">目录</div>
|
|
<div class="anchor" v-for="prop in record.props" :key="prop.id">
|
|
<div class="anchor" v-for="prop in record.props" :key="prop.id">
|
|
- <a :href="'#anchor' + prop.id">{{ prop.prop_title }}</a>
|
|
|
|
|
|
+ <a :href="'#anchor' + prop.id"
|
|
|
|
+ @click.prevent="handleAnchor('.entry-content', '#anchor' + prop.id)">{{ prop.prop_title
|
|
|
|
+ }}</a>
|
|
<!-- <el-button type="text" :targetId="'anchor' + prop.id">{{ prop.prop_title }}</el-button> -->
|
|
<!-- <el-button type="text" :targetId="'anchor' + prop.id">{{ prop.prop_title }}</el-button> -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -39,7 +41,7 @@
|
|
<div class="prop-content">
|
|
<div class="prop-content">
|
|
<div v-if="prop.answer">
|
|
<div v-if="prop.answer">
|
|
<i v-for="(answer, index) in prop.answer" :key="index">
|
|
<i v-for="(answer, index) in prop.answer" :key="index">
|
|
- <i>{{ answer.sentence }}</i>
|
|
|
|
|
|
+ <i v-html="answer.sentence"></i>
|
|
<i v-if="answer.flag" class="pdf-icon" @click="handlePdf(answer.flag, prop.references)">
|
|
<i v-if="answer.flag" class="pdf-icon" @click="handlePdf(answer.flag, prop.references)">
|
|
{{ answer.flag }} PDF
|
|
{{ answer.flag }} PDF
|
|
</i>
|
|
</i>
|
|
@@ -120,8 +122,8 @@
|
|
<!-- <PdfViewer :pdfUrl="pdfUrl" :pdfPage="pdfPage" @closePdf="closePdf"></PdfViewer> -->
|
|
<!-- <PdfViewer :pdfUrl="pdfUrl" :pdfPage="pdfPage" @closePdf="closePdf"></PdfViewer> -->
|
|
<i class="el-icon-circle-close pdf2js-close-icon" @click="pdfShow = false"></i>
|
|
<i class="el-icon-circle-close pdf2js-close-icon" @click="pdfShow = false"></i>
|
|
<iframe style="width: 100%;height: 100%;" id="pdf2js"
|
|
<iframe style="width: 100%;height: 100%;" id="pdf2js"
|
|
- :src="pdf2jsUrl + '?file=' + encodeURIComponent(pdfUrl)"></iframe>
|
|
|
|
-
|
|
|
|
|
|
+ :src="pdf2jsUrl + '?file=' + encodeURIComponent(pdfProxy + decodeURIComponent(pdfUrl))">
|
|
|
|
+ </iframe>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
@@ -143,15 +145,19 @@
|
|
import $ from 'jquery'
|
|
import $ from 'jquery'
|
|
import PdfViewer from "./PdfViewer.vue"
|
|
import PdfViewer from "./PdfViewer.vue"
|
|
const markdown = require("markdown").markdown;
|
|
const markdown = require("markdown").markdown;
|
|
-const knowledgeGraphAddr = "http://172.16.8.57:8080";
|
|
|
|
-// const knowledgeGraphAddr = "http://173.18.12.191:1388";
|
|
|
|
-
|
|
|
|
|
|
+import config from "@api/config.js"
|
|
|
|
+const knowledgeGraphAddr = config.knowledgeGraphAddr
|
|
|
|
+// console.log(config.pdfProxy, knowledgeGraphAddr)
|
|
|
|
+let timer1
|
|
|
|
+let timer2
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ pdfProxy: config.pdfProxy,
|
|
radio: "检索推荐",
|
|
radio: "检索推荐",
|
|
loading: false,
|
|
loading: false,
|
|
keyword: "",
|
|
keyword: "",
|
|
|
|
+ distance: 1,
|
|
records: [],
|
|
records: [],
|
|
pagination: {},
|
|
pagination: {},
|
|
activeName: "1",
|
|
activeName: "1",
|
|
@@ -195,8 +201,14 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+
|
|
viewPdf(pdfUrl, page, reference) {
|
|
viewPdf(pdfUrl, page, reference) {
|
|
- let timer
|
|
|
|
|
|
+ clearInterval(timer1)
|
|
|
|
+ clearInterval(timer2)
|
|
|
|
+ this.pdfPage = page || 1
|
|
|
|
+ this.pdfDialogData.visible = false
|
|
|
|
+ this.pdfShow = true;
|
|
|
|
|
|
const iframeLoadEvent = async () => {
|
|
const iframeLoadEvent = async () => {
|
|
const iframe = document.getElementById('pdf2js');
|
|
const iframe = document.getElementById('pdf2js');
|
|
@@ -204,66 +216,57 @@ export default {
|
|
// console.log("PDFViewerApplication", viewerApp, viewerApp.eventBus)
|
|
// console.log("PDFViewerApplication", viewerApp, viewerApp.eventBus)
|
|
await viewerApp.initializedPromise //等待pdf查看器初始化完成
|
|
await viewerApp.initializedPromise //等待pdf查看器初始化完成
|
|
// 监听 PDF 加载完成事件
|
|
// 监听 PDF 加载完成事件
|
|
- // viewerApp.page = this.pdfPage1 // 传入需要让跳转页码的值
|
|
|
|
- viewerApp.eventBus.on('documentloaded', () => {
|
|
|
|
|
|
+ // viewerApp.page = this.pdfPage // 传入需要让跳转页码的值
|
|
|
|
+
|
|
|
|
+ // 监听目标页面渲染完成
|
|
|
|
+ const onTargetPageRendered = (event) => {
|
|
|
|
+ if (event.pageNumber === this.pdfPage) { // 目标页码
|
|
|
|
+ let cycleIndex = 1
|
|
|
|
+ viewerApp.page = this.pdfPage;
|
|
|
|
+ // console.log(`第${this.pdfPage}页渲染完成!`);
|
|
|
|
+ timer2 = setInterval(() => {
|
|
|
|
+ viewerApp.page = this.pdfPage;
|
|
|
|
+ const iframeDocument = document.getElementById('pdf2js').contentWindow.document;
|
|
|
|
+ const pdfData = {
|
|
|
|
+ htmlElements: [],
|
|
|
|
+ textList: [],
|
|
|
|
+ page: this.pdfPage,
|
|
|
|
+ trunkId: this.pdfDialogData.reference.id
|
|
|
|
+ }
|
|
|
|
+ $(iframeDocument).find(`.pdfViewer .page[data-page-number="${this.pdfPage}"] .textLayer span[role="presentation"]`).each((index, element) => {
|
|
|
|
+ // console.log(index, $(element).text())
|
|
|
|
+ pdfData.htmlElements.push(element)
|
|
|
|
+ pdfData.textList.push($(element).text())
|
|
|
|
+ // $(element).addClass("highlight")
|
|
|
|
+ })
|
|
|
|
+ if (pdfData.htmlElements.length === 0 && cycleIndex <= 500) {
|
|
|
|
+ // console.log("1没有获取到文本!")
|
|
|
|
+ } else {
|
|
|
|
+ clearInterval(timer2)
|
|
|
|
+ this.matchHighlight(pdfData)
|
|
|
|
+ }
|
|
|
|
+ }, 200)
|
|
|
|
+ viewerApp.eventBus.off('pagerendered', onTargetPageRendered); // 移除监听
|
|
|
|
+ viewerApp.eventBus.off('documentloaded', onTargetDocumentLoaded); // 移除监听
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ const onTargetDocumentLoaded = () => {
|
|
viewerApp.page = this.pdfPage // 传入需要让跳转页码的值
|
|
viewerApp.page = this.pdfPage // 传入需要让跳转页码的值
|
|
- iframe.contentWindow.postMessage("", '*') //传递要匹配的字符串
|
|
|
|
- iframe.contentWindow.addEventListener('message', (e) => { //搜索高亮
|
|
|
|
- viewerApp.findBar.findField.value = e.data
|
|
|
|
- viewerApp.findBar.highlightAll.checked = true
|
|
|
|
- viewerApp.findBar.dispatchEvent('highlightallchange')
|
|
|
|
- }, false)
|
|
|
|
- // console.log("pagesCount", viewerApp.pagesCount) //获取pdf总页数
|
|
|
|
- // console.log('文档加载完毕!')
|
|
|
|
-
|
|
|
|
- timer = setInterval(() => {
|
|
|
|
- viewerApp.page = this.pdfPage
|
|
|
|
- const iframeDocument = document.getElementById('pdf2js').contentWindow.document;
|
|
|
|
- const pdfData = {
|
|
|
|
- htmlElements: [],
|
|
|
|
- textList: [],
|
|
|
|
- trunkId: this.pdfDialogData.reference.id
|
|
|
|
- }
|
|
|
|
- $(iframeDocument).find(`.pdfViewer .page[data-page-number="${this.pdfPage}"] .textLayer span[role="presentation"]`).each((index, element) => {
|
|
|
|
- // console.log(index, $(element).text())
|
|
|
|
- pdfData.htmlElements.push(element)
|
|
|
|
- pdfData.textList.push($(element).text())
|
|
|
|
- // $(element).addClass("highlight")
|
|
|
|
- })
|
|
|
|
- if (pdfData.htmlElements.length === 0) {
|
|
|
|
- console.log("1没有获取到文本!")
|
|
|
|
|
|
+ const iframeDocument = document.getElementById('pdf2js').contentWindow.document;
|
|
|
|
+ let cycleIndex = 1
|
|
|
|
+ timer1 = setInterval(() => {
|
|
|
|
+ if (+$(iframeDocument).find("#pageNumber.toolbarField").val() !== this.pdfPage && cycleIndex <= 500) {
|
|
|
|
+ viewerApp.page = this.pdfPage;
|
|
|
|
+ cycleIndex++
|
|
|
|
+ // console.log("viewerApp.page", viewerApp.page !== this.pdfPage)
|
|
} else {
|
|
} else {
|
|
- clearInterval(timer)
|
|
|
|
- this.matchHighlight(pdfData)
|
|
|
|
|
|
+ // console.log("viewerApp.page", viewerApp.page === this.pdfPage, viewerApp.page, this.pdfPage)
|
|
|
|
+ clearInterval(timer1)
|
|
}
|
|
}
|
|
}, 500)
|
|
}, 500)
|
|
- });
|
|
|
|
- // viewerApp.eventBus.on('pagesloaded', () => {
|
|
|
|
- // alert('pagesloaded')
|
|
|
|
- // viewerApp.page = this.pdfPage
|
|
|
|
- // let timer = null
|
|
|
|
- // timer = setInterval(() => {
|
|
|
|
- // viewerApp.page = this.pdfPage
|
|
|
|
- // const iframeDocument = document.getElementById('pdf2js').contentWindow.document;
|
|
|
|
- // const pdfData = {
|
|
|
|
- // htmlElements: [],
|
|
|
|
- // textList: [],
|
|
|
|
- // trunkId: reference.id
|
|
|
|
- // }
|
|
|
|
- // $(iframeDocument).find(`.pdfViewer .page[data-page-number="${page}"] .textLayer span[role="presentation"]`).each((index, element) => {
|
|
|
|
- // // console.log(index, $(element).text())
|
|
|
|
- // pdfData.htmlElements.push(element)
|
|
|
|
- // pdfData.textList.push($(element).text())
|
|
|
|
- // // $(element).addClass("highlight")
|
|
|
|
- // })
|
|
|
|
- // if (pdfData.htmlElements.length === 0) {
|
|
|
|
- // } else {
|
|
|
|
- // clearInterval(timer)
|
|
|
|
- // this.matchHighlight(pdfData)
|
|
|
|
- // }
|
|
|
|
- // }, 200)
|
|
|
|
- // // console.log('PDF 页面渲染完成');
|
|
|
|
- // });
|
|
|
|
|
|
+ }
|
|
|
|
+ viewerApp.eventBus.on('pagerendered', onTargetPageRendered);
|
|
|
|
+ viewerApp.eventBus.on('documentloaded', onTargetDocumentLoaded);
|
|
}
|
|
}
|
|
if (!this.pdfUrl) {
|
|
if (!this.pdfUrl) {
|
|
document.getElementById('pdf2js').addEventListener('load', iframeLoadEvent);
|
|
document.getElementById('pdf2js').addEventListener('load', iframeLoadEvent);
|
|
@@ -271,9 +274,6 @@ export default {
|
|
|
|
|
|
const isPdfUrlChange = this.pdfUrl !== pdfUrl;
|
|
const isPdfUrlChange = this.pdfUrl !== pdfUrl;
|
|
this.pdfUrl = pdfUrl
|
|
this.pdfUrl = pdfUrl
|
|
- this.pdfDialogData.visible = false
|
|
|
|
- this.pdfShow = true;
|
|
|
|
- this.pdfPage = page || 1
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
// 获取 iframe 元素
|
|
// 获取 iframe 元素
|
|
@@ -283,33 +283,31 @@ export default {
|
|
// iframe.removeEventListener('load', iframeLoadEvent);
|
|
// iframe.removeEventListener('load', iframeLoadEvent);
|
|
// iframe.addEventListener('load', iframeLoadEvent);
|
|
// iframe.addEventListener('load', iframeLoadEvent);
|
|
} else {
|
|
} else {
|
|
|
|
+
|
|
const viewerApp = iframe.contentWindow.PDFViewerApplication;
|
|
const viewerApp = iframe.contentWindow.PDFViewerApplication;
|
|
viewerApp.page = this.pdfPage // 传入需要让跳转页码的值
|
|
viewerApp.page = this.pdfPage // 传入需要让跳转页码的值
|
|
- // iframe.contentWindow.postMessage("", '*') //传递要匹配的字符串
|
|
|
|
- // iframe.contentWindow.addEventListener('message', (e) => { //搜索高亮
|
|
|
|
- // viewerApp.findBar.findField.value = e.data
|
|
|
|
- // viewerApp.findBar.highlightAll.checked = true
|
|
|
|
- // viewerApp.findBar.dispatchEvent('highlightallchange')
|
|
|
|
- // }, false)
|
|
|
|
-
|
|
|
|
- timer = setInterval(() => {
|
|
|
|
|
|
+ let cycleIndex = 1
|
|
|
|
+ timer2 = setInterval(() => {
|
|
viewerApp.page = this.pdfPage // 传入需要让跳转页码的值
|
|
viewerApp.page = this.pdfPage // 传入需要让跳转页码的值
|
|
const iframeDocument = document.getElementById('pdf2js').contentWindow.document;
|
|
const iframeDocument = document.getElementById('pdf2js').contentWindow.document;
|
|
const pdfData = {
|
|
const pdfData = {
|
|
htmlElements: [],
|
|
htmlElements: [],
|
|
textList: [],
|
|
textList: [],
|
|
|
|
+ page: this.pdfPage,
|
|
trunkId: this.pdfDialogData.reference.id
|
|
trunkId: this.pdfDialogData.reference.id
|
|
}
|
|
}
|
|
$(iframeDocument).find(`.pdfViewer .page[data-page-number="${page}"] .textLayer span[role="presentation"]`).each((index, element) => {
|
|
$(iframeDocument).find(`.pdfViewer .page[data-page-number="${page}"] .textLayer span[role="presentation"]`).each((index, element) => {
|
|
// console.log(index, $(element).text())
|
|
// console.log(index, $(element).text())
|
|
pdfData.htmlElements.push(element)
|
|
pdfData.htmlElements.push(element)
|
|
pdfData.textList.push($(element).text())
|
|
pdfData.textList.push($(element).text())
|
|
- // $(element).addClass("highlight")
|
|
|
|
|
|
+ // 移除之前的高亮
|
|
|
|
+ $(element).removeClass("highlight")
|
|
})
|
|
})
|
|
- if (pdfData.htmlElements.length === 0) {
|
|
|
|
- console.log("2没有获取到文本!")
|
|
|
|
|
|
+ if (pdfData.htmlElements.length === 0 && cycleIndex <= 500) {
|
|
|
|
+ // console.log("2没有获取到文本!")
|
|
|
|
+ cycleIndex++
|
|
} else {
|
|
} else {
|
|
- clearInterval(timer)
|
|
|
|
|
|
+ clearInterval(timer2)
|
|
this.matchHighlight(pdfData)
|
|
this.matchHighlight(pdfData)
|
|
}
|
|
}
|
|
}, 200)
|
|
}, 200)
|
|
@@ -319,15 +317,38 @@ export default {
|
|
closePdf(data) {
|
|
closePdf(data) {
|
|
this.pdfShow = false
|
|
this.pdfShow = false
|
|
},
|
|
},
|
|
|
|
+ handleAnchor(parentClass, anchor) {
|
|
|
|
+ // console.log(parentClass, anchor, $(anchor).offset().top)
|
|
|
|
+ // $(parentClass).animate({
|
|
|
|
+ // scrollTop: $(anchor).offset().top - $(parentClass).offset().top
|
|
|
|
+ // }); // 1000 表示滚动的动画持续时间(毫秒)
|
|
|
|
+
|
|
|
|
+ const container = $(parentClass);
|
|
|
|
+ const target = $(anchor);
|
|
|
|
+
|
|
|
|
+ // 获取父容器当前滚动量
|
|
|
|
+ const currentScroll = container.scrollTop();
|
|
|
|
+ // 计算目标元素的原始偏移(需父容器有 position: relative)
|
|
|
|
+ const targetOffset = target.position().top;
|
|
|
|
+
|
|
|
|
+ // 最终滚动位置 = 原始偏移 + 当前已滚动量
|
|
|
|
+ container.animate({ scrollTop: currentScroll + targetOffset });
|
|
|
|
+ },
|
|
matchHighlight: async function (pdfData) {
|
|
matchHighlight: async function (pdfData) {
|
|
try {
|
|
try {
|
|
// clearInterval(timer)
|
|
// clearInterval(timer)
|
|
- const { data, success } = await this.$http.post(`/kgrt_api/saas/trunks/${pdfData.trunkId}/highlight`, pdfData.textList)
|
|
|
|
|
|
+
|
|
|
|
+ const { data, success } = await this.$http.post(`/knowledge/saas/trunks/${pdfData.trunkId}/highlight`, pdfData.textList)
|
|
// console.log(data)
|
|
// console.log(data)
|
|
if (success) {
|
|
if (success) {
|
|
|
|
+ // const iframeDocument = document.getElementById('pdf2js').contentWindow.document;
|
|
|
|
+ // const divArray = $(iframeDocument).find(`.pdfViewer .page[data-page-number="${pdfData.page}"] .textLayer span[role="presentation"]`).map(function () { return this; }).get()
|
|
|
|
+ // console.log(pdfData, data, divArray)
|
|
for (let i = 0; i < data.length; i++) {
|
|
for (let i = 0; i < data.length; i++) {
|
|
// console.log(data[i], pdfData.htmlElements[data[i]])
|
|
// console.log(data[i], pdfData.htmlElements[data[i]])
|
|
|
|
+ // $(pdfData.htmlElements[data[i]]).css('backgroundColor', 'red');
|
|
$(pdfData.htmlElements[data[i]]).addClass("highlight");
|
|
$(pdfData.htmlElements[data[i]]).addClass("highlight");
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (e) {
|
|
} catch (e) {
|
|
@@ -373,9 +394,10 @@ export default {
|
|
const params = {
|
|
const params = {
|
|
"node_id": this.records[index].id,
|
|
"node_id": this.records[index].id,
|
|
"props_ids": this.records[index].props.map(it => it.id),
|
|
"props_ids": this.records[index].props.map(it => it.id),
|
|
|
|
+ symptoms: this.$route.query.mw ? this.$route.query.mw.split(';') : []
|
|
// "conversation_id": "string"
|
|
// "conversation_id": "string"
|
|
}
|
|
}
|
|
- let res = await this.axios.post("/kgrt_api/text/eb_search", params)
|
|
|
|
|
|
+ let res = await this.axios.post("/knowledge/text/eb_search", params)
|
|
const { data, code, msg, success } = res.data
|
|
const { data, code, msg, success } = res.data
|
|
if (success) {
|
|
if (success) {
|
|
// Object.assign(this.records[index], data)
|
|
// Object.assign(this.records[index], data)
|
|
@@ -391,28 +413,26 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
getPaginatedSearch: async function (keyword, category = "", pageNo = 1, limit = 10) {
|
|
getPaginatedSearch: async function (keyword, category = "", pageNo = 1, limit = 10) {
|
|
- if (!keyword) {
|
|
|
|
- this.pagination = {};
|
|
|
|
- this.records = [];
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
try {
|
|
try {
|
|
|
|
+ if (!keyword) {
|
|
|
|
+ this.pagination = {};
|
|
|
|
+ this.records = [];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
this.loading = true;
|
|
this.loading = true;
|
|
let resData = await this.axios.post(
|
|
let resData = await this.axios.post(
|
|
- "/kgrt_api/saas/nodes/paginated_search",
|
|
|
|
|
|
+ "/knowledge/saas/nodes/paginated_search",
|
|
{
|
|
{
|
|
keyword: keyword,
|
|
keyword: keyword,
|
|
category: category,
|
|
category: category,
|
|
pageNo: pageNo,
|
|
pageNo: pageNo,
|
|
limit: limit,
|
|
limit: limit,
|
|
|
|
+ distance: this.distance,
|
|
// knowledge_ids: ["ER"],
|
|
// knowledge_ids: ["ER"],
|
|
}
|
|
}
|
|
);
|
|
);
|
|
-
|
|
|
|
this.records = resData.data.data.records;
|
|
this.records = resData.data.data.records;
|
|
- // this.records.forEach((it) => {
|
|
|
|
- // it.isShow = false
|
|
|
|
- // })
|
|
|
|
|
|
+
|
|
// console.log("records", this.records);
|
|
// console.log("records", this.records);
|
|
this.pagination = resData.data.data.pagination;
|
|
this.pagination = resData.data.data.pagination;
|
|
if (this.records.length > 0) {
|
|
if (this.records.length > 0) {
|
|
@@ -424,21 +444,27 @@ export default {
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
// 回到顶部
|
|
// 回到顶部
|
|
document.querySelector(".kgrt-entry").scrollTop = 0;
|
|
document.querySelector(".kgrt-entry").scrollTop = 0;
|
|
|
|
+ if (this.distance === 0) {
|
|
|
|
+ // this.records.forEach((it) => {
|
|
|
|
+ // it.isShow = true
|
|
|
|
+ // })
|
|
|
|
+ $(".main-content-list .record-title").trigger('click')
|
|
|
|
+ }
|
|
});
|
|
});
|
|
} catch (e) {
|
|
} catch (e) {
|
|
- console.log("getPaginatedSearch出错了", e);
|
|
|
|
|
|
+ console.log(e);
|
|
} finally {
|
|
} finally {
|
|
this.loading = false;
|
|
this.loading = false;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
handlePaginationChange(page) {
|
|
handlePaginationChange(page) {
|
|
// console.log(page);
|
|
// console.log(page);
|
|
- this.getPaginatedSearch(this.$route.params.keyword || this.keyword, page);
|
|
|
|
|
|
+ this.getPaginatedSearch(this.$route.params.keyword || this.keyword, this.$route.query.category || "", page);
|
|
},
|
|
},
|
|
getVectorSearch: async function (text) {
|
|
getVectorSearch: async function (text) {
|
|
try {
|
|
try {
|
|
let resData = await this.axios.post(
|
|
let resData = await this.axios.post(
|
|
- "/kgrt_api/saas/trunks/vector_search",
|
|
|
|
|
|
+ "/knowledge/saas/trunks/vector_search",
|
|
{
|
|
{
|
|
text: text,
|
|
text: text,
|
|
limit: 10,
|
|
limit: 10,
|
|
@@ -447,14 +473,24 @@ export default {
|
|
);
|
|
);
|
|
this.vectorSearch = resData.data.data;
|
|
this.vectorSearch = resData.data.data;
|
|
} catch (e) {
|
|
} catch (e) {
|
|
- console.log("getVectorSearch出错了", e);
|
|
|
|
|
|
+ console.log(e);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
|
|
created() {
|
|
created() {
|
|
this.keyword = this.$route.query.keyword;
|
|
this.keyword = this.$route.query.keyword;
|
|
- let category = this.$route.query.category
|
|
|
|
|
|
+ const category = this.$route.query.category
|
|
|
|
+ if (this.$route.query.hasOwnProperty('exact')) {
|
|
|
|
+ if (this.$route.query.exact === null) {
|
|
|
|
+ this.distance = 0
|
|
|
|
+ } else {
|
|
|
|
+ this.distance = Number(this.$route.query.exact) || 0
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.distance = 1
|
|
|
|
+ }
|
|
|
|
+ // console.log('exact', this.$route.query.exact, this.distance)
|
|
this.getPaginatedSearch(this.keyword, category);
|
|
this.getPaginatedSearch(this.keyword, category);
|
|
},
|
|
},
|
|
mounted() { },
|
|
mounted() { },
|
|
@@ -462,17 +498,22 @@ export default {
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="less">
|
|
<style scoped lang="less">
|
|
|
|
+div {
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+}
|
|
|
|
+
|
|
.pdf-icon {
|
|
.pdf-icon {
|
|
display: inline;
|
|
display: inline;
|
|
- height: 20px;
|
|
|
|
- min-width: 40px;
|
|
|
|
|
|
+ height: 12px;
|
|
|
|
+ font-size: 12px;
|
|
|
|
+ // min-width: 40px;
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
color: white;
|
|
color: white;
|
|
- font-weight: bolder;
|
|
|
|
|
|
+ // font-weight: bolder;
|
|
border-radius: 10px;
|
|
border-radius: 10px;
|
|
- padding: 0px 10px;
|
|
|
|
|
|
+ padding: 0px;
|
|
text-align: right;
|
|
text-align: right;
|
|
- line-height: 20px;
|
|
|
|
|
|
+ // line-height: 20px;
|
|
background-color: #FECFCB;
|
|
background-color: #FECFCB;
|
|
white-space: nowrap;
|
|
white-space: nowrap;
|
|
}
|
|
}
|
|
@@ -499,9 +540,9 @@ export default {
|
|
width: 100vw;
|
|
width: 100vw;
|
|
height: 100vh;
|
|
height: 100vh;
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
- padding: 10px 10px 20px 20px;
|
|
|
|
- overflow-y: auto;
|
|
|
|
- overflow-x: hidden;
|
|
|
|
|
|
+ padding: 0px;
|
|
|
|
+ overflow: auto;
|
|
|
|
+ // overflow-x: hidden;
|
|
display: flex;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
|
|
|
@@ -510,7 +551,9 @@ export default {
|
|
flex: 0 0 auto;
|
|
flex: 0 0 auto;
|
|
display: flex;
|
|
display: flex;
|
|
align-items: center;
|
|
align-items: center;
|
|
- padding: 0px 5px;
|
|
|
|
|
|
+ padding: 0px 5px 20px;
|
|
|
|
+ border-bottom: 1px solid #e0e0e0;
|
|
|
|
+ margin: 0px 15px;
|
|
|
|
|
|
// min-width: 500px;
|
|
// min-width: 500px;
|
|
.back {
|
|
.back {
|
|
@@ -547,37 +590,45 @@ export default {
|
|
}
|
|
}
|
|
|
|
|
|
.entry-content {
|
|
.entry-content {
|
|
- margin-top: 20px;
|
|
|
|
- border-top: 1px solid #e0e0e0;
|
|
|
|
|
|
+ // margin-top: 20px;
|
|
|
|
+ // margin: 20px 15px 0px 15px;
|
|
|
|
+
|
|
display: flex;
|
|
display: flex;
|
|
flex-wrap: nowrap;
|
|
flex-wrap: nowrap;
|
|
flex: 1 1 auto;
|
|
flex: 1 1 auto;
|
|
- overflow: hidden;
|
|
|
|
|
|
+ overflow-y: auto;
|
|
|
|
+ // overflow-x: hidden;
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+ padding: 0px 15px;
|
|
|
|
+ position: relative;
|
|
|
|
+
|
|
|
|
+ &::-webkit-scrollbar {
|
|
|
|
+ // display: none;
|
|
|
|
+ width: 10px;
|
|
|
|
+ height: 10px;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ &::-webkit-scrollbar-thumb {
|
|
|
|
+ background-color: rgb(226, 218, 218);
|
|
|
|
+ border-radius: 10px;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ &::-webkit-scrollbar-track {
|
|
|
|
+ border-radius: 2px;
|
|
|
|
+ }
|
|
|
|
|
|
.left {
|
|
.left {
|
|
// flex: 1 1 1;
|
|
// flex: 1 1 1;
|
|
// background: skyblue;
|
|
// background: skyblue;
|
|
- overflow-y: auto;
|
|
|
|
- overflow-x: hidden;
|
|
|
|
|
|
+ // overflow-y: auto;
|
|
|
|
+ // overflow-x: hidden;
|
|
width: 50%;
|
|
width: 50%;
|
|
- height: 100%;
|
|
|
|
|
|
+ // height: 100%;
|
|
|
|
|
|
min-width: 500px;
|
|
min-width: 500px;
|
|
padding-top: 10px;
|
|
padding-top: 10px;
|
|
|
|
|
|
- &::-webkit-scrollbar {
|
|
|
|
- // display: none;
|
|
|
|
- width: 10px;
|
|
|
|
- }
|
|
|
|
|
|
|
|
- &::-webkit-scrollbar-thumb {
|
|
|
|
- background-color: rgb(226, 218, 218);
|
|
|
|
- border-radius: 10px;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- &::-webkit-scrollbar-track {
|
|
|
|
- border-radius: 2px;
|
|
|
|
- }
|
|
|
|
|
|
|
|
.result-num {
|
|
.result-num {
|
|
padding-left: 5px;
|
|
padding-left: 5px;
|
|
@@ -721,19 +772,24 @@ export default {
|
|
// flex: 0 0 1;
|
|
// flex: 0 0 1;
|
|
// background: orange;
|
|
// background: orange;
|
|
padding: 10px 5px 5px 30px;
|
|
padding: 10px 5px 5px 30px;
|
|
|
|
+ position: sticky;
|
|
|
|
+ /* 使右边盒子固定 */
|
|
|
|
+ top: 0;
|
|
|
|
|
|
|
|
+ /* 顶部固定 */
|
|
.aside {
|
|
.aside {
|
|
position: relative;
|
|
position: relative;
|
|
height: 100%;
|
|
height: 100%;
|
|
|
|
+ width: 100%;
|
|
display: flex;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
|
|
|
.pdf {
|
|
.pdf {
|
|
position: absolute;
|
|
position: absolute;
|
|
- top: 0px;
|
|
|
|
- width: 100%;
|
|
|
|
|
|
+ top: -18px;
|
|
|
|
+ width: calc(100% + 20px);
|
|
min-height: 500px;
|
|
min-height: 500px;
|
|
- height: calc(100vh - 130px);
|
|
|
|
|
|
+ height: calc(100vh - 80px);
|
|
// overflow: auto;
|
|
// overflow: auto;
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
background: white;
|
|
background: white;
|