mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-09 10:56:50 +08:00
feat(components): 优化 PDF 渲染和 Markdown 处理
- 在 RenderMinerU 组件中添加 loading 状态,提升用户体验- 重构 Markdown 数据处理逻辑,使用数组替代对象存储页面内容- 优化 PDF 详细信息获取流程,支持异步加载 - 在 lineEcharts 组件中增加空数据处理,确保图表正确显示
This commit is contained in:
@@ -48,6 +48,8 @@
|
||||
<div
|
||||
:class="!isEdit ? 'mt10 flex' : 'flex'"
|
||||
style="height:calc(100%);flex:1"
|
||||
v-loading="finishenEnd"
|
||||
element-loading-text="读取文档中..."
|
||||
>
|
||||
<iframe
|
||||
v-if="isShowPdf"
|
||||
@@ -121,7 +123,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
mdJsons: {},
|
||||
|
||||
finishenEnd: false,
|
||||
fileName: '',
|
||||
recordId: '', //pdf 记录的id
|
||||
endEmit: false,
|
||||
@@ -496,14 +498,16 @@ export default {
|
||||
// 保存markdown
|
||||
async saveMarkDown() {
|
||||
let promises = []
|
||||
for (let item in this.mdJsons) {
|
||||
|
||||
this.mdJsons.map(item => {
|
||||
let promise = contentUpdate({
|
||||
documentId: this.documentId,
|
||||
pageIndex: item,
|
||||
newMd: this.mdJsons[item]
|
||||
pageIndex: item.key,
|
||||
newMd: item.value
|
||||
})
|
||||
promises.push(promise)
|
||||
}
|
||||
})
|
||||
|
||||
try {
|
||||
await Promise.all(promises)
|
||||
this.$emit('saveMarkDown', true)
|
||||
@@ -618,23 +622,83 @@ export default {
|
||||
}
|
||||
})
|
||||
}
|
||||
this.mdJsons[this.page - 1] = pre
|
||||
|
||||
this.mdJsons.map(item => {
|
||||
if (item.key === this.page - 1) {
|
||||
item.value = pre
|
||||
}
|
||||
})
|
||||
|
||||
// this.mdJsons[this.page - 1] = pre
|
||||
this.markdownHtml = md.render(
|
||||
this.mdJsons[this.page - 1].replace(/class="m-view"/g, '')
|
||||
this.mdJsons
|
||||
.find(item => item.key === this.page - 1)
|
||||
.value.replace(/class="m-view"/g, '')
|
||||
)
|
||||
},
|
||||
// 初始md 文档
|
||||
async getPDFDetailMarkDown() {
|
||||
if (this.mdJsons[this.page - 1]) {
|
||||
this.markdown = this.mdJsons[this.page - 1]
|
||||
if (this.mdJsons.length > 0) {
|
||||
let findValue = this.mdJsons.find(item => item.key === this.page - 1)
|
||||
.value
|
||||
if (findValue) {
|
||||
this.markdown = findValue
|
||||
} else {
|
||||
// 将所有md 更新到本地 后续所有操作都将在本地进行处理
|
||||
this.finishenEnd = true
|
||||
|
||||
let values = await mdIndex({
|
||||
index: this.page - 1,
|
||||
documentId: this.documentId
|
||||
})
|
||||
this.mdJsons.push({
|
||||
key: this.page - 1,
|
||||
value: values
|
||||
})
|
||||
|
||||
// this.markdown = this.mdJsons[this.page - 1].value
|
||||
this.finishenEnd = false
|
||||
}
|
||||
} else {
|
||||
this.mdJsons[this.page - 1] = await mdIndex({
|
||||
index: this.page - 1,
|
||||
documentId: this.documentId
|
||||
})
|
||||
this.markdown = this.mdJsons[this.page - 1]
|
||||
// 将所有md 更新到本地 后续所有操作都将在本地进行处理
|
||||
this.finishenEnd = true
|
||||
let array = []
|
||||
for (let i = 0; i < this.mdPges; i++) {
|
||||
// if (i == 3) {
|
||||
// array.push({
|
||||
// key: i,
|
||||
// value: '401'
|
||||
// })
|
||||
// } else {
|
||||
let values = await mdIndex({
|
||||
index: i,
|
||||
documentId: this.documentId
|
||||
})
|
||||
array.push({
|
||||
key: i,
|
||||
value: values
|
||||
})
|
||||
// }
|
||||
}
|
||||
this.mdJsons = array
|
||||
this.markdown = this.mdJsons.find(
|
||||
item => item.key === this.page - 1
|
||||
).value
|
||||
// this.markdown = this.mdJsons[this.page - 1].value
|
||||
this.finishenEnd = false
|
||||
}
|
||||
|
||||
// if (
|
||||
// this.mdJsons.length > 0 &&
|
||||
// this.mdJsons.find(item => item.key === this.page - 1).value
|
||||
// ) {
|
||||
// this.markdown = this.mdJsons.find(
|
||||
// item => item.key === this.page - 1
|
||||
// ).value
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
|
||||
this.renderMarkDown()
|
||||
},
|
||||
// 向 iframe 发送消息
|
||||
|
||||
Reference in New Issue
Block a user