liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
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
<apex:page sidebar="true" standardController="Solution_Programme__c" lightningStylesheets="true">
   <!-- <apex:relatedList list="ProcessSteps" ></apex:relatedList>-->
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <script type="text/javascript">   
       document.addEventListener("DOMContentLoaded", function(event) {
            $(function(){
                
                //添加新按钮隐藏老按钮
                // alert($('input[name="piSubmit"]').val());
                if($('input[name="piSubmit"]').val()=='Submit for Approval')
                {            
                        // ($('input[name="piSubmit"]').hide()).parent().append($('input[name="submit_for_approval"]'));
                        //  $('input[name="piSubmit"]').next().hide();
                }
                else
                {
                    // alert($('input[name="piSubmit"]').val());
                    //   $('input[name="submit_for_approval"]').hide();
                        //替换HistoryList中的审批链接
                        var SolId = ('{!Solution_Programme__c.Id}').substring(0,15);
                        var ApprovalListID = SolId + '_RelatedProcessHistoryList_body';
                        // alert(ApprovalListID);
                        var Approvalprocessdiv=document.getElementById(ApprovalListID);
                        // alert(Approvalprocessdiv.getAttribute('class'));
                        if(Approvalprocessdiv!=null)
                        {
                            var originalHTML=Approvalprocessdiv.innerHTML;
                            var newHtml=originalHTML.replace('/p/process/ProcessInstanceWorkitemWizardStageManager?','/apex/ProcessInstance?SolId='+SolId+'&');
                            Approvalprocessdiv.innerHTML=newHtml;
                        }else{
                                var originalHTML=Approvalprocessdiv.innerHTML;
                                var newHtml=originalHTML.replace('/apex','');
                                Approvalprocessdiv.innerHTML=newHtml;
                        }
                }
            });
        });
    </script>
    <apex:detail relatedList="true" title="true"/>
</apex:page>