Li Jun
2022-03-28 f5a94e721ae5a26f817f0df75065b64f1f192eb3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<apex:page standardController="Report__c" extensions="NewAndEditReportController" id="page">
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/>
    <apex:form id="form">
        <apex:pageblock id="pageBlock">
            <apex:pageBlockSection showHeader="false" title="" collapsible="true" columns="2" id="pageBlockSection">
                <!--Each section has layoutFields, let's iterate them as well-->
                <apex:repeat value="{!encryptedAPIList}" var="encryptedAPI">
                    <apex:outputField html-data-id="{!encryptedAPI}" value="{!Report__c[encryptedAPI]}" />
                </apex:repeat>
            </apex:pageBlockSection>
            <script>
                var staticResources = JSON.parse('{!staticResource}');
                function QueryLeadFromAWS() {
                    AWSService.query(staticResources.queryUrl, '{!AWSDataId}', queryBack, staticResources.token);
                }
                var queryBack = function queryBack(data) {
                    document.querySelector("[data-id='VOC_Informer_Name__c']").innerText=data.object.vocInformerName
                    document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id2:1:j_id3']").innerText=data.object.callerPhone
                    document.querySelector("[data-id='VOC_Informer_Contact__c']").innerText=data.object.vocInformerContact
                    document.querySelector("[data-id='Person_In_Charge_Text__c']").innerText=data.object.personInChargeText
                    document.querySelector("[data-id='Professor_sigh_text__c']").innerText=data.object.professorSighText
                    document.querySelector("[data-id='Staff_Info_Manual_c__c']").innerText=data.object.staffInfoManual
                    document.querySelector("[data-id='Medical_History__c']").innerText = data.object.medicalHistory
                    document.querySelector("[data-id='Responsible_Person_HP_c__c']").innerText=data.object.responsiblePersonHP
                    document.querySelector("[data-id='Practitioner1_Part__c']").innerText=data.object.practitioner1Part
                    document.getElementById('page:form:pageBlock:pageBlockSection:j_id2:8:j_id3').innerText=data.object.practitioner2Part
                    document.getElementById('page:form:pageBlock:pageBlockSection:j_id2:9:j_id3').innerText=data.object.practitioner3Part
                    document.getElementById('page:form:pageBlock:pageBlockSection:j_id2:10:j_id3').innerText=data.object.practitioner4Part
                    document.getElementById('page:form:pageBlock:pageBlockSection:j_id2:11:j_id3').innerText=data.object.practitioner5Part
                    document.querySelector("[data-id='age__c']").innerText=data.object.age
                    document.querySelector("[data-id='sex__c']").innerText=data.object.sex
                };
                sfdcPage.appendToOnloadQueue(function () {
                    console.log('awsDataId = '+'{!AWSDataId}')
                    QueryLeadFromAWS();
                });
            </script>
        </apex:pageblock>
    </apex:form>
</apex:page>