From d26a973271e4cd14fc13171eab04201344c23ae3 Mon Sep 17 00:00:00 2001
From: tom <tom.he@highdatas.com>
Date: 星期日, 04 八月 2024 17:09:17 +0800
Subject: [PATCH] 调整

---
 module/md/page/customer/page/customer_basic.html |  318 ++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 229 insertions(+), 89 deletions(-)

diff --git a/module/md/page/customer/page/customer_basic.html b/module/md/page/customer/page/customer_basic.html
index ea7ba7a..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:[],
@@ -150,22 +151,6 @@
 								this.formAttr.disabled = true;
 							}
 							else if (this.popupParames.sceneCode == "edit") {//缂栬緫
-								var newEntity_ = {
-									name: "md_org_account_criteria",
-									url: "root/data/getEntitySet",
-									paramsobj: {dataname: 'md_org_account_criteria',parent_id:this.popupParames.data.id},
-									isnotoption: true, //true:涓嶆槸閫夐」
-								}
-								this.dataRequest.push(newEntity_);
-								
-								// if (this.newformData) {
-								// 	let formData_ = clone(this.formData);
-									
-								// 	for (var k in this.newformData) {
-								// 		formData_[k] = this.newformData[k];
-								// 	}
-								// 	this.formData = formData_;
-								// }
 								this.isedit = true;
 							}
 							else if (this.popupParames.sceneCode == "approval") {//瀹℃壒
@@ -373,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]);
 									}
@@ -572,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 = ""
 						},
 						
 						//鎻愪氦
@@ -771,19 +913,19 @@
 								data: {},
 							}
 							//鏂板鐨勬儏鍐�
-							me.formdata_group.map(group => {
-								group.children.map(unitobj => {
-									var row_ = {
-										id: uuid_short(),
-										parent_id: me.formData.id,
-										criteria_id: unitobj.id,
-										criteria_value: unitobj.criteria_value,
-										remark: unitobj.remark,
-									}
-									md_org_account_criteria_.push(row_);
-								})
-							})
-							param.data["md_org_account_criteria"] = md_org_account_criteria_.length ? md_org_account_criteria_ : null;
+							// me.formdata_group.map(group => {//
+							// 	group.children.map(unitobj => {
+							// 		var row_ = {
+							// 			id: uuid_short(),
+							// 			parent_id: me.formData.id,
+							// 			criteria_id: unitobj.id,
+							// 			criteria_value: unitobj.criteria_value,
+							// 			remark: unitobj.remark,
+							// 		}
+							// 		md_org_account_criteria_.push(row_);
+							// 	})
+							// })
+							// param.data["md_org_account_criteria"] = md_org_account_criteria_.length ? md_org_account_criteria_ : null;
 							param.data[this.dataname] = entity;
 
 
@@ -923,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"
@@ -955,20 +1101,15 @@
 							>
 							</h-form>
 						</div>
-							<div v-if='formFields.length>0' class="el-dialog__body" style="width: 100%; float: right; ">
+						<!-- <div v-if='formFields.length>0' class="el-dialog__body" style="width: 100%; float: right; ">
 							<div style="border: 1px solid #C0C4CC ;padding: 5px">
 								<div class="h_table_title"><i class="iconfont icon-fuzhushuxian" style="color: rgb(2, 112, 193);"></i><span style="font-size: 16px;">鎺ㄥ箍鍟嗚瘎鍒�</span></div>
 								</i>
-								<!-- <el-row style="display: flex;flex-direction: row;justify-content:space-between;padding-left: 91px;padding-top: 10px;" >
-									<el-col :span="16"><div class="itemgroup_field"><span>璇勫垎椤�</span></div></el-col>
-									<el-col :span="8"><div class="itemgroup_field"><span>璇勫垎</span></div></el-col>
-								</el-row> -->
 								<div style="width: 100%;height: 5px;margin: 10px 0px 25px 0px;background-color: gainsboro; opacity: 40%;"></div>
 								<template v-for="(formgroup, k) in formdata_group">
 									<div  style="display: flex;justify-content: space-between;padding: 5px;">
 										<div style="width: 7%; display: flex; align-items: center; justify-content: center; text-align: center;font-weight: bold;border-right: 3px solid gainsboro;">
 											<div style="display: flex;justify-content: center;align-items: center;margin-right: 15px;">
-												<!-- {{formgroup.groupname}} -->
 												{{formgroup.group_name}}
 											</div>
 										</div>
@@ -978,7 +1119,6 @@
 												<el-col :span="6" class="itemgroup_row_item">
 													<div>
 														<span :class="[unitobj.required_no ? 'me_h_nounitlabel' : 'me_h_unitlabel']" style="font-size: 12px;">
-															<!-- {{unitobj.content_before}} -->
 															{{unitobj.content_before}}
 														</span>
 													</div>
@@ -1035,7 +1175,7 @@
 									<div style="width: 100%;height: 5px;margin: 25px 0px;background-color: gainsboro;opacity: 40%"></div>
 								</template >
 							</div>
-						</div>
+						</div> -->
 					</div>
 					<!-- <div class="el-dialog__footer" style="position: absolute; bottom: 0px;  left: 0px; right: 0px;">
 						<el-button size="small" type="default" @click="reasonvisible = false">鍙� 娑�</el-button>

--
Gitblit v1.8.0