buli
2022-03-11 02ddc35714cbd1688b7cb057f770f1410de79dab
force-app/main/default/pages/ConsumTrial.page
@@ -5,6 +5,7 @@
    <apex:stylesheet value="{!URLFOR($Resource.ConsumTrialPageCss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.ReceivingNotePageJS)}"/>
    <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
    <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/>
    <apex:form id="allForm">
        <style>
            table.headTable td   {
@@ -26,6 +27,8 @@
<script type="text/javascript">
    var heightAjustment = 120;
    var widthAjustment = 30;
            var staticResource = JSON.parse('{!staticResource}');
    // 适用按钮
    function applyJs() {
@@ -303,6 +306,109 @@
        }
        window.history.pushState({},"", window.location.href.replace('&saveType=1',''));
    }
            //2022 02 24 张华建 display PI Data start
            var rowBList;
            var TrialUser = {};
            var ids = [];
            queryUser();
            function q1(){
                var p = new Promise(function(resolve, reject){
                    rowBList = JSON.parse('{!rowListString}')
                    var x = 0;
                    let searchCallBack = function searchCallBack(result){
                        let contacts = result.object;
                        if(contacts == null){
                            return;
                        }
                        let temp = {}
                        temp.trialUser = contacts.trialUser;
                        TrialUser[contacts.dataId] = temp;
                        x++;
                    };
                    for(var i=0;i<rowBList.length;i++){
                        ids.push(rowBList[i].rnd.AWS_Data_Id__c + '_' + rowBList[i].rnd.Id);
                        AWSService.query(staticResource.queryUrl,rowBList[i].rnd.AWS_Data_Id__c,searchCallBack,staticResource.token);
                    }
                    var id = setInterval(function(){
                        if(x >= rowBList.length){
                            console.log('success')
                            resolve('success');
                            clearInterval(id);
                        }
                    },1000);
                });
                return p;
            }
            function q2(value){
                var p = new Promise(function(resolve, reject){
                    console.log('进入q2'+value)
                    for(var i=0;i<ids.length;i++){
                        console.log('i = '+i);
                        document.getElementById(ids[i]).children[0].children[0].children[0].value = TrialUser[ids[i].substring(0,18)].trialUser;
                        console.log('i = '+i);
                    }
                });
            }
            function queryUser(){
                rowBList = JSON.parse('{!rowListString}')
                console.log('pageB.fixMode = '+'{!pageB.fixMode}')
                if('{!pageB.fixMode}' == 'true'){
                    q1().then(function(data){
                        return q2(data);
                    })
                    unblockUI();
                }else{
                    blockme();
                    console.log(rowBList)
                    let searchCallBack = function searchCallBack(result){
                        let contacts = result.object;
                        if(contacts == null){
                            return;
                        }
                        let temp = {}
                        temp.trialUser = contacts.trialUser;
                        TrialUser[contacts.dataId] = temp;
                    };
                    for(var i=0;i<rowBList.length;i++){
                        ids.push(rowBList[i].rnd.AWS_Data_Id__c + '_' + rowBList[i].rnd.Id);
                        AWSService.query(staticResource.queryUrl,rowBList[i].rnd.AWS_Data_Id__c,searchCallBack,staticResource.token);
                    }
                    unblockUI();
                }
            }
            function showPIDiv(awsDataId){
                if(awsDataId.length == 0){
                    return
                }
                console.log('awsDataId Value:'+awsDataId);
                let parentNode = document.getElementById(awsDataId);
                let createDiv = document.createElement("div");
                createDiv.id = awsDataId+"_PI";
                let piInformation = 'trialUser:'+TrialUser[awsDataId.substring(0,18)].trialUser
                //let piInformation = 'Name:'+contact['943114607025717249'].lastName +'\n' +'Phone:'+contact['943114607025717249'].phone
                createDiv.innerText = piInformation;
                let x=window.event.x;
                let y=window.event.y;
                createDiv.style.left=x;
                createDiv.style.top=y;
                createDiv.style.background="#dddddd";
                createDiv.style.position = "absolute";
                parentNode.appendChild(createDiv);
            }
            function hidePIDiv(awsDataId){
                if(awsDataId.length == 0){
                    return
                }
                document.getElementById(awsDataId+'_PI').remove();
            }
            //2022 02 24 张华建 display PI Data end
</script>
        <apex:pageMessages />
        <!-- oncomplete="clearApplyValue(); return false;" -->
@@ -352,6 +458,15 @@
                                    <!-- 试用者 -->
                                    {!$ObjectType.Consum_Apply_Equipment_Set_Detail__c.fields.Trial_User__c.label}
                                    <apex:inputField id="TrialUser" value="{!pageB.caesdInput.Trial_User__c}"/>
                                    <!-- <script>
                                           sfdcPage.appendToOnloadQueue(function () {
                                            var queryBack = function queryBack(data) {
                                                console.log('data = ' + data);
                                                document.getElementById('{!pageB.caesdInput.AWS_Data_Id__c}') = data.object.trialUser;
                                            };
                                                AWSService.query(staticResources.queryUrl, '{!pageB.caesdInput.AWS_Data_Id__c}', queryBack, staticResources.token);
                                            });
                                    </script> -->
                                </td>
                                <td>
                                    <!-- 跟台者 -->
@@ -444,7 +559,7 @@
                    <apex:repeat id="dataline_R" value="{!pageB.rowBList}" var="var">
                    <tr id="tableData_R_{!Cnt_R}" class="dataRow" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}" style="{!IF(var.isOddnumber, 'background-color : #EFF4FC;', '')}">
                        <apex:repeat value="{!inputFieldList}" var="info" id="inputField">
                            <td class="dataCellBorder1 intf {!info.value} col_{!info.value}">
                                    <td class="dataCellBorder1 intf {!info.value} col_{!info.value}" id="{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,info.value)}" onmouseover="showPIDiv('{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,'')}')" onmouseout="hidePIDiv('{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,'')}')">
                                <apex:outputPanel rendered="{!(contains(var.canChangeField, info.value) || var.canChangeField == '') && pageB.fixMode == true && var.canChange == true && info.value != 'Degree_Of_Importance__c'}">
                                    <!-- onchange="setChangeFlg('{!var.lineNo}')" -->
                                    <apex:outputPanel rendered="{!info.value != 'Case_OR_animal_organ__c'}">