DESKTOP-0K9VGFE\hp
2022-03-11 6d766b0c8e9b31e7e03ffd344a94c2851aa9beb9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<apex:page controller="InsReportPDFOuterController" showHeader="false" sidebar="false" action="{!init}" applyHtmlTag="false" id="Page">
<head>
<meta name="viewport" content="width=860,user-scalable=yes" />
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.signaturePadMinJs)}"/>
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
 
<script type="text/javascript">
var signaturePad;
function signCanvas() {
    j$(escapeVfId('Page:Form:outputCanvas')).hide();
    j$(escapeVfId('myCanvas')).show();
    j$(escapeVfId('myCanvas')).css("pointer-events","");
    j$(escapeVfId('myCanvas')).css("background-color","");
    signaturePad.clear();
}
 
function bolckCanvas() {
    blockme();
    saveSignfunc(signaturePad.toDataURL());
}
</script>
<title>{!ir.Name}</title>
</head>
    <apex:form id="Form">
        <iframe src="/apex/InsReportPDF?id={!URLENCODE(ir.Id)}" scrolling="true" width="100%;" height="450px;"></iframe>
        
        <apex:actionFunction name="saveSignfunc" action="{!saveSign}" rerender="Form" onComplete="savePDF();">
            <apex:param name="firstParam" assignTo="{!signStr}" value="" />
        </apex:actionFunction>
        
        <apex:actionFunction name="savePDF" action="{!savePDF}" rerender="Form" onComplete="location.href='/apex/OFSInsReportLayout?id={!URLENCODE(ir.Id)}';return false;" />
        
        <div style="float:right;">
            <apex:outputPanel layout="none" rendered="{!ir.ResponsiblePerson_Sign__c == null}">
                <div id="myCanvas_div" style="border:1px solid #000000; width:300px; height:150px;"><apex:outputField Id="outputCanvas" value="{!ir.ResponsiblePerson_Sign__c}" /></div>
            </apex:outputPanel>
            <br/>
            <!-- update by rentx 20210913 start -->
            <!-- <input type="button" value="返回" onclick="location.href='/apex/OFSInsReportLayout?id={!URLENCODE(ir.Id)}';return false;" style="width:100px"/> -->
            <apex:outputText rendered="{!isVm == 'FALSE'}">
                <input type="button" value="返回" onclick="location.href='/apex/OFSInsReportLayout?id={!URLENCODE(ir.Id)}';return false;" style="width:100px"/>
            </apex:outputText>
            <apex:outputText rendered="{!isVm == 'TRUE'}">
                <input type="button" value="返回" onclick="location.href='/apex/OFSInsReportLayoutForVm?id={!URLENCODE(ir.Id)}';return false;" style="width:100px"/>
            </apex:outputText>
            <!-- update by rentx 20210913 end -->
            <apex:outputPanel layout="none" rendered="{!ir.ResponsiblePerson_Sign__c == null}">
                <input type="button" value="签字" onclick="signCanvas();return false;" style="width:100px"/>
                <input type="button" value="确认并上传" onclick="bolckCanvas();" style="width:100px"/>
            </apex:outputPanel>
        </div>
<script type="text/javascript">
jQuery(document).ready(function() {
    j$(escapeVfId('myCanvas_div')).append("<canvas id='myCanvas' width='300px' height='150px'></canvas>");
    var canvas = j$(escapeVfId('myCanvas'))[0];
    signaturePad = new SignaturePad(canvas);
    j$(escapeVfId('myCanvas')).css("pointer-events","none");
    //if ('{!ir.ResponsiblePerson_Sign__c}' != null && '{!ir.ResponsiblePerson_Sign__c}' != '') {
        j$(escapeVfId('myCanvas')).hide();
    //} else {
    //    j$(escapeVfId('myCanvas')).css("background-color","rgba(0, 0, 0, 0.06)");
    //}
    
    var rt = document.getElementsByClassName('sfdc_richtext')[0];
    rt.style.width = "300px";
    rt.style.height = "150px";
});
</script>
    </apex:form>
</apex:page>