From e75bee10a78b89fc0d162131f40673961173767f Mon Sep 17 00:00:00 2001 From: zhangyanpeng <bob.zhang@highdatas.com> Date: 星期日, 04 八月 2024 15:55:40 +0800 Subject: [PATCH] 调整 --- module/md/page/customer/page/customer_basic.html | 266 ++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 214 insertions(+), 52 deletions(-) diff --git a/module/md/page/customer/page/customer_basic.html b/module/md/page/customer/page/customer_basic.html index 506c8b7..5a4d32a 100644 --- a/module/md/page/customer/page/customer_basic.html +++ b/module/md/page/customer/page/customer_basic.html @@ -87,7 +87,8 @@ formFields: [], formFields_criteria: [], - + fileobj: {}, + ocrobj: {}, formData: {}, formData_criteria: {}, formData1:[], @@ -357,7 +358,9 @@ me.tableFieldClick(); } me.formData = getDataByFields(me.formData, me.formFields); - + if (me.formData.file_authorization_content) { + me.imgurl = config.url_root + "starwaytestroot/file/getFile?category=org&token=" + Root.getToken() + "&id=" + me.formData.file_authorization_content; + } if (me.rowData[me.dataname]) { me.formData = clone(me.rowData[me.dataname]); } @@ -556,39 +559,194 @@ } }); }, - uploadFileFun_file(one,fileList,type) { - var me = this; - me.imgLoading = true - me.imgurl =URL.createObjectURL(one.raw) //淇濇寔鏂囦欢鍦ㄦ湰绐楀彛锛屽惁鍒欎細鍔犺浇澶辫触 - // me.imgurl = one.url - // console.log(one+fileList+type) - + + submitUpload(one, fileList, type) { + this.isOCR = false; + let me = this; + let formData = new FormData(); + var ocrtype = ""; + formData.append("oneFile", one.raw); + + formData.append("id", me.formData.id); + formData.append("dataName", "md_org_register"); + formData.append("field_fileName", "file_name_certificate_original"); + formData.append("field_fileId", "file_certificate_original"); + + uploadFile(me, formData, result_ => { + me.uploade_state = true; + // me.formData.file_authorization_content = result_.data.file.file_index_id; + me.uploadFileFun_file(one, fileList, type); + + }, function() {}, ocrtype); }, + + uploadFileFun_file(one, fileList, type) { + let me = this; + let formData = new FormData() + formData.append("category" , "org"); + formData.append("oneFile" , one.raw); + + formData.append("id", me.formData.id); + formData.append("dataName", "md_org_register"); + formData.append("field_fileName", "file_name_certificate_original"); + formData.append("field_fileId", "file_certificate_original"); + + me.imgLoading = true; + uploadFileOCR("bizLicense", me, formData, function(result_){ + var form_data_ = {}; + + if (result_.data && result_.data.data && result_.data.data.upload && result_.data.data.ocr && result_.data.data.ocr.operator) { + var file_ = result_.data.data.upload; + var ocr_ = result_.data.data.ocr; + + if (typeof(ocr_.content)=="string") { + ocr_.content = JSON.parse(ocr_.content); + } + + for (var k in ocr_.content) { + // var v_ = decodeURI(ocr_[k]); + var v_ = ocr_.content[k]; + if ( "string" == typeof v_) { + //鍘婚櫎涓ょ鐨勭┖鏍� + v_ = v_.replace(/(^\s*)|(\s*$)/g, ""); + //鍘婚櫎涓棿鐨勫洖杞︽崲琛� + v_ = v_.replace(/[\r\n]/g,""); + //鍘婚櫎涓棿鎵�鏈�" + v_ = v_.replace(/\"/g,""); + } + form_data_[k] = v_; + } + + me.fileobj = file_; + me.ocrobj = form_data_; + console.log("璇嗗埆淇℃伅",form_data_); + me.imgurl = config.url_root + "starwaytestroot/file/getFile?category=org&token=" + Root.getToken() + "&id=" + file_.indexid; + me.formData.file_authorization_content = file_.indexid; + } + else { + me.$message({ + type:"warning", + message:"璇嗗埆澶辫触" + }) + } + + if (me.ocrobj.validToDate) { + var txt = me.ocrobj.validToDate; + me.ocrobj.validToDate = me.newOcrDate(txt); + } + + if (me.ocrobj.validFromDate) { + var txt = me.ocrobj.validFromDate; + me.ocrobj.validFromDate = me.newOcrDate(txt); + } + + var from_ = clone(me.formData); + console.log(form_data_); + // from_.register_address = form_data_.Address || null; + // from_.certificate_no = me.ocrobj.RegNum || null; // 钀ヤ笟鎵х収-璇佺収缂栧彿 + // from_.name = form_data_.Name; + // from_.certificate_date_from = form_data_.SetDate; + // from_.certificate_date_to = form_data_.Period; + // from_.certificate_legal_representative = form_data_.Person; + // from_.certificate_scope = form_data_.Business; + + from_.register_address = form_data_.businessAddress || null; + from_.license_business_no = me.ocrobj.creditCode || null; // 钀ヤ笟鎵х収-璇佺収缂栧彿 + from_.name = form_data_.companyName; + from_.license_business_name = form_data_.companyName; + from_.license_business_date_from = form_data_.validFromDate; + from_.license_business_date_to = form_data_.validToDate; + from_.certificate_legal_representative = form_data_.legalPerson; + from_.certificate_scope = form_data_.businessScope; + + me.formData = from_; + + me.imgLoading = false; + + }, function() { + me.$message({ + type:"warning", + message:"璇嗗埆澶辫触" + }) + me.imgLoading = false; + }); + }, + + newOcrDate(txt) { + var txtList = txt.split("鑷�"); + if(txtList[0] == "骞存湀鏃�"){ + txt = "2099-12-31"; + } + else { + if (txtList.length > 1) { + if(txtList[1].indexOf("闀挎湡") != -1 || txtList[1].indexOf("姘镐箙") != -1 || txtList[1].indexOf("涓嶇害瀹氭湡闄�") != -1){//涓嶇害瀹氭湡闄� + txt = "2099-12-31"; + } + else { + txt = txtList[1]; + + txt = txt.replace("骞�", "-"); + txt = txt.replace("鏈�", "-"); + txt = txt.replace("鏃�", ""); + var datas_ = txt.split("-"); + var txt_ = ""; + datas_.map(d=>{ + d = d * 1; + if (txt_ == "") { + txt_ = d; + } + else { + txt_ += "-" + d; + } + }) + txt = txt_.toString(); + if(txt && txt.search && txt.search(/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$/) == -1) { + txt = "" + } + //licenceObj_[k] = txt; + } + } + else if (txtList.length == 1) { + txt = txtList[0]; + if(txt.indexOf("闀挎湡") != -1 || txt.indexOf("姘镐箙") != -1 || txt.indexOf("涓嶇害瀹氭湡闄�") != -1){ + txt = "2099-12-31"; + } + if (txt.indexOf("骞�") != -1) { + var Date = txt.replace("骞�", "-").replace("鏈�", "-").replace("鏃�", ""); + txt = Date; + } else if (txt.length == 8) { + var Date = txt.slice(0, 4) + "-" + txt.slice(4, 6) + "-" + txt.slice(6, 8); + txt = Date; + } else { + txt = ""; + } + + if(txt && txt.search && txt.search(/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$/) == -1) { + txt = "" + } + } + } + return txt; + }, + showThumbnail(file, type, num) { - var me = this; - - if(num == "2"){ - return me.fileUrl; - } - if(type == "pic") { - return file.url; - } - console.log(file) - // var me = this; - - // if(num == "2"){ - // return me.fileUrl; - // } - // if(type == "pic") { - // me.imgurl = file.url - // return file.url; - // } - - }, + var me = this; + + if(num == "2"){ + return me.fileUrl; + } + if(type == "pic") { + return file.url; + } + }, + delyyzz() {//鍒犻櫎钀ヤ笟鎵х収 var me = this; - me.imgurl = ""; - me.formData1 = [] + me.imgurl = ""; + if (me.fileobj.indexid) { + me.fileobj.indexid = "" + } + me.formData.file_authorization_content = "" }, //鎻愪氦 @@ -907,29 +1065,33 @@ </div> <div :style="{height: dheight + 'px', 'overflow-y': 'auto'}"> <!-- <div style="position: absolute; top:40px; bottom: 50px; left: 0px; right: 0px; overflow-y: auto;"> --> - <div class="el-dialog__body" style="width: 20%; float: left;"> - <el-image - v-if="imgurl.length>0" - :style="{width: '100%', 'max-height': dheight + 'px'}" - :src="imgurl" - :preview-src-list="[imgurl]"> - </el-image> - <el-upload - v-else-if="!imgurl" - class="ocr_img" - action="#" style="margin-top: 15px;margin-bottom: 15px;" accept="image/jpeg,image/gif,image/png" - ref="reportUpload1" list-type="picture-card" :file-list="formData1" - :on-change="(file, fileList) => {uploadFileFun_file(file, fileList, '1')}" :auto-upload="false"> - <!-- <i slot="default" class="el-icon-plus"></i> --> - <span style="font-size: 14px; color: #909399;">钀ヤ笟鎵х収涓婁紶</span> - <div slot="file" slot-scope="{file}"> - <img class="el-upload-list__item-thumbnail" :src="showThumbnail(file, 'pic', '1')" alt=""> - </div> - </el-upload> - <el-button v-if="imgurl" size="small" type="danger" @click="delyyzz">鍒犻櫎钀ヤ笟鎵х収</el-button> + <div v-loading.fullscreen.lock="imgLoading" element-loading-text="OCR璇嗗埆涓�" style="width: 30%; float: left; overflow: hidden;"> + <el-image + v-if="imgurl && !imgLoading" + :style="{width: '100%', 'max-height': dheight - 50 + 'px'}" + :src="imgurl" + :preview-src-list="[imgurl]"> + </el-image> + + <div v-else-if="!imgLoading && (isedit || isrefuseedit)" class="ocr_img"> + <el-upload action="#" style="margin-top: 15px;margin-bottom: 15px;" + accept="image/jpeg,image/gif,image/png" + ref="reportUpload1" + list-type="picture-card" + :file-list="formData1.mdm_img" + :on-change="(file, fileList) => {submitUpload(file, fileList, '1')}" + :auto-upload="false"> + <!-- <i slot="default" class="el-icon-plus"></i> --> + <span style="font-size: 14px; color: #909399;">钀ヤ笟鎵х収涓婁紶</span> + <div slot="file" slot-scope="{file}"> + <img class="el-upload-list__item-thumbnail" :src="showThumbnail(file, 'pic', '1')" alt=""> + </div> + </el-upload> + </div> + <el-button v-if="imgurl && (isedit || isrefuseedit)" size="small" type="danger" @click="delyyzz">鍒犻櫎钀ヤ笟鎵х収</el-button> </div> - <div class="el-dialog__body" style="width: 79%; float: right;"> + <div class="el-dialog__body" style="width: 69%; float: right;"> <h-form ref="form1" :form-attr="formAttr" -- Gitblit v1.8.0