| | |
| | | <script type="text/javascript"> |
| | | |
| | | // 2022/02/15 张华建 改造PI start |
| | | //zhj 2022-02-04 新方案改造 start |
| | | var accountId = '{!accountIdV2}' |
| | | var accountName = ''; |
| | | var dataIdManageCodeMap = {}; |
| | | var staticResourcesV2 = JSON.parse('{!staticResourceContactV2}'); |
| | | //zhj 2022-02-04 新方案改造 end |
| | | var staticResources = JSON.parse('{!staticResource}'); |
| | | var contactAWSIds = JSON.parse('{!contactAWSIds}'); |
| | | var LastName = ''; |
| | |
| | | } |
| | | |
| | | function editSaveJs() { |
| | | hiddenErrorMsgNode(); //zhj MEBG新方案改造 2022-11-24 |
| | | |
| | | document.getElementById("errorMsg").innerHTML = ''; |
| | | if(!document.getElementById("Page:allForm:editBlock:Search_LastName__c").value){ |
| | |
| | | return null; |
| | | } |
| | | function ProcessPI(sobjJson, payloadForNewPI) { |
| | | //blockme(); |
| | | let url = staticResources.newUrl |
| | | if (now_edit_id) { |
| | | url = staticResources.updateUrl |
| | | } |
| | | AWSService.post(url, payloadForNewPI, function(result){ |
| | | aws_result = result; |
| | | SetEditObj(); |
| | | saveNew(); |
| | | }, staticResources.token); |
| | | // //blockme(); |
| | | // //zhj 2022-02-04 新方案改造 start |
| | | // // let url = staticResources.newUrl |
| | | // // if (now_edit_id) { |
| | | // // url = staticResources.updateUrl |
| | | // // } |
| | | // let url = staticResourcesV2.newUrl |
| | | // if (now_edit_id) { |
| | | // url = staticResourcesV2.updateUrl |
| | | // } |
| | | // //zhj 2022-02-04 新方案改造 end |
| | | // AWSService.post(url, payloadForNewPI, function(result){ |
| | | // aws_result = result; |
| | | // //zhj MEBG新方案改造 2022-11-24 start |
| | | // if(r.status == '129'){ |
| | | // alertErrorMessage('客户 [ '+accountName+ ' ],已存在相同名字的联系人 人员管理编码 ['+dataIdManageCodeMap[r.object[0].dataId]+' ] ,不能重复创建,请了解'); |
| | | // unblockUI(); |
| | | // return |
| | | // } |
| | | // if(r.status == '130'){ |
| | | // if(r.object[0] && r.object[0].sfRecordId != null && r.object[0].sfRecordId != '') |
| | | // alertErrorMessage('已找到重复值: UniqueNumber__c 与记录值重复,ID 为: '+r.object[0].sfRecordId+'客户人员信息'); |
| | | // else |
| | | // alertErrorMessage('数据中存在重复的电话号码'); |
| | | // unblockUI(); |
| | | // return |
| | | // } |
| | | // //zhj MEBG新方案改造 2022-11-24 end |
| | | // SetEditObj(); |
| | | // saveNew(); |
| | | // }, staticResources.token); |
| | | } |
| | | |
| | | function Trans(){ |
| | | |
| | | debugger |
| | | AWSService.post(staticResources.transactionUrl, JSON.stringify({ |
| | | "txId":aws_result.txId, |
| | | "isSuccess":1 |
| | | "isSuccess":1, |
| | | "sfRecordId":document.getElementById('Page:allForm:sfContactId').value, |
| | | }), function(result){ |
| | | window.location.reload(); |
| | | }, staticResources.token); |
| | |
| | | } |
| | | |
| | | function GetEditObj(){ |
| | | return JSON.stringify([{ |
| | | lastName : document.getElementById("Page:allForm:editBlock:Search_LastName__c").value, |
| | | //phone : document.getElementById("Page:allForm:editBlock:Phone").value, |
| | | dataId:document.getElementById("Page:allForm:editBlock:AWS_Data_Id__c").value, |
| | | }]); |
| | | //zhj 2022-02-04 新方案改造 start |
| | | Visualforce.remoting.Manager.invokeAction( |
| | | 'CM_SearchContactServiceController.searchContactByAccountId', |
| | | accountId, |
| | | function (result, event) { |
| | | if(result.status == 'fail'){ |
| | | alertErrorMessage(result.message); |
| | | return |
| | | } |
| | | console.log('result = ' + JSON.stringify(result)); |
| | | accountName = result.accountName; |
| | | dataIdManageCodeMap = result.dataIdManageCodeMap; |
| | | var contactList = ''; |
| | | for(var i = 0; i<result.contactList.length; i++){ |
| | | if(result.contactList[i].AWS_Data_Id__c) |
| | | contactList += ',' + result.contactList[i].AWS_Data_Id__c; |
| | | } |
| | | contactList = contactList.substring(1); |
| | | var payloadForNewPI = JSON.stringify([{ |
| | | lastName : document.getElementById("Page:allForm:editBlock:Search_LastName__c").value, |
| | | mobilePhone : '', |
| | | dataId : document.getElementById("Page:allForm:editBlock:AWS_Data_Id__c").value, |
| | | contactIds : contactList, |
| | | isMobileVerif : result.isMobileVerif, |
| | | isNameMobileVerif : result.isNameMobileVerif |
| | | }]); |
| | | console.log('payloadForNewPI = ' + JSON.stringify(payloadForNewPI)); |
| | | debugger |
| | | let url = staticResourcesV2.newUrl |
| | | if (now_edit_id) { |
| | | url = staticResourcesV2.updateUrl |
| | | } |
| | | //zhj 2022-02-04 新方案改造 end |
| | | AWSService.post(url, payloadForNewPI, function(result){ |
| | | aws_result = result; |
| | | //zhj MEBG新方案改造 2022-11-24 start |
| | | if(result.status == '129'){ |
| | | alertErrorMessage('客户 [ '+accountName+ ' ],已存在相同名字的联系人 人员管理编码 ['+dataIdManageCodeMap[result.object[0].dataId]+' ] ,不能重复创建,请了解'); |
| | | unblockUI(); |
| | | return |
| | | } |
| | | if(result.status == '130'){ |
| | | if(result.object[0] && result.object[0].sfRecordId != null && result.object[0].sfRecordId != '') |
| | | alertErrorMessage('已找到重复值: UniqueNumber__c 与记录值重复,ID 为: '+result.object[0].sfRecordId+'客户人员信息'); |
| | | else |
| | | alertErrorMessage('数据中存在重复的电话号码'); |
| | | unblockUI(); |
| | | return |
| | | } |
| | | //zhj MEBG新方案改造 2022-11-24 end |
| | | SetEditObj(); |
| | | saveNew(); |
| | | }, staticResources.token); |
| | | }); |
| | | //zhj 2022-02-04 新方案改造 end |
| | | } |
| | | |
| | | function SetEditObj(){ |
| | |
| | | if(obj){ |
| | | document.getElementById("Page:allForm:editBlock:AWS_Data_Id__c").value = obj.dataId; |
| | | document.getElementById("Page:allForm:editBlock:Search_LastName__c").value = obj.lastName; |
| | | document.getElementById("Page:allForm:editBlock:LastName_Encrypted__c").value = obj.lastNameEncrypt; |
| | | //document.getElementById("Page:allForm:editBlock:LastName_Encrypted__c").value = obj.lastNameEncrypt; //zhj 新方案改造 2022-12-05 |
| | | //document.getElementById("Page:allForm:editBlock:Phone").value = obj.phone; |
| | | document.getElementById("Page:allForm:editBlock:Phone_Encrypted__c").value = obj.phoneEncrypt; |
| | | //document.getElementById("Page:allForm:editBlock:Phone_Encrypted__c").value = obj.phoneEncrypt; //zhj 新方案改造 2022-12-05 |
| | | } |
| | | |
| | | } |
| | | |
| | | //zhj MEBG新方案改造 2022-11-24 start |
| | | function alertErrorMessage(errorMsg) { |
| | | let errorMsgNode = document.getElementById("Page:allForm:editBlock:msgContent"); |
| | | errorMsg = '错误:无效数据。' + '\n' + errorMsg; |
| | | errorMsgNode.innerText = errorMsg; |
| | | errorMsgNode.className = 'pbError'; |
| | | } |
| | | function hiddenErrorMsgNode() { |
| | | let errorMsgNode = document.getElementById("Page:allForm:editBlock:msgContent"); |
| | | errorMsgNode.innerText = ''; |
| | | errorMsgNode.className = ''; |
| | | } |
| | | //zhj MEBG新方案改造 2022-11-24 end |
| | | // 2022年2月15日 PI改造 徐亮 end |
| | | |
| | | </script> |
| | | |
| | | <apex:form id="allForm"> |
| | | <apex:actionFunction name="searchContact" action="{!searchContact}" rerender="allForm,allPanel" onComplete="unblockUI();Foo()"> |
| | | <apex:actionFunction name="searchContact" action="{!searchContact}" rerender="allForm,allPanel,sfContactId" onComplete="unblockUI();Foo()"> |
| | | <apex:param name="awsDataIdArray" assignTo="{!awsDataIdArray}" value="" /> |
| | | </apex:actionFunction> |
| | | <apex:actionFunction name="editContact" action="{!editContact}" rerender="allForm,allPanel" onComplete="assignUnencrypted();"> |
| | | <apex:actionFunction name="editContact" action="{!editContact}" rerender="allForm,allPanel,sfContactId" onComplete="assignUnencrypted();"> |
| | | <apex:param name="firstParam" assignTo="{!conId}" value="" /> |
| | | </apex:actionFunction> |
| | | <apex:actionFunction name="saveNew" action="{!saveNew}" rerender="allForm,allPanel" onComplete="Trans();"> |
| | | <apex:actionFunction name="saveNew" action="{!saveNew}" rerender="allForm,allPanel,sfContactId" onComplete="Trans();"> |
| | | </apex:actionFunction> |
| | | <apex:actionFunction name="editClear" action="{!editClear}" rerender="allForm,allPanel" onComplete="unblockUI();"> |
| | | <apex:actionFunction name="editClear" action="{!editClear}" rerender="allForm,allPanel,sfContactId" onComplete="unblockUI();searchContactAll()"> |
| | | </apex:actionFunction> |
| | | <!-- 2022/02/15 张华建 清空LineInfoList start --> |
| | | <apex:actionFunction name="clearLineInfoList" action="{!clearLineInfoList}" rerender="allForm" onComplete="unblockUI();"> |
| | | </apex:actionFunction> |
| | | <apex:inputHidden id="sfContactId" value="{!sfContactId}"/> <!-- zhj 2022-12-02 sfId --> |
| | | <!-- 2022/02/15 张华建 清空LineInfoList end --> |
| | | <apex:outputPanel id="allPanel"> |
| | | <apex:pageBlock id="searchBlock" title="检索条件"> |
| | |
| | | <apex:commandButton onclick="editClearJs();" value="清空" rerender="dummy"/> |
| | | <apex:commandButton onclick="editSaveJs();" value="保存" rerender="dummy"/> |
| | | </apex:pageBlockButtons> |
| | | <apex:inputHidden id="LastName_Encrypted__c" value="{!newCon.LastName_Encrypted__c}"/> |
| | | <apex:inputHidden id="Phone_Encrypted__c" value="{!newCon.Phone_Encrypted__c}"/> |
| | | <!-- Error Msg--> |
| | | <div style="text-align: center;"> |
| | | <apex:outputPanel id="errorMsg"> |
| | | <apex:pageMessages id="msgContent" escape="false" /> |
| | | </apex:outputPanel> |
| | | </div> |
| | | <!-- zhj 新方案改造 2022-12-05 start--> |
| | | <!-- <apex:inputHidden id="LastName_Encrypted__c" value="{!newCon.LastName_Encrypted__c}"/> |
| | | <apex:inputHidden id="Phone_Encrypted__c" value="{!newCon.Phone_Encrypted__c}"/> --> |
| | | <!-- zhj 新方案改造 2022-12-05 end--> |
| | | <apex:inputHidden id="AWS_Data_Id__c" value="{!newCon.AWS_Data_Id__c}"/> |
| | | <table class="edittable" border="0" style="border-collapse: collapse; width:600px; table-layout:fixed;"> |
| | | <colgroup> |