mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-11 11:56:51 +08:00
feat(RenderMinerU): 添加表格重新识别和撤销功能
- 新增 imageRetry 函数用于重新识别表格 - 添加撤销功能,可恢复到未识别状态 -优化按钮显示逻辑,只有在可编辑状态下显示撤销按钮 -调整公共样式,确保表格宽度占满
This commit is contained in:
@@ -257,3 +257,14 @@ export function queryTask(params) {
|
|||||||
params
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 识别页面表格
|
||||||
|
|
||||||
|
export function imageRetry(data) {
|
||||||
|
return request({
|
||||||
|
url: getUrl(`/document/mineru/img/retry`),
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
noLoading: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ body .el-collapse-item__wrap {
|
|||||||
table {
|
table {
|
||||||
border: 1px solid #f9f9f9;
|
border: 1px solid #f9f9f9;
|
||||||
position: relative;
|
position: relative;
|
||||||
//width: 100%;
|
width: 100%;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
background: linear-gradient(to bottom, #ffffff, #f9f9f9);
|
background: linear-gradient(to bottom, #ffffff, #f9f9f9);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getPdfUrl, minerUBbox, minerUMarkDown, minerUMarkDownUpdate, minerURetry, minerUQuery } from '@/api/generatedApi/index'
|
import { getPdfUrl, minerUBbox, minerUMarkDown, minerUMarkDownUpdate, minerURetry, minerUQuery, imageRetry } from '@/api/generatedApi/index'
|
||||||
import { DEFAULT_COLOR_SECTION, PDF_COLOR_PICKER } from './pdf-color'
|
import { DEFAULT_COLOR_SECTION, PDF_COLOR_PICKER } from './pdf-color'
|
||||||
import MarkdownIt from 'markdown-it'
|
import MarkdownIt from 'markdown-it'
|
||||||
import markdownItKatex from 'markdown-it-katex'
|
import markdownItKatex from 'markdown-it-katex'
|
||||||
@@ -57,6 +57,7 @@ export default {
|
|||||||
{
|
{
|
||||||
label: '重新识别',
|
label: '重新识别',
|
||||||
icon: 'el-icon-view',
|
icon: 'el-icon-view',
|
||||||
|
name: 'retry',
|
||||||
click: tableElement => {
|
click: tableElement => {
|
||||||
console.log('重新识别')
|
console.log('重新识别')
|
||||||
// 获取的 识别图片
|
// 获取的 识别图片
|
||||||
@@ -76,15 +77,14 @@ export default {
|
|||||||
// background: 'rgba(0, 0, 0, 0.8)',
|
// background: 'rgba(0, 0, 0, 0.8)',
|
||||||
text: 'AI模型分析中....'
|
text: 'AI模型分析中....'
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
|
||||||
loading.close()
|
this.retryMinerImage(chooseItem, loading, tableElement)
|
||||||
// tableElement.innerHTML = '<div>123</div>'
|
|
||||||
}, 3000)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '编辑',
|
label: '编辑',
|
||||||
|
name: 'edit',
|
||||||
icon: 'el-icon-edit-outline',
|
icon: 'el-icon-edit-outline',
|
||||||
click: tableElement => {
|
click: tableElement => {
|
||||||
this.copyTable = tableElement.innerHTML
|
this.copyTable = tableElement.innerHTML
|
||||||
@@ -94,12 +94,35 @@ export default {
|
|||||||
buttonContainer.innerHTML = null
|
buttonContainer.innerHTML = null
|
||||||
this.generateButton(tableElement, buttonContainer, this.tableActionConfirm)
|
this.generateButton(tableElement, buttonContainer, this.tableActionConfirm)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '撤销',
|
||||||
|
icon: 'el-icon-refresh-left',
|
||||||
|
name: 'refresh',
|
||||||
|
click: tableElement => {
|
||||||
|
this.$messageBox(
|
||||||
|
() => {
|
||||||
|
let chooseItem = this.findMatchingTable(tableElement)
|
||||||
|
let tableMatch = chooseItem.html.match(/<table>([\s\S]*)<\/table>/)
|
||||||
|
if (tableMatch) {
|
||||||
|
tableElement.innerHTML = tableMatch[1]
|
||||||
|
// tableElement 删除data-path-id
|
||||||
|
tableElement.removeAttribute('data-path-id')
|
||||||
|
tableElement.removeAttribute('data-path-type')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'是否撤销当前识别内容?',
|
||||||
|
'warning',
|
||||||
|
'撤销提醒'
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
tableActionConfirm: [
|
tableActionConfirm: [
|
||||||
{
|
{
|
||||||
label: '返回',
|
label: '返回',
|
||||||
icon: 'el-icon-refresh-left',
|
icon: 'el-icon-refresh-left',
|
||||||
|
name: 'back',
|
||||||
click: tableElement => {
|
click: tableElement => {
|
||||||
tableElement.classList.add('m-view')
|
tableElement.classList.add('m-view')
|
||||||
tableElement.setAttribute('contenteditable', 'false')
|
tableElement.setAttribute('contenteditable', 'false')
|
||||||
@@ -145,6 +168,23 @@ export default {
|
|||||||
components: {},
|
components: {},
|
||||||
filters: {},
|
filters: {},
|
||||||
methods: {
|
methods: {
|
||||||
|
//
|
||||||
|
retryMinerImage(chooseItem, loading, tableElement) {
|
||||||
|
imageRetry({
|
||||||
|
documentId: this.documentId,
|
||||||
|
imgName: chooseItem.image_path
|
||||||
|
}).then(res => {
|
||||||
|
if (res) {
|
||||||
|
loading.close()
|
||||||
|
let path = res.content.content
|
||||||
|
let tableMatch = path.match(/<table>([\s\S]*)<\/table>/)
|
||||||
|
if (tableMatch) {
|
||||||
|
tableElement.innerHTML = tableMatch[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
// 生成视觉模型
|
// 生成视觉模型
|
||||||
viewHtmlModel() {
|
viewHtmlModel() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
@@ -192,11 +232,15 @@ export default {
|
|||||||
let contenteditable = tableElement.getAttribute('contenteditable')
|
let contenteditable = tableElement.getAttribute('contenteditable')
|
||||||
// 根据可编辑状态选择按钮配置
|
// 根据可编辑状态选择按钮配置
|
||||||
let buttons = !actionButtons ? (contenteditable === 'false' ? this.tableActionButtons : this.tableActionConfirm) : actionButtons
|
let buttons = !actionButtons ? (contenteditable === 'false' ? this.tableActionButtons : this.tableActionConfirm) : actionButtons
|
||||||
|
let pathId = tableElement.getAttribute('data-path-id')
|
||||||
|
|
||||||
// 循环按钮配置,动态生成按钮并绑定点击事件
|
// 循环按钮配置,动态生成按钮并绑定点击事件
|
||||||
for (let i = 0; i < buttons.length; i++) {
|
for (let i = 0; i < buttons.length; i++) {
|
||||||
|
if (buttons[i].name === 'refresh' && !pathId && contenteditable === 'false') {
|
||||||
|
break
|
||||||
|
}
|
||||||
const icon = document.createElement('i')
|
const icon = document.createElement('i')
|
||||||
const button = document.createElement('button')
|
const button = document.createElement('button')
|
||||||
|
|
||||||
icon.className = `${buttons[i].icon} public-icon`
|
icon.className = `${buttons[i].icon} public-icon`
|
||||||
button.appendChild(icon)
|
button.appendChild(icon)
|
||||||
// 悬浮提示
|
// 悬浮提示
|
||||||
@@ -217,6 +261,12 @@ export default {
|
|||||||
if (pathId) {
|
if (pathId) {
|
||||||
let pathType = tableElement.getAttribute('data-path-type')
|
let pathType = tableElement.getAttribute('data-path-type')
|
||||||
this.selectionImagePath = pathId + pathType
|
this.selectionImagePath = pathId + pathType
|
||||||
|
chooseItem = this.selectionTable.find(item => {
|
||||||
|
if (item.image_path === this.selectionImagePath) {
|
||||||
|
return item
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
// 如果没有路径 ID,则通过表格内容匹配对照表
|
// 如果没有路径 ID,则通过表格内容匹配对照表
|
||||||
let tableText = this.getTableText(tableElement)
|
let tableText = this.getTableText(tableElement)
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ Vue.component('RMinerU', RenderMinerU)
|
|||||||
Vue.component('VEditor', VueEditor)
|
Vue.component('VEditor', VueEditor)
|
||||||
// 富文本编辑器 可视化代码
|
// 富文本编辑器 可视化代码
|
||||||
Vue.component('MEditor', MavonEditor)
|
Vue.component('MEditor', MavonEditor)
|
||||||
Vue.prototype.$messageBox = function(isOk, message, type) {
|
Vue.prototype.$messageBox = function(isOk, message, type, title) {
|
||||||
this.$confirm(message ? message : '是否确认删除当前数据', '提示', {
|
this.$confirm(message ? message : '是否确认删除当前数据', title ? title : '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: type ? type : 'error'
|
type: type ? type : 'error'
|
||||||
|
|||||||
Reference in New Issue
Block a user