| | |
| | | if (result.object != null) { |
| | | this.to_contact_list(result, contactData, component); |
| | | } else { |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | } else { |
| | | this.error("AWS search status1 : " + result.status); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | }, |
| | | component |
| | |
| | | } |
| | | component.find("select_agency_person").set("v.options", res); |
| | | component.set("v.allselectlistAgencyPerson", res); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | }, |
| | | |
| | | search_contact_url: function (component, sobject, callback) { |
| | |
| | | if (callback) callback(result); |
| | | } else { |
| | | this.error("AWS url/token error."); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }, |
| | | get_reports_edit: function (component, event, helper, date_str, person_str) { |
| | | if (!date_str) { |
| | | return false; |
| | | } |
| | | |
| | | date_str = this.get_date_string(date_str); |
| | | |
| | | var action = component.get("c.getReports"); |
| | | action.setParams({ |
| | | date_str: date_str, |
| | | person_str: person_str |
| | | }); |
| | | |
| | | component.set("v.loginEdit", true); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == "SUCCESS") { |
| | | var res = response.getReturnValue(); |
| | | component.set("v.reports", res.reports); |
| | | |
| | | // 20220222 PI改造 by Bright--start |
| | | let dataIds = []; |
| | | let dataIds1 = []; |
| | | let mm = {}; |
| | | let b = false; |
| | | let b1 = false; |
| | | for (const rep of res.reports) { |
| | | if (rep.doctor2__r && rep.doctor2__r.AWS_Data_Id__c) { |
| | | dataIds.push(rep.doctor2__r.AWS_Data_Id__c); |
| | | } |
| | | |
| | | if ( |
| | | rep.Person_In_Charge2__r && |
| | | rep.Person_In_Charge2__r.AWS_Data_Id__c |
| | | ) { |
| | | dataIds1.push(rep.Person_In_Charge2__r.AWS_Data_Id__c); |
| | | } |
| | | } |
| | | let Foo = null; |
| | | Foo = function () { |
| | | if (b && b1) { |
| | | for (const rep of res.reports) { |
| | | if ( |
| | | rep.doctor2__r && |
| | | rep.doctor2__r.AWS_Data_Id__c && |
| | | mm.hasOwnProperty(rep.doctor2__r.AWS_Data_Id__c) |
| | | ) { |
| | | rep.doctor2__r.awsdata = mm[rep.doctor2__r.AWS_Data_Id__c]; |
| | | } |
| | | if ( |
| | | rep.Person_In_Charge2__r && |
| | | rep.Person_In_Charge2__r.AWS_Data_Id__c && |
| | | mm.hasOwnProperty(rep.Person_In_Charge2__r.AWS_Data_Id__c) |
| | | ) { |
| | | rep.Person_In_Charge2__r.awsdata = |
| | | mm[rep.Person_In_Charge2__r.AWS_Data_Id__c]; |
| | | } |
| | | } |
| | | |
| | | $A.getCallback(() => component.set("v.reports", res.reports))(); |
| | | } else { |
| | | console.log("b=" + b + ",b1=" + b1 + ",continue"); |
| | | setTimeout(Foo, 100); |
| | | } |
| | | }; |
| | | |
| | | if (dataIds.length > 0) { |
| | | let awsurl = component.get("v.awsurl"); |
| | | helper.search_core( |
| | | awsurl.token, |
| | | awsurl.searchUrl, |
| | | JSON.stringify({ |
| | | dataIds: dataIds |
| | | }), |
| | | (result) => { |
| | | if (result.status == "0") { |
| | | for (const m of result.object) { |
| | | mm[m.dataId] = m; |
| | | } |
| | | b = true; |
| | | Foo(); |
| | | } else { |
| | | //this.error('AWS search status2 : ' + result.status); |
| | | this.success("请重新刷新页面进行解密"); |
| | | } |
| | | }, |
| | | component |
| | | ); |
| | | } else { |
| | | b = true; |
| | | } |
| | | |
| | | if (dataIds1.length > 0) { |
| | | let contactawsurl = component.get("v.contactawsurl"); |
| | | helper.search_core( |
| | | contactawsurl.token, |
| | | contactawsurl.searchUrl, |
| | | JSON.stringify({ |
| | | dataIds: dataIds1 |
| | | }), |
| | | (result) => { |
| | | if (result.status == "0") { |
| | | for (const m of result.object) { |
| | | mm[m.dataId] = m; |
| | | } |
| | | b1 = true; |
| | | Foo(); |
| | | } else { |
| | | this.error("AWS search status3 : " + result.status); |
| | | } |
| | | }, |
| | | component |
| | | ); |
| | | } else { |
| | | b1 = true; |
| | | } |
| | | // 20220222 PI改造 by Bright--end |
| | | |
| | | component.set("v.report_count", res.reports.length); |
| | | |
| | | // 更新保存後のselect_data用 |
| | | var report_id = component.get("v.update_select_report_data_id"); |
| | | |
| | | if (report_id != "") { |
| | | for (i = 0; i < res.reports.length; i++) { |
| | | if (res.reports[i]["Id"] == report_id) { |
| | | component.set("v.select_report_data", res.reports[i]); |
| | | break; |
| | | } |
| | | } |
| | | component.set("v.update_select_report_data_id", ""); |
| | | } |
| | | |
| | | if (res.reports.length > 0) { |
| | | component.set("v.list_message", ""); |
| | | } else { |
| | | component.set("v.list_message", "no_data"); |
| | | } |
| | | component.set("v.loginEdit", false); |
| | | } else { |
| | | this.error("get_reports failed."); |
| | | component.set("v.loginEdit", false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }, |
| | | |
| | | select_date_change: function (component, event, helper) { |
| | | this.get_reports( |
| | |
| | | // OPEN |
| | | $A.util.removeClass(modal_window, "disp_none"); |
| | | $A.util.removeClass(modal_bg, "disp_none"); |
| | | component.set("v.loginEdit", true); |
| | | |
| | | if ( |
| | | component.get("v.mode") == "edit" || |
| | | component.get("v.mode") == "copy" |
| | |
| | | } |
| | | |
| | | if (reportDate != null) { |
| | | console.log("reportDate = " + reportDate); |
| | | component.set("v.data.Report_Date__c", reportDate); |
| | | } |
| | | |
| | | component.set("v.edit_copy_select_report_id", ""); |
| | | } |
| | | } |
| | | setTimeout(function () { |
| | | component.set("v.loginEdit", false); |
| | | }, 1000); |
| | | } else { |
| | | // CLOSE |
| | | |
| | |
| | | }, |
| | | |
| | | edit_button: function (component, event, helper) { |
| | | component.set("v.login", true); |
| | | this.allclear(component); |
| | | component.set("v.loadOpp", true); |
| | | var index = event.getSource().get("v.value"); |
| | |
| | | } |
| | | |
| | | // 保存処理 |
| | | component.set("v.loginEdit", true); |
| | | component.set("v.login", true); |
| | | if (component.get("v.mode") == "edit") { |
| | | var Agency_Report__c = component.get("v.select_report_data").Id; |
| | | var action = component.get("c.editAgencyReport"); |
| | |
| | | .set("v.options", select_agency_list); |
| | | |
| | | component.set("v.update_select_report_data_id", report_id); |
| | | this.get_reports_edit( |
| | | this.get_reports( |
| | | component, |
| | | event, |
| | | helper, |
| | |
| | | ); |
| | | |
| | | component.find("save_button").set("v.disabled", false); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } else { |
| | | // var error = response.getError(); |
| | | // alert(JSON.stringify(error)); |
| | |
| | | // } |
| | | this.error("save_report failed."); |
| | | component.find("save_button").set("v.disabled", false); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | |
| | | var report_id = response.getReturnValue(); |
| | | component.set("v.create_agency_report_id", report_id); |
| | | |
| | | this.get_reports_edit( |
| | | this.get_reports( |
| | | component, |
| | | event, |
| | | helper, |
| | |
| | | } else { |
| | | this.error("get_reports_now failed."); |
| | | component.find("save_button").set("v.disabled", false); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action2); |
| | | |
| | | this.allclear(component); |
| | | component.find("save_button").set("v.disabled", false); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } else { |
| | | var error = response.getError(); |
| | | // alert(JSON.stringify(error)); |
| | | this.error("saveAgencyReport failed."); |
| | | component.find("save_button").set("v.disabled", false); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | |
| | | component.find("select_Product1").set("v.value", ""); |
| | | component.find("select_Product2").set("v.value", ""); |
| | | component.find("select_Product3").set("v.value", ""); |
| | | console.log("reportDate = 空"); |
| | | component.set("v.data.Report_Date__c", ""); |
| | | component.set("v.oppdata.Close_Forecasted_Date__c", ""); |
| | | component.set("v.oppdata.Amount__c", ""); |
| | |
| | | component.set("v.AWStransactionURL", awsmap.transactionURL); |
| | | } else { |
| | | this.error("AWS url/token error."); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | |
| | | })(); |
| | | } else { |
| | | console.log("AWS status error:" + result); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | if (result.status == "129") { |
| | | component |
| | | .find("OppMessage") |
| | |
| | | }) |
| | | .catch((error) => { |
| | | console.log("AWS insert error:" + error); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | component.find("OppMessage").setError("AWS insert error."); |
| | | }); |
| | | }, |
| | |
| | | this.to_confirm(component, token, confirmUrl, JSON.stringify(data)); |
| | | } else if (acMap.errormsg != "") { |
| | | this.error(acMap.errormsg); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } else { |
| | | this.error("agency contact insert id error."); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | } else { |
| | | this.error("agency contact insert error."); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | |
| | | this.set_doctor_list(component); |
| | | } else { |
| | | this.error("AWS confirm error."); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | this.error("AWS confirm error."); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | }); |
| | | }, |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | |
| | | set_doctor_list: function (component) { |
| | | var hospital_id = component.get("v.hospitalLinkId"); |
| | | if (hospital_id) { |
| | | component.set("v.loginEdit", true); |
| | | component.set("v.login", true); |
| | | var action = component.get("c.getDoctorList"); |
| | | action.setParams({ |
| | | hospital_id: hospital_id |
| | |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | | } else { |
| | | this.error("set_doctor_list failed."); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | |
| | | dataArr.push(key); |
| | | } |
| | | if (dataArr.length == 0) { |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | this.warning("没有找到符合条件的客户人员"); |
| | | return; |
| | | } |
| | |
| | | this.to_doctor_list(result, retMap, component); |
| | | } else { |
| | | this.error("AWS search status4 : " + result.status); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | }, |
| | | component |
| | |
| | | return data.json(); |
| | | }) |
| | | .then((result) => { |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | if (callback) callback(result); |
| | | }) |
| | | .catch((error) => { |
| | | console.log("error = " + JSON.stringify(error)); |
| | | this.error("AWS search error."); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | }); |
| | | }, |
| | | |
| | |
| | | |
| | | component.set("v.default_select_doctor_id", ""); |
| | | component.set("v.doctor_list", res); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | }, |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | | |
| | |
| | | agency_hospital_link_id: component.get("v.hospitalLinkId") |
| | | }); |
| | | |
| | | component.set("v.loginEdit", true); |
| | | component.set("v.login", true); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == "SUCCESS") { |
| | |
| | | // } else { |
| | | // component.find('input-opportunity').get("v.body")[0].set('v.selectedLabel', ''); |
| | | // } |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | return false; |
| | | } |
| | | //SWAG-CKH5M8 【委托】周报关联询价,可选择询价范围调整 fy start |
| | |
| | | ); |
| | | } |
| | | |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } else { |
| | | this.error("selectOpportunityByIdAndHospitalLinkId failed."); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | |
| | | }, |
| | | |
| | | saveRecords: function (component, event, helper) { |
| | | debugger; |
| | | component.set("v.loginEdit", true); |
| | | component.set("v.login", true); |
| | | //fy 导入 20220424 start |
| | | var action1 = component.get("c.processDataAWSId"); |
| | | action1.setParams({ |
| | | fileData: component.get("v.fileContentData") |
| | | }); |
| | | debugger; |
| | | action1.setCallback(this, function (response) { |
| | | console.log("response = " + JSON.stringify(response)); |
| | | var state = response.getState(); |
| | |
| | | dataMap.set(item.AWS_Data_Id__c, item.AWS_Data_Id__c); //zhj 新方案改造 2022-12-21 |
| | | } |
| | | }); |
| | | debugger; |
| | | let obj = Object.create(null); |
| | | obj["dataIds"] = dataArr; |
| | | var payload = JSON.stringify(obj); |
| | | console.log("payload zhj = " + JSON.stringify(payload)); |
| | | |
| | | this.search_contact_url( |
| | | component, |
| | | "Agency_Contact__c", |
| | |
| | | // component.set('v.login',true); |
| | | // this.ImportMethod(component,resultjson); |
| | | // } |
| | | component.set("v.loginEdit", true); |
| | | component.set("v.login", true); |
| | | this.saveRecordsEditFile( |
| | | component, |
| | | dataMap, |
| | |
| | | helper |
| | | ); |
| | | } else { |
| | | this.error("AWS 查询数据为空 "); |
| | | component.set("v.loginEdit", false); |
| | | this.error("AWS search status5 "); |
| | | component.set("v.login", false); |
| | | } |
| | | } else { |
| | | this.error("AWS search status6 : " + result.status); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | }, |
| | | component |
| | |
| | | // }); |
| | | // $A.enqueueAction(action); |
| | | }, |
| | | isNumber: function (str) { |
| | | return /^\d+$/.test(str); |
| | | }, |
| | | ImportMethod: function (component, fileStr) { |
| | | debugger; |
| | | var actionss = component.get("c.processData"); |
| | | var selectDate = component.find("select_date").get("v.value"); |
| | | var fieldsList = ["Name", "Phone", "AccountNumber"]; //Please write your code dynamic |
| | |
| | | if (res != "success") { |
| | | var ress = res.split("="); |
| | | console.log(ress); |
| | | let errorDatas = []; |
| | | let errorDataRow = []; |
| | | debugger; |
| | | var fileContentData = component.get("v.fileContentData").split("\n"); |
| | | for (var i = 0; i < ress.length; i++) { |
| | | res1 += ress[i].substr(7) + "\n"; |
| | | if (ress[i] != "") { |
| | | let errorData = {}; |
| | | if (!this.isNumber(ress[i].substr(7).substring(1, 2))) { |
| | | continue; |
| | | } |
| | | let index = errorDataRow.indexOf( |
| | | ress[i].substr(7).substring(1, 2) |
| | | ); |
| | | if (index == -1) { |
| | | errorData.errorRow = ress[i].substr(7).substring(1, 2); |
| | | errorDataRow.push(errorData.errorRow); |
| | | errorData.errorInfo = ress[i] |
| | | .substr(7) |
| | | .substring(5) |
| | | .replace("=", ""); |
| | | if (errorData.errorInfo == "拜访人不存在") { |
| | | console.log("errorData.errorRow = " + errorData.errorRow); |
| | | errorData.errorInfo = |
| | | "拜访人 " + |
| | | fileContentData[errorData.errorRow].split(",")[4] + |
| | | "不存在"; |
| | | } |
| | | errorDatas.push(errorData); |
| | | } else { |
| | | if (ress[i].substr(7).substring(5) == "拜访人不存在") { |
| | | errorDatas[index].errorInfo += |
| | | "; " + |
| | | "拜访人 " + |
| | | fileContentData[errorDatas[index].errorRow].split(",")[4] + |
| | | "不存在"; |
| | | } else { |
| | | errorDatas[index].errorInfo += |
| | | "; " + ress[i].substr(7).substring(5); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | let errorColumns = [ |
| | | { |
| | | label: "错误行", |
| | | fieldName: "errorRow", |
| | | type: "text", |
| | | hideDefaultActions: true, |
| | | initialWidth: 100 |
| | | }, |
| | | { |
| | | label: "错误信息", |
| | | fieldName: "errorInfo", |
| | | type: "text", |
| | | hideDefaultActions: true, |
| | | initialWidth: 300, |
| | | wrapText: true |
| | | } |
| | | ]; |
| | | for (var i = 0; i < fileContentData[0].split(",").length; i++) { |
| | | errorColumns.push({ |
| | | label: fileContentData[0].split(",")[i], |
| | | fieldName: "field" + i, |
| | | type: "text", |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | initialWidth: 120 |
| | | }); |
| | | } |
| | | |
| | | for (var i = 0; i < errorDatas.length; i++) { |
| | | let data = fileContentData[errorDatas[i].errorRow]; |
| | | console.log("data = " + JSON.stringify(data)); |
| | | if (data) { |
| | | for (var j = 0; j < data.split(",").length; j++) { |
| | | let label = "field" + j; |
| | | errorDatas[i][label] = data.split(",")[j]; |
| | | } |
| | | } |
| | | } |
| | | component.set("v.errorColumns", errorColumns); |
| | | component.set("v.errorData", errorDatas); |
| | | component.set("v.showErrorInfo", true); |
| | | // $('.forceToastManager').css('white-space', 'pre-wrap'); |
| | | console.log("==" + res1); |
| | | this.error(res1 + "请修改后重新上传"); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } else { |
| | | component.set("v.showMain", true); |
| | | this.success("导入成功"); |
| | | // alert('saved successfully'); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | } else if (state === "INCOMPLETE") { |
| | | // do something |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } else if (state === "ERROR") { |
| | | var errors = response.getError(); |
| | | if (errors) { |
| | | if (errors[0] && errors[0].message) { |
| | | console.log("Error message: " + errors[0].message); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | } else { |
| | | console.log("Unknown error"); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | } |
| | | }); |
| | |
| | | } |
| | | |
| | | if (error != "") { |
| | | console.log("zhj error = " + error); |
| | | let errorArray = error.split("error1"); |
| | | let errorDatas = []; |
| | | let errorDataRow = []; |
| | | debugger; |
| | | var fileContentData = component.get("v.fileContentData").split("\n"); |
| | | console.log("errorArray = " + JSON.stringify(errorArray)); |
| | | for (var i in errorArray) { |
| | | if (errorArray[i] != "") { |
| | | let errorData = {}; |
| | | if (!this.isNumber(errorArray[i].trim().substring(1, 2))) { |
| | | continue; |
| | | } |
| | | let index = errorDataRow.indexOf( |
| | | errorArray[i].trim().substring(1, 2) |
| | | ); |
| | | if (index == -1) { |
| | | errorData.errorRow = errorArray[i].trim().substring(1, 2); |
| | | errorDataRow.push(errorData.errorRow); |
| | | errorData.errorInfo = errorArray[i] |
| | | .trim() |
| | | .substring(5, errorArray[i].trim().length) |
| | | .replace("=", ""); |
| | | if (errorData.errorInfo == "拜访人AWS不存在") { |
| | | errorData.errorInfo = |
| | | "拜访人 " + |
| | | fileContentData[errorData.errorRow].split(",")[4] + |
| | | "不存在"; |
| | | } |
| | | errorDatas.push(errorData); |
| | | } else { |
| | | if (errorArray[i].trim().substring(5) == "拜访人AWS不存在") { |
| | | errorData[index].errorInfo = |
| | | "; " + |
| | | "拜访人 " + |
| | | fileContentData[errorDatas[index].errorRow].split(",")[4] + |
| | | "不存在"; |
| | | } else { |
| | | errorDatas[index].errorInfo += |
| | | "; " + |
| | | errorArray[i].trim().substring(5, errorArray[i].trim().length); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | var fileContentData = component.get("v.fileContentData").split("\n"); |
| | | let errorColumns = [ |
| | | { |
| | | label: "错误行", |
| | | fieldName: "errorRow", |
| | | type: "text", |
| | | hideDefaultActions: true, |
| | | initialWidth: 100 |
| | | }, |
| | | { |
| | | label: "错误信息", |
| | | fieldName: "errorInfo", |
| | | type: "text", |
| | | hideDefaultActions: true, |
| | | initialWidth: 300, |
| | | wrapText: true |
| | | } |
| | | ]; |
| | | for (var i = 0; i < fileContentData[0].split(",").length; i++) { |
| | | errorColumns.push({ |
| | | label: fileContentData[0].split(",")[i], |
| | | fieldName: "field" + i, |
| | | type: "text", |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | initialWidth: 120 |
| | | }); |
| | | } |
| | | |
| | | for (var i = 0; i < errorDatas.length; i++) { |
| | | let data = fileContentData[errorDatas[i].errorRow]; |
| | | console.log("data = " + JSON.stringify(data)); |
| | | for (var j = 0; j < data.split(",").length; j++) { |
| | | let label = "field" + j; |
| | | errorDatas[i][label] = data.split(",")[j]; |
| | | } |
| | | } |
| | | console.log("errorDatas =" + JSON.stringify(errorDatas)); |
| | | component.set("v.errorColumns", errorColumns); |
| | | component.set("v.errorData", errorDatas); |
| | | component.set("v.showErrorInfo", true); |
| | | |
| | | console.log("error = " + error); |
| | | component.set("v.errorMessage", error); |
| | | |
| | | this.error(error); |
| | | console.log("error=" + error); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | return; |
| | | } |
| | | |
| | |
| | | }, |
| | | |
| | | select_repores_date: function (component, event, helper) { |
| | | component.set("v.loginEdit", true); |
| | | component.set("v.login", true); |
| | | var reportsdate1 = component.find("input-report-date1").get("v.value"); |
| | | var reportsdate2 = component.find("input-report-date2").get("v.value"); |
| | | console.log( |
| | |
| | | if (state === "SUCCESS") { |
| | | var res = response.getReturnValue(); |
| | | console.log("输入的开始日期3" + res); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | |
| | | // PI 改造 By Bright 20220328 |
| | | if (true) { |
| | |
| | | } |
| | | helper.showExportDate(component, res); |
| | | |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | }, |
| | | awsurl.token |
| | | ); |
| | |
| | | component.set("v.reports_date", res); |
| | | } else { |
| | | alert("导出失败,请检查活动日"); |
| | | component.set("v.loginEdit", false); |
| | | component.set("v.login", false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | |
| | | } |
| | | |
| | | $A.enqueueAction(action); |
| | | }, |
| | | } |
| | | //zhj MEBG新方案改造 2022-11-29 end |
| | | |
| | | //zhj 导出错误信息 2023-05-16 start |
| | | exportErrorInfoHelper: function (component) { |
| | | var errorData = component.get("v.errorData"); |
| | | var errorColumns = component.get("v.errorColumns"); |
| | | |
| | | var datas = []; |
| | | let errorColumnsArray = []; |
| | | for (var i in errorColumns) { |
| | | errorColumnsArray.push(errorColumns[i].label); |
| | | } |
| | | datas.push(errorColumnsArray); |
| | | //datas.push(errorColumns); |
| | | |
| | | for (var i in errorData) { |
| | | let data = []; |
| | | data.push(errorData[i].errorRow); |
| | | data.push(errorData[i].errorInfo); |
| | | for (var j = 0; j < Object.keys(errorData[i]).length - 2; j++) { |
| | | data.push(errorData[i]["field" + j]); |
| | | } |
| | | datas.push(data); |
| | | } |
| | | |
| | | console.log("datas = " + JSON.stringify(datas)); |
| | | var csv = this.convertToCSV(component, datas); |
| | | console.log("csv = " + JSON.stringify(csv)); |
| | | this.downloadCSV(component, csv); |
| | | }, |
| | | |
| | | convertToCSV: function (component, data) { |
| | | console.log("enter convertToCSV"); |
| | | console.log("data = " + data); |
| | | var csv = ""; |
| | | for (var i = 0; i < data.length; i++) { |
| | | var row = data[i]; |
| | | console.log("row = " + JSON.stringify(row)); |
| | | for (var j = 0; j < row.length; j++) { |
| | | var val = ""; |
| | | val = row[j] === null ? "" : row[j].toString(); |
| | | console.log("val = " + val); |
| | | if ( |
| | | val.indexOf(",") !== -1 || |
| | | val.indexOf('"') !== -1 || |
| | | val.indexOf("\n") !== -1 |
| | | ) { |
| | | //val = '"' + val.replace(/"/g,'""') + '"'; |
| | | } |
| | | if (j > 0) { |
| | | csv += ","; |
| | | } |
| | | csv += val; |
| | | } |
| | | csv += "\n"; |
| | | } |
| | | return csv; |
| | | }, |
| | | |
| | | downloadCSV: function (component, csv) { |
| | | var link = document.createElement("a"); |
| | | // 设置字符集和文件头 |
| | | var bom = "\uFEFF"; |
| | | link.href = "data:text/csv;charset=utf-8," + encodeURIComponent(bom + csv); |
| | | link.download = "data.csv"; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | } |
| | | //zhj 导出错误信息 2023-05-16 end |
| | | |
| | | // searchAgencyContact : function(res) { |
| | | // var agencyContacts = []; |