diff --git a/src/api/common/uploadFile.js b/src/api/common/uploadFile.js index 6c8989e..f8c9d59 100644 --- a/src/api/common/uploadFile.js +++ b/src/api/common/uploadFile.js @@ -10,4 +10,16 @@ export function uploadSmallFileByOcr(data) { }, data: data }) +} + +// 上传小文件---5M以上,使用OCR识别 +export function uploadLargeFileByOcr(data) { + return request({ + url: '/smartBid/commonUpload/uploadLargeFileByOcr', + method: 'post', + headers: { + 'Content-Type': 'multipart/form-data' + }, + data: data + }) } \ No newline at end of file diff --git a/src/utils/bonus.js b/src/utils/bonus.js index 3de2d98..534d9a9 100644 --- a/src/utils/bonus.js +++ b/src/utils/bonus.js @@ -226,3 +226,16 @@ export function getNormalPath(p) { export function blobValidate(data) { return data.type !== 'application/json' } + +// 将年月日格式转换为yyyy-MM-dd格式 +export function formatDate(dateStr) { + if (!dateStr) return ''; + // 提取年、月、日 + const match = dateStr.match(/(\d{4})年(\d{1,2})月(\d{1,2})日/); + if (!match) return dateStr; + const year = match[1]; + const month = match[2].padStart(2, '0'); // 月份补零 + const day = match[3].padStart(2, '0'); // 日期补零 + + return `${year}-${month}-${day}`; +} \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index c34965c..e7bdfbd 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -41,7 +41,7 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' const service = axios.create({ baseURL: process.env.VUE_APP_BASE_API, - timeout: 30000, + timeout: 60000 * 2, }) // 判断是否为二进制数据(File/Blob) diff --git a/src/views/common/UploadFile.vue b/src/views/common/UploadFile.vue index e642af5..242f74a 100644 --- a/src/views/common/UploadFile.vue +++ b/src/views/common/UploadFile.vue @@ -43,7 +43,7 @@ @@ -144,18 +193,10 @@ export default { &.no-pointer-events { pointer-events: none; - // 但允许滚动(如果需要) - // overflow-y: auto; - // 子元素也继承禁用点击 * { pointer-events: none; } - - // 重新启用滚动条的点击事件(如果需要滚动) - // ::-webkit-scrollbar { - // pointer-events: auto; - // } } } @@ -246,19 +287,6 @@ export default { } } -// 或者使用更简单的方法:直接在动画显示时给body添加禁用样式 -// 在 mounted 和 beforeDestroy 中动态添加/移除样式 -.global-upload-animation-active { - .app-container { - pointer-events: none !important; - user-select: none !important; - - * { - pointer-events: none !important; - } - } -} - .content-body { margin-top: 20px; } @@ -306,6 +334,12 @@ export default { background: #4A8BFF; box-shadow: 0px 6px 12px 0px rgba(51, 135, 255, 0.6); } + + // 当按钮处于loading状态时的样式 + &.is-loading { + opacity: 0.7; + pointer-events: none; + } } .reset-btn { diff --git a/src/views/enterpriseLibrary/enterprise/components/child/AccountOpeningCertificate.vue b/src/views/enterpriseLibrary/enterprise/components/child/AccountOpeningCertificate.vue index 4aa7a62..aba00e9 100644 --- a/src/views/enterpriseLibrary/enterprise/components/child/AccountOpeningCertificate.vue +++ b/src/views/enterpriseLibrary/enterprise/components/child/AccountOpeningCertificate.vue @@ -6,13 +6,14 @@ - + - + - + @@ -24,12 +25,23 @@ import UploadFile from '@/views/common/UploadFile.vue' export default { name: 'AccountOpeningCertificate', components:{UploadFile}, + dicts: ['identification_tag'], data() { return { form: { fileList:[], openingBank: '', openingAccount: '', + delFileList: [] + }, + // OCR 识别规则 + ocrRuleList: ['account_opening_license'], + fileUploadList: [], + // 根据返回的chat_res对象结构修改映射关系 + ocrResultParams: { + "开户银行": "openingBank", + "账号": "openingAccount", + "开户账号": "openingAccount", }, rules: { fileList:[ @@ -59,6 +71,66 @@ export default { }) }) }, + // ocr文件识别规则 + ocrRule(type) { + const foundItem = this.dict.type.identification_tag.find(item => item.value === type); + const item = foundItem ? { + fileUploadType: foundItem.value, + fields_json: foundItem.raw.remark, + suffix: 'mainDatabase' + } : null; + + this.fileUploadList.push(item) + }, + // 添加ocr文件识别规则 + addOcrRule() { + this.ocrRuleList.forEach(item => { + this.ocrRule(item) + }) + }, + // 文件变化 + handleFileChange(file) { + this.form.fileList = file; + if (file instanceof Array && file.length > 0 && file[0].response) { + const response = file[0].response; + if (response.ocrResult && response.ocrResult.status_code === 200) { + // ocr识别成功 + const chat_res = response.ocrResult.data?.chat_res; + if (chat_res && typeof chat_res === 'object') { + // 直接遍历chat_res对象的属性 + Object.keys(chat_res).forEach(key => { + const formField = this.ocrResultParams[key]; + if (formField && chat_res[key]) { + this.form[formField] = chat_res[key]; + } + }); + } + } + // 触发表单验证 + this.$refs.accountOpeningCertificateForm.validate(); + } + }, + // 文件删除时触发 + handleDelFile(file) { + console.log(file); + this.form.delFileList.push(file.response.fileRes.uploadPath || file.filePath); + } + }, + computed: { + fileUploadRule() { + return this.fileUploadList[0] || {}; + } + }, + watch: { + // 监听字典数据加载完成 + 'dict.type.identification_tag': { + handler(newVal) { + if (newVal && newVal.length > 0) { + this.addOcrRule(); + } + }, + immediate: true // 立即执行一次 + } }, } diff --git a/src/views/enterpriseLibrary/enterprise/components/child/BasicInfo.vue b/src/views/enterpriseLibrary/enterprise/components/child/BasicInfo.vue index 8404a8e..6f36196 100644 --- a/src/views/enterpriseLibrary/enterprise/components/child/BasicInfo.vue +++ b/src/views/enterpriseLibrary/enterprise/components/child/BasicInfo.vue @@ -7,25 +7,36 @@ - + - + - + - + + + + - + - + - + @@ -33,6 +44,7 @@