| | |
| | | <apex:includeScript value="{!URLFOR($Resource.jquerysuggestjs)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.connection20)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.apex20)}"/> |
| | | <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> |
| | | <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no"/> |
| | | <style type="text/css"> |
| | | /*.sfdcBody {position: absolute; |
| | |
| | | <!-- JS 方法 --> |
| | | <script> |
| | | var j$ = jQuery.noConflict(); |
| | | var closeField = ''; |
| | | var closePhone = ''; |
| | | var newSearchContactWindow = null; |
| | | var staticResourceContact = JSON.parse('{!staticResourceContact}') |
| | | |
| | | |
| | | j$(document).ready(function() { |
| | | var status = '{!tsr.TSReportStatus__c}'; |
| | |
| | | } |
| | | |
| | | |
| | | //20220310 zhj PIPL start |
| | | function isError(){ |
| | | let h = HasError() |
| | | if(h){ |
| | | unblockUI(); |
| | | } |
| | | } |
| | | function HasError(){ |
| | | // if (IsAddmessage) { |
| | | // return true; |
| | | // } |
| | | let e = document.getElementById("allPage:allForm:message"); |
| | | if (!e) { |
| | | return false; |
| | | } |
| | | |
| | | 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){ |
| | | if (cls.indexOf('error')>-1) { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | function alertErrorMessage(errorMsg) { |
| | | let errorMsgNode = document.getElementById("allPage:allForm:message"); |
| | | errorMsgNode.innerText = errorMsg; |
| | | errorMsgNode.className = 'pbError'; |
| | | } |
| | | |
| | | function htmlToElement(html) { |
| | | var template = document.createElement('template'); |
| | | html = html.trim(); // Never return a text node of whitespace as the result |
| | | template.innerHTML = html; |
| | | return template.content.firstChild; |
| | | } |
| | | |
| | | var contactIdValue = ''; |
| | | function searchContact(contactNodeId,field1,field2,field3,accountValueId){ |
| | | closeField = field1; |
| | | closePhone = field2; |
| | | contactIdValue = field3; |
| | | var accountValueLkid = document.getElementById(accountValueId+'_lkid').value; |
| | | var searchContactKeyWord = document.getElementById(field1).value; |
| | | if (accountValueLkid != '000000000000000') { |
| | | let baseUrl = "/apex/SearchContactPage"; |
| | | let suffixUrl = "?contactId="+contactNodeId+ "&accountId=" + accountValueLkid; |
| | | 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) { |
| | | newSearchContactWindow.focus(); |
| | | } |
| | | return false; |
| | | }else { |
| | | alert('请先选择客户单位'); |
| | | } |
| | | } |
| | | |
| | | var currentLastName = ''; |
| | | var currentPhoneId = ''; |
| | | |
| | | function replaceSearchContactLookup() { |
| | | blockme(); |
| | | var RepairInfoListStr = JSON.parse('{!RepairInfoListStr}'); |
| | | sforce.connection.sessionId = '{!GETSESSIONID()}'; |
| | | let queryContactBack = function(data,number){ |
| | | document.getElementById(currentLastName).value = data.object.lastName; |
| | | document.getElementById(currentPhoneId).innerText = data.object.phone; |
| | | number++; |
| | | if(document.getElementById('allPage:allForm:RepairInfoList:'+number+':contactIdValue') != null && document.getElementById('allPage:allForm:RepairInfoList:'+number+':contactIdValue').value != ''){ |
| | | currentLastName = 'allPage:allForm:RepairInfoList:'+number+':Contacts__c'; |
| | | currentPhoneId = 'allPage:allForm:RepairInfoList:'+number+':j_id91'; |
| | | let sfId = document.getElementById('allPage:allForm:RepairInfoList:'+number+':contactIdValue').value; |
| | | var queryStr = 'Select Id, AWS_Data_Id__c' |
| | | +' from Contact where id = \'' |
| | | + sfId +'\' '; |
| | | var reports = sforce.connection.query(queryStr); |
| | | var records = reports.getArray("records"); |
| | | var awsDataId = records[0].AWS_Data_Id__c; |
| | | AWSService.queryTSRepair(staticResourceContact.queryUrl, awsDataId, queryContactBack, staticResourceContact.token,number); |
| | | } |
| | | } |
| | | for(var i = 0;i<RepairInfoListStr.length;i++){ |
| | | let contactHtmlString = '<img src="/img/s.gif" onclick="searchContact(\'allPage:allForm:contactId\',\'allPage:allForm:RepairInfoList:'+i+':Contacts__c\',\'allPage:allForm:RepairInfoList:'+i+':j_id91\',\'allPage:allForm:RepairInfoList:'+i+':contactIdValue\',\'allPage:allForm:RepairInfoList:'+i+':BusinessACustomerUnit\')" alt="Reference Document Number Lookup" class="lookupIcon" title="Reference Document Number Lookup (New Window)"/>'; |
| | | let lookUpNode = htmlToElement(contactHtmlString); |
| | | console.log(lookUpNode); |
| | | let parentNode = document.getElementById('allPage:allForm:RepairInfoList:'+i+':contactIdValue').parentNode; |
| | | parentNode.appendChild(lookUpNode); |
| | | } |
| | | if(document.getElementById('allPage:allForm:RepairInfoList:0:contactIdValue').value != ''){ |
| | | currentLastName = 'allPage:allForm:RepairInfoList:0:Contacts__c'; |
| | | currentPhoneId = 'allPage:allForm:RepairInfoList:0:j_id91'; |
| | | //解密 |
| | | let sfId = document.getElementById('allPage:allForm:RepairInfoList:0:contactIdValue').value; |
| | | var queryStr = 'Select Id, AWS_Data_Id__c' |
| | | +' from Contact where id = \'' |
| | | + sfId +'\' '; |
| | | var reports = sforce.connection.query(queryStr); |
| | | var records = reports.getArray("records"); |
| | | var awsDataId = records[0].AWS_Data_Id__c; |
| | | AWSService.queryTSRepair(staticResourceContact.queryUrl, awsDataId, queryContactBack, staticResourceContact.token,0); |
| | | } |
| | | unblockUI(); |
| | | } |
| | | |
| | | |
| | | function closePopupWindow() { |
| | | console.log('closePopupWindow()') |
| | | if (null != newSearchContactWindow) { |
| | | newSearchContactWindow.close(); |
| | | } |
| | | let contactInfoStr = document.getElementById('allPage:allForm:contactId').value; |
| | | console.log('closePopup:'+contactInfoStr); |
| | | let contactInfo = JSON.parse(contactInfoStr); |
| | | |
| | | document.getElementById(contactIdValue).value = contactInfo.ContactId; |
| | | document.getElementById(''+closeField).value = contactInfo.Name; |
| | | document.getElementById(''+closePhone).value = contactInfo.Phone; |
| | | document.getElementById(''+closePhone).innerText = contactInfo.Phone; |
| | | } |
| | | //20220310 zhj PIPL end |
| | | </script> |
| | | <apex:form id="allForm"> |
| | | <apex:inputHidden value="{!contactId}" id="contactId"/> |
| | | <!-- 王鹏伟 点击按钮更新状态开始 --> |
| | | <apex:actionFunction name="setStatus" action="{!setStatus}" reRender="Activities,message,Activities1" oncomplete="unblockUI();replaceSearchContactLookup();"> |
| | | <apex:actionFunction name="setStatus" action="{!setStatus}" reRender="Activities,message,Activities1" oncomplete="unblockUI();"> |
| | | |
| | | <apex:param name="status" assignTo="{!status}" value="" /> |
| | | </apex:actionFunction> |
| | | <!-- 王鹏伟 点击按钮更新状态结束 --> |
| | | <apex:actionFunction name="updateServiceCategory" action="{!updateServiceCategory}" rerender="Activities" onComplete="replaceSearchContactLookup();unblockUI();"> |
| | | <apex:actionFunction name="updateServiceCategory" action="{!updateServiceCategory}" rerender="Activities" onComplete="unblockUI();"> |
| | | <apex:param name="num" assignTo="{!num}" value="" /> |
| | | </apex:actionFunction> |
| | | |
| | |
| | | <apex:inputField id="BusinessACustomerUnit" value="{!repairInfo.ba.BusinessAAccount__c}" /> |
| | | </td> |
| | | <th style="text-align: center;">联系人</th> |
| | | <td align="left" > |
| | | <!-- <apex:inputField value="{!repairInfo.ba.BusinessAContact__c}" style="width: 80%"/> --> |
| | | <!-- Add By zhj for PIPL 20220309 Start --> |
| | | <apex:inputText value="{!contactNameValue}" id="Contacts__c" style="width: 80%"/> |
| | | <apex:inputHidden id="contactIdValue" value="{!repairInfo.ba.BusinessAContact__c}"/> |
| | | <!-- Add By zhj for PIPL 20220309 end --> |
| | | </td> |
| | | <td align="left" ><apex:inputField value="{!repairInfo.ba.BusinessAContact__c}" style="width: 80%"/></td> |
| | | <th style="text-align: center;">联系电话</th> |
| | | <td align="left" ><apex:outputField value="{!repairInfo.ba.BusinessAPhone_F__c}"/></td> |
| | | </tr> |
| | |
| | | <th style="text-align: center;" >客户单位</th> |
| | | <td style="text-align: left;"><apex:outputField value="{!repairInfo.ba.BusinessAAccount__c}" style="width: 80%"/></td> |
| | | <th style="text-align: center;">联系人</th> |
| | | <td align="left" > |
| | | <apex:outputField value="{!repairInfo.ba.BusinessAContact__c}" style="width: 80%"/> |
| | | <apex:inputHidden id="contactIdValue" value="{!repairInfo.ba.BusinessAContact__c}"/> |
| | | </td> |
| | | <td align="left" ><apex:outputField value="{!repairInfo.ba.BusinessAContact__c}" style="width: 80%"/></td> |
| | | <th style="text-align: center;">联系电话</th> |
| | | <td align="left" ><apex:outputField value="{!repairInfo.ba.BusinessAPhone_F__c}"/></td> |
| | | </tr> |
| | |
| | | <br/> |
| | | <br/> |
| | | </apex:repeat> |
| | | |
| | | </apex:outputPanel> |
| | | <script> |
| | | console.log('appendToOnloadQueue') |
| | | sfdcPage.appendToOnloadQueue(function () { |
| | | replaceSearchContactLookup(); |
| | | }); |
| | | </script> |
| | | <apex:commandButton id="test" onclick="blockme();" action="{!addBusinessActivity}" reRender="Activities" value="添加业务活动" oncomplete="unblockUI();" disabled="{!If(tsr.TSReportStatus__c = '申请中' || tsr.TSReportStatus__c = '确认' ,true , If((tsr.TSReportStatus__c = '草案中' || tsr.TSReportStatus__c = '驳回') && onclickType != '0',true,false))}"></apex:commandButton> |
| | | <apex:commandButton id="save" onclick="blockme();" action="{!save}" reRender="message,allPanel,allForm" value="保存" style="width: 70px;" oncomplete="unblockUI();isError();" disabled="{!If(tsr.TSReportStatus__c = '申请中' || tsr.TSReportStatus__c = '确认',true , If((tsr.TSReportStatus__c = '草案中' || tsr.TSReportStatus__c = '驳回') && onclickType != '0',true,false))}"></apex:commandButton> |
| | | <apex:commandButton id="save" onclick="blockme();" action="{!save}" reRender="message,allPanel,allForm" value="保存" style="width: 70px;" oncomplete="unblockUI();" disabled="{!If(tsr.TSReportStatus__c = '申请中' || tsr.TSReportStatus__c = '确认',true , If((tsr.TSReportStatus__c = '草案中' || tsr.TSReportStatus__c = '驳回') && onclickType != '0',true,false))}"></apex:commandButton> |
| | | </apex:form> |
| | | </apex:page> |