高章伟
2023-03-03 d8dc84a3d56df839895f1c417a4d9cbee763d262
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
745
746
747
748
749
<apex:page id="Page" showHeader="false" sidebar="false" controller="OFSInsReportLayoutController" applyBodyTag="false" applyHtmlTag="false" action="{!init}" lightningStylesheets="true">
<!-- <apex:page id="Page" showHeader="false" sidebar="false" standardcontroller="Inspection_Item__c" extensions="OFSInsReportLayoutController" applyBodyTag="false" applyHtmlTag="false" action="{!init}"> -->
<html>
<head>
    <meta name="viewport" content="width=1150,user-scalable=yes" />     <!-- TODO 1150はコンテンツの幅 -->
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
    <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
    <style type="text/css">
        table#AssetTable select {
            width: 98%;
        }
        table#AssetTableHeader .headerCell {
            box-sizing: border-box;
            padding: 2px 1px;
        }
        table#AssetTable .dataCell {
            box-sizing: border-box;
            padding: 1px 1px;
        }
        .bPageBlock .dataCol .requiredInput {
            display: inline-table;
        }
        .bPageBlock .detailList .labelCol {
            width: 1%;
        }
        .dateFormat  {
            display: none;
        }
        
    </style>
    <script type="text/javascript">
        var tmpaid = "";
        var tmpan = "";
        var tmpahid = "";
        var tmpahn = "";
        var tmpadid = "";
        var tmpadn = "";
        var tmpaaid = "";
        var tmpaan = "";
        var tmpinsid = "";
        var tmpinsn = "";
        var tmprstr = "";
        sforce.connection.sessionId = '{!$Api.Session_ID}';
        function toggleIrNameDisabled(checker) {
            if (checker.checked) {
                j$(escapeVfId('Page:Form:Block:Ir_Name')).prop("disabled", false);
            } else {
                j$(escapeVfId('Page:Form:Block:Ir_Name')).prop("disabled", true);
            }
        }
        function changeAllCheckResult(val) {
            var cnt = j$(escapeVfId('ProductCnt')).val();
            for (var i = 0; i < cnt; i++) {
                if (val == ' ') {
                    document.getElementById('Page:Form:Block:CheckSection:CheckedInfoList:' + i + ':AssetRowCheckboxIsNormal').value = '';
                } else {
                    document.getElementById('Page:Form:Block:CheckSection:CheckedInfoList:' + i + ':AssetRowCheckboxIsNormal').value = val;
                }
            }
        }
 
        function clearAndSearch() {
            document.getElementById("Page:Form:Block:UnCheckSection:text1").value = "";
            document.getElementById("Page:Form:Block:UnCheckSection:cond1").value = "equals";
            document.getElementById("Page:Form:Block:UnCheckSection:val1").value = "";
            blockme();
            searchfunc();
        }
 
        function searchJs() {
            blockme();
            searchfunc();
        }
 
        function sortTableJs(key) {
            blockme();
            sortTablefunc(key);
        }
 
        function exchangeAssetJs() {
            blockme();
            exchangeAssetfunc();
        }
 
        function saveByRepairJs(aid, an, ahid, ahn, adid, adn, aaid, aan, rstr) {
            tmpaid = aid;
            tmpan = an;
            tmpahid = ahid;
            tmpahn = ahn;
            tmpadid = adid;
            tmpadn = adn;
            tmpaaid = aaid;
            tmpaan = aan;
            tmprstr = rstr;
    // 点検報告書変更できなくても、修理を作れる?
    if (tmpinsid == "") {
        blockme();
        saveByRepair();
    } else {
        openRepair();
    }
}
 
function openRepair() {
    // TODO 今後採番テーブルを使いNameを取得、点検報告書は一時的なものです
    window.open('/a0J/e?retURL=%2F' + tmpaid + '&CF00N10000002Dx66_lkid=' + tmpahid + '&CF00N10000002Dx66=' + encodeURIComponent(tmpahn) + '&CF00N10000002Dx5t_lkid=' + tmpadid + '&CF00N10000002Dx5t=' + encodeURIComponent(tmpadn) + '&CF00N10000002Dx5n_lkid=' + tmpaaid + '&CF00N10000002Dx5n=' + encodeURIComponent(tmpaan) + '&CF00N10000002Dx1X_lkid=' + tmpaid + '&CF00N10000002Dx1X=' + encodeURIComponent(tmpan) + '&00N10000002FH86=' + encodeURIComponent(tmprstr) + '&CF00N10000006PRCp=' + encodeURIComponent(tmpinsn) + '&CF00N10000006PRCp_lkid=' + tmpinsid, '_blank');
}
//add by rentx 20210809 全选功能 start
function checkAll(checker) {
    var cnt = j$(escapeVfId('ProductCnt')).val();
    for (var i = 0; i < cnt; i++) {
        if (j$(escapeVfId('Page:Form:Block:CheckSection:CheckedInfoList:'+i+':AssetRowCheckbox1')).size() == 0) {
            break;
        }
        document.getElementById('Page:Form:Block:CheckSection:CheckedInfoList:'+i+':AssetRowCheckbox1').checked = checker.checked;
    }
}
function checkAll2(checker) {
    var cnt = j$(escapeVfId('ProductCnt2')).val();
    var tempi = parseInt(cnt / 900 )+1;
    for (var j = 0; j < tempi; j++) {
        for (var i = 0; i < 900; i++) {
            if (j$(escapeVfId('Page:Form:Block:UnCheckSection:unCheckedInfoListForThousend:'+j+':UnCheckedInfoList:'+i+':AssetRowCheckbox2')).size() == 0) {
                break;
            }
            document.getElementById('Page:Form:Block:UnCheckSection:unCheckedInfoListForThousend:'+j+':UnCheckedInfoList:'+i+':AssetRowCheckbox2').checked = checker.checked;
        }
    }
    
}
//add by rentx 20210809 全选功能 end
 
 
AWSService.sfSessionId = '{!GETSESSIONID()}';
var staticResource = JSON.parse('{!staticResource}');
var aws_data = {};
var txid = null;
function Encrypt(callback){
    blockme();
    //callback();return;
    //<input type="hidden" value="{!ir.Id}" id="IrId"/>
    let e_id = document.getElementById("IrId");
    let url = staticResource.newUrl;
 
    aws_data = {
        "phone":j$("[field-api='phone__c']").val(),
        "responsiblePerson":j$("[field-api='Responsible_Person__c']").val(),
    };
 
    if(e_id && e_id.value){
        url = staticResource.updateUrl;
        aws_data.dataId = document.getElementById("Page:Form:Block:AWS_Data_Id__c").value;
    }
 
    
 
    AWSService.post(url, JSON.stringify([aws_data]), function(data){
        
        if (!(data && data.object && data.object.length)) {
            console.log('AWSService.post failed');
            return;
        }
        let aws_data1 = data.object[0];
        txid = data.txId;
 
        document.getElementById("Page:Form:Block:AWS_Data_Id__c").value = aws_data1.dataId;
        j$("[field-api='phone__c']").val(aws_data1.phone);
        j$("[field-api='Responsible_Person__c']").val(aws_data1.responsiblePerson);
        
        if (callback) {
            callback();
        }
    }, staticResource.token);
}
 
function saveBtnJs(){
    Encrypt(saveBtn);
}
function submitJs(){
    Encrypt(submit);
}
function showPDFJs(){
    Encrypt(showPDF);
}
 
function afterSaveBtnJs(){
    Trans();
}
 
function afterSubmitJs(){
    Trans();
}
 
function afterShowPDFJs(){
    Trans(function(){
        if (!HasError()) {
            window.location.href = '/apex/InsReportPDFOuter?id=' + document.getElementById("IrId").value;
        }
        
    });
}
 
function HasError(){
    
    // if (IsAddmessage) {
    //     return true;
    // }
    let e = document.getElementById("Page:Form:MessageP");
    if (!e) {
        return false;
    }
 
    let divs = j$(e).find("div.message");
    for (let i = 0; i < divs.length; i++) {
        for (let j = 0; j < divs[i].classList.length; j++) {
            for(let clsi in divs[i].classList){let cls=divs[i].classList[clsi];
                if (typeof cls == 'string'  && cls.indexOf('error')>-1) {
                    return true;
                }
            }
            
        }
        
    }
 
 
    return false;
}
 
function Decrypt(data){
    
    j$("[field-api='phone__c']").val(data.phone);
    j$("[field-api='Responsible_Person__c']").val(data.responsiblePerson);
    
    
}
 
function Trans(callback){
    let payload = {
        "txId":txid,
        "sfRecordId":document.getElementById("IrId").value,
        "isSuccess":(txid && !HasError()) ? 1 : 0
    };
    AWSService.post(staticResource.transactionUrl, JSON.stringify(payload), function(result){
        Decrypt(aws_data);
        if(callback)callback();
        unblockUI();
    }, staticResource.token);
}
 
function Query(){
    let ele = document.getElementById("Page:Form:Block:AWS_Data_Id__c");
    if (ele && ele.value) {
        blockme();
        AWSService.query(staticResource.queryUrl, ele.value, function(data){
            if (data && data.object) {
                Decrypt(data.object);
            }
            unblockUI();
        }, staticResource.token);
    }
}
 
j$(function(){
    Query();
})
 
</script>
<title>{!ir.Name}</title>
</head>
<body>
    <!-- HWAG-B4Q3G5 20180918Start -->
    <apex:form id="Form" style="margin:0 5px;" onkeydown="if(event.keyCode==13){return false;}">>
    <!-- HWAG-B4Q3G5 20180918End -->
    <script type="text/javascript">
    // 保存後、新規の報告書IDを取得
    tmpinsid = '{!ir.Id}';
    tmpinsn = '{!JSENCODE(ir.Name)}';
    //var IsAddmessage = {IsAddmessage};
    var isPDF = {!isPDF};
    
</script>
<apex:actionFunction name="searchfunc" action="{!searchBtn}" rerender="Form,Block,UnCheckSection" onComplete="unblockUI();"></apex:actionFunction>
 
<apex:actionFunction name="exchangeAssetfunc" action="{!exchangeAsset}" rerender="Form" onComplete="unblockUI();"></apex:actionFunction>
 
<apex:actionFunction name="sortTablefunc" action="{!sortTable}" rerender="Form" onComplete="unblockUI();">
<apex:param name="firstParam" assignTo="{!sortKey}" value="" />
</apex:actionFunction>
 
<apex:actionFunction name="getAssetFromHp" action="{!getAssetFromHp}" rerender="Form" onComplete="unblockUI();" />
 
<apex:actionFunction name="saveByRepair" action="{!saveBtn}" rerender="Form" onComplete="unblockUI();openRepair();"/>
 
<apex:actionFunction name="saveBtn" action="{!saveBtn}" rerender="Form" onComplete="afterSaveBtnJs();"/>
<apex:actionFunction name="submit" action="{!submit}" rerender="Form" onComplete="afterSubmitJs();"/>
<apex:actionFunction name="showPDF" action="{!showPDF}" rerender="Form" onComplete="afterShowPDFJs();"/>
 
<apex:outputPanel id="MessageP">
<apex:pageMessages />
</apex:outputPanel>
 
 
<div><apex:pageBlock mode="maindetail" Id="Block" rendered="{!initFlag}">
    <div style="position: relative;top:0;width:100%;">
        <table>
            <tr>
                <td><apex:outputLabel value="{!$ObjectType.Inspection_Report__c.Label}:" style="font-size:18px;font-weight:bold;padding-right: 5px;"/></td>
                <td>(<apex:inputCheckBox value="{!ir.Name_Manual__c}" id="Name_Manual" onchange="toggleIrNameDisabled(this);return false;"/>
                    <apex:outputLabel value="{!$ObjectType.Inspection_Report__c.fields.Name_Manual__c.Label}" for="Name_Manual"/>)
                    <apex:inputField value="{!ir.Name}" id="Ir_Name" html-disabled="disabled" style="border-width:0px;font-size:18px;font-weight:bold;padding-right:20px;-webkit-text-fill-color:black;"/>
                </td>
                <td style="text-align: center;padding-right: 100px;"><input class="btn" type="Button" style="width:80px;" value="保存" action="" onclick="saveBtnJs();" rerender="Form" onComplete="unblockUI();"/></td>
                <td style="text-align: center;padding-right: 100px;"><input class="btn" type="Button" value="提交" action="" onclick="submitJs();" style="width:80px" rerender="Form" id="submitButton" onComplete="unblockUI();"/></td>
                <td style="text-align: center;padding-right: 100px;"><apex:commandButton style="width:80px;" value="关闭窗口" onclick="location.href='/apex/OFSWindowClose';return false;" id="closeButton"/></td>
                <td style="text-align: center;"><input class="btn" type="Button" style="width:80px;" value="PDF" action="" onclick="showPDFJs();" rerender="Form" onComplete="unblockUI();"/></td>
            </tr>
        </table>
        <apex:pageBlockSection title="{!sectionList[0].title}" columns="{!sectionList[0].column}" showHeader="{!sectionList[0].showHeader}" rendered="{!sectionList.size>0}">
        <apex:repeat value="{!sectionList[0].sectionItemList}" var="sectionItem" id="SectionItemList">
        <apex:outputField value="{!ir[sectionItem.api]}" rendered="{!NOT(sectionItem.isDummy)&&NOT(sectionItem.isCustomize)&&NOT(sectionItem.isInput)}"/>
        <apex:inputField style="width:{!sectionItem.width};height:{!sectionItem.height};" value="{!ir[sectionItem.api]}" rendered="{!NOT(sectionItem.isDummy)&&NOT(sectionItem.isCustomize)&&sectionItem.isInput}" required="{!sectionItem.isRequired}" html-tabindex="{!sectionItem.index}"/>
        <apex:pageblockSectionItem rendered="{!NOT(sectionItem.isDummy)&&(sectionItem.isCustomize)&&Not(isNull(sectionItem.customizeLable))}">
        <apex:outputLabel value="{!sectionItem.customizeLable}"/>
        <apex:outputPanel layout="none">
        <apex:repeat value="{!sectionItem.apiList}" var="api">
        <!-- 保存後、病院は強制outputField -->
        <apex:outputPanel layout="none" rendered="{!api == 'Hospital__c' && ir.Id != ''}">
        <apex:outputField value="{!ir[api]}"/>
    </apex:outputPanel>
    <apex:outputPanel layout="none" rendered="{!NOT(api == 'Hospital__c' && ir.Id != '')}">
    <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="{!sectionItem.apiLabelMap[api]}"/>
    <apex:inputField value="{!ir[api]}" style="{!sectionItem.apiStyleMap[api]}" rendered="{!NOT(api=='') && (sectionItem.isInput || sectionItem.apiInputMap[api])}" required="{!sectionItem.apiRequireMap[api]}" html-tabindex="{!sectionItem.index}"/>
    <apex:outputPanel style="display:inline-block;{!sectionItem.apiStyleMap[api]}" rendered="{!NOT(api=='') && NOT((sectionItem.isInput || sectionItem.apiInputMap[api]))}">
    <apex:outputField value="{!ir[api]}"/>
</apex:outputPanel>
</apex:outputPanel>
</apex:repeat>
</apex:outputPanel>
</apex:pageblockSectionItem>
<apex:pageblockSectionItem rendered="{!NOT(sectionItem.isDummy)&&(sectionItem.isCustomize)&&(isNull(sectionItem.customizeLable))}">
<apex:outputPanel layout="none">
<apex:repeat value="{!sectionItem.apiList}" var="api">
<apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="{!sectionItem.apiLabelMap[api]}"/>
<apex:inputField value="{!ir[api]}" style="{!sectionItem.apiStyleMap[api]}" rendered="{!NOT(api=='') && (sectionItem.isInput || sectionItem.apiInputMap[api])}" required="{!sectionItem.apiRequireMap[api]}" html-tabindex="{!sectionItem.index}"/>
<apex:outputPanel style="display:inline-block;{!sectionItem.apiStyleMap[api]}" rendered="{!NOT(api=='') && NOT((sectionItem.isInput || sectionItem.apiInputMap[api]))}">
<apex:outputField value="{!ir[api]}"/>
</apex:outputPanel>
</apex:repeat>
</apex:outputPanel>
</apex:pageblockSectionItem>
<apex:pageBlockSectionItem rendered="{!sectionItem.isDummy}"/>
</apex:repeat>
</apex:pageBlockSection>
</div>
<div style="position: relative;top:0;height:700px;overflow:hidden;overflow-y:auto;-webkit-overflow-scrolling: touch;">
    <input type="hidden" value="{!ir.Id}" id="IrId"/>
    <apex:inputHidden value="{!ir.AWS_Data_Id__c}" id="AWS_Data_Id__c"/>
    
    
 
 
    <apex:repeat value="{!sectionList}" var="section" id="SectionList">
    <apex:pageBlockSection title="{!section.title}" columns="{!section.column}" showHeader="{!section.showHeader}" rendered="{!!section.isTop}">
    <apex:repeat value="{!section.sectionItemList}" var="sectionItem" id="SectionItemList">
    <apex:outputField value="{!ir[sectionItem.api]}" rendered="{!NOT(sectionItem.isDummy)&&NOT(sectionItem.isCustomize)&&NOT(sectionItem.isInput)}"/>
    <apex:inputField html-field-api="{!sectionItem.api}" style="width:{!sectionItem.width};height:{!sectionItem.height};" value="{!ir[sectionItem.api]}" rendered="{!NOT(sectionItem.isDummy)&&NOT(sectionItem.isCustomize)&&sectionItem.isInput}" required="{!sectionItem.isRequired}" html-tabindex="{!sectionItem.index}"/>
    <apex:pageblockSectionItem rendered="{!NOT(sectionItem.isDummy)&&(sectionItem.isCustomize)&&Not(isNull(sectionItem.customizeLable))}">
    <apex:outputLabel value="{!sectionItem.customizeLable}"/>
    <apex:outputPanel layout="none">
    <apex:repeat value="{!sectionItem.apiList}" var="api">
    <!-- 保存後、病院は強制outputField -->
    <apex:outputPanel layout="none" rendered="{!api == 'Hospital__c' && ir.Id != ''}">
    <apex:outputField value="{!ir[api]}"/>
</apex:outputPanel>
<apex:outputPanel layout="none" rendered="{!NOT(api == 'Hospital__c' && ir.Id != '')}">
<apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="{!sectionItem.apiLabelMap[api]}"/>
<apex:inputField html-field-api="{!api}" value="{!ir[api]}" style="{!sectionItem.apiStyleMap[api]}" rendered="{!NOT(api=='') && (sectionItem.isInput || sectionItem.apiInputMap[api])}" required="{!sectionItem.apiRequireMap[api]}" html-tabindex="{!sectionItem.index}"/>
<apex:outputPanel style="display:inline-block;{!sectionItem.apiStyleMap[api]}" rendered="{!NOT(api=='') && NOT((sectionItem.isInput || sectionItem.apiInputMap[api]))}">
<apex:outputField value="{!ir[api]}"/>
</apex:outputPanel>
</apex:outputPanel>
</apex:repeat>
</apex:outputPanel>
</apex:pageblockSectionItem>
<apex:pageblockSectionItem rendered="{!NOT(sectionItem.isDummy)&&(sectionItem.isCustomize)&&(isNull(sectionItem.customizeLable))}">
<apex:outputPanel layout="none">
<apex:repeat value="{!sectionItem.apiList}" var="api">
<apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="{!sectionItem.apiLabelMap[api]}"/>
<apex:inputField html-field-api="api" value="{!ir[api]}" style="{!sectionItem.apiStyleMap[api]}" rendered="{!NOT(api=='') && (sectionItem.isInput || sectionItem.apiInputMap[api])}" required="{!sectionItem.apiRequireMap[api]}" html-tabindex="{!sectionItem.index}"/>
<apex:outputPanel style="display:inline-block;{!sectionItem.apiStyleMap[api]}" rendered="{!NOT(api=='') && NOT((sectionItem.isInput || sectionItem.apiInputMap[api]))}">
<apex:outputField value="{!ir[api]}"/>
</apex:outputPanel>
</apex:repeat>
</apex:outputPanel>
</apex:pageblockSectionItem>
<apex:pageBlockSectionItem rendered="{!sectionItem.isDummy}"/>
</apex:repeat>
</apex:pageBlockSection>
</apex:repeat>
 
<script type="text/javascript">
    // 病院の左側「刷新」ボタン追加
    var labels = document.getElementsByTagName("label");
    for (var i = 0; i < labels.length; i++) {
        var lbl = labels[i];
        if (lbl.innerText == "医院" || lbl.innerText == "病院") {
            var html = lbl.parentNode.innerHTML;
            html = "<input type='button' value='刷新' class='btn' onclick='blockme();getAssetFromHp();' />&nbsp;&nbsp;&nbsp;&nbsp;" + html;
            lbl.parentNode.innerHTML = html;
            break;
        }
    }
</script>
<apex:pageBlockSection title="已选保有设备字段历史" columns="1" id="CheckSection">
<input type="hidden" id="ProductCnt" value="{!productCount}" />
 
<apex:outputPanel >
<table width="100%">
    <tr>
        <td>&nbsp;</td>
        <td width="100px">
            <span>全</span>
            <select style="vertical-align:text-bottom" id="allCheckResult" size="1" onchange="changeAllCheckResult(this.value);">
                <option value=" ">--无--</option>
                <!-- 默认全OK -->
                <option value="OK" selected = "selected" >OK</option>
                <!-- 默认全OK -->
                <option value="NG">NG</option>
                <!-- add by rentx 20210630 start -->
                <option value="医院放弃">医院放弃</option>
                <!-- add by rentx 20210630 end -->
            </select>
        </td>
        <td width="500px">&nbsp;</td>
    </tr>
</table>
<!-- TODO minus scroll with -->
<table id="AssetTableHeader" class="list" style="border-bottom-width: 0px; font-size:13px;" border="0" cellspacing="0" cellpadding="0">
    <tr style="border-bottom: 1px groove rgba(254, 254, 254, 0.48);background: #f2f3f3;">
        <!-- add by rentx 20210809  -->
        <th class="headerCell" style="width:14px"> <apex:inputCheckbox id="checkAll1" onclick="checkAll(this)" /> </th>
        <!-- <th class="headerCell" style="width:14px" /> -->
        <!-- add by rentx 202120809  -->
        <th class="headerCell" style="width:24px"/>
        <th class="headerCell" style="width:60px">{!$ObjectType.Asset.fields.Asset_situation__c.label}</th>
        <th class="headerCell">{!$ObjectType.Asset.fields.Name.label}</th>
        <th class="headerCell" style="width:100px">{!$ObjectType.Inspection_Item__c.Fields.SerialNumber__c.Label}</th>
        <!-- TODO 項目の作成 -->
        <th class="headerCell" style="width:80px">上次点检日</th>
        <th class="headerCell" style="width:100px">上次修理完毕日</th>
        <th class="headerCell" style="width:80px">
         {!$ObjectType.Inspection_Item__c.Fields.ItemStatus__c.Label}
     </th>
     <th class="headerCell" style="width:100px">{!$ObjectType.Inspection_Item__c.Fields.Fault_Classification1__c.Label}</th>
     <th class="headerCell" style="width:100px">{!$ObjectType.Inspection_Item__c.Fields.Fault_Classification2__c.Label}</th>
     <th class="headerCell" style="width:100px">{!$ObjectType.Inspection_Item__c.Fields.Fault_Classification3__c.Label}</th>
     <th class="headerCell" style="width:100px">{!$ObjectType.Inspection_Item__c.Fields.Diagnosis__c.Label}</th>
     <!-- add by rentx 20210630  -->
     <th class="headerCell" style="width:85px">{!$ObjectType.Inspection_Item__c.Fields.Abandonment_Reasons__c.Label}</th>
     <!-- add by rentx 20210630 -->
     <th class="headerCell" style="width:35px">{!$ObjectType.Asset.Fields.Create_repair__c.Label}</th>
     <!--                                 <td class="headerScroll"></td> -->
 </tr>
</table>
 
<div style="height:320px; width:100%; overflow:auto;">
    <table style="border-collapse:collapse; width:100%;" id="AssetTable">
        <apex:variable value="{!1}" var="cnt" />
        <apex:repeat value="{!checkedInfoList}" var="cInfo" id="CheckedInfoList" >
        <tr style="border-bottom: 1px groove rgba(254, 254, 254, 0.48);">
            <td style="width:14px">
                <apex:inputCheckbox value="{!cInfo.rec_checkBox_c}" id="AssetRowCheckbox1" rendered="{!Not(cInfo.IsManual)}"/>
                <apex:outputText value="{!cInfo.IsManual}" id="IsManual" style="display:none;" />
                <input type="hidden" value="{!cInfo.rec.Id}" id="CheckAssetId"/>
            </td>
            <td style="font-weight:bold; text-align:right; width:24px;">{!cnt}</td>
            <td class="dataCell" style="width:60px">
                <apex:outputField value="{!cInfo.rec.Asset_situation__c}"/>
            </td>
            <td class="dataCell">
                <!-- HWAG-BDCA9J 添加了 onclick blurProduct 内容 start-->
                <apex:outputField value="{!cInfo.rec.Name}" rendered="{!Not(cInfo.IsManual)}"/>
                <apex:inputField value="{!cInfo.ah.Product_Manual__c}" id="Assert" style="width:90%;" rendered="{!cInfo.IsManual}"
                onclick="if(!blurProduct(this))return false;"/>
                <!-- HWAG-BDCA9J 添加了 onclick  blurProduct 内容 end-->
            </td>
            <td class="dataCell" style="width:100px">
                <apex:outputField value="{!cInfo.ah.SerialNumber__c}" rendered="{!Not(cInfo.IsManual)}"/>
                <apex:inputField value="{!cInfo.ah.SerialNo_Manual__c}" id="SerialNo" style="width:90%;" rendered="{!cInfo.IsManual}" />
            </td>
            <td class="dataCell" style="width:80px">
                <apex:outputField value="{!cInfo.rec.Final_Examination_Date__c}" rendered="{!Not(cInfo.IsManual)}"/>
            </td>
            <td class="dataCell" style="width:100px">
                <apex:outputField value="{!cInfo.rec.After_repair_last_internal_check_day__c}" rendered="{!Not(cInfo.IsManual)}"/>
            </td>
            <td class="dataCell" style="width:80px">
                <apex:inputField value="{!cInfo.ah.ItemStatus__c}" id="AssetRowCheckboxIsNormal" style="width:98%"/>
            </td>
            <td class="dataCell" style="width:100px">
                <apex:inputField value="{!cInfo.ah.Fault_Classification1__c}" />
             </td>
             <td class="dataCell" style="width:100px">
                 <apex:inputField value="{!cInfo.ah.Fault_Classification2__c}" id="cat2" />
             </td>
             <td class="dataCell" style="width:100px">
                 <apex:inputField value="{!cInfo.ah.Fault_Classification3__c}" id="cat3" />
             </td>
             <td class="dataCell" style="width:100px">
                <apex:inputField value="{!cInfo.ah.Diagnosis__c}" style="width:93%"/>
            </td>
            <!-- add by rentx 20210630 -->
            <td class="dataCell" style="width:85px">
                <apex:inputField value="{!cInfo.ah.Abandonment_Reasons__c}"  style="width:93%"   />
            </td>
            <!-- add by rentx 20210630 -->  
            <td class="dataCell" style="width:35px">
                <apex:outputPanel layout="none" rendered="{!Not(cInfo.IsManual)}">
                    <a href="#" onclick="saveByRepairJs('{!cInfo.rec.Id}', '{!JSENCODE(cInfo.rec.Name)}', '{!cInfo.rec.Hospital__r.Id}', '{!JSENCODE(cInfo.rec.Hospital__r.Name)}', '{!cInfo.rec.Department_Class__r.Id}', '{!JSENCODE(cInfo.rec.Department_Class__r.Name)}', '{!cInfo.rec.Account.Id}', '{!JSENCODE(cInfo.rec.Account.Name)}', '只修理');">■</a>
                </apex:outputPanel>
            </td>
        </tr>
<apex:variable value="{!cnt + 1}" var="cnt" />
</apex:repeat>
</table>
</div>
</apex:outputPanel>
 
</apex:pageBlockSection>
 
<apex:outputPanel id="ButtonPanel">
<table style="width:100%;">
    <tr>
        <td>
            <apex:commandButton value="行追加" action="{!addNewRows}" disabled="{!Not($ObjectType.Inspection_Item__c.createable)}"
            style="margin-left:10px;float:left;" onclick="blockme();" oncomplete="unblockUI();" rerender="Form" />
            <apex:commandButton value="刷新选中的保有设备" onclick="exchangeAssetJs();return false;" rerender="dummy"/>
            <!-- <apex:commandButton value="刷新选中的保有设备" action="{!exchangeAsset}" onclick="blockme();" oncomplete="unblockUI();" rerender="Form" /> -->
            <!--                                 <apex:commandButton value="刷新医院下的全部保有设备" action="{!getAssetFromHp}" onclick="blockme();" oncomplete="unblockUI();" rerender="Form" /> -->
        </td>
    </tr>
</table>
</apex:outputPanel>
<table>
    <tr>
        <td><div id="ErrorName" style="color: red;font-weight: bold;">{!alertMessage}</div>
        </td>
    </tr>
</table>
<!-- HWAG-B4Q3G5 20180918Start -->
<apex:pageBlockSection title="未选保有设备字段历史" columns="1" id="UnCheckSection" onkeydown="if(event.keyCode==13){searchJs(); return false;}">
<!-- HWAG-B4Q3G5 20180918End -->
<input type="hidden" id="ProductCnt2" value="{!productCount2}" />
<apex:outputPanel >
<div align="center">
    <apex:outputPanel id="countorder">第{!countorder}页</apex:outputPanel>
    <apex:commandButton value="上一页" action="{!UpPage}" onclick="blockme();" disabled="{!IF(countorder=1,true,false)}" oncomplete="unblockUI();" reRender="Form"/>
    <apex:commandButton value="下一页" action="{!DownPage}" onclick="blockme();" disabled="{!IF(countorder >=nowAssetcount ,true,false)}" oncomplete="unblockUI();" rerender="Form"/>
    <apex:outputPanel id="NowOrdercount">共{!nowAssetcount}页</apex:outputPanel>
</div>
 
<table>
    <tr>
        <td style="width:85px" align="right">选择条件</td>
        <td style="width:85px" align="right"><apex:selectList value="{!text1}" id="text1" size="1" style="width:80px"><apex:selectOptions value="{!textOpts}"/></apex:selectList></td>
        <td style="width:85px" align="center"><apex:selectList value="{!cond1}" id="cond1" size="1" style="width:80px"><apex:selectOptions value="{!equalOpts}"/></apex:selectList></td>
        <td style="width:95px" align="left"><apex:inputText value="{!val1}" id="val1" style="width:100px"/></td>
        <td align="left">
            &nbsp;&nbsp;&nbsp;&nbsp;
            <apex:commandButton value="检索" onclick="searchJs();return false;" style="width:130px" rerender="dummy"/>
            &nbsp;&nbsp;
            <apex:commandButton value="清除条件" onclick="clearAndSearch();" style="width:130px" rerender="dummy"/>
            &nbsp;&nbsp;
            <span style="vertical-align: text-bottom;">使用中<apex:inputCheckBox value="{!activeOn}" /></span>
        </td>
    </tr>
</table>
<table style="border-collapse:collapse;" id="AssetTable2">
    <tr style="border-bottom: 1px groove rgba(254, 254, 254, 0.48);background: #f2f3f3;">
        <!-- add by rentx 20210809 start 全选功能  -->
        <!-- <th class="headerCell" style="width:25px"></th> -->
        <th class="headerCell" style="padding: 2px 5px; width:25px"><apex:inputCheckbox id="checkAll1" onclick="checkAll2(this)" /> </th>
        <!-- add by rentx 20210809 end 全选功能  -->
        <th class="headerCell" style="width:70px">
            <a href="#" onclick="sortTableJs('0');return false;" style="text-decoration: underline;">{!$ObjectType.Asset.fields.Asset_situation__c.label}</a>{!sortOrder[0]}
        </th>
        <th class="headerCell">
            <a href="#" onclick="sortTableJs('1');return false;" style="text-decoration: underline;">{!$ObjectType.Asset.fields.Name.label}</a>{!sortOrder[1]}
        </th>
        <th class="headerCell" style="width:70px">
            <a href="#" onclick="sortTableJs('2');return false;" style="text-decoration: underline;">{!$ObjectType.Asset.fields.SerialNumber.label}</a>{!sortOrder[2]}
        </th>
        <th class="headerCell" style="width:70px">
            <a href="#" onclick="sortTableJs('3');return false;" style="text-decoration: underline;">{!$ObjectType.Asset.fields.CurrentContract__c.label}</a>{!sortOrder[3]}
        </th>
        <th class="headerCell" style="width:70px">
            <a href="#" onclick="sortTableJs('4');return false;" style="text-decoration: underline;">{!$ObjectType.Asset.fields.Department_Name__c.label}</a>{!sortOrder[4]}
        </th>
        <th class="headerCell" style="width:70px">
            <a href="#" onclick="sortTableJs('5');return false;" style="text-decoration: underline;">{!$ObjectType.Asset.fields.Status.label}</a>{!sortOrder[5]}
        </th>
        <th class="headerCell" style="width:90px">
            <a href="#" onclick="sortTableJs('6');return false;" style="text-decoration: underline;">{!$ObjectType.Asset.fields.Installation_Site__c.label}</a>{!sortOrder[6]}
        </th>
        <th class="headerCell" style="width:90px">
            <a href="#" onclick="sortTableJs('7');return false;" style="text-decoration: underline;">{!$ObjectType.Asset.fields.Room_Number__c.label}</a>{!sortOrder[7]}
        </th>
        <th class="headerCell" style="width:90px">
            <a href="#" onclick="sortTableJs('8');return false;" style="text-decoration: underline;">{!$ObjectType.Asset.fields.InstallDate.label}</a>{!sortOrder[8]}
        </th>
        <th class="headerCell" style="width:90px">
            <a href="#" onclick="sortTableJs('9');return false;" style="text-decoration: underline;">{!$ObjectType.Asset.fields.Asset_Owner__c.label}</a>{!sortOrder[9]}
        </th>
        <th class="headerCell" style="width:90px">
            <a href="#" onclick="sortTableJs('10');return false;" style="text-decoration: underline;">{!$ObjectType.Asset.fields.Accumulation_Repair_Amount__c.label}</a>{!sortOrder[10]}
        </th>
    </tr>
    <apex:variable value="{!1}" var="cnt" />
    <apex:variable value="{!0}" var="cntOut" />
    <apex:repeat value="{!IF(ThousandFLG>0,unCheckedInfoListForThousend,1)}" var="Thoinfo" id="unCheckedInfoListForThousend">
    <apex:repeat value="{!IF(ThousandFLG>0,Thoinfo,unCheckedInfoList)}" var="ucInfo" id="UnCheckedInfoList" >
 
    <tr style="border-bottom: 1px groove rgba(254, 254, 254, 0.48);">
        <td style="padding: 2px 5px; width:25px">
            <apex:inputCheckbox value="{!ucInfo.rec_checkBox_c}" id="AssetRowCheckbox2"/>
            <input type="hidden" value="{!ucInfo.rec.Id}" id="UncheckAssetId"/>
        </td>
        <td style="padding: 2px 5px; width:70px">
            <apex:outputField value="{!ucInfo.rec.Asset_situation__c}"/>
        </td>
        <td style="padding: 2px 5px;">
            <a href="#" onclick="window.open('/{!ucInfo.rec.Id}', '_blank');">{!ucInfo.rec.Name}</a>
            <!--                                     <apex:outputField value="{!ucInfo.rec.name}" id="assetName"/> -->
        </td>
        <td style="padding: 2px 5px; width:70px">
            <apex:outputField value="{!ucInfo.rec.SerialNumber}"/>
        </td>
        <td style="padding: 2px 5px; width:70px">
            <!--                                     <apex:outputField value="{!ucInfo.rec.CurrentContract__c}"/> -->
            <a href="#" onclick="window.open('/{!ucInfo.rec.CurrentContract__c}', '_blank');">{!ucInfo.rec.CurrentContract__r.Management_Code__c}</a>
        </td>
        <td style="padding: 2px 5px; width:70px">
            <apex:outputField value="{!ucInfo.rec.Department_Name__c}"/>
        </td>
        <td style="padding: 2px 5px; width:70px">
            <apex:outputField value="{!ucInfo.rec.Status}"/>
        </td>
        <td style="padding: 2px 5px; width:70px">
            <apex:outputField value="{!ucInfo.rec.Installation_Site__c}"/>
        </td>
        <td style="padding: 2px 5px; width:70px">
            <apex:outputField value="{!ucInfo.rec.Room_Number__c}"/>
        </td>
        <td style="padding: 2px 5px; width:90px;text-align:center">
            <apex:outputField value="{!ucInfo.rec.InstallDate}"/>
        </td>
        <td style="padding: 2px 5px; width:90px">
            <apex:outputField value="{!ucInfo.rec.Asset_Owner__c}"/>
        </td>
        <td style="padding: 2px 5px; width:90px;text-align:center">
            <apex:outputField value="{!ucInfo.rec.Accumulation_Repair_Amount__c}"/>
        </td>
    </tr>
    <apex:variable value="{!cnt + 1}" var="cnt" />
</apex:repeat>
<apex:variable value="{!cntOut + 1}" var="cntOut" />
</apex:repeat>
</table>
</apex:outputPanel>
</apex:pageBlockSection>
<!-- fxk 2021/8/4 新加 Start-->
<apex:pageBlockSection title="打印时洗消信息" columns="1" id="UnCheckSection1" >
<apex:outputPanel >
<table class="edittable" border="0" style="border-collapse: collapse; width:600px; table-layout:fixed;">
    <tr>
        <td>{!$ObjectType.Inspection_Report__c.fields.CleaningFluid__c.Label}:</td>
        <td><apex:inputField value="{!ir.CleaningFluid__c}" style="width: 90%"/></td>
        <!-- 方式  add by rentx 20210927 start-->
        <td>{!$ObjectType.Inspection_Report__c.fields.Mode__c.Label}:</td>
        <td><apex:inputField value="{!ir.Mode__c}" style="width: 90%"/></td> 
        <!-- 方式 add by rentx 20210927 end -->
        <td>{!$ObjectType.Inspection_Report__c.fields.SterilizationMethod__c.Label}:</td>
        <td><apex:inputField value="{!ir.SterilizationMethod__c}" style="width: 90%"/></td> 
        <td>{!$ObjectType.Inspection_Report__c.fields.Remarks__c.Label}:</td>
        <td><apex:inputText value="{!ir.Remarks__c}" style="width: 90%"/></td> 
    </tr>
    <tr>
        <td>{!$ObjectType.Inspection_Report__c.fields.Disinfectant__c.Label}:</td>
        <td><apex:inputField value="{!ir.Disinfectant__c}" style="width: 90%"/></td>
        <td>{!$ObjectType.Inspection_Report__c.fields.UsedMachine__c.Label}:</td>
        <td><apex:inputField value="{!ir.UsedMachine__c}" style="width: 90%"/></td>
        <td>{!$ObjectType.Inspection_Report__c.fields.Used_ET__c.Label}:</td>
        <td><apex:inputText value="{!ir.Used_ET__c}" style="width: 90%"/></td> 
    </tr>
</table>
</apex:outputPanel>
</apex:pageBlockSection>
<!-- fxk 2021/8/4 新加 End-->
</div>
</apex:pageBlock></div>
<script type="text/javascript">
    // 已签字の場合、変更不能にする
    var status = '{!ir.Status__c}';
    if (status == "申请中" || status == "批准") {
        var inputs = document.getElementsByTagName("input");
        for (var i = 0; i < inputs.length; i++) {
            var obj = inputs[i];
            
            if (obj.id == "Page:Form:Block:closeButton") continue;
            //if (obj.id == "Page:Form:Block:submitButton") continue;
            //if (status == "已签字" && obj.id == "Page:Form:Block:submitButton") continue;
            
            if (obj.type == "button") {
                setButtonDisable(obj, true);
            } else {
                obj.disabled = true;
            }
        }
        var selects = document.getElementsByTagName("select");
        console.log(selects);
        for (var i = 0; i < selects.length; i++) {
            selects[i].disabled = true;
        }
    } else {
        //var smb = j$(escapeVfId("Page:Form:Block:submitButton"))[0];
        //setButtonDisable(smb, true);
    }
    // HWAG-BDCA9J 提醒未保存和刷新前不能选择产品 start
    function blurProduct(obj) {
        var irID = "{!ir.Id}";
        var productCount2 = "{!productCount2}";
        if(!irID && productCount2  == 0){
            alert('请先输入医院并点击刷新按钮调出保有设备,否则点检结果无法与设备关联。');
            obj.blur();
            return false;
        }
        return true;
    }
    // HWAG-BDCA9J 提醒未保存和刷新前不能选择产品 end
</script>
</apex:form>
</body>
</html>
</apex:page>