Li Jun
2022-03-24 f127c76b19f5316032d4bed127a1dde710c48d74
force-app/main/default/pages/StraightBackAddress.page
@@ -21,7 +21,7 @@
        //替换vlookup
        var newSearchContactWindow = null;
        window.onload = () => {
        window.onload = function () {
            document.getElementById("tab01").style.height  =  screen.availHeight*0.07+'px';
            document.getElementById("tab02").style.height  =  screen.availHeight*0.53+'px';
            document.getElementById("tab03").style.height  =  screen.availHeight*0.25+'px';
@@ -81,7 +81,7 @@
            let divs = j$(e).find("div.message");
            for (let i = 0; i < divs.length; i++) {
                for (let j = 0; j < divs[i].classList.length; j++) {
                    for(let cls of divs[i].classList){
                    for(let cls in divs[i].classList){
                        if (cls.indexOf('error')>-1) {
                            return true;
                        }
@@ -140,7 +140,10 @@
            }
            blockme();
            console.log('{!insUpdData}')
            if(document.getElementById("allPage:allForm:oppBlock2:UpdAddressId:Create_Contacts__c").value){
            if(document.getElementById("allPage:allForm:oppBlock2:UpdAddressId:Create_Contacts__c").value //【联系人(新建)】不为空
                &&document.getElementById("allPage:allForm:oppBlock2:UpdAddressId:CustomerRecordType").value!='{!accOfficeTypeId}'////记录类型id  办事处
                &&document.getElementById("allPage:allForm:oppBlock2:UpdAddressId:CustomerRecordType").value!='{!accAgencyTypeId}'//记录类型id  販売店
                &&document.getElementById("allPage:allForm:oppBlock2:UpdAddressId:CustomerRecordType").value!='{!accAgencyContactTypeId}'){//记录类型id  经销商联系人
                //new contact
                ProcessPI({},GetEditObj('contact'),'contact',function(){
                    //new address
@@ -357,7 +360,12 @@
                for(var i=0;i<tableDataStr.length;i++){
                    if(tableDataStr[i].address.AWS_Data_Id__c){
                        correct++;
                        AWSService.queryRepair(staticResource.queryUrl,tableDataStr[i].address.AWS_Data_Id__c,tableDataStr[i].address.Id,tableDataStr[i].address.Contacts__r.AWS_Data_Id__c,searchCallBack,staticResource.token);
                        AWSService.queryRepair(staticResource.queryUrl,
                                                tableDataStr[i].address.AWS_Data_Id__c,
                                                tableDataStr[i].address.Id,
                                                tableDataStr[i].address.Contacts__r.AWS_Data_Id__c,
                                                searchCallBack,
                                                staticResource.token);
                    } 
                }
                var interval=self.setInterval(function (){
@@ -379,7 +387,6 @@
                let queryBack = function queryBack(result) {
                    let contacts = result.object;
                    if(contacts == null){
                        console.log('查询联系人的数据 == null')
                        return;
                    }
                    for(var i=0;i<result.object.length;i++){
@@ -442,7 +449,7 @@
                '\n邮编: '+PIData[awsDataId].zipCode+
                '\n详细地址: '+PIData[awsDataId].detailedAddress
            }else{
                piInformation = '联系人: '+
                piInformation = '联系人: null'+
                '\n电话: '+PIData[awsDataId].telephone+
                '\n邮编: '+PIData[awsDataId].zipCode+
                '\n详细地址: '+PIData[awsDataId].detailedAddress
@@ -453,8 +460,8 @@
            let y=window.event.y; 
            createDiv.style.left=x;  
            createDiv.style.top=y;  
            createDiv.style.width = '100px';
            createDiv.style.height = '100px';
            createDiv.style.height='100px';
            createDiv.style.width='100px';
            createDiv.style.background="#dddddd";
            createDiv.style.position = "absolute";
            parentNode.appendChild(createDiv);  
@@ -495,6 +502,7 @@
        //自定义lookup查询
        function searchContact(contactNodeId,field){
            closeField = field;
            let searchContactKeyWord = document.getElementById(field).value
            let accountValue = "";
            if (document.getElementById('allPage:allForm:oppBlock2:UpdAddressId:Customer__r_Name')!=null) {
                let accountNodeId = document.getElementById('allPage:allForm:oppBlock2:UpdAddressId:Customer__r_Name').id + '_lkid';
@@ -503,7 +511,7 @@
            console.log(accountValue);
            if(accountValue !='000000000000000'){
                let baseUrl = "/apex/SearchContactPage";
                let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue;
                let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord;
                let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no';
                newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam);
                if (window.focus) {
@@ -511,7 +519,7 @@
                }
                return false;
            }else{
                console.log('请先选择客户再选择联系人')
                alert('请先选择客户再选择联系人')
            }
        }
@@ -525,6 +533,11 @@
            let contactNodeId = 'allPage:allForm:oppBlock2:UpdAddressId:contactIdValue';
            document.getElementById(contactNodeId).value = contactInfo.ContactId;
            document.getElementById(closeField).value = contactInfo.Name;     
        }
        function queryRecordType(){
            if(document.getElementById('allPage:allForm:oppBlock2:UpdAddressId:Customer__r_Name').value){
                queryRecordType();
            }
        }
        //2022 02 28 张华建 display PI Data end
    </script>
@@ -546,6 +559,8 @@
            </apex:actionFunction>
            <!-- 保存和修改方法 -->
            <apex:actionFunction name="save" action="{!save}" rerender="oppBlock2,message" onComplete="unblockUI();{!IF(isSearchBtn,'searchBtnJs()',false)};Trans()"></apex:actionFunction>
            <!-- 查询客户记录类型方法 -->
            <apex:actionFunction name="queryRecordType" action="{!queryRecordType}" rerender="oppBlock2,message" onComplete="unblockUI();"></apex:actionFunction>
            <!-- 点击修改按钮获取修改数据方法 -->
            <apex:actionFunction name="onEditor" action="{!onEditor}" rerender="oppBlock2,checEventFrame,insUpdDataStr" onComplete="decrypt();unblockUI();">
                <apex:param name="UpdId" assignTo="{!UpdId}" value="" />
@@ -635,9 +650,9 @@
                                        <td align="left"  style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                            <apex:outputfield value="{!or.address.Customer__c}" />
                                        </td>
                                        <td align="left"  style="vertical-align: inherit;border-width: 0px 1px 1px 0px;" aws-data-id="{!or.address.AWS_Data_Id__c}" >
                                        <td align="left"  style="vertical-align: inherit;border-width: 0px 1px 1px 0px;" aws-data-id="{!or.address.AWS_Data_Id__c}">
                                            <!-- <apex:outputfield value="{!or.address.Contacts__c}" id="{!or.address.Contacts__c}_{!or.address.Id}"/> -->
                                            <a href="#" id="{!or.address.Id}"   aws-data-id="{!or.address.Contacts__r.AWS_Data_Id__c}" onmouseover="showPIDiv('{!or.address.Id}')" onmouseout="hidePIDiv('{!or.address.Id}')">{!or.address.Contacts__r.Name}</a>
                                            <a href="#" id="{!or.address.Id}" onmouseover="showPIDiv('{!or.address.Id}')" onmouseout="hidePIDiv('{!or.address.Id}')"  aws-data-id="{!or.address.Contacts__r.AWS_Data_Id__c}">{!or.address.Contacts__r.Name}</a>
                                        </td>
                                        <td align="left" style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                            <apex:outputText value="{!or.address.Telephone__c}" />
@@ -681,11 +696,12 @@
            <apex:pageBlock id="oppBlock2" tabStyle="Report">
                <apex:pageblocksection title="编辑地址" id="UpdAddressId" rendered="true" columns="4">
                    <apex:inputfield value="{!insUpdData.Address_Classification__c}" id="Address_Classification__c" />
                    <apex:inputfield value="{!insUpdData.Customer__c}" id="Customer__r_Name" required="false" />
                    <apex:inputfield value="{!insUpdData.Customer__c}" id="Customer__r_Name" required="false" onchange="queryRecordType();" />
                    <!-- Before PIPL 20220308 -->
                    <!-- <apex:inputfield value="{!insUpdData.Contacts__c}" id="Contacts__c" required="false"/> -->
                    <!-- Add By Li Jun for PIPL 20220308 Start -->
                    <apex:inputText label="联系人" disabled="true" value="{!contactNameValue}" id="Contacts__c">
                    <!-- <apex:inputText label="联系人" disabled="true" value="{!contactNameValue}" id="Contacts__c">-->
                        <apex:inputText label="联系人" value="{!contactNameValue}" id="Contacts__c">
                    </apex:inputText>
                    <apex:inputHidden id="contactIdValue" value="{!contactIdValue}"/>
                     <!-- Add By Li Jun for PIPL 20220308 End -->
@@ -708,6 +724,7 @@
                    <apex:inputHidden id="Telephone_Encrypted__c"        value="{!insUpdData.Telephone_Encrypted__c}"/>
                    <apex:inputHidden id="ZipCode_Encrypted__c"          value="{!insUpdData.ZipCode_Encrypted__c}"/>
                    <apex:inputHidden id="Detailed_Address_Encrypted__c" value="{!insUpdData.Detailed_Address_Encrypted__c}"/>
                    <apex:inputHidden id="CustomerRecordType"            value="{!accRecordTypeId}"/>
                </apex:pageblocksection>
                <div style="text-align: center;">