DESKTOP-0K9VGFE\hp
2022-03-11 6d766b0c8e9b31e7e03ffd344a94c2851aa9beb9
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<apex:page controller="AccessorySelectController" showHeader="false" sidebar="false" id="allPage" action="{!init}">
<head>
<title>附属品选择</title>
<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">
var heightAjustment = 120;
var widthAjustment = 30;
 
function saveGoPageJs(lineNo) {
    blockme();
 
    checkEvent(lineNo);
}
 
function goPageJs(goUrl) {
    unblockUI();
 
    if (goUrl != "") {
        window.location.href = goUrl;
    }
}
 
function clickCancel(){
    if (confirm('是否操作取消?')) {
        blockme();
        cancel();
    }
}
function clickunassign(){
    if (confirm('是否操作取消分配?')) {
        blockme();
        unassign();
    }
}
 
</script>
</head>
    <apex:form id="allForm">
 
        <apex:actionFunction name="checkEvent" action="{!checkEvent}" rerender="allForm,checEventFrame" oncomplete="goPageJs(j$(escapeVfId('{!$Component.checkEventUrl}')).value())">
            <apex:param name="firstParam" assignTo="{!clickLineNo}" value="" />
        </apex:actionFunction>
        <apex:actionFunction action="{!cancel}" name="cancel" rerender="allForm,checEventFrame" oncomplete="unblockUI();"/>
        <apex:actionFunction action="{!unassign}" name="unassign" rerender="allForm,checEventFrame" oncomplete="unblockUI();"/>
        <apex:inputHidden id="checkEventUrl" value="{!goAccessoryAdd}" />
 
        <apex:outputPanel id="pageallPanel">
            <apex:pageBlock id="searchBlock" tabStyle="Report">
                <apex:pageBlockSection title="附属品选择" id="fspId" >
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Name}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Demo_purpose1__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Owner.Name}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.demo_purpose2__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Salesdept__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Product_category__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.WorkPlace__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Equipment_Type_F__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Internal_asset_location_F__c}" />
                    <apex:outputField value="{!parentObj.SerialNumber_F__c}"/>
                    <!-- <apex:outputText /> -->
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Request_shipping_day__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Request_return_day__c}"/>
                    <apex:outputField value="{!parentObj.Fixture_Set__r.Fixture_Set_Body_Model_No__c}"/>
                    <apex:outputField value="{!parentObj.Irreplaceable_flag__c}"/>
                    <apex:outputField value="{!parentObj.Fu_Shu_Pin_Fen_Pei_Jia__c}"/>
                    <apex:outputText />
                    <apex:outputField value="{!parentObj.Rental_Start_Date__c}"/>
                    <apex:outputField value="{!parentObj.Rental_End_Date__c}"/>
                    <!-- <apex:outputText /> -->
                    
                </apex:pageBlockSection>
                    <!-- <apex:pageBlockSectionItem id="pbId"> -->
                    <apex:outputPanel style="float:right;" >
                        <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set_Detail__c.fields.Cancel_Reason__c.label}" for="Cancel_Reason"/>
                        <apex:inputField value="{!sonObj.Cancel_Reason__c}" id="Cancel_Reason" onchange="changeCancleReasonJs();" />
                        <!-- 20210817 ljh onchange SFDC-C448KZ pageRaesd.Cancel_Reason__c -->
                        <!--20210803 SFDC-C448KZ you  start-->
                        <apex:outputLabel style="margin-left: 15px;" value="{!$ObjectType.Rental_Apply_Equipment_Set_Detail__c.fields.Loaner_cancel_reason__c.label}" for="Loaner_cancel_reason"/>
                        <apex:inputField value="{!sonObj.Loaner_cancel_reason__c}" id="Loaner_cancel_reason" onchange="changeReasonJs();"/>
                        <!-- 20210817 ljh onchange  SFDC-C448KZ end-->
                        <apex:outputLabel style="margin-left: 15px;" value="{!$ObjectType.Rental_Apply_Equipment_Set_Detail__c.fields.Loaner_cancel_Remarks__c.label}" for="Loaner_cancel_Remarks"/>
                        <!-- <apex:inputField value="{!pageRaesd.Loaner_cancel_Remarks__c}" id="Loaner_cancel_Remarks"/> -->
                        <apex:inputField value="{!sonObj.Loaner_cancel_Remarks__c}" id="Loaner_cancel_Remarks" html-disabled="true"/>
                        <!-- 20210817 ljh html-disabled SFDC-C448KZ -->
                        <apex:commandButton style="margin-left: 20px;" reRender="allForm,checEventFrame" value="适用" onclick="applyJs()" oncomplete="applyLcr();changeReasonJs()" />
                        <!-- 20210817 ljh  SFDC-C448KZ  add oncomplete  -->
                        <script type="text/javascript">
                            function applyJs() {
                              // var errorFlag = j$(escapeVfId('{!$Component.hasError}')).value();
                              // if(errorFlag == 'false'){
                                var cnt = document.getElementById('allPage:allForm:cmpid:cmpinnerid:dataBlock:currentPageRecordCnt').value;
                                var Cancel_Reason = j$(escapeVfId('{!$Component.Cancel_Reason}')).value();
                                var Loaner_cancel_Remarks = j$(escapeVfId('{!$Component.Loaner_cancel_Remarks}')).value();
                                var Loaner_cancel_reason = j$(escapeVfId('{!$Component.Loaner_cancel_reason}')).value();
                                var cancel_Reason = [];
                                j$("td.dataCellBorder1.col_Cancel_Reason__c").each(function () {
                                  cancel_Reason.push(j$(this))
                                });
                                var cancel_Remarks = [];
                                j$("td.dataCellBorder1.col_Loaner_cancel_Remarks__c").each(function () {
                                  cancel_Remarks.push(j$(this))
                                });
                                for (var i = 0; i < cnt; i++) {
                                  var lock = j$(escapeVfId('allPage:allForm:cmpid:cmpinnerid:dataBlock:oppTable_L:' + i + ':rowCheck'));
                                  if(lock.prop('checked') == true){
                                    cancel_Reason[i].find("Select").val(Cancel_Reason);
                                    cancel_Remarks[i].find("input").val(Loaner_cancel_Remarks);
                                  }
                                }
                              // }
                            }
                            //20210817 ljh  SFDC-C448KZ  start
                            function applyLcr(){
                                var cnt = document.getElementById('allPage:allForm:cmpid:cmpinnerid:dataBlock:currentPageRecordCnt').value;
                                var Loaner_cancel_reason = j$(escapeVfId('{!$Component.Loaner_cancel_reason}')).value(); 
                                var loaner_cancel_reason_SZ = [];
                                j$("td.dataCellBorder1.col_Loaner_cancel_reason__c").each(function () {
                                    loaner_cancel_reason_SZ.push(j$(this))
                                });
                                var cancel_RemarksSZ = [];
                                j$("td.dataCellBorder1.col_Loaner_cancel_Remarks__c").each(function () {
                                  cancel_RemarksSZ.push(j$(this))
                                });
                                for (var i = 0; i < cnt; i++) {
                                  var lock = j$(escapeVfId('allPage:allForm:cmpid:cmpinnerid:dataBlock:oppTable_L:' + i + ':rowCheck'));
                                    if(lock.prop('checked') == true){
                                        loaner_cancel_reason_SZ[i].find("Select").val(Loaner_cancel_reason);
                                        if(Loaner_cancel_reason == '其他'){
                                            cancel_RemarksSZ[i].find("input").attr('disabled',false);
                                        }
                                    }
                                }
                            }
                            //20210817 ljh  SFDC-C448KZ  end 
                          </script>
                    </apex:outputPanel>
                    <!-- </apex:pageBlockSectionItem> -->
 
                <apex:pageBlockButtons location="bottom">
                    <!-- <apex:commandButton style="float:left;" value="检索" action="{!searchOpp}" onclick="blockme();" rerender="allForm, checEventFrame" oncomplete="unblockUI();" /> -->
                    <apex:commandButton style="float:left;" action="{!save}" value="保存" onclick="blockme();" rerender="allForm,checEventFrame" oncomplete="unblockUI();" />
                    <apex:commandButton style="float:left;" value="取消分配" onclick="unassign(); return false;" rerender="allForm,checEventFrame"/>
                    <apex:commandButton style="float:left;" value="取消" onclick="clickCancel(); return false;" />
                    <apex:commandButton style="float:right;" action="{!turnback}" value="返回" rerender="allForm,checEventFrame"/>
                </apex:pageBlockButtons>
                <div style="clear:both;"></div>
 
                <apex:outputPanel id="message">
                    <apex:pageMessages />
                </apex:outputPanel>
            </apex:pageBlock>
            <c:RelationListPagingCmp id="cmpid" pgController="{!this}" hasCheckbox="true"/>
        </apex:outputPanel>
    </apex:form>
    <apex:outputPanel id="checEventFrame">
        <script>
            // 20210817 ljh add 
            function changeCancleReasonJs(){
                // allPage:allForm:searchBlock:Cancel_Reason
                // allPage:allForm:searchBlock:Loaner_cancel_Remarks
                var Cancel_Reason = j$(escapeVfId('allPage:allForm:searchBlock:fspId:Cancel_Reason')).value();
                if((Cancel_Reason != null && Cancel_Reason == '主动取消') || Cancel_Reason == '' || Cancel_Reason == null){
                    j$(escapeVfId('allPage:allForm:searchBlock:Loaner_cancel_Remarks')).val('');
                    j$(escapeVfId('allPage:allForm:searchBlock:Loaner_cancel_Remarks')).attr('disabled',true);
                }
                changeReasonJs();
                // else if(Cancel_Reason != null && Cancel_Reason == '重新分配'){
                //     j$(escapeVfId('allPage:allForm:searchBlock:fspId:pbId:Loaner_cancel_Remarks')).attr('disabled',false);
                // }    
            }
            function changeReasonJs(){
                var reason = j$(escapeVfId('allPage:allForm:searchBlock:Loaner_cancel_reason')).value();
                if(reason != null && reason == '其他'){
                    j$(escapeVfId('allPage:allForm:searchBlock:Loaner_cancel_Remarks')).attr('disabled',false);
                }else{
                    j$(escapeVfId('allPage:allForm:searchBlock:Loaner_cancel_Remarks')).val('');
                    j$(escapeVfId('allPage:allForm:searchBlock:Loaner_cancel_Remarks')).attr('disabled',true);
                }    
            }
            // 20210817 ljh add end
            //add by rentx 20210813 start SFDC-C448KZ
            //1.默认设置"取消备注理由"不可编辑
            //设置明细行的不可编辑
            j$(".dataCellBorder1.col_Loaner_cancel_Remarks__c input").each(function () {
                //设置只读
                j$(this).prop('disabled', true)
            });
            //2.设置只有明细取消理由为 '其他' 时 取消理由备注 可编辑
            //设置当明细取消原因为 其他时可编辑
            j$(".dataCellBorder1.col_Loaner_cancel_reason__c span").each(function () {
                //判断当前标签下的select标签值是否为取消--
                // var aaa = j$(this);
                var Loaner_cancel_reason = j$(this).children()[0].value;
                if (Loaner_cancel_reason == '其他') {
                    //拿到输入框 设置可以编辑
                    j$(this).parent().parent().find("input[type=text]").prop("disabled",false);
                    j$(this).parent().parent().find("input[type=text]").prop("required","required");
                }
            });
 
            //为明细取消原因添加change时间 如果变为其他 则设置可编辑 反之设置不可编辑
            j$(".dataCellBorder1.col_Cancel_Reason__c").on("change", function () {
                //判断当前标签下的select标签值是否为取消--
                var Cancel_Reason = j$(this).children()[0].value;
                if((Cancel_Reason != null && Cancel_Reason == '主动取消') || Cancel_Reason == ''|| Cancel_Reason == null ){
                    //清空输入框 设置不可编辑
                    j$(this).parent().find("input[type=text]").val('');
                    j$(this).parent().find("input[type=text]").prop("disabled",true);
                }
                // else if(Cancel_Reason != null && Cancel_Reason == '重新分配'){
                //     j$(this).parent().find("input[type=text]").prop("disabled",false);
                // }
            });
            j$(".dataCellBorder1.col_Loaner_cancel_reason__c span").on("change", function () {
                //判断当前标签下的select标签值是否为取消--
                var Loaner_cancel_reason = j$(this).children()[0].value;
                if (Loaner_cancel_reason == '其他') {
                    //拿到输入框 设置可以编辑
                    j$(this).parent().parent().find("input[type=text]").prop("disabled",false);
                }else{
                    //清空输入框 设置不可编辑
                    j$(this).parent().parent().find("input[type=text]").val('');
                    j$(this).parent().parent().find("input[type=text]").prop("disabled",true);
                }
            });
            //add by rentx 20210813 end SFDC-C448KZ
 
        addlinkbutton();
        function addlinkbutton() {
            // 次の画面遷移click
            var ele = j$(".dataCellBorder1.col_Fu_Shu_Pin_Fen_Pei_Jia__c");
 
            if (ele.length) {
                var i = 0;
                var showButton = eval("({!JSENCODE(bodyModelNoJson)})");
 
                ele.each(function () {
                    if (showButton[i]) {
                        j$(this).css('align-items','center');
                        j$(this).append('<input type="button" style="width: auto;" value="分配" disabled onclick="saveGoPageJs('+i+');"/>');
                    } else {
                        j$(this).css('align-items','center');
                        j$(this).append('<input type="button" style="width: auto;" value="分配" onclick="saveGoPageJs('+i+');"/>');
                    }
 
                    i = i + 1;
                });
            }
        }
        </script>
    </apex:outputPanel>
</apex:page>