[update OCR识别] 暂无搜索

This commit is contained in:
danshihao
2024-07-19 10:04:36 +08:00
parent a5fcafceca
commit 56a765364c
6 changed files with 351 additions and 51 deletions
+14
View File
@@ -555,6 +555,20 @@ module.exports = {
publishComment: 'Comment',
noComment: 'No Comments',
replyToComments: 'Reply To Comments'
},
// OCR文本识别
ocrTextRecognition: {
upload: 'Upload',
getFile: 'Get files',
standardCategory: 'Standard category',
standardNumber: 'Standard number',
standardName: 'Standard Name',
textStatus: 'Text status',
conversionResults: 'Conversion results',
conversionStatus: 'Transition state',
timeConsuming: 'Time consumption (seconds)',
file: 'File',
uploadPdf: 'Upload PDF'
}
},
// 业务支持
+4 -1
View File
@@ -622,8 +622,11 @@ module.exports = {
standardName: '标准名称',
textStatus: '文本状态',
conversionResults: '转换结果',
conversionStatus: '转换状态',
timeConsuming: '消耗时间(秒)',
file: '文件'
file: '文件',
uploadPdf: '上传PDF',
manuallySearch: '手动查找'
}
},
// 业务支持
+6
View File
@@ -253,3 +253,9 @@ export const IsDistribute = {
export const DecompositionSource = {
NO_INPUT: { text: '不带入', value: 'noncarry' }
}
// OCR识别-转换状态
export const OcrConvertStateEnums = {
CONVERTING: { text: '转换中', value: '1' },
CONVERTED: { text: '转换完成', value: '2' }
}
@@ -1,5 +1,36 @@
<template>
<a-card :bordered="false">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<!--标准号/标准名称-->
<a-col :md="6" :sm="12">
<a-form-item :label="$t('standardSelect.standardNumOrName')">
<a-input :placeholder="$t('pleaseEnter') + $t('standardSelect.standardNumOrName')"
v-model="queryParam.serialNumberOrName"></a-input>
</a-form-item>
</a-col>
<!--转换状态-->
<a-col :md="6" :sm="12">
<a-form-item :label="$t('docTool.ocrTextRecognition.conversionStatus')">
<j-dict-select-tag
class="box-input"
v-model="queryParam.splitStatus"
:placeholder="$t('pleaseSelect') + $t('docTool.ocrTextRecognition.conversionStatus')"
:type="'select'"
:triggerChange="false"
dictCode="transition_status" />
</a-form-item>
</a-col>
<div style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 8px" v-has="'split:sarFileSplitInfo:search'">
{{ $t('query') }}
</a-button>
<a-button type="primary" @click="searchReset" icon="reload" ghost>{{ $t('reset') }}</a-button>
</div>
</a-row>
</a-form>
</div>
<div class="table-operator">
<!-- 上传 -->
<a-button icon="plus" type="primary" @click="handleAdd" v-has="'docTool:ocrTextRecognition:add'">{{$t('docTool.ocrTextRecognition.upload') }}</a-button>
@@ -16,11 +47,16 @@
:pagination="ipagination"
:scroll="{x: '100%', y: yScrollHeight}"
:loading="loading"
:operation-list="operationList"
@change="handleTableChange"
@operationClick="operationClick">
@change="handleTableChange">
<!--跳转标准详情-->
<template v-slot:action="{text, record}">
<!--获取文件-->
<a @click="handleDownload(record)"
v-has="'docTool:ocrTextRecognition:download'"
:disabled="record.resultContent !== OcrConvertStateEnums.CONVERTED.value">{{ $t('docTool.ocrTextRecognition.getFile') }}</a>
</template>
<!--转换状态-->
<template v-slot:tag="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
@@ -29,6 +65,14 @@
</a-tooltip>
</template>
<!--跳转详情-->
<template v-slot:toDetail="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toStandardDetail(record)">{{ text }}</div>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
</j-table>
</div>
<!-- 新增编辑弹框 -->
@@ -41,6 +85,7 @@ import { JeroListMixin } from '@/mixins/JeroListMixin'
import JTable from '@comp/jero/JTable'
import OcrTextRecognitionModal from '@views/documentTool/ocrTextRecognition/modules/OcrTextRecognitionModal'
import { downloadFile, getAction, postAction } from '@api/manage'
import { OcrConvertStateEnums } from '@/enums/commonEnums'
export default {
name: 'OcrTextRecognition',
@@ -48,6 +93,7 @@ export default {
mixins: [JeroListMixin],
data () {
return {
OcrConvertStateEnums,
url: {
list: '/laws/ocr/OCRRestful/getAllOcrResult',
deleteBatch: '/laws/ocr/OCRRestful/deleteOcrRecord'
@@ -73,14 +119,14 @@ export default {
align: 'center',
width: 180,
dataIndex: 'standNumber',
scopedSlots: { customRender: 'text' }
scopedSlots: { customRender: 'toDetail' }
},
{ // 标准名称
title: this.$t('docTool.ocrTextRecognition.standardName'),
align: 'center',
width: 180,
dataIndex: 'standName',
scopedSlots: { customRender: 'text' }
scopedSlots: { customRender: 'toDetail' }
},
{ // 文本状态
title: this.$t('docTool.ocrTextRecognition.textStatus'),
@@ -93,7 +139,7 @@ export default {
title: this.$t('docTool.ocrTextRecognition.conversionResults'),
align: 'center',
width: 180,
dataIndex: 'resultContent',
dataIndex: 'resultContent_dictText',
scopedSlots: { customRender: 'tag' }
},
{ // 消耗时间
@@ -110,36 +156,20 @@ export default {
fixed: 'right',
width: 200
}
],
operationList: [
// 获取文件
{
text: this.$t('docTool.ocrTextRecognition.getFile'),
clickEvent: 'handleDownload',
has: 'docTool:ocrTextRecognition:download',
show: (record) => {
return record.resultContent !== '转换中'
}
},
// 编辑
{
text: this.$t('edit'),
clickEvent: 'handleEdit',
has: 'docTool:ocrTextRecognition:edit'
}
// 删除
// {
// text: this.$t('delete'),
// clickEvent: 'handleDelete',
// has: 'split:sarFileSplitInfo:release'
// }
]
}
},
mounted () {
console.log(this.$refs.modalForm)
},
methods: {
// 跳转详情
toStandardDetail () {
const { standardId } = this.info.data.processStandardInterpret
this.$openPageNewSheet({
path: '/standardRegulationLibrary/foreignStandardDetailPage',
query: {
id: standardId
}
})
},
loadData (arg) {
if (!this.url.list) {
this.$message.warning('请设置url.list属性!')
@@ -171,9 +201,9 @@ export default {
downloadFile(`/sys/common/download/${data.wordAttId}`, data.docRealName)
},
getTagColor (row) {
if (row.resultContent === '转换成功') {
if (row.resultContent === OcrConvertStateEnums.CONVERTED.value) {
return 'green'
} else if (row.resultContent === '转换中') {
} else if (row.resultContent === OcrConvertStateEnums.CONVERTING.value) {
return 'blue'
} else {
return 'red'
@@ -0,0 +1,216 @@
<template>
<a-drawer
:title="title"
placement="right"
:visible="visible"
@close="onClose"
width="1100"
class="custom-drawer-style">
<div class="custom-drawer-style-scroll">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-row :gutter="24">
<!--来源-->
<a-col :md="8" :sm="12">
<a-form-item :label="$t('docTool.comparison.standardStructureTree')">
<j-dict-select-tag style="width: 100%" v-model="queryParam.source"
disabled
:placeholder="$t('pleaseSelect')+$t('standardSelect.source')"
:triggerChange="false"
dict-code="standard_source" />
</a-form-item>
</a-col>
<!--标准号-->
<a-col :md="8" :sm="12">
<a-form-item :label="$t('standardSelect.standardNumber')">
<a-input :placeholder="$t('pleaseEnter') + $t('standardSelect.standardNumber')"
v-model="queryParam.standardNumber"></a-input>
</a-form-item>
</a-col>
<!--标准名称-->
<a-col :md="8" :sm="12">
<a-form-item :label="$t('standardSelect.standardName')">
<a-input :placeholder="$t('pleaseEnter') + $t('standardSelect.standardName')"
v-model="queryParam.standardName"></a-input>
</a-form-item>
</a-col>
</a-row>
</a-form>
<div class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">
{{ $t('query') }}
</a-button>
<a-button type="primary" @click="searchReset" icon="reload" ghost style="margin-left: 8px">{{ $t('reset') }}</a-button>
</div>
</div>
<j-table
:columns="columns"
:dataSource="dataSource"
:can-drag="true"
rowKey="id"
:loading="loading"
:scroll="{x: '100%'}"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio' }"
:pagination="ipagination"
@change="handleTableChange">
</j-table>
</div>
<div class="custom-drawer-style-bottom-btn">
<a-button @click="cancelSplit" style='margin-right: 15px'>{{ $t('cancel') }}</a-button>
<a-button type="primary" :loading="loading" @click="handleSubmit">{{ $t('submit') }}</a-button>
</div>
</a-drawer>
</template>
<script>
import JTable from '../../../../components/jero/JTable.vue'
import { JeroListMixin } from '../../../../mixins/JeroListMixin.js'
import { getForeignStandardTree } from '@api/standardRegulationLibraryApi'
import { filterObj } from '@/utils/util'
import { StandardSource } from '@/enums/commonEnums'
export default {
name: 'OcrSelectStandard',
components: { JTable },
mixins: [JeroListMixin],
data () {
return {
title: this.$t('standardSelect.standardSelection'),
visible: false,
loading: false,
labelCol: {
span: 6
},
wrapperCol: {
span: 14
},
columns: [
// 资料类型
{
dataIndex: 'origin_dictText',
title: this.$t('docTool.split.dataType'),
width: 150
},
// 标准号
{
dataIndex: 'standardNumber',
title: this.$t('standardSelect.standardNumber'),
width: 150
},
// 标准名称
{
dataIndex: 'standardName',
title: this.$t('standardSelect.standardName'),
width: 150
},
// 文件状态
{
dataIndex: 'standardFileType_dictText',
title: this.$t('docTool.comparison.textStatus'),
width: 150
},
// 附件
{
dataIndex: 'fileName',
title: this.$t('businessSupport.questionAnswer.attach'),
width: 150
}
],
url: {
list: '/laws/DocumentTool/documentSplit/querySplitFileInfoByPage' // 表格数据
},
type: 'pdfdoc',
operationList: [],
showAction: false,
flag: 'header',
disableMixinCreated: true,
// 标准结构树
standardStructureTree: [],
filters: {
fileSuffix: '.pdf'
},
// 默认查询参数
defaultQueryParam: {
source: StandardSource.FOREIGN.value
}
}
},
created () {
// this.loadStandardStructureTree()
},
methods: {
getQueryParams () {
// 获取查询条件
const sqp = {}
if (this.superQueryParams) {
sqp.superQueryParams = encodeURI(this.superQueryParams)
sqp.superQueryMatchType = this.superQueryMatchType
}
const param = Object.assign(sqp, this.queryParam, this.isorter, this.filters)
param.field = this.getQueryField()
param.pageNo = this.ipagination.current
param.pageSize = this.ipagination.pageSize
if (Array.isArray(param.standardSystem)) {
param.standardSystem = param.standardSystem.map(item => item.value).join(',')
}
return filterObj(param)
},
// 加载标准结构树
loadStandardStructureTree () {
// option 不传显示我的收藏,1不显示我的收藏
getForeignStandardTree({ option: 1 }).then(res => {
if (res.success) {
console.log(res.result)
this.standardStructureTree = res.result || []
}
})
},
open () {
this.visible = true
this.queryParam = Object.assign({}, this.defaultQueryParam)
this.loadData(1)
},
searchReset () {
this.queryParam = Object.assign({}, this.defaultQueryParam)
this.loadData(1)
},
// 抽屉关闭
onClose () {
this.visible = false
this.onClearSelected()
},
// 取消
cancelSplit () {
this.onClose()
},
// 提交
handleSubmit () {
if (this.loading) {
return
}
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('selectOne'))
return
}
this.$emit('ok', this.selectionRows[0])
this.onClose()
}
}
}
</script>
<style scoped lang="less">
@import '~../../../../assets/less/common.less';
.table-page-search-wrapper {
display: flex;
.ant-form {
flex: 1;
}
}
.table-page-search-submitButtons {
margin-left: 10px;
}
</style>
@@ -12,21 +12,19 @@
style="top:5%;overflow-y: hidden">
<a-spin :spinning="confirmLoading">
<a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 16 }">
<!--文件-->
<a-form-item label="文件">
<j-upload v-decorator="['attId', validatorRules.attId]"
@change="changeAttIdFile"
:number="1"
return-id
class="line-btn"
accept=".pdf"
file-type="pdf" />
</a-form-item>
<!--标准编号-->
<a-form-item :label="$t('docTool.ocrTextRecognition.standardNumber')">
<standard-selection :placeholder="$t('pleaseSelect') + $t('docTool.ocrTextRecognition.standardNumber')"
@nameChange="changeStandardName" type="radio"
v-decorator="['standNumber']" />
<div class="box-title-text">
<a-input class="box-input"
v-decorator="['standNumber']"
:title="model.standNumber"
:max-length="500"
:placeholder="$t('pleaseSelect') + $t('docTool.ocrTextRecognition.standardNumber')">
</a-input>
<a-button type="primary" style="margin-left: 8px;" @click="openSelectStandard">
{{ $t('docTool.ocrTextRecognition.manuallySearch') }}
</a-button>
</div>
</a-form-item>
<!--标准名称-->
<a-form-item :label="$t('docTool.ocrTextRecognition.standardName')">
@@ -36,6 +34,10 @@
</a-form-item>
<!--文本状态-->
<a-form-item :label="$t('docTool.ocrTextRecognition.textStatus')">
<!-- TODO 现在是传文字,应该后续要改成数据字典-->
<!--<j-dict-select-tag dict-code="decomposition_source"-->
<!-- :placeholder="$t('pleaseSelect') + $t('docTool.ocrTextRecognition.textStatus')"-->
<!-- v-decorator.trim="['fileType', validatorRules.fileType]"/>-->
<a-select
:placeholder="$t('pleaseSelect') + $t('docTool.ocrTextRecognition.textStatus')"
v-decorator="['fileType', validatorRules.fileType]"
@@ -45,20 +47,33 @@
<a-select-option v-for="item in fileTypeList" :key="item.value" :value="item.value">{{ item.text || item.label }}</a-select-option>
</a-select>
</a-form-item>
<!--上传文件-->
<a-form-item :label="$t('docTool.ocrTextRecognition.uploadPdf')">
<j-upload v-decorator="['attId', validatorRules.attId]"
@change="changeAttIdFile"
:number="1"
return-id
class="line-btn"
accept=".pdf"
file-type="pdf" />
</a-form-item>
</a-form>
</a-spin>
<!--选择标准弹框-->
<ocr-select-standard ref="selectStandard" @ok="selectStandardCallback"/>
</j-modal>
</template>
<script>
import StandardSelection from '@comp/selection/StandardSelection'
import { getFileInfo } from '@api/api'
import { postAction } from '@api/manage'
import pick from 'lodash.pick'
import OcrSelectStandard from '@views/documentTool/ocrTextRecognition/modules/OcrSelectStandard'
export default {
name: 'OcrTextRecognitionModal',
components: { StandardSelection },
components: { OcrSelectStandard },
data () {
return {
form: this.$form.createForm(this),
@@ -72,6 +87,7 @@ export default {
// 文本状态下拉
fileTypeList: [
{ label: '修改单', value: '修改单' },
{ label: 'TBT通报文件', value: 'TBT通报文件' },
{ label: '草稿', value: '草稿' },
{ label: '报批稿', value: '报批稿' },
{ label: '发布稿(原文)', value: '发布稿(原文)' },
@@ -99,6 +115,21 @@ export default {
}
},
methods: {
// 打开选择标准弹框
openSelectStandard () {
this.$refs.selectStandard.open()
},
// 选择标准回调
selectStandardCallback (data) {
console.log('选择标准:', data)
this.model.standNumber = data.standNumber
this.form.setFieldsValue({
attId: data.id,
standName: data.standardName,
standNumber: data.standardNumber,
fileType: data.standardFileType_dictText
})
},
add () {
this.edit()
},