mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-11 20:06:52 +08:00
feat(components): 优化 PDF 渲染和 Markdown 处理
- 在 RenderMinerU 组件中添加 loading 状态,提升用户体验- 重构 Markdown 数据处理逻辑,使用数组替代对象存储页面内容- 优化 PDF 详细信息获取流程,支持异步加载 - 在 lineEcharts 组件中增加空数据处理,确保图表正确显示
This commit is contained in:
@@ -48,6 +48,8 @@
|
|||||||
<div
|
<div
|
||||||
:class="!isEdit ? 'mt10 flex' : 'flex'"
|
:class="!isEdit ? 'mt10 flex' : 'flex'"
|
||||||
style="height:calc(100%);flex:1"
|
style="height:calc(100%);flex:1"
|
||||||
|
v-loading="finishenEnd"
|
||||||
|
element-loading-text="读取文档中..."
|
||||||
>
|
>
|
||||||
<iframe
|
<iframe
|
||||||
v-if="isShowPdf"
|
v-if="isShowPdf"
|
||||||
@@ -121,7 +123,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
mdJsons: {},
|
mdJsons: {},
|
||||||
|
finishenEnd: false,
|
||||||
fileName: '',
|
fileName: '',
|
||||||
recordId: '', //pdf 记录的id
|
recordId: '', //pdf 记录的id
|
||||||
endEmit: false,
|
endEmit: false,
|
||||||
@@ -496,14 +498,16 @@ export default {
|
|||||||
// 保存markdown
|
// 保存markdown
|
||||||
async saveMarkDown() {
|
async saveMarkDown() {
|
||||||
let promises = []
|
let promises = []
|
||||||
for (let item in this.mdJsons) {
|
|
||||||
|
this.mdJsons.map(item => {
|
||||||
let promise = contentUpdate({
|
let promise = contentUpdate({
|
||||||
documentId: this.documentId,
|
documentId: this.documentId,
|
||||||
pageIndex: item,
|
pageIndex: item.key,
|
||||||
newMd: this.mdJsons[item]
|
newMd: item.value
|
||||||
})
|
})
|
||||||
promises.push(promise)
|
promises.push(promise)
|
||||||
}
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await Promise.all(promises)
|
await Promise.all(promises)
|
||||||
this.$emit('saveMarkDown', true)
|
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.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 文档
|
// 初始md 文档
|
||||||
async getPDFDetailMarkDown() {
|
async getPDFDetailMarkDown() {
|
||||||
if (this.mdJsons[this.page - 1]) {
|
if (this.mdJsons.length > 0) {
|
||||||
this.markdown = this.mdJsons[this.page - 1]
|
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 {
|
} else {
|
||||||
this.mdJsons[this.page - 1] = await mdIndex({
|
// 将所有md 更新到本地 后续所有操作都将在本地进行处理
|
||||||
index: this.page - 1,
|
this.finishenEnd = true
|
||||||
documentId: this.documentId
|
let array = []
|
||||||
})
|
for (let i = 0; i < this.mdPges; i++) {
|
||||||
this.markdown = this.mdJsons[this.page - 1]
|
// 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()
|
this.renderMarkDown()
|
||||||
},
|
},
|
||||||
// 向 iframe 发送消息
|
// 向 iframe 发送消息
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import '@/assets/js/business-common'
|
||||||
import uuid from 'uuid'
|
import uuid from 'uuid'
|
||||||
export default {
|
export default {
|
||||||
name: 'overveiw',
|
name: 'overveiw',
|
||||||
@@ -104,6 +105,10 @@ export default {
|
|||||||
xAxis: {
|
xAxis: {
|
||||||
...this.options.xAxis,
|
...this.options.xAxis,
|
||||||
type: 'category',
|
type: 'category',
|
||||||
|
data:
|
||||||
|
this.options.xAxis.data.length > 0
|
||||||
|
? this.options.xAxis.data
|
||||||
|
: [new Date().format('yyyy-MM-dd')],
|
||||||
splitLine: this.echartsSetXAxisLine()
|
splitLine: this.echartsSetXAxisLine()
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
@@ -121,7 +126,8 @@ export default {
|
|||||||
? this.echartsSetSeriesColor(item.areaStyle.color)
|
? this.echartsSetSeriesColor(item.areaStyle.color)
|
||||||
: null
|
: null
|
||||||
},
|
},
|
||||||
type: 'line'
|
type: 'line',
|
||||||
|
data: item.data.length > 0 ? item.data : [0]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user