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
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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
<!-- 20230524 ljh lightning  -->
<!-- <apex:page controller="RentalFixtureSetAssignAgencyController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="办事处分配/发货"> -->
<apex:page controller="RentalFixtureSetAssignAgencyController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="办事处分配/发货" lightningStylesheets="true">
<!-- 20210624 ljh update SFDC-C448GR --><!-- title="办事处分配/下架/发货" -->
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="{!URLFOR($Resource.instascan)}"/>
    <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
    <!-- 标准控件弹出页面修改 start -->
    <apex:includeScript value="{!URLFOR($Resource.SelectFieldJs)}"/>
    <!-- 标准控件弹出页面修改 end -->
    <apex:stylesheet value="{!URLFOR($Resource.sldsMy)}"/><!-- 20230619 ljh lightning  -->
    <apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/><!-- 20230525 ljh lightning  -->
<style type="text/css">
    .pbTitle{
        display: none
    }
    .pbButton{
        text-align: right !important; 
    }
    .hideDropdown select{
        display: none
    }
    .modal {
       display:none;
       position: fixed; /* Stay in place */
       z-index: 10; /* Sit on top */
       left: 0;
       top: 0;
       width: 100%; /* Full width */
       height: 100%; /* Full height */
       overflow: auto; /* Enable scroll if needed */
       background-color: rgb(0,0,0); /* Fallback color */
       background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    }
    span.dateFormat {
        display: none;
    }
 
    /* Modal Content/Box */
    .modal-content {
       background-color: #fefefe;
       margin-left: 6px;
       margin-top: 100px;
       padding: 20px;
       border: 1px solid #888;
       right: 5%;
       position: absolute;
       /* 20230628 ljh */
       /* width: 200px; */
       width: 300px;
    }
    .modal-content-cancel {
       background-color: #fefefe;
       margin-left: -150px;
       margin-top: 100px;
       padding: 20px;
       border: 1px solid #888;
       left: 50%;
       position: absolute;
       width: 310px;
    }
    table.list td{
        width:100px;
        border-width: 1px;
    }
    table.list td.col_chk {
        width:30px;
    }
    /* 20230524 ljh lightning start  */
    /* body .pbBody table.list tr.headerRow td, body .pbBody table.list tr.headerRow th {
        border-width: 1px;
    } */
    /* 20230524 ljh lightning end  */
    /* 20230927 zq*/
    .modal-content-cancel select {
        margin-bottom: 8px;
    }
    .modal-content-trade {
        background-color: #fefefe;
        margin-left: -150px;
        margin-top: 100px;
        padding: 20px;
        border: 1px solid #888;
        left: 50%;
        position: absolute;
        width: 310px;
    }
    /* body .labelCol .vfLabelColTextWrap{
        vertical-align: initial !important;
    } */
    body .bPageBlock .detailList .labelCol .vfLabelColTextWrap{
        vertical-align: initial !important;
    }
    .hideDropdown select{
        display:none;
    }
</style>
<script type="text/javascript">
function checkMessage() {
    if (j$(escapeVfId('allPage:allForm:done_flg')).val() == 'true') {
        alert("保存成功");
    }
}
var clickType = '无';    //20240109  sx 判断贸易合规标识
function checkMessage2(type) {
    clickType = type;   //20240109  sx 判断贸易合规标识
    // if (j$(escapeVfId('allPage:allForm:done_flg')).val() == 'true') {
    //     alert("保存成功");
    // }
    //20240109  sx 判断贸易合规标识 true时 弹出弹窗,false时 走原来的逻辑 start
    console.log('type===='+type);
    console.log('trade_fag==='+ j$(escapeVfId('allPage:allForm:trade_fag')).val());
    if(type && j$(escapeVfId('allPage:allForm:trade_fag')).val() == 'true'){
        j$('#tradeComplianceTWOModal').show();
    }else{
        blockme();
        if(type == '分配'){
            assign();
        }else if(type == '发货'){
            shipment();
        }
    }
    //20240109  sx 判断贸易合规标识 true时 弹出弹窗,false时 走原来的逻辑 end
}
function filljsQR(qrcode) {
    if(!qrcode) return;
    blockme();
    if(scanType == '1'){
        j$("input[name$='SlipNo']").val(qrcode);
    }
    //20210513 ljh 1829 add start
    else if(scanType.indexOf('2;') != -1){ 
        scanAndMatch(qrcode+';'+scanType);
    }
    //20210513 ljh 1829 add end
    else{
        scanAndMatch(qrcode);
    }
    j$("#scanedqr").append("<li>"+qrcode+"</li>");
    j$("#scanedqr").animate({ scrollTop: j$("#scanedqr").prop("scrollHeight")}, 1000);
    unblockUI();
}
function checkAll() {
    j$("table td.dataCellBorder1.col_chk input").each(function(){
        if(!this.disabled) {
            this.checked = j$("input#checker").prop('checked');
        }
    })
}
var globalChecked = false;
function checkGlobal() {
    globalChecked = !globalChecked;
    j$("table td.col_chk input[type=checkbox]:enabled").each(function(){
        this.checked = globalChecked;
    })
}
/**
20210707 SFDC-C448KZ you start
function cancelModalConfirm() {
    //检查取消理由和取消理由备注
    var reason = j$.trim(j$("select[name$=cancelReason]").val());
    var remark = j$.trim(j$("input[name$=cancelReasonRemark]").val());
    //20210420 ljh 1711 update start
    //if(reason == "" || remark == "") {
    if(reason == "" && remark == "") {
        j$("#errormessage span").html('取消理由和取消理由备注不可为空!');
        j$("#errormessage").css('display', '');
    }
    else if(reason == "") {
        j$("#errormessage span").html('取消理由不可为空!');
        j$("#errormessage").css('display', '');
    }
    else if(remark == "") {
        j$("#errormessage span").html('取消理由备注不可为空!');
        j$("#errormessage").css('display', '');
    }
    //20210420 ljh 1711 update end
    else {
        j$("#errormessage").css('display', 'none');
        blockme();
        cancelSet();
    }
}
**/
function cancelModalConfirm() {
   //检查取消理由和取消理由备注   cancle Reason Lcr
    var reason = j$(escapeVfId('allPage:allForm:Cancel_Reason')).value();
    var remark = j$(escapeVfId('allPage:allForm:Loaner_cancel_reason')).value();
    var Lcr = j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).value();
    if(reason == "" && remark == "") {
        j$("#errormessage span").html('取消理由和备品申请取消理由不可为空!');
        j$("#errormessage").css('display', ''); 
    }
    else if(reason == "") {
        j$("#errormessage span").html('取消理由不可为空!');
        j$("#errormessage").css('display', '');
    }
    else if(remark == "") {
        j$("#errormessage span").html('一览取消理由不可为空!');
        j$("#errormessage").css('display', '');
    }else if(remark == "其他" && Lcr =="") {
        j$("#errormessage span").html('取消理由备注不可为空!');
        j$("#errormessage").css('display', '');
    }
    else {
        j$("#errormessage").css('display', 'none');
        blockme();
        cancelSet();
    }
}
/**20210707 SFDC-C448KZ you end**/
 
 
// 20231127 sx 贸易合规二期 add 弹窗提醒 start
function showModal(){
 
    console.log('showModal====' + j$(escapeVfId('allPage:allForm:trade_fag')).val());
    //贸易合规二期 ax add
 
    // if(j$(escapeVfId('allPage:allForm:trade_fag')).val() == 'true'){
    if(true) {
        //打开弹窗
        j$('#tradeComplianceTWOModal').show();
 
    }else{
        //如果合规直接走保存(原有逻辑)
        assign();
    }
}
function closeTradeModal(){
    j$('#tradeComplianceTWOModal').hide();
    //清空合规状态
    j$(escapeVfId('allPage:allForm:trade_fag')).val(false);
}
function tradeModalConfirm(){
    //贸易合规二期 弹窗确认 点击确认就调原来的保存方法 点取消就不进行保存逻辑
    // j$(escapeVfId('allPage:allForm:pageContuine')).val() = true;
    j$('#tradeComplianceTWOModal').hide();
    console.log('clickType===' + clickType);
    if(clickType == '分配'){
        blockme();
        assign();
    }else if(clickType == '发货'){
        blockme();
        shipment();
    }
}
 
//清除合规状态
function clearTradeStatus(){
    console.log('clearTradeStatus====false');
    j$(escapeVfId('allPage:allForm:trade_fag')).val(false);
}
// 20231127 sx 贸易合规二期 add 弹窗提醒 end
 
function showCancelModal() {
    var hasChecked = false;
 
    j$("table td.dataCellBorder1.col_chk input").each(function(){
        if(this.checked) {
            hasChecked = true;
        }
    })
    if(!hasChecked) {
        alert('未选择取消的一览!');
        return;
    }
    j$('#cancelModal').show();
    j$('#searchBlock1').show();
    
}
/** 20210707 SFDC-C448KZ you start**/
 function changeCancleReasonJs(){
    var Cancel_Reason = j$(escapeVfId('allPage:allForm:Cancel_Reason')).value();
    if(Cancel_Reason != '被动取消'){
        j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).val('');
        j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).attr('disabled',true);
    }    
}
function changeReasonJs(){
    var reason = j$(escapeVfId('allPage:allForm:Loaner_cancel_reason')).value();
    if(reason != null && reason == '其他'){
        j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).attr('disabled',false);
    }else{
        j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).val('');
        j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).attr('disabled',true);
    }    
}
/** 20210707 SFDC-C448KZ you end**/
</script>
<div id="myModal" class="modal">
  <!-- Modal content -->
  <div class="modal-content">
    <span class="close" onclick="stopScan()">&times;</span>
    <p>扫描中</p>
        <p>Code:<input type="text" id="qrcode"/></p>
    <video playsinline="true" id="preview" style="width: 100%;z-index: 11;transform: scaleX(-1);margin-top: 10px;"></video>
    扫码履历:
    <ul id="scanedqr" style="list-style-type: none; text-align: center;padding: 0;width: 100%; height: 60px; overflow: auto">
    </ul>
  </div>
</div>
 
<apex:form id="allForm" styleclass="pbBody">
    <!-- 20210624 ljh update SFDC-C448GR -->
    <!-- <apex:actionFunction name="stockDown" action="{!stockDown}" rerender="detail,message,done_flg"  oncomplete="unblockUI();checkMessage();checEventFrame();"/> -->
    <apex:actionFunction name="scanAndMatch" action="{!scanAndMatch}" rerender="detail,message,done_flg"  oncomplete="unblockUI();checkMessage();checEventFrame();">
        <apex:param name="firstParam" assignTo="{!qrcode}" value="" />
    </apex:actionFunction>
    <apex:actionFunction name="cancelSet" action="{!cancelSet}" rerender="allForm"  oncomplete="unblockUI();checkMessage();checEventFrame();j$('#cancelModal').hide();"/>
    <apex:actionFunction name="changeStep" rerender="allForm"  oncomplete="unblockUI();"/>
    <!-- 20231207 sx 贸易合规二期 add start-->
    <apex:actionFunction name="tradeComplianceTWO" action="{!tradeComplianceTWO}" rerender="trade_fag" />
    <apex:inputHidden value="{!trade_fag}" id="trade_fag"/>
    <apex:inputHidden value="{!trade_String}" id="trade_String"/>
    <apex:actionFunction name="assign" action="{!assign}" rerender="allForm" oncomplete="unblockUI();checkMessage();checEventFrame();"/>
    <apex:actionFunction name="shipment" action="{!shipment}" rerender="allForm" oncomplete="unblockUI();checkMessage();checEventFrame();"/>
    <!-- <apex:inputHidden value="{!pageContuine}" id="pageContuine"/> -->
    <!-- 20231207 sx 贸易合规二期 add end-->
    <apex:inputHidden value="{!done_flg}" id="done_flg"/>
    <apex:inputHidden value="{!readOnly}" id="readOnly"/>
    <div id="cancelModal" class="modal">
        <div class="modal-content-cancel">
            <table>
                <tr>
                    <td colspan="2" align="center">
                        <apex:commandButton style="margin: 8px 20px;" value="确定" onclick="cancelModalConfirm(); return false;" />
                        <apex:commandButton style="margin: 8px 20px;" value="取消" onclick="j$('#errormessage').css('display', 'none');j$('#cancelModal').hide();return false;"/>
                        <!-- <apex:commandButton style="margin: 0 20px;" value="取消" onclick="j$('#errormessage').css('display', 'none');j$('#cancelModal').hide();return false;"/> -->
                    </td>
                </tr>
                <tr style="display: none;" id="errormessage">
                    <td colspan="2">
                        <span style="color: #F00; font-weight:bold"></span>
                    </td>
                </tr>
                <!--
                <tr>
                    <td>
                        <apex:outputLabel value="取消理由"/>
                    </td>
                    <td>
                        <apex:selectList id="cancelReason" size="1" value="{!cancelReason}">
                            <apex:selectOption itemValue="" itemLabel="--无--"/>
                            <apex:selectOption itemValue="主动取消" itemLabel="主动取消"/>
                            <apex:selectOption itemValue="被动取消" itemLabel="被动取消"/>
                        </apex:selectList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <apex:outputLabel value="取消理由备注"/> 
                    </td>
                    <td>
                        <apex:inputText id="cancelReasonRemark" value="{!cancelReasonRemark}"/>
                    </td>
                </tr>
            -->
            <!--  20210707 SFDC-C448KZ you start-->
            <tr>
                <td>
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Cancel_Reason__c.label}" />
                </td>
                <td>
                <apex:inputField value="{!parentObj.Cancel_Reason__c}" id="Cancel_Reason" onchange="changeCancleReasonJs();"/>
                </td>
            </tr>            
            <tr rendered="true">
                <td>
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Loaner_cancel_reason__c.label}" for="Loaner_cancel_reason"/>
                </td>
                <td>
                    <apex:inputField value="{!parentObj.Loaner_cancel_reason__c}" id="Loaner_cancel_reason"  onchange="changeReasonJs();"/>
                </td>
            </tr>
            <tr>
                <td>
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Loaner_cancel_Remarks__c.label}" for="Loaner_cancel_request"/>
                </td>
                <td>
                 <apex:inputField value="{!parentObj.Loaner_cancel_request__c}" id="Loaner_cancel_request" html-disabled="true"/>
                </td>
            </tr>
            <!--  20210707 SFDC-C448KZ you end-->
            <!--<tr>  20210707 SFDC-C448KZ you start-->
            <!-- <apex:pageBlock id="searchBlock1" tabStyle="Report">
            <apex:pageBlockSection title="备品借出申请一览取消" collapsible="false" id="cancle">
               <apex:pageBlockSectionItem id="CR">
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Cancel_Reason__c.label}" />
                    <apex:inputField value="{!parentObj.Cancel_Reason__c}" id="Cancel_Reason" onchange="changeCancleReasonJs();"/>
                </apex:pageBlockSectionItem>
                
                <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>              
                <apex:pageBlockSectionItem rendered="true" id="Reason">
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Loaner_cancel_reason__c.label}" for="Loaner_cancel_reason"/>
                    <apex:inputField value="{!parentObj.Loaner_cancel_reason__c}" id="Loaner_cancel_reason"  onchange="changeReasonJs();"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem id="Lcr">
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Loaner_cancel_Remarks__c.label}" for="Loaner_cancel_request"/>
                    <apex:inputField value="{!parentObj.Loaner_cancel_request__c}" id="Loaner_cancel_request" html-disabled="true"/>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            </apex:pageBlock>   -->
            <!-- 20210707 SFDC-C448KZ you end
            </tr>--> 
            </table>
        </div>
    </div>
    <!-- 20231127 sx add 贸易合规二期 弹窗提醒 start  -->
    <div id="tradeComplianceTWOModal" class="modal">
        <div class="modal-content-trade">
            <table>
                <tr>
                    <td>
                        <apex:outputText styleClass="title" value="您此次申请的业务可能存在贸易合规风险,是否继续{!stepName},{!$Label.IFTradeComplianceAlert2},(一般需5-10个工作日)。"/>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" test-align="center" style="padding-left: 30px;">
                        <apex:commandButton style="margin: 8px 20px;" value="确定" onclick="tradeModalConfirm(); return false;"/>
                        <apex:commandButton style="margin: 8px 20px;" value="取消" onclick="closeTradeModal();"/>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <!-- 20231127 sx add 贸易合规二期 弹窗提醒 end  -->
 
    <apex:pageBlock id="searchBlock" tabStyle="Report">
        <apex:pageBlockButtons location="top">
            预计出货日
            <input type="hidden" name="hide"/>
            <apex:inputField id="rentalStartDate" value="{!parentObj.Asset_loaner_start_day__c}"/>
            <!--添加 style="padding-top: 0px;padding-bottom: 0px;margin-bottom: 4px;" -->
            <apex:commandButton value="适用" style="padding-top: 0px;padding-bottom: 0px;margin-bottom: 4px;"
                action="{!applyDate}" onclick="blockme();" reRender="allForm" disabled="{!readOnly}" oncomplete="unblockUI();checkMessage();checEventFrame();"/>
            &nbsp; &nbsp;
            出库
            <apex:selectList size="1" value="{!stepName}" onchange="blockme();changeStep();return false;">
                <apex:selectOption itemValue="无" itemLabel="无"/>
                <apex:selectOption itemValue="分配" itemLabel="分配"/>
                <!-- 20210624 ljh update SFDC-C448GR -->
                <!-- <apex:selectOption itemValue="下架" itemLabel="下架"/> -->
                <apex:selectOption itemValue="发货" itemLabel="发货"/>
            </apex:selectList>
            &nbsp; &nbsp;
            <!-- 20210517 ljh update 1829 start -->
            <!-- <apex:commandButton value="扫一扫" onclick="qrscan();return false;" disabled="{!readOnly || stepName!='分配'}"/> -->
            <apex:commandButton value="扫一扫" onclick="qrscan(0);return false;" disabled="{!readOnly || stepName!='分配'}"/>
            <!-- 20210517 ljh update 1829 end -->
            <!-- 20240108 sx 贸易合规二期 分配增加合规提醒 -->
<!--             <apex:commandButton value="分配" style="padding-top: 0px;padding-bottom: 0px;"
                action="{!assign}" onclick="blockme();" reRender="allForm,trade_fag" disabled="{!readOnly || stepName!='分配'}" oncomplete="unblockUI();checkMessage('分配');checEventFrame();"/> -->
            <apex:commandButton value="分配" style="padding-top: 0px;padding-bottom: 0px;"
                action="{!tradeComplianceTWO}" onclick="blockme();" reRender="allForm,trade_fag" disabled="{!readOnly || stepName!='分配'}" oncomplete="checkMessage2('分配');unblockUI();checkMessage();checEventFrame();"/>
            <!-- 20240108 sx 贸易合规二期 分配增加合规提醒 -->
            <!-- 20210624 ljh update SFDC-C448GR -->
            <!-- <apex:commandButton value="下架" action="{!stockdown}" onclick="blockme();" reRender="allForm" disabled="{!readOnly || stepName!='下架'}" oncomplete="unblockUI();checkMessage();checEventFrame();"/> -->
            <!-- 20231207 sx 贸易合规二期 修改 start  -->
<!--             <apex:commandButton value="发货" style="padding-top: 0px;padding-bottom: 0px;"
                action="{!shipment}" onclick="blockme();" reRender="allForm" disabled="{!readOnly || stepName!='发货'}" oncomplete="unblockUI();checkMessage('发货');checEventFrame();"/> -->
            <apex:commandButton value="发货" style="padding-top: 0px;padding-bottom: 0px;"
                action="{!tradeComplianceTWO}" onclick="blockme();" reRender="allForm,trade_fag" disabled="{!readOnly || stepName!='发货'}" oncomplete="checkMessage2('发货');unblockUI();checkMessage();checEventFrame();"/>
            <!-- 20231207 sx 贸易合规二期 修改 end  -->
            &nbsp; &nbsp;
            <apex:commandButton value="全选/取消全选" onclick="checkGlobal(); return false;" disabled="{!readOnly}"/>
            <apex:commandButton value="取消" onclick="showCancelModal(); return false;" disabled="{!readOnly}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="办事处分配" id="searchBlockPage">
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="{!$ObjectType.Rental_Apply__c.fields.Name.Label}"/>
                <apex:outputField value="{!parentObj.Name}"/>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="主单预计出货日"/>
                <apex:outputText value="{0,date, yyyy/MM/dd}">
                    <apex:param value="{!masterDate}"/>
                </apex:outputText>
            </apex:pageBlockSectionItem>
            <!-- 20210508 ljh add 1672 start -->
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="{!$ObjectType.Rental_Apply__c.fields.demo_purpose2__c.Label}"/>
                <apex:outputField value="{!parentObj.demo_purpose2__c}"/>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
            &nbsp;&nbsp;&nbsp;&nbsp;
            </apex:pageBlockSectionItem>
            <!-- 20210508 ljh add 1672 end -->
            <apex:pageBlockSectionItem >
                <apex:outputLabel style="vertical-align: initial !important;" value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.Name.Label}"/>
                <apex:outputPanel >
                    <apex:inputField value="{!slip.Name}" id="SlipNo" rendered="{!slipEnabled && stepName == '发货'}"/>
                    <apex:outputField value="{!slip.Name}" rendered="{!NOT(slipEnabled && stepName == '发货')}"/>
                    <br />
                    <span>
                        <input type="hidden" name="hide"/>
                        <apex:commandButton value="扫运输单" onclick="qrscan(1);return false;" disabled="{!NOT(slipEnabled && stepName == '发货')}"/>
                        <apex:commandButton value="检索" style="padding-top: 0px;padding-bottom: 0px;"
                            action="{!searchSlip}" onclick="blockme();" reRender="allForm" disabled="{!NOT(slipEnabled && stepName == '发货')}" oncomplete="unblockUI();checEventFrame();"/>
                    </span>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.DeliveryType__c.Label}"/>
                <apex:outputPanel >
                    <apex:inputField value="{!slip.DeliveryType__c}" id="deliveryType" rendered="{!slipEnabled && stepName == '发货'}"/>
                    <apex:outputField value="{!slip.DeliveryType__c}"  rendered="{!NOT(slipEnabled && stepName == '发货')}"/>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.Distributor_method__c.Label}"/>
                <apex:outputPanel >
                    <apex:inputField value="{!slip.Distributor_method__c}" id="distributorMethod" rendered="{!slipEnabled && stepName == '发货'}"/>
                    <apex:outputField value="{!slip.Distributor_method__c}" rendered="{!NOT(slipEnabled && stepName == '发货')}"/>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.DeliveryCompany__c.Label}"/>
                <apex:outputPanel >
                    <apex:inputField value="{!slip.DeliveryCompany__c}" id="deliveryCompany" rendered="{!slipEnabled && stepName == '发货'}"/>
                    <apex:outputField value="{!slip.DeliveryCompany__c}" rendered="{!NOT(slipEnabled && stepName == '发货')}"/>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem id="whStaffBlock">
                <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.Wh_Staff__c.Label}"/>
                <apex:outputPanel >
                    <apex:inputField value="{!slip.Wh_Staff__c}" id="whStaff" styleClass="hideDropdown" rendered="{!slipEnabled && stepName == '发货'}"/>
                    <apex:outputField value="{!slip.Wh_Staff__c}" rendered="{!NOT(slipEnabled && stepName == '发货')}"/>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <!-- 20201209 ljh add start-->
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="{!$ObjectType.Rental_Apply__c.fields.Delivery_Agency__c.Label}"/>
                <!-- 20210624 ljh update SFDC-C448GR start-->
                <!-- <apex:outputPanel >
                    <apex:inputField value="{!parentObj.Delivery_Agency__c}" styleClass="hideDropdown" rendered="{!parentObj.StockDown_ng_num__c == 0 && stepName == '发货'}" />
                    <apex:outputField value="{!parentObj.Delivery_Agency__c}" rendered="{!NOT(parentObj.StockDown_ng_num__c == 0 && stepName == '发货')}"/>
                </apex:outputPanel> -->
                <apex:outputPanel >
                    <apex:inputField value="{!parentObj.Delivery_Agency__c}" styleClass="hideDropdown" rendered="{!parentObj.Wei_Assigned_Cnt__c == 0 && stepName == '发货'}" />
                    <apex:outputField value="{!parentObj.Delivery_Agency__c}" rendered="{!NOT(parentObj.Wei_Assigned_Cnt__c == 0 && stepName == '发货')}"/>
                </apex:outputPanel>
                <!-- 20210624 ljh update SFDC-C448GR end-->
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem html-style="display: none;">
                <apex:inputField value="{!parentObj.SalesdeptSelect__c}"  style="display: none;" />
            </apex:pageBlockSectionItem>
            <!-- 20201209 ljh add end-->
        </apex:pageBlockSection>
    </apex:pageBlock>
    <apex:outputPanel id="message">
        <apex:pageMessages />
    </apex:outputPanel>
 
    <apex:outputPanel id="detail">
    <div id="out_Div_L">
            <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0;" border="" id="tableHeader_L">
                <tr class="headerRow" height="30px">
                    <td class="col_chk" align="center">
                        全选 <input type='checkbox' onClick='checkAll();' id="checker"/>
                    </td>
                    <td> 申请型号 </td>
                    <td> 存放地 </td>
                    <td> 固定资产编号(Key) </td>
                    <td> 机身编号 </td>
                    <td> 预计出货日 </td>
                    <td style="{!IF(stepName='分配','background-color: #cfeef9','')}"> 分配 </td>
                    <!-- 20210624 ljh update SFDC-C448GR -->
                    <!-- <td style="{!IF(stepName='下架','background-color: #cfeef9','')}"> 下架 </td> -->
                    <td> 借出备品一览明细状态 </td>
                    <td> 备品分类 </td><!-- 20210508 ljh add 1672  -->
                    <td> 操作 </td> 
                    <!-- 20210510 ljh add 1829 -->
                </tr>
                <apex:variable value="{!0}" var="Cnt" />
                <apex:repeat id="dataline_L" value="{!esdList}" var="esdInfo">
                    <tr class="" id="tableData_L_{!Cnt}" style="{!IF(esdInfo.rec.AgencyTempCancel__c, 'display: none','')}">
                        <td class="dataCellBorder1 col_chk" align="center">
                            <apex:inputCheckbox styleClass="rowchkcls" rendered="{!esdInfo.rec.Is_Body__c}" value="{!esdInfo.checked}" id="rowCheck" disabled="{!!esdInfo.editable}" html-qrscan="{!esdInfo.rec.Rental_Apply_Equipment_Set__c}"/>
                            <!-- 20210514 ljh 1829 add html-qrscan -->
                        </td>
                        <td> <apex:outputText value="{!esdInfo.tempModel}"/> </td>
                        <td> {!esdInfo.tempLocation} </td>
                        <td> {!esdInfo.tempKey}</td>
                        <td> {!esdInfo.tempSerial} </td>
                        <td>
                            <apex:inputField value="{!esdInfo.rec.Rental_Apply_Equipment_Set__r.Rental_Start_Date__c}" rendered="{!esdInfo.editable && stepName=='分配'}"/>
                            <apex:outputText value="{0,date, yyyy/MM/dd}" rendered="{!NOT(esdInfo.editable && stepName=='分配')}">
                                <apex:param value="{!esdInfo.tempDate}"/>
                            </apex:outputText>
                        </td>
                        <td style="{!IF(stepName='分配','background-color: #cfeef9','')}">
                            {!esdInfo.tempStatus}
                        </td>
                        <!-- 20210624 ljh update SFDC-C448GR -->
                        <!-- <td style="{!IF(stepName='下架','background-color: #cfeef9','')}">
                            <apex:outputField value="{!esdInfo.rec.StockDown__c}"/>
                        </td> -->
                        <td> <apex:outputText value="{!esdInfo.tempDetailStatus}"/> </td>
                        <td> {!esdInfo.tempEquipmentType}</td>
                        <!-- 20210508 ljh add 1672  -->
                        <td>
                            <apex:commandButton rendered="{!esdInfo.rec.Is_Body__c}" style="padding-left: 5px;padding-right: 5px;"
                                value="分配代替品" onclick="qrscan('2;{!esdInfo.rec.Rental_Apply_Equipment_Set__c}');return false;" disabled="{!readOnly || esdInfo.IsCanSub || stepName != '分配'}"/>
                        </td>
                        <!-- 20210508 ljh add 1829  -->
                    </tr>
                    <apex:variable value="{!Cnt+1}" var="Cnt" />
                </apex:repeat>
            </table>
        </div>
    </apex:outputPanel>
    <apex:outputPanel id="checEventFrame">
        <script>
            checEventFrame();
        </script>
    </apex:outputPanel>
</apex:form>
<script type="text/javascript">
    var standalone = window.navigator.standalone,
        userAgent = window.navigator.userAgent.toLowerCase(),
        safari = /safari/.test( userAgent ),
        ios = /iphone|ipod|ipad/.test( userAgent ),
        ver = '';
        if (ios) {
            ver = (navigator.userAgent).match(/OS (\d)?\d_\d(_\d)?/i)[0].split('_')[0].replace("OS ","");
        }
    let scanner = new Instascan.Scanner({ video: document.getElementById('preview'), scanPeriod: 5 ,mirror: false});
    scanner.addListener('scan', function (content) {
      filljsQR(content);
    });
 
    function qrscan(stype) {
        scanType = stype.toString();//20210518 ljh update toString 1829
        //20210514 ljh add 1829 start
        //console.log(scanType+':~'+scanType.indexOf('2;'));
        if(scanType.indexOf('2;') != -1){
            j$("input[type=checkbox][qrscan='"+scanType.split('2;')[1]+"']").prop("checked", true);
        }
        //20210514 ljh add 1829 end
        if (!standalone && !safari && ios) {
            window.location.href="sfqr://scan";
        } else {
            j$("#myModal").show();
            Instascan.Camera.getCameras().then(function (cameras) {
              if (cameras.length > 0) {
                if (ver >= 13) {
                    scanner.start(cameras[1]);
                } else {
                    // scanner.start(cameras[0]);
                    // 20231105 zq 设置摄像头 start
                    if(cameras.length > 1){
                        scanner.start(cameras[1]);
                    }else{
                        scanner.start(cameras[0]);
                    }
                    // 20231105 zq 设置摄像头 end
                }
              } else {
                console.error('No cameras found.');
              }
            }).catch(function (e) {
              console.error(e);
            });
        }
    }
 
    function stopScan() {
        scanner.stop().then(function () {
            j$("#myModal").hide();
        });
        j$("#scanedqr").children().remove();
    }
    j$(document).ready(function(){
        j$( '#qrcode' ).unbind();
        j$( '#qrcode' ).keypress( function ( e ) {
            if ( e.which == 13 ) {
                filljsQR(j$( '#qrcode' ).val());
                return false;
            }
        });
    });
    function checEventFrame() {
        j$('select[name$="deliveryType"]').val('发货');
        j$('select[name$="deliveryType"]').prop('disabled', true);
        j$("input[name=onetoone]").siblings("input[type=checkbox]").each(function(){
            this.disabled = true;
        })
        if (j$(escapeVfId('allPage:allForm:readOnly')).val() == 'true') {
            j$("input#checker").attr('disabled', 'disabled');
        }
        else {
            j$("input#checker").removeAttr('disabled');
        }
        setTimeout(function() {
            j$('select[name$="distributorMethod"]').children('option[value="空运"]').remove();
            j$('select[name$="deliveryCompany"]').children('option[value="莱比特"],option[value="嘉里大通"]').remove();
            if (j$(escapeVfId('allPage:allForm:readOnly')).val() == 'true') {
                j$("input[type=text],select").each(function(){
                    this.disabled = true;
                })
            }
        }, 500);
 
    }
    // checEventFrame();
        //标准控件弹出页面修改 start
    //查询参数列表
    let SelectFieldParamList=[
        // 
        {
            //原apex:inputField的id值,需要在页面上获取
            inputFieldId : 'allPage:allForm:searchBlock:searchBlockPage:whStaffBlock:whStaff',
            //查找字段所在对象
            ObjectType : 'FixtureDeliverySlip__c',
            //查找字段的api名称
            QueryFieldApiName : 'Wh_Staff__c',
            //查找字段的查找对象
            SelectObj : 'User',
            //搜索时使用的字段
            SelectFld : 'Name',
        }
    ]
    //初始化
    resetOpenPage(SelectFieldParamList);
    
    
    function unblockUI(){
        j$("#sbArea").fadeOut(500, function(){
            j$("#sbArea").remove();
        });
        try{
            resetOpenPage(SelectFieldParamList);
        }catch(e){
            console.log('e==='+e);
        }
 
    }
    //标准控件弹出页面修改 end
</script>
</apex:page>