Li Jun
2022-04-11 9c014262e3cf8eb25f7d538f3130f2e7e2820d68
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
<!-- <apex:page controller="QISPDFController" showHeader="false" sidebar="false" renderAs="pdf" action="{!init}" applyHtmlTag="false"> -->
<apex:page controller="QISPDFController" showHeader="false" sidebar="false" action="{!init}" applyHtmlTag="false">
<html>
    <head>
        <style>
            @page {
                size: A4 portrait;
                margin: 5mm 12mm 5mm 12mm;
                
    /*             @bottom-center { */
    /*                 content: counter(page) " / " counter(pages); */
    /*             } */
            }
            
            table {border-collapse: collapse;}
            
    /*         td {padding: 0px 0px 0px 0px;} */
            td.title {text-align: center; font-weight: bold; background-color: #BDBDBD;}
            td.middle {text-align: center; font-size:120%; font-weight: bold;}
            td.label {padding-left: 10px;}
 
            /* 20220221 PI改造 by 徐亮 start */
            body{margin: 0 auto;
            width: 780px;}
            .title1{height: 30px;}
            .title2{height: 110px;}
            /* 20220221 PI改造 by 徐亮 end */
            
 
        </style>
        <!-- 20220221 PI改造 by 徐亮 start  -->
        <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
        <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script>
        <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
        <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
        <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
        <apex:includeScript value="{!URLFOR($Resource.jspdf)}"/>
        <apex:includeScript value="{!URLFOR($Resource.html2canvas)}"/>
 
        <!-- 20220221 PI改造 by 徐亮 end  -->
    </head>
    
<body style="font-family: MS Gothic;">
    <div id="pdf-wrapper">
        <div class="pdf-page">
            
        <table width="100%" border="0">
            <tr>
                <td width="25%">
                    <!-- <apex:image value="{!$Resource.swmLOGO}" /> -->
                    <table width="100%" border="1" cellspacing="0" style="border-color: red;">
                        <tr><td colspan="2" style="font-size: 6px; font-weight: bold; color: red; text-align: center; padding: 0px 0px 0px 0px;">OLYMPUS</td></tr>
                        <tr>
                            <td style="font-size: 7px; color: red; text-align: center; padding: 0px 0px 0px 0px; border-color: red;" width="80%" >INTERNAL USER ONLY</td>
                            <td style="font-size: 7px; color: red; text-align: center; padding: 0px 0px 0px 0px; border-color: red;">社外秘</td>
                        </tr>
                    </table>
                    <table width="100%" cellspacing="0" style="border-color: red;">
                        <tr><td colspan="2" style="font-size: 6px; font-weight: bold; color: red; text-align: center; padding: 0px 0px 0px 0px;">社内密:公司内部公开</td></tr>
                    </table>
                </td>
                <td style="text-align: center;"><span style="font-size: 12pt;">产品质量信息单</span></td>
                <td width="12%" style="text-align: right; vertical-align: bottom; font-size: 10pt;">
                    <apex:outputText value="{0, date, yyyyMMdd}">
                        <apex:param value="{!TODAY()}" /> 
                    </apex:outputText>
                </td>
            </tr>
        </table>
        <div style="height:3px;"></div>
        <table width="100%" border="0" cellspacing="2" style="font-size: 8pt;">
            <tr>
                <td>
                    <table width="100%" border="1" cellspacing="0">
                        <tr>
                            <td width="20%" class="label" height="23px">产品名称/型号</td>
                            <td width="30%" class="middle"><c:PDFWbr targetStr="{!qr.QIS_product_name__c}"/></td>
                            <td rowspan="2" width="20%" class="label" style="vertical-align: middle;">OCSM管理号码</td>
                            <td rowspan="2" width="30%" class="middle" style="vertical-align: middle;">{!qr.OCM_control_no__c}</td>
                        </tr>
                        <tr>
                            <td class="label" height="23px">机器号/批号</td>
                            <td class="middle">{!qr.lot_or_serial__c}</td>
    <!--                             <td class="label">OCM管理号码</td> -->
    <!--                             <td class="middle">{!qr.OCM_control_no__c}</td> -->
                        </tr>
                        <tr >
                            <td class="label" height="23px">问题现象</td>
                            <td style="text-align: center; font-size: 7pt;"><c:PDFWbr targetStr="{!qr.Comment__c}" /></td>
                            <td class="label">销售合同上的订单编号</td>
                            <td class="middle">{!qr.contract_number__c}</td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td style="border-top-color: white;">
                    <table width="100%" border="1" cellspacing="0">
                        <tr>
                            <td colspan="2" class="title">提交者信息</td>
                            <td colspan="3" class="title">客户信息</td>
                        </tr>
                        <tr>
                            <td width="25%" class="label" height="23px">分公司</td>
                            <td width="25%" class="middle" style="font-size: 6pt;">{!usr.fen_corp_name__c}</td>
                            <td width="10%" class="label">用户名称</td>
                            <td colspan="2" class="middle">{!qr.Hospital__r.Name}</td>
                        </tr>
                        <tr>
                            <td width="25%" class="label" height="23px">销售本部</td>
                            <td width="25%" class="middle">{!usr.Salesdepartment__c}</td>
                            <td width="10%" class="label">科室</td>
                            <td colspan="2" class="middle">{!qr.Department_Name__c}</td>
                        </tr>
                        <tr>
                            <td width="25%" class="label" height="23px">提交者</td>
                            <td width="25%" class="middle">{!usr.Name}</td>
                            <td width="10%" class="label">地址</td>
                            <td width="20%" style="text-align: right;">{!qr.Hospital_Department__r.Parent.Parent.State_Master__r.Name}&nbsp;&nbsp;&nbsp;&nbsp;省/自治区</td>
                            <td width="20%" style="text-align: right;">{!qr.Hospital_Department__r.Parent.Parent.City_Master__r.Name}&nbsp;&nbsp;&nbsp;&nbsp;市</td>
                        </tr>
                        <tr>
                            <td width="25%" class="label" height="23px">提交者上司</td>
                            <td width="25%" class="middle">{!usr.Manager.Name}</td>
                            <td width="10%" class="label">电话号码</td>
                            <td colspan="2" class="middle" id="Caller_phone__c">{!qr.Caller_phone__c}</td>
                        </tr>
                        <tr>
                            <td width="25%" class="label" height="23px">提交日期</td>
                            <td width="25%" class="middle"><apex:outputField value="{!qr.QIS_Submit_day__c}" /></td>
                            <td width="10%" class="label">联系人</td>
                            <td colspan="2" class="middle" id="Responsible_Person_HP__c">{!qr.Responsible_Person_HP__c}</td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td style="border-top-color: white;">
                    <table width="100%" border="1" cellspacing="0">
                        <tr>
                            <td colspan="5" class="title">产品/使用信息</td>
                        </tr>
                        <tr>
                            <td colspan="2" class="label" height="23px">
                                <apex:outputPanel layout="none" rendered="{!qr.demo_or_asset__c == '购买'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.demo_or_asset__c <> '购买'}">&#9633;</apex:outputPanel>购买
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!qr.demo_or_asset__c == '备品'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.demo_or_asset__c <> '备品'}">&#9633;</apex:outputPanel>备品
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!qr.demo_or_asset__c == '其他'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.demo_or_asset__c <> '其他'}">&#9633;</apex:outputPanel>其他&nbsp;&nbsp;&nbsp;&nbsp;>>
                            </td>
                            <td colspan="2" class="label">清洗消毒方法(方法,化学消毒剂):</td>
                            <td width="20%" class="label">
                                <apex:outputPanel layout="none" rendered="{!qr.cds_methods__c == '手动'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.cds_methods__c <> '手动'}">&#9633;</apex:outputPanel>手动
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!qr.cds_methods__c == '自动'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.cds_methods__c <> '自动'}">&#9633;</apex:outputPanel>自动
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!qr.cds_methods__c == '没有'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.cds_methods__c <> '没有'}">&#9633;</apex:outputPanel>没有
                            </td>
                        </tr>
                        <tr>
                            <td width="25%" class="label" height="23px">故障发生日&nbsp;/&nbsp;问题联络收到日</td>
                            <td width="25%" class="middle"><apex:outputField value="{!qr.Faliour_date__c}" />&nbsp;/&nbsp;<apex:outputField value="{!qr.Trable_occur_daY_collect__c}" /></td>
                            <td width="25%" style="text-align: center;">清洗</td>
                            <td colspan="2" style="text-align: center;">消毒</td>
                        </tr>
                        <tr>
                            <td class="label" height="23px">购买日期/安装日期</td>
                            <td class="middle"><apex:outputField value="{!qr.QISInstallDate__c}" /></td>
                            <td class="middle">{!qr.cleanning__c}</td>
                            <td colspan="2" class="middle">{!qr.disinfection__c}</td>
                        </tr>
                        <tr>
                            <td class="label" height="23px">新品保证期间</td>
                            <td class="label">
                                <apex:outputPanel layout="none" 
                                rendered="{!inGuarantee}"
                                >&#10004;
                                </apex:outputPanel>
                                <apex:outputPanel layout="none"
                                rendered="{!not(inGuarantee)}">
                                &#9633;
                            </apex:outputPanel>内
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none"
                                    rendered="{!if(Not(inGuarantee) && Not(outOfGuarantee) , 'true', 'false')}"
                                    >&#10004;</apex:outputPanel>
                                <apex:outputPanel layout="none" 
                                
                                rendered="{!if(inGuarantee || outOfGuarantee , 'true', 'false')}"
                                >&#9633;</apex:outputPanel>外
                            </td>
                            <td colspan="3" style="text-align: center;">灭菌  (温度及灭菌时间)</td>
                        </tr>
                        <tr>
                            <td class="label" height="23px">使用频率</td>
                            <td style="text-align: right;">{!qr.usage_frequence__c}&nbsp;&nbsp;&nbsp;&nbsp;例次/日</td>
                            <td colspan="3" class="middle">{!qr.sterlization__c}</td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td style="border-top-color: white;">
                    <table width="100%" border="1" cellspacing="0">
                        <tr>
                            <td colspan="4" class="title">发生故障信息</td>
                        </tr>
                        <tr>
                            <td class="label" height="23px">问题发生时的情况</td>
                            <td colspan="3" class="label">
                                <apex:outputPanel layout="none" rendered="{!qr.failuer_situation__c == '到货验收'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.failuer_situation__c <> '到货验收'}">&#9633;</apex:outputPanel>到货验收
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!qr.failuer_situation__c == '使用前准备'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.failuer_situation__c <> '使用前准备'}">&#9633;</apex:outputPanel>使用前准备
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!qr.failuer_situation__c == '手术-使用中'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.failuer_situation__c <> '手术-使用中'}">&#9633;</apex:outputPanel>使用中
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!qr.failuer_situation__c == '清洗消毒'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.failuer_situation__c <> '清洗消毒'}">&#9633;</apex:outputPanel>清洗消毒
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!qr.failuer_situation__c == '其他'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.failuer_situation__c <> '其他'}">&#9633;</apex:outputPanel>其他
                            </td>
                        </tr>
                        <tr>
                            <td class="label" height="23px">配套使用产品</td>
                            <td colspan="3" class="middle">{!qr.Set_usage_product__c}</td>
                        </tr>
                        <tr>
                            <td colspan="4" style="height:18px; padding-top: 0px; padding-bottom: 0px; padding-left: 10px;border-bottom: none;border-bottom: none;">问题内容描述</td>
                        </tr>
                        <tr>
                            <td colspan="4" style="height:40px; border-top-color: white; font-size:120%; font-weight: bold; vertical-align: top;"><c:PDFWbr targetStr="{!qr.problem_detail__c}" /></td>
                        </tr>
                        <tr>
                            <td width="25%" class="label" height="23px">问题产品/零件</td>
                            <td width="25%" class="label">
                                <apex:outputPanel layout="none" rendered="{!qr.accsessary_ship__c == '同发'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.accsessary_ship__c <> '同发'}">&#9633;</apex:outputPanel>同发
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!qr.accsessary_ship__c == '另发'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.accsessary_ship__c <> '另发'}">&#9633;</apex:outputPanel>另发
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!qr.accsessary_ship__c == '不送'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.accsessary_ship__c <> '不送'}">&#9633;</apex:outputPanel>不送
                            </td>
                            <td width="25%" style="text-align: center;">现品发货日</td>
                            <td width="25%" class="middle"><apex:outputField value="{!qr.shipping_to_QIS_dept_day__c}" /></td>
                        </tr>
                        <tr>
                            <td width="25%" class="label" height="23px">同时发送的附件/零件</td>
                            <td width="25%" class="middle">{!qr.accsessary_detail__c}</td>
                            <td width="25%" style="text-align: center;">更换品申请</td>
                            <td width="25%" class="label">
                                <apex:outputPanel layout="none" rendered="{!qr.request_altanetive_product__c == '已申'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.request_altanetive_product__c <> '已申'}">&#9633;</apex:outputPanel>已申
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!qr.request_altanetive_product__c == '未申请'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.request_altanetive_product__c <> '未申请'}">&#9633;</apex:outputPanel>未申请
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td style="border-top-color: white;">
                    <table width="100%" border="1" cellspacing="0">
                        <tr>
                            <td colspan="13" class="title">OCSM服务本部</td>
                        </tr>
                        <tr>
                            <td colspan="13" style="height:18px; padding-top: 0px; padding-bottom: 0px; padding-left: 10px;border-bottom: none;">检测/分析情况详述</td>
                        </tr>
                        <tr>
                            <td colspan="13" style="height:42px; border-top-color: white; font-size:120%; font-weight: bold; vertical-align: top;"><c:PDFWbr targetStr="{!qr.QIS_Reply_Comment__c}" /></td>
                        </tr>
                        <tr>
                            <td colspan="13" style="height:18px; padding-top: 0px; padding-bottom: 0px; padding-left: 10px;border-bottom: none;">原因</td>
                        </tr>
                        <tr>
                            <td colspan="13" style="height:42px; border-top-color: white; font-size:120%; font-weight: bold; vertical-align: top;"><c:PDFWbr targetStr="{!qr.Reason_bloken__c}" /></td>
                        </tr>
                        <tr>
                            <td colspan="3" class="label" height="23px">检测结论</td>
                            <td colspan="10" class="label">
                                <apex:outputPanel layout="none" rendered="{!LEFT(qr.OCM_judgement__c,4) == '质量问题'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!LEFT(qr.OCM_judgement__c,4) <> '质量问题'}">&#9633;</apex:outputPanel>质量问题
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!NOT(ISBLANK(qr.OCM_judgement__c)) && contains(qr.OCM_judgement__c, '非质量问题')}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!ISBLANK(qr.OCM_judgement__c) || NOT(contains(qr.OCM_judgement__c, '非质量问题'))}">&#9633;</apex:outputPanel>非质量问题
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!qr.OCM_judgement__c == '现象未发现' || (qr.RC_problem_not_found__c && NOT(qr.RC_FixedJudgement__c))}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.OCM_judgement__c <> '现象未发现' && NOT(qr.RC_problem_not_found__c && NOT(qr.RC_FixedJudgement__c))}">&#9633;</apex:outputPanel>现象未发现
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3" class="label" height="23px">对应方法</td>
                            <td colspan="8" class="label">
                                <apex:outputPanel layout="none" rendered="{!qr.next_action__c == '无偿更换'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.next_action__c <> '无偿更换'}">&#9633;</apex:outputPanel>无偿更换
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!NOT(ISBLANK(qr.next_action__c)) && contains(qr.next_action__c, '无偿维修')}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!ISBLANK(qr.next_action__c) || NOT(contains(qr.next_action__c, '无偿维修'))}">&#9633;</apex:outputPanel>无偿维修
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!NOT(ISBLANK(qr.next_action__c)) && contains(qr.next_action__c, '有偿维修')}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!ISBLANK(qr.next_action__c) || NOT(contains(qr.next_action__c, '有偿维修'))}">&#9633;</apex:outputPanel>有偿维修
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!qr.next_action__c == '送回'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.next_action__c <> '送回'}">&#9633;</apex:outputPanel>送回
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!qr.RC_problem_not_found__c && NOT(qr.RC_FixedJudgement__c)}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!NOT(qr.RC_problem_not_found__c && NOT(qr.RC_FixedJudgement__c))}">&#9633;</apex:outputPanel>继续观察
                            </td>
                            <td colspan="2" class="label">
                                <apex:outputPanel layout="none" rendered="{!qr.Special_follow__c}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!NOT(qr.Special_follow__c)}">&#9633;</apex:outputPanel>特别对应
                            </td>
                        </tr>
                        <tr>
    <!--                             <td colspan="4" style="text-align: center;" height="23px">现品收到日</td> -->
    <!--                             <td colspan="4" style="text-align: center;">确认日</td> -->
                            <td colspan="3" style="text-align: center;" height="23px">现品收到日</td>
                            <td colspan="3" style="text-align: center;">CDS日</td>
                            <td colspan="3" style="text-align: center;">检查日</td>
                            <td colspan="4" style="text-align: center;">确认日</td>
                        </tr>
                        <tr>
    <!--                             <td colspan="4" class="middle" style="height:30px;"><apex:outputField value="{!qr.OCM_RC_RecievedDate__c}" /></td> -->
    <!--                             <td colspan="4" class="middle"><apex:outputField value="{!qr.QIS_Reply_day__c}" /></td> -->
                            <td colspan="3" class="middle" style="height:30px;"><apex:outputField value="{!qr.OCM_RC_RecievedDate__c}" /></td>
                            <td colspan="3" class="middle"><apex:outputField value="{!qr.CDS_date__c}" /></td>
                            <td colspan="3" class="middle"><apex:outputField value="{!qr.RC_inspection_date__c}" /></td>
                            <td colspan="4" class="middle"><apex:outputField value="{!qr.QIS_Reply_day__c}" /></td>
                        </tr>
                        <tr>
    <!--                             <td style="text-align: center; height:40px;">确认者</td> -->
    <!--                             <td colspan="2" width="24%" class="middle">{!qr.RC__r.Alias__c}</td> -->
    <!--                             <td style="text-align: center; color: #D8D8D8">盖章</td> -->
    <!--                             <td style="text-align: center;">确认者</td> -->
    <!--                             <td colspan="2" width="24%" class="middle">{!qr.RC_manager__r.Alias__c}</td> -->
    <!--                             <td style="text-align: center; color: #D8D8D8">盖章</td> -->
                            <td width="6%" style="height:40px;">确认者</td>
                            <td width="13%" class="middle">{!qr.RC__r.Alias__c}</td>
                            <td width="6%" style="text-align: center; color: #D8D8D8">盖章</td>
                            <td width="6%">确认者</td>
                            <td width="13%" class="middle">{!qr.RC_CDS_staff__c}</td>
                            <td width="6%" style="text-align: center; color: #D8D8D8">盖章</td>
                            <td width="6%">确认者</td>
                            <td width="13%" class="middle">{!qr.RC_Inspection_staff__c}</td>
                            <td width="6%" style="text-align: center; color: #D8D8D8">盖章</td>
                            <td width="6%">确认者</td>
                            <td colspan="2" width="13%" class="middle">{!qr.RC_manager__r.alias__c}</td>
                            <td width="6%" style="text-align: center; color: #D8D8D8">盖章</td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td style="border-top-color: white;">
                    <table width="100%" border="1" cellspacing="0">
                        <tr>
                            <td colspan="10" class="title">OSH 医疗品质保障部</td>
                        </tr>
                        <tr>
                            <td colspan="9" style="height:18px; padding-top: 0px; padding-bottom: 0px; padding-left: 10px;border-bottom: none;">检测/分析情况详述<br/></td>
                            <td style="text-align: center;">质量判定</td>
                        </tr>
                        <tr>
                            <td colspan="9" style="height:35px; border-top-color: white; font-size:120%; font-weight: bold; vertical-align: top;"><c:PDFWbr targetStr="{!qr.OSH_judgement__c}" /></td>
                            <td class="label">
                                <apex:outputPanel layout="none" rendered="{!LEFT(qr.QIS_final_judgement__c,4) == '质量问题'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!LEFT(qr.QIS_final_judgement__c,4) <> '质量问题'}">&#9633;</apex:outputPanel>质量问题
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!NOT(ISBLANK(qr.QIS_final_judgement__c)) && contains(qr.QIS_final_judgement__c, '非质量问题')}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!ISBLANK(qr.QIS_final_judgement__c) || NOT(contains(qr.QIS_final_judgement__c, '非质量问题'))}">&#9633;</apex:outputPanel>非质量问题
                            </td>
                        </tr>
                        <tr></tr>
                        <tr>
                            <td colspan="6" rowspan="2" class="label" style="height:35px;">OSH采取的对应措施(属于OSH修理对象品时填写)</td>
                            <td colspan="3" rowspan="2" style="text-align: center; font-size: 7pt;"><c:PDFWbr targetStr="{!qr.OSH_action__c}" /></td>
                            <td style="text-align: center;">发行QIS</td>
                        </tr>
                        <tr>
                            <td rowspan="2" style="height:35px;" class="label">
                                <apex:outputPanel layout="none" rendered="{!qr.Wether_publish_QIS_not__c == '发行'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.Wether_publish_QIS_not__c <> '发行'}">&#9633;</apex:outputPanel>发行
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <apex:outputPanel layout="none" rendered="{!qr.Wether_publish_QIS_not__c == '不发行'}">&#10004;</apex:outputPanel><apex:outputPanel layout="none" rendered="{!qr.Wether_publish_QIS_not__c <> '不发行'}">&#9633;</apex:outputPanel>不发行
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3" style="text-align: center; height: 23px;">检查受理日</td>
                            <td colspan="3" style="text-align: center;">检查结论日</td>
                            <td colspan="3" style="text-align: center;">QIS发行日</td>
                        </tr>
                        <tr>
                            <td colspan="3" class="middle" style="height:30px;"><apex:outputField value="{!qr.OSHRecievedDate__c}" /></td>
                            <td colspan="3" class="middle" ><apex:outputField value="{!qr.QIS_OSH_answerdate__c}" /></td>
                            <td colspan="3" class="middle" ><apex:outputField value="{!qr.QIS_submit_date_for_MBC__c}" /></td>
                            <td style="text-align: center;">QIS No.</td>
                        </tr>
                        <tr>
                            <td width="6%" style="height:40px;">检查者</td>
                            <td width="13%" class="middle">{!qr.OSH_staff__c}</td>
                            <td width="6%" style="text-align: center; color: #D8D8D8">盖章</td>
                            <td width="6%" >负责人</td>
                            <td width="13%" class="middle">{!qr.OSH_Manager__r.Alias__c}</td>
                            <td width="6%" style="text-align: center; color: #D8D8D8">盖章</td>
                            <td width="6%">负责人</td>
                            <td width="13%" class="middle">{!qr.OSH_Manager__r.Alias__c}
    <!--                                 {!IF(Isblank(qr.OSH_Manager__r.BuchangApprovalManager__c), qr.OSH_Manager__r.Alias__c, qr.OSH_Manager__r.BuchangApprovalManager__r.Alias__c)} -->
                            </td>
                            <td width="6%" style="text-align: center; color: #D8D8D8">盖章</td>
                            <td width="25%" class="middle">{!qr.QIS_no_for_m_BC__c}</td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        
        
        </div>
        <div style="page-break-after: always;"></div>
        <div class="pdf-page">
            
        <table width="100%" border="0">
            <tr>
                <td width="25%">
                    <table width="100%" border="1" cellspacing="0" style="border-color: red;">
                        <tr><td colspan="2" style="font-size: 6px; font-weight: bold; color: red; text-align: center; padding: 0px 0px 0px 0px;">OLYMPUS</td></tr>
                        <tr>
                            <td style="font-size: 7px; color: red; text-align: center; padding: 0px 0px 0px 0px; border-color: red;" width="80%" >INTERNAL USER ONLY</td>
                            <td style="font-size: 7px; color: red; text-align: center; padding: 0px 0px 0px 0px; border-color: red;">社外秘</td>
                        </tr>
                    </table>
                    <table width="100%" cellspacing="0" style="border-color: red;">
                        <tr><td colspan="2" style="font-size: 6px; font-weight: bold; color: red; text-align: center; padding: 0px 0px 0px 0px;">社内密:公司内部公开</td></tr>
                    </table>
                </td>
                <td style="text-align: center;"><span style="font-size: 12pt;">产品质量信息单</span></td>
                <td width="12%" style="text-align: right; vertical-align: bottom; font-size: 10pt;">
                    <apex:outputText value="{0, date, yyyyMMdd}">
                        <apex:param value="{!TODAY()}" /> 
                    </apex:outputText>
                </td>
            </tr>
        </table>
        <div style="height:3px;"></div>
        <table width="100%" border="0" cellspacing="2" style="font-size: 8pt;">
            <tr>
                <td>
                    <table width="100%" border="1" cellspacing="0">
                        <tr>
                            <td width="20%" class="label" height="23px">产品名称/型号</td>
                            <td width="30%" class="middle"><c:PDFWbr targetStr="{!qr.QIS_product_name__c}"/></td>
                            <td rowspan="2" width="20%" class="label" style="vertical-align: middle;">OCSM管理号码</td>
                            <td rowspan="2" width="30%" class="middle" style="vertical-align: middle;">{!qr.OCM_control_no__c}</td>
                        </tr>
                        <tr>
                            <td class="label" height="23px">机器号/批号</td>
                            <td class="middle">{!qr.lot_or_serial__c}</td>
    <!--                             <td class="label">OCM管理号码</td> -->
    <!--                             <td class="middle">{!qr.OCM_control_no__c}</td> -->
                        </tr>
                        <tr >
                            <td class="label" height="23px">问题现象</td>
                            <td style="text-align: center; font-size: 7pt;"><c:PDFWbr targetStr="{!qr.Comment__c}" /></td>
                            <td class="label">销售合同上的订单编号</td>
                            <td class="middle">{!qr.contract_number__c}</td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <br/>
        <table width="100%" border="1" cellspacing="2" style="font-size: 8pt;">
            <tr>
                <td style="width:50%">
                    <table width="100%" border="0" cellspacing="0">
                        <tr><td style="height:300px; text-align: center;"><apex:image id="Photo_1_Text" value="{!Photo_1_Text}" width="80%" rendered="{!NOT(ISBLANK(qr.Photo_1_Text__c))}" /></td></tr>
                        <tr><td style="height:40px;"></td></tr>
                    </table>
                </td>
                <td style="border-left-color: white;">
                    <table width="100%" border="0" cellspacing="0">
                        <tr><td style="height:300px; text-align: center;"><apex:image value="{!Photo_2_Text}" width="80%" rendered="{!NOT(ISBLANK(qr.Photo_2_Text__c))}" /></td></tr>
                        <tr><td style="height:40px;"></td></tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td style="border-top-color: white;">
                    <table width="100%" border="0" cellspacing="0">
                        <tr><td style="height:300px; text-align: center;"><apex:image value="{!Photo_3_Text}" width="80%" rendered="{!NOT(ISBLANK(qr.Photo_3_Text__c))}" /></td></tr>
                        <tr><td style="height:40px;"></td></tr>
                    </table>
                </td>
                <td style="border-left-color: white; border-top-color: white;">
                    <table width="100%" border="0" cellspacing="0">
                        <tr><td style="height:300px; text-align: center;"><apex:image value="{!Photo_4_Text}" width="80%" rendered="{!NOT(ISBLANK(qr.Photo_4_Text__c))}" /></td></tr>
                        <tr><td style="height:40px;"></td></tr>
                    </table>
                </td>
            </tr>
        </table>
        </div>
        
    </div>
</body>
 
<!-- 20220221 PI改造 by 徐亮 start  -->
<script>
    AWSService.sfSessionId = '{!GETSESSIONID()}';
    var staticResources = JSON.parse('{!staticResource}');
    var staticResourceFile = JSON.parse('{!staticResourceFile}');
    function Fun(pdf) {
 
        var form = jQuery("<form method='post'></form>");
        jQuery(document.body).append(form);
        let href = window.location.href
        let arr = href.split('/')
        form.attr({ "action": staticResourceFile.viewUnifiedContactUrl + "?from=" + encodeURIComponent(href) + "&fileName=" + encodeURIComponent(arr[arr.length - 1].split('?')[0]) });
        // form.attr({"action":"http://127.0.0.1:8080/a/d?from="+encodeURIComponent(window.location.href)});
        let input = jQuery("<input type='hidden'/>");
        input.attr({ "name": "base64Str" });
        input.val(pdf.output('datauristring').substr(28));
        form.append(input);
        form.submit();
 
        // jQuery("body > *").each(function(){
        //     jQuery(this).css('display','none');
        // })
        // jQuery("body").append('<embed style="position:absolute; left: 0; top: 0;" width="100%" height="100%" src="'+pdf.output('datauristring')+'" type="application/pdf"/>')
 
    }
 
    let id = "pdf-wrapper";
    var target = document.getElementById(id);
    // 把imageDta转换成url
        // page_height:一页的高度
        function ImageDataToUrl(img_data,page_height){
            let cvs = document.createElement("CANVAS");
            cvs.width = img_data.width;
            cvs.height = page_height;
            var ctx= cvs.getContext("2d");
            ctx.fillStyle="white";
            ctx.fillRect(0,0,cvs.width,cvs.height);// 填充canvas所有区域为白色
            ctx.putImageData(img_data,0,0);
            return cvs.toDataURL('image/jpeg', 1.0);
        }
        function jsPdfDownload() {
    
            let jtargets = jQuery("#pdf-wrapper .pdf-page");
            let j_arr = new Array(jtargets.length + 1).join(0).split('').map(function () { return false });
            let landscape = false;
            let pw = 595.28;
            let ph = 841.89;
            const marginw = 40;
            const marginh = 40;
    
            let orientation = '';
            if (landscape) {
                pw += ph; ph = pw - ph; pw = pw - ph;
                orientation = 'l';
            }
            var pdf = new jsPDF(orientation, 'pt', 'a4');// 第一个参数填字母l,注意不是数字1,为横向pdf
            jtargets.each(function (i, e) {
                e.style.background = "#FFFFFF";
            })
    
            let rei = 0;
            let recursion = null;
            recursion = function (i) {
                if (i >= jtargets.length) {
                    Fun(pdf);
                    return;
                }
                e = jtargets[i];
                html2canvas(e, {
                    scale: 2,
                    onrendered: function (canvas) {
                        /**
                        本方法需要做几个事情
                        1.需要把canvas的内容分页显示到pdf的页中
                        2.canvas的宽高需要和pdf的宽高进行映射
                        3.截取到的内容需要放进一页宽高的canvas里面,并对其余区域刷白
                        */
                        var ctx = canvas.getContext("2d");
                        let canvas_max_page_num = 9;
                        let canvas_current_page_num = 0;
                        var contentWidth = canvas.width;
                        var contentHeight = canvas.height;
    
                        
                        //未生成pdf的html页面高度
                        var leftHeight = contentHeight;
                        //页面偏移
                        var position = 0;
                        
                        //a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高
                        var outputWidth = pw - 2 * marginw;//595.28//左右边距20
                        let rate = outputWidth / 780;//输出宽度和内容宽度的比例
                        var outputHeight = ph - 2 * marginh;//左右边距20
                        let onePdfPageInCanvasHeight = contentWidth/outputWidth*outputHeight;//一页pdf在canvas中的高度;
                        //var pageData = canvas.toDataURL('image/jpeg', 1.0);
                        var pageData = null;
                        var imgData = null;
                        
                        var captureHeight = null;// 截取的当前canvas页的高度
                        
                        let j = i;
                        while(position < contentHeight){
                            
                            if (j++) {
                                pdf.addPage();
                            }
 
                            if(position+onePdfPageInCanvasHeight>contentHeight){
                                captureHeight = contentHeight-position;
                            }else{
                                captureHeight = onePdfPageInCanvasHeight;
                            }
    
                            imgData = ctx.getImageData(0,position,contentWidth,captureHeight);
                            pageData = ImageDataToUrl(imgData,onePdfPageInCanvasHeight);
                            pdf.addImage(pageData, 'JPEG', marginw, marginh, outputWidth, outputHeight);//左右边距20,被输出的图片会被拉伸为outputWidth,outputHeight的宽高
                            canvas_current_page_num++;
                            position += onePdfPageInCanvasHeight;
                            if (canvas_max_page_num > 0 && canvas_current_page_num >= canvas_max_page_num) {
                                break;
                            }
                        }
    
                        recursion(i + 1);
                    }
                })
            };
            recursion(rei);
    
    
    
        }
    
        //blockme();
        document.body.onload = function(){
            
            AWSService.query(staticResources.queryUrl, '{!qr.AWS_Data_Id__c}', function(data){
                //unblockUI();
                document.getElementById("Responsible_Person_HP__c").innerHTML = data.object.responsiblePersonHP;
                document.getElementById("Caller_phone__c").innerHTML = data.object.callerPhone;
                if(confirm("PDF已加载完毕,是否显示?")){
                    jsPdfDownload(); 
                }
            }, staticResources.token);
        }
        
        
    
</script>
<!-- 20220221 PI改造 by 徐亮 end  -->
</html>
</apex:page>