buli
2023-07-14 e6068da47c1bef5517c9e5fdc8c726766867ad4e
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<apex:page controller="NewAccountExamineController" tabStyle="Account"  lightningstylesheets="true">
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:stylesheet value="{!URLFOR($Resource.AccessorySelectCss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.RelationListPagingCmpJS)}"/>
   <script type="text/javascript">
   
        // function ShowHidden(){
        //     var InsTypeval = document.getElementById("j_id0:j_id2:alltable:j_id12:j_id43:InsType").value;
        //     if(InsTypeval == '非医疗机构'){
        //         document.getElementById("j_id0:j_id2:alltable:j_id12:j_id45:HosType").style.display = "block";
        //     }
 
        //测试客户Id    0011000001WVals 0011000001fxzTb(2) ---------------- 0011000001fyz5o  0011000001af6uE(1)  
 
        //驳回理由j_id0:j_id2:alltable:j_id12:j_id40:RejectionReason
        //关联医院j_id0:j_id2:alltable:j_id12:j_id42:AssociatedHospital
        //机构类型j_id0:j_id2:alltable:j_id12:j_id44:InsType
        //医院类型j_id0:j_id2:alltable:j_id12:j_id46:HosType
        //是否为有风险通过j_id0:j_id2:alltable:j_id12:j_id48:Risk
        var isadmin = {!loginUser.ProfileId == $Label.ProfileId_SystemAdmin};
        var isdealers = {!loginUser.ProfileId == $Label.ProfileId_2J3};
        window.onload = function(){ 
            if (!isadmin && !isdealers) {
                j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id46:RejectionReason')).attr('disabled',true);
                j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id48:AssociatedHospital')).attr('disabled',true);
                j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id50:InsType')).attr('disabled',true);
                j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id52:HosType')).attr('disabled',true);
                j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id54:Risk')).attr('disabled',true);
            }else if(isadmin && !isdealers){
                j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id46:RejectionReason')).attr('disabled',false);
                j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id48:AssociatedHospital')).attr('disabled',true);
                j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id50:InsType')).attr('disabled',false);
                j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id52:HosType')).attr('disabled',true);
                j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id54:Risk')).attr('disabled',true);
                // document.getElementById("j_id0:j_id2:alltable:j_id12:j_id42:AssociatedHospital").disabled = "true";
                // document.getElementById("j_id0:j_id2:alltable:j_id12:j_id44:InsType").disabled = "false";
                // document.getElementById("j_id0:j_id2:alltable:j_id12:j_id46:HosType").disabled = "true";
                // document.getElementById("j_id0:j_id2:alltable:j_id12:j_id48:Risk").disabled = "true";
            }else if (isdealers) {
                j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id46:RejectionReason')).attr('disabled',true);
                j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id48:AssociatedHospital')).attr('disabled',true);
                j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id50:InsType')).attr('disabled',true);
                j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id52:HosType')).attr('disabled',true);
                j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id54:Risk')).attr('disabled',false);
            }
        }
          function changeReasonJs(){
                var RejectionReason = j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id46:RejectionReason')).value();
                if(RejectionReason != null && RejectionReason == '重复'){
                   j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id48:AssociatedHospital')).attr('disabled',false);
                }else{
                   j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id48:AssociatedHospital')).attr('disabled',true); 
                }
                if (isdealers) {
                   j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id54:Risk')).attr('disabled',false);
                   j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id46:RejectionReason')).attr('disabled',true);
                   j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id48:AssociatedHospital')).attr('disabled',true);
                   j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id50:InsType')).attr('disabled',true);
                   j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id52:HosType')).attr('disabled',true);
                }else{
                   j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id54:Risk')).attr('disabled',true);
                }  
 
            }
           function changeReasonJs1(){
                var InsType = j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id50:InsType')).value();
                if(InsType != null && InsType == '非医疗机构'){
                   j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id52:HosType')).attr('disabled',false);
                }else{
                    j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id52:HosType')).attr('disabled',true);
                }
                if (isdealers) {
                   j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id54:Risk')).attr('disabled',false);
                   j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id46:RejectionReason')).attr('disabled',true);
                   j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id48:AssociatedHospital')).attr('disabled',true);
                   j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id50:InsType')).attr('disabled',true);
                   j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id52:HosType')).attr('disabled',true);
                }else{
                   j$(escapeVfId('j_id0:j_id8:alltable:j_id18:j_id54:Risk')).attr('disabled',true);
                }
            }
           function saveJs() {
              blockme();
           }
   </script>
   <apex:form >
   <apex:sectionHeader title="批准请求" subtitle="{!objAcc.Name}"/>
   <apex:actionFunction name="Approval1" action="{!Approval}" />
   <apex:pageBlock id="alltable" title="批准/拒绝批准请求">
       <apex:pageBlockButtons location="bottom"> 
           <apex:commandButton value="批准"  onclick="saveJs()" action="{!Approval}" reRender="alltable" oncomplete="changeReasonJs(),changeReasonJs1(),unblockUI()">
                   <apex:param name="approve" value="Approve" assignTo="{!ApprovalAction}"/>
           </apex:commandButton>
           <apex:commandButton value="拒绝"  onclick="saveJs()" action="{!Approval}" reRender="alltable" oncomplete="changeReasonJs(),changeReasonJs1(),unblockUI()">
                   <apex:param name="reject" value="Reject" assignTo="{!ApprovalAction}"/>
           </apex:commandButton>
           <apex:commandButton value="取消" action="{!Approval}" reRender="alltable">
                   <apex:param name="cancel" value="Cancel" assignTo="{!ApprovalAction}"/>
           </apex:commandButton>
       </apex:pageBlockButtons>   
       <apex:pageBlockSection columns="1">
              <apex:pageBlockSectionItem >
               <apex:pageMessages />
           </apex:pageBlockSectionItem>
          
 
           <apex:pageBlockSectionItem >
               驳回理由 <font color="red"></font><apex:inputField id="RejectionReason" value="{!objAcc.RejectionReason__c}" style="width:170px;" onchange="changeReasonJs();"/>
           </apex:pageBlockSectionItem>
           <apex:pageBlockSectionItem >
               关联医院 <font color="red"></font><apex:inputField id="AssociatedHospital" value="{!objAcc.AssociatedHospital__c}"/>
           </apex:pageBlockSectionItem>
           <!-- onchange="ShowHidden()"   display:none; -->
           <apex:pageBlockSectionItem >
               机构类型 <font color="red"></font>
               <apex:inputField id="InsType" value="{!objAcc.InstitutionalType__c}" style="width:170px;"  onchange="changeReasonJs1();"
               />
           </apex:pageBlockSectionItem>
           <apex:pageBlockSectionItem >
               医院类型 <font color="red"></font>
               <apex:inputField id="HosType" value="{!objAcc.HospitalType__c}" style="width:170px;"
                />
           </apex:pageBlockSectionItem>
           <apex:pageBlockSectionItem >
               是否为有风险通过 <font color="red"></font>
               <apex:inputField id="Risk" value="{!objAcc.WhetherRiskPassing__c}" style="width:170px;"/>
           </apex:pageBlockSectionItem>
           <apex:pageBlockSectionItem >
              评论 <font color="red"></font> <apex:inputTextArea value="{!Comments}" rows="5" cols="100"/>
           </apex:pageBlockSectionItem>
       </apex:pageBlockSection>
   </apex:pageBlock>
   </apex:form>
</apex:page>