Initial commit

This commit is contained in:
danshihao
2024-06-11 15:39:01 +08:00
commit 00acf31aa3
1589 changed files with 520803 additions and 0 deletions
@@ -0,0 +1,220 @@
<template>
<a-card :bordered="false">
<div class="table-operator">
<!-- 上传 -->
<a-button icon="plus" type="primary" @click="handleAdd" v-has="'docTool:ocrTextRecognition:add'">{{$t('docTool.ocrTextRecognition.upload') }}</a-button>
<!-- 批量删除 -->
<a-button type="primary" icon="delete" ghost @click="batchDel" v-has="'docTool:ocrTextRecognition:batchDel'">{{$t('batchDelete')}}</a-button>
</div>
<div>
<j-table
:columns="columns"
:dataSource="dataSource"
:can-drag="true"
rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:pagination="ipagination"
:scroll="{x: '100%', y: yScrollHeight}"
:loading="loading"
:operation-list="operationList"
@change="handleTableChange"
@operationClick="operationClick">
<!--跳转标准详情-->
<template v-slot:tag="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text" v-if="text || text === 0"><a-tag :color="getTagColor(record)">{{ text }}</a-tag></div>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
</j-table>
</div>
<!-- 新增编辑弹框 -->
<ocr-text-recognition-modal ref="modalForm" @ok="modalFormOk"/>
</a-card>
</template>
<script>
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'
export default {
name: 'OcrTextRecognition',
components: { OcrTextRecognitionModal, JTable },
mixins: [JeroListMixin],
data () {
return {
url: {
list: '/laws/ocr/OCRRestful/getAllOcrResult',
deleteBatch: '/laws/ocr/OCRRestful/deleteOcrRecord'
},
columns: [
{ // 序号
title: this.$t('serialNumber'),
key: 'rowIndex',
width: 80,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
// { // 标准类别
// title: this.$t('docTool.ocrTextRecognition.standardCategory'),
// align: 'center',
// width: 180,
// dataIndex: 'fileType2',
// scopedSlots: { customRender: 'text' }
// },
{ // 标准编号
title: this.$t('docTool.ocrTextRecognition.standardNumber'),
align: 'center',
width: 180,
dataIndex: 'standNumber',
scopedSlots: { customRender: 'text' }
},
{ // 标准名称
title: this.$t('docTool.ocrTextRecognition.standardName'),
align: 'center',
width: 180,
dataIndex: 'standName',
scopedSlots: { customRender: 'text' }
},
{ // 文本状态
title: this.$t('docTool.ocrTextRecognition.textStatus'),
align: 'center',
width: 180,
dataIndex: 'fileType',
scopedSlots: { customRender: 'text' }
},
{ // 转换结果
title: this.$t('docTool.ocrTextRecognition.conversionResults'),
align: 'center',
width: 180,
dataIndex: 'resultContent',
scopedSlots: { customRender: 'tag' }
},
{ // 消耗时间
title: this.$t('docTool.ocrTextRecognition.timeConsuming'),
align: 'center',
width: 180,
dataIndex: 'spendTime',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('operation'),
scopedSlots: { customRender: 'action' },
align: 'center',
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: {
loadData (arg) {
if (!this.url.list) {
this.$message.warning('请设置url.list属性!')
return
}
// 加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1
}
const params = this.getQueryParams()// 查询条件
console.log(params)
this.loading = true
postAction(this.url.list, params).then((res) => {
if (res.ok) {
this.dataSource = res.data.list
if (res.data.count) {
this.ipagination.total = res.data.count
} else {
this.ipagination.total = 0
}
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
handleDownload (data) {
downloadFile(`/sys/common/download/${data.wordAttId}`, data.docRealName)
},
getTagColor (row) {
if (row.resultContent === '转换成功') {
return 'green'
} else if (row.resultContent === '转换中') {
return 'blue'
} else {
return 'red'
}
},
batchDel: function () {
if (!this.url.deleteBatch) {
this.$message.warning('请设置url.deleteBatch属性!')
return
}
if (this.selectedRowKeys.length <= 0) {
this.$message.warning(this.$t('selectARecord'))
} else {
const ids = this.selectedRowKeys.join(',')
const that = this
this.$confirm({
title: this.$t('confirmBatchDeletion'),
content: this.$t('deleteAData'),
onOk: function () {
that.loading = true
getAction(that.url.deleteBatch, { ids: ids }).then((res) => {
if (res.ok) {
// 重新计算分页问题
that.reCalculatePage(that.selectedRowKeys.length)
that.$message.success(res.message)
that.loadData()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.loading = false
})
}
})
}
}
}
}
</script>
<style scoped>
</style>