标签编辑

This commit is contained in:
caoyang
2022-02-16 18:09:58 +08:00
parent 21e51bf25b
commit e703c1cc63
5 changed files with 671 additions and 2 deletions
@@ -183,7 +183,7 @@
</div>
</a-row>
</div>
<uploadFile ref="uploadFile" :disabled="disabled" @uploadSuccess="uploadSuccess"></uploadFile>
<uploadFile ref="uploadFile" @uploadSuccess="uploadSuccess"></uploadFile>
</a-form-model>
</a-spin>
</template>
+148
View File
@@ -0,0 +1,148 @@
<template>
<div class="ocr-upload">
<a-modal v-model="visible" :maskClosable="false" :footer="[]" :title="title">
<a-upload-dragger
accept='*.*'
:disabled="disabled"
class="ant-upload-list"
name="file"
:file-list="myfileList"
:multiple="true"
:action = 'uploadAction'
:headers="headers"
:before-upload="beforeUpload"
:remove='remove'
@change="handleChange">
<p><a-icon style="font-size: 67px;color: #c0c4cc;" type="cloud-upload" /></p>
<p class="ant-upload-text" style="font-size: 14px;line-height: 30px">点击上传</p>
</a-upload-dragger>
</a-modal>
</div>
</template>
<script>
import Vue from 'vue'
import { ACCESS_TOKEN } from "@/store/mutation-types"
export default {
name: 'ocrUpload',
props:['disableds','disabled','thisFileUploadUrl','readonly','thisFileType'],
data(){
return{
visible:false,
uploadAction:window._CONFIG['domianURL']+"/sys/common/upload",
downLoadFileUrl:window._CONFIG['domianURL']+'/sys/common/static',
myfileList:[],
fileList:[],
fileTypeSatus:false,
headers:{},
title:'上传文件'
}
},
created(){
const token = Vue.ls.get(ACCESS_TOKEN);
this.headers = {"X-Access-Token":token};
this.containerId = 'container-ty-'+new Date().getTime();
},
mounted(){
// console.log(this.thisFileType,this.thisFileSize,this.thisFileUploadUrl);
},
methods:{
beforeUpload(file) {
console.log(file)
// let thisFileType = this.thisFileType.replace(/\s+/g, "");
this.fileTypeSatus = true;
this.$message.destroy()
// 207M.doc文件大小超出100MB限制, 请压缩或降低文件质量!
this.errorMessage = file.name + "文件大小超出100MB限制, 请压缩或降低文件质量!";
},
remove(){
this.fileTypeSatus = true;
},
handleChange(info) {
console.log('info',info)
let { file } = info;
const status = info.file.status;
info.fileList.forEach((val,index)=>{
if(val.response && !val.response.result){
this.$message.error(val.response.message);
info.fileList.splice(index,1)
}
})
if (this.fileTypeSatus) {
if (file.size > 100000000) {
this.$message.error(this.errorMessage)
return
}else {
if (status === 'error') {
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.error(`${info.file.name} 文件上传失败。`);
} else if (status === 'removed') {
this.myfileList = info.fileList;
this.fileList = []
this.myfileList.forEach((res) => {
if (res.response) {
this.fileList.push(res.response.result)
} else {
this.fileList.push(res)
}
})
this.$emit('uploadSuccess', this.fileList)
if(this.myfileList.length > 0){
this.$message.destroy()
this.$message.success(`${info.file.name} 删除成功。`);
}
} else if (status === 'done') {
this.fileList = []
this.myfileList = info.fileList;
console.log('file3333',info.fileList)
if (info.fileList.length > 20) {
info.fileList.splice(20)
// this.myfileList = info.fileList;
this.myfileList.forEach((res) => {
if (res.response) {
this.fileList.push(res.response.result)
} else {
this.fileList.push(res)
}
})
console.log('file1111',this.fileList)
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.error('最多只能上传二十个');
return
}
console.log('my222',this.myfileList)
this.myfileList.forEach((res) => {
if (res.response) {
this.fileList.push(res.response.result)
console.log('flist',res.response)
} else {
this.fileList.push(res)
}
})
if(this.myfileList.length > 0){
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.success(`${info.file.name} 文件上传成功。`);
}
} else if (status === 'uploading') {
this.myfileList = info.fileList;
this.$emit('uploadSuccess')
// this.$message.success(`${info.file.name} 文件上传成功。`);
}
}
}else{
this.$message.warning('不支持上传该类型的文件!')
}
},
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,510 @@
<template>
<div class="ocr">
<div class="table-page-search-wrapper">
<!-- <search :flag="'1'" :url="url"/>-->
<div class="ocr-search-header">
<a-form layout="inline" @keyup.enter.native="searchQuery(queryParams)">
<a-row :gutter="24">
<a-col :md="6" :sm="12">
<a-form-item :label="'编号'">
<j-input :placeholder="'请输入编号'" v-model="queryParams.standNumber"></j-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="12">
<a-form-item :label="'标题'">
<j-input :placeholder="'请输入标题'" v-model="queryParams.standName"></j-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-form-item :label="'转换结果'">
<a-select v-model="queryParams.transformation" :placeholder="$t('pleaseSelect')">
<a-select-option :value="item.value" v-for="(item) in transOptions">{{item.label}}</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">{{$t('query')}}</a-button>
<a-button @click="searchReset" icon="reload" style="margin-left: 8px">清空</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
</div>
<div class="table-operator">
<a-button @click="handleUpload()" type="primary">上传</a-button>
<a-button @click="handleFileExport()" type="primary">调取已入库文件</a-button>
<a-button @click="handleDel()" type="primary">批量删除</a-button>
</div>
<!-- 上传弹框-->
<a-modal
class="show-content"
title="上传文件"
:visible="fileVisible"
:confirm-loading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
v-if="fileVisible"
>
<a-form-model
class="tag-content"
ref="fileForm"
:model="form"
:rules="rules"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-form-model-item ref="file" label="文件" prop="file">
<a-button type="primary" class="button-text"
@click="fileUpload()">
{{ (file === 'null' || file === '' ||
file == null) ? '点击上传' : '查看已上传文件'
}}
</a-button>
<!-- <a-button @click="fileUpload" type="primary">点击上传</a-button>-->
</a-form-model-item>
<a-form-model-item ref="standNumber" label="编号" prop="standNumber">
<a-input
v-model="form.standNumber"
placeholder="请输入编号"
/>
</a-form-model-item>
<a-form-model-item ref="standName" label="名称" prop="standName">
<a-input
v-model="form.standName"
placeholder="请输入名称"
/>
</a-form-model-item>
<a-form-model-item label="文本状态" prop="fileType">
<j-dict-select-tag type="list" v-model="form.fileType" dictCode="file_type" placeholder="请选择文本状态" />
</a-form-model-item>
</a-form-model>
</a-modal>
<!-- 同步弹框-->
<a-modal
class="show-content"
title="同步至文档库"
v-if="toVisible"
:visible="toVisible"
:confirm-loading="confirmLoading"
@ok="handleOkTo"
@cancel="handleCancelTo"
>
<p style="text-align: center">该文件未进行校验,确定要同步至文档库?</p>
</a-modal>
<!-- 校核弹框-->
<a-modal
class="show-content"
title="校核"
v-if="checkVisible"
:visible="checkVisible"
:confirm-loading="confirmLoading"
@ok="handleOkCheck"
@cancel="handleCancelCheck"
>
<p style="text-align: center">确定对该文件未进行校验?</p>
</a-modal>
<div class="table-detail">
<a-table bordered :data-source="tableSorce" :columns="columns" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" class="tag-con-table" :pagination="ipagination" >
<template slot="action" slot-scope="text, record">
<a class="action action-syn" href="javascript:;" @click="actionSynchron(record)">同步至文档库</a>
<a class="action action-check" href="javascript:;" @click="actionCheck(record)">校核</a>
<a class="action action-down" href="javascript:;" @click="actionDown(record)">下载</a>
<a-popconfirm
v-if="tableSorce.length"
title="Sure to delete?"
@confirm="() => onDelete(record)"
>
<a class="action action-delete" href="javascript:;" @click="actionDelete(record)">删除</a>
</a-popconfirm>
</template>
</a-table>
</div>
<addForm
ref="addFormRef"
:url="url"
:flag="'1'"
/>
<frameAssembly
:url="url"
ref="frameAssemblyRef"
/>
<ocr-upload ref="uploadFile" :disabled="disabled" @uploadSuccess="uploadSuccess"></ocr-upload>
<!-- <uploadFile ref="uploadFile" @uploadSuccess="uploadSuccess"></uploadFile>-->
</div>
</template>
<script>
import { getAction, postAction } from '@/api/manage'
import search from '@/components/search/index'
import tableData from '@/components/tableDate/index'
import addForm from './modules/addForm'
import frameAssembly from '@/components/frameAssembly/index'
import ocrUpload from '@/components/ocrUpload/index'
// import uploadFile from '@/components/uploadFile/file'
export default {
name: 'ocr',
components:{
search,
tableData,
addForm,
frameAssembly,
ocrUpload
},
data(){
return{
labelCol: { span:4 },
wrapperCol: { span: 18 },
disabled:false,
toVisible:false, //同步弹框
checkVisible:false, //校核弹框
file:'',
form:{}, //表单数据
rules:{
file:[
{ required: true, message: '请选择文件', trigger: 'blur' },
],
standNumber:[
{ required: true, message: '请输入编号', trigger: 'blur' },
],
standName:[
{ required: true, message: '请输入名称', trigger: 'blur' },
],
fileType:[
{ required: true, message: '请选择文本状态', trigger: 'blur' },
]
},
url: {
seachList: 'document/bussDocumentLibraryEO/queryCondition', //搜索字段
tableList: 'document/bussDocumentLibraryEO/queryPageInfo', //表格数据
// getAddForm: 'document/bussDocumentLibraryEO/getAddForm', // 表单的字段
// addInfo: 'document/bussDocumentLibraryEO/addInfo', //新增
// updateInfo: 'document/bussDocumentLibraryEO/updateInfo', //编辑
// getDocumentInfo: 'document/bussDocumentLibraryEO/getDocumentInfoById', //查看
// deleteBatch: 'document/bussDocumentLibraryEO/deleteBatch' //删除
},
queryParams:{}, //搜索条件
transOptions:[
{
value:1,
label:'转换中',
},
{
value:2,
label:'转换完成',
},
{
value:3,
label:'转换失败',
}
],
//列表数据
tableSorce:[
{
id: '1',
standNumber: 'sfsf1',
standName:'下拉单选',
fileType_dictText:'单选',
fileName:'123.pdf',
resultContent:'1',
createTime:'2020-1-1',
resultStatus:1
},
{
id: '2',
standNumber: 'sfsdfd2222',
standName:'aaaa选',
fileType_dictText:'sdf选',
fileName:'sss.word',
resultContent:'2',
createTime:'2020-1-1',
resultStatus:2
},
{
id: '3',
standNumber: 'sfsf1',
standName:'下拉单选',
fileType_dictText:'单选',
fileName:'123.pdf',
resultContent:'1',
createTime:'2020-1-1',
resultStatus:1
},
{
id: '4',
standNumber: 'sfsdfd2222',
standName:'aaaa选',
fileType_dictText:'sdf选',
fileName:'sss.word',
resultContent:'2',
createTime:'2020-1-1',
resultStatus:2
},
{
id: '5',
standNumber: 'sfsf1',
standName:'下拉单选',
fileType_dictText:'单选',
fileName:'123.pdf',
resultContent:'1',
createTime:'2020-1-1',
resultStatus:1
},
{
id: '6',
standNumber: 'sfsdfd2222',
standName:'aaaa选',
fileType_dictText:'sdf选',
fileName:'sss.word',
resultContent:'2',
createTime:'2020-1-1',
resultStatus:2
},
{
id: '7',
standNumber: 'sfsf1',
standName:'下拉单选',
fileType_dictText:'单选',
fileName:'123.pdf',
resultContent:'1',
createTime:'2020-2-12',
resultStatus:1
},
{
id: '8',
standNumber: 'sfsdfd2222',
standName:'aaaa选',
fileType_dictText:'sdf选',
fileName:'sss.word',
resultContent:'2',
createTime:'2020-1-19',
resultStatus:2
},
{
id: '9',
standNumber: 'sfsf1',
standName:'下拉单选',
fileType_dictText:'单选',
fileName:'123.pdf',
resultContent:'1',
createTime:'2020-1-1',
resultStatus:1
},
{
id: '10',
standNumber: 'sfsdfd2222',
standName:'aaaa选',
fileType_dictText:'sdf选',
fileName:'sss.word',
resultContent:'2',
createTime:'2020-2-12',
resultStatus:2
},
{
id: '11',
standNumber: 'sfsf1',
standName:'下拉单选',
fileType_dictText:'单选',
fileName:'123.pdf',
resultContent:'1',
createTime:'2020-2-1',
resultStatus:1
},
{
id: '12',
standNumber: 'sfsdfd2222',
standName:'aaaa选',
fileType_dictText:'sdf选',
fileName:'sss.word',
resultContent:'2',
createTime:'2020-1-13',
resultStatus:2
},
],
columns: [
{
title:'标准编号',
key: 'standNumber',
align:"center",
dataIndex: 'standNumber'
},
{
title:'标准名称',
key: 'standName',
align:"center",
dataIndex: 'standName'
},
{
title:'文本状态',
key: 'fileType_dictText',
align:"center",
dataIndex: 'fileType_dictText'
},
{
title:'文件名称',
key: 'fileName',
align:"center",
dataIndex: 'fileName'
},
{
title:'转换结果',
key: 'resultContent',
align:"center",
dataIndex: 'resultContent'
},
{
title:'转换时间',
key: 'createTime',
align:"center",
sorter: true,
dataIndex: 'createTime'
},
{
title:'同步情况',
key: 'resultStatus',
align:"center",
sorter: true,
dataIndex: 'resultStatus'
},
{
title: this.$t('operation'),
dataIndex: 'action',
scopedSlots: {customRender: 'action'},
align: "center",
width: 260
}
],
ipagination: {
defaultPageSize: 10,
defaultCurrent: 1,
pageSizeOptions: ['10', '20', '30', '40', '100'],
showQuickJumper: true,
showSizeChanger: true,
showTotal: (total, range) => `显示 ${range[0]} ~ ${range[1]} 条记录,共 ${total} 条记录`
},
total:0,
selectedRowKeys:[],
fileVisible:false,
confirmLoading: false,
}
},
props:{
},
mounted() {
},
methods:{
//搜索
searchQuery(){
},
//清空搜索
searchReset(){
},
//上传
handleUpload(){
this.fileVisible=true
},
//调取已入库文件
handleFileExport(){
},
//批量删除
handleDel(){
},
//同步
actionSynchron(){
this.toVisible=true
},
//校核
actionCheck(){
this.checkVisible=true
},
//下载
actionDown(){
},
//删除
actionDelete(){
},
onDelete(){
},
onSelectChange(){
},
//上传确定按钮
handleOk(){
this.$refs.fileForm.validate((valid)=>{
if(valid){
console.log('succ')
}
})
},
handleCancel(){
this.fileVisible=false
},
//上传文件
uploadSuccess(data) {
console.log('updata',data)
let attIdList = []
// data.map(item => {
// attIdList.push(item.id || data.name)
// })
// // /** 赋值给当前对应的表单文件 */
// this.file = attIdList.join(',')
},
fileUpload(){
this.$refs.uploadFile.visible=true
},
//同步至文档库确认
handleOkTo(){
this.toVisible=false
},
//同步至文档库取消
handleCancelTo(){
this.toVisible=false
},
//校核确认
handleOkCheck(){
this.checkVisible=false
},
//校核取消
handleCancelCheck(){
this.checkVisible=false
},
}
}
</script>
<style lang="less" scoped>
.ocr{
.table-detail{
.action{
margin-right: 10px;
}
.action-delete{
color:red;
}
}
}
</style>
<style lang="less">
.show-content{
.ant-modal-footer{
text-align: center;
}
}
</style>
@@ -0,0 +1,11 @@
<template>
</template>
<script>
export default {
name: 'ocraddForm',
}
</script>
<style lang="less" scoped>
</style>
@@ -31,7 +31,7 @@
</a-col>
<a-col :span="24">
<a-form-model-item label="属性类型" prop="fieldShowType">
<j-dict-select-tag type="list" v-model="form.fieldShowType" dictCode="attribute_type" placeholder="请选择属性类型" />
<j-dict-select-tag type="list" v-model="form.fieldShowType" dictCode="field_show_type" placeholder="请选择属性类型" />
</a-form-model-item>
</a-col>
<a-col :span="24" v-if="isTagContent">