高章伟
2022-03-18 4bfe21c4b5ddc089ae5a95f4b10f6cff148b690d
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
<apex:page Controller="EquipmentRentalCancelController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="取消一览">
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
 
<script type="text/javascript">
function savejs() {
    if (confirm('是否操作取消?')) {
        blockme();
        saveBtn();
    }
}
function returnjs() {
    var rentalApplyId = j$(escapeVfId('allPage:allForm:allBlock:rentalApplyId')).text();
    var url = "/" + rentalApplyId;
    window.location.href = url;
}
function refresh() {
    var hasError = j$(escapeVfId('allPage:allForm:allBlock:hasError')).text();
    if (hasError == 'false') {
        returnjs();
    }
}
/** 20210708 SFDC-C448KZ you start**/
var cnt = {!EquipmentSetCnt};
 function changeCancleReasonJs(){
    
    for (var i = 0; i < cnt; i++) {
        var Cancel_Reason = j$(escapeVfId('allPage:allForm:allBlock:records:' + i + ':Cancel_Reason')).value();
        // && j$(escapeVfId('allPage:allForm:allBlock:records:' + i + ':rowCheck')).attr('checked') == 'checked'
        if(Cancel_Reason != '被动取消'){
            j$(escapeVfId('allPage:allForm:allBlock:records:' + i + ':Loaner_cancel_request')).val('');
            j$(escapeVfId('allPage:allForm:allBlock:records:' + i + ':Loaner_cancel_request')).attr('disabled',true);
        } 
    }    
       
}
function changeReasonJs(){
    for (var i = 0; i < cnt; i++) {
        var reason = j$(escapeVfId('allPage:allForm:allBlock:records:' + i + ':Loaner_cancel_reason')).value();
        if(reason != null && reason == '其他'){
            j$(escapeVfId('allPage:allForm:allBlock:records:' + i + ':Loaner_cancel_request')).attr('disabled',false);
        }else{
            j$(escapeVfId('allPage:allForm:allBlock:records:' + i + ':Loaner_cancel_request')).val('');
            j$(escapeVfId('allPage:allForm:allBlock:records:' + i + ':Loaner_cancel_request')).attr('disabled',true);
        } 
    }   
}
/** 20210708 SFDC-C448KZ you end**/
</script>
 
    <apex:form id="allForm">
        <apex:actionFunction name="saveBtn" action="{!saveBtn}" rerender="allBlock,message" onComplete="unblockUI();refresh();changeReasonJs();">
        </apex:actionFunction>
        <apex:outputPanel id="allPanel">
            <apex:pageBlock title="取消一览" id="allBlock">
                <apex:pageBlockButtons >
                    <apex:commandButton onclick="savejs(); return false;" value="保存" disabled="{!saveBtn}" rerender="dummy"/>
                    <apex:commandButton onclick="returnjs(); return false;" value="返回" rerender="dummy"/>
                </apex:pageBlockButtons>
 
                <apex:outputPanel id="message">
                    <apex:pageMessages />
                </apex:outputPanel>
 
                <apex:outputText id="hasError" value="{!hasError}" style="display:none"/>
                <apex:outputText id="rentalApplyId" value="{!rentalApplyId}" style="display:none"/>
                <apex:inputHidden id="EquipmentSetCnt" value="{!EquipmentSetCnt}"/><!--20210708 SFDC-C448KZ you  -->
 
                <table class="linetable" border="1" style="border-collapse: collapse;width: 750px;">
                    <colgroup>
                        <col width="25"/>
                        <col width="110"/>
                        <col width="110"/>
                        <col width="110"/>
                        <col width="110"/>
                        <col width="110"/>
                        <col width="175"/>
                    </colgroup>
                    <tr style="background-color:#DCDCDC;">
                        <th style="text-align:center">&nbsp;</th>
                        <th style="text-align:center">{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Name.label}</th>
                        <th style="text-align:center">{!$ObjectType.Fixture_Set__c.fields.Name.label}</th>
                        <th style="text-align:center">{!$ObjectType.Fixture_Set__c.fields.Loaner_name__c.label}</th>
                        <th style="text-align:center">{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.RAES_Status__c.label}</th>
                        <th style="text-align:center">{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Rental_Start_Date__c.label}</th>
                        <th style="text-align:center">{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Final_reply_day__c.label}</th>
                        <th style="text-align:center">{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Cancel_Reason__c.label}</th>
                        <!--20210708 SFDC-C448KZ you  -->
                        <th style="text-align:center;width:80px"> 
                        {!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Loaner_cancel_reason__c.label}</th>
                        <th style="text-align:center">{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Loaner_cancel_Remarks__c.label}</th>
                    </tr>
                    <apex:repeat value="{!lineInfoList}" var="info" id="records">
                        <tr>
                            <!--<td align="center"><apex:inputCheckbox value="{!info.isSelect}" id="rowCheck" disabled="{!IF(info.status=='cantCancel', true, false)}"/></td>-->
                            <td align="center"><apex:inputCheckbox value="{!info.isSelect}" id="rowCheck"/></td>
                            <td align="left"><apex:outputText value="{!info.raes.Name}"></apex:outputText></td>
                            <td align="left"><apex:outputText value="{!info.esName}"></apex:outputText></td>
                            <td align="left"><apex:outputText value="{!info.loanerCode}"></apex:outputText></td>
                            <td align="left"><apex:outputText value="{!info.raes.RAES_Status__c}"></apex:outputText></td>
                            <td align="center"><apex:outputField value="{!info.raes.Rental_Start_Date__c}"></apex:outputField></td>
                            <td align="center"><apex:outputField value="{!info.raes.Final_reply_day__c}"></apex:outputField></td>
                            <td align="right">
                                <!--<apex:inputField id="reason" value="{!info.raes.Cancel_Reason__c}" rendered="{!IF(info.status=='canCancel', true, false)}"/>
                                <apex:outputField value="{!info.raes.Cancel_Reason__c}" rendered="{!IF(info.status=='canCancel', false, true)}"/>-->
                                <apex:inputField id="Cancel_Reason" value="{!info.raes.Cancel_Reason__c}" onchange="changeCancleReasonJs();"/>
                                <!-- <apex:outputField value="{!info.raes.Cancel_Reason__c}"/> -->
                            </td>
                           <!--20210708 SFDC-C448KZ you  -->
                            <td align="right">
                                <apex:inputField value="{!info.raes.Loaner_cancel_reason__c}" id="Loaner_cancel_reason"  onchange="changeReasonJs();"/>
                            </td>
                            <td align="center"><apex:inputField value="{!info.raes.Loaner_cancel_Remarks__c}" id="Loaner_cancel_request" html-disabled="true"></apex:inputField></td>
                        </tr>
                    </apex:repeat>
                </table>
            </apex:pageBlock>
        </apex:outputPanel>
    </apex:form>
</apex:page>