高章伟
2022-03-18 4bfe21c4b5ddc089ae5a95f4b10f6cff148b690d
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
<apex:page action="{!init}" controller="AttachmentPreviewController" id="allPage" showheader="false" sidebar="false">
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}">
    </apex:stylesheet>
    <apex:includescript value="{!URLFOR($Resource.jquery183minjs)}">
    </apex:includescript>
    <apex:includescript value="{!URLFOR($Resource.PleaseWaitDialog)}">
    </apex:includescript>
    <apex:includescript value="/soap/ajax/29.0/connection.js">
    </apex:includescript>
    <apex:includescript value="/soap/ajax/29.0/apex.js">
    </apex:includescript>
    <style type="text/css">
        body {
    margin: 0;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}
 
td,th {
    padding: 0;
}
 
.pure-table {
    border-collapse: collapse;
    border-spacing: 0;
    empty-cells: show;
    border: 1px solid #cbcbcb;
}
 
.pure-table caption {
    color: #000;
    font: italic 85%/1 arial,sans-serif;
   /* padding: 1em 0;*/
    text-align: center;
}
 
.pure-table td,.pure-table th {
    border-left: 1px solid #cbcbcb;
    border-width: 0 0 0 1px;
    font-size: inherit;
    margin: 0;
    overflow: visible;
    padding: .5em 1em;
}
 
.pure-table thead {
    background-color: #c3bfbf;
    color: #000;
    text-align: left;
    vertical-align: bottom;
}
 
.pure-table td {
    background-color: transparent;
}
.pure-table-horizontal td,.pure-table-horizontal th {
    border-width: 0 0 1px 0;
    border-bottom: 1px solid #cbcbcb;
}
 
.pure-table-horizontal tbody>tr:last-child>td {
    border-bottom-width: 0;
}
    </style>
    <!-- 20201224 liying statr -->
    <script language="javascript" type="text/javascript">
        //20201225 liying start
        //判断附件名称后缀名
        function openUrl(id,name){
            var picArr=['jpg','png','jpeg','PNG','JPG','JPEG','bmp','BMP'];
            var wordArr=['doc','pdf','PDF','xlsx','xls','csv','txt','docx','mov','DOC','XLSX','XLS','CSV','TXT','DOCX','MOV'];
            //lastIndexOf 是要判断最后一个'.',判断出来才能根据后缀截取
            //IndexOf 如果在名称中包含'.'则判断不出来
          
                //定义后缀名 suffix
                var suffix=name.substring(name.lastIndexOf('.')+1);
                if(picArr.indexOf(suffix)>-1){
                      if((!!window.ActiveXObject || "ActiveXObject" in window)&&(suffix=='bmp'||suffix=='BMP')) {
                        alert("IE浏览器不能打开后缀是bmp的文件,请使用其他浏览器!");
                   }
                   else{
                     window.location.href=' https://ocsm--stagefull--c.visualforce.com/apex/eSignFormAttachment?id='+id;
                    // window.location.href=' https://ocsm--c.ap0.visual.force.com/apex/eSignFormAttachment?id='+id;
                   } 
                }else{
                     window.location.href='https://ocsm--stagefull--c.documentforce.com/servlet/servlet.FileDownload?file='+id;
                    // window.location.href='https://ocsm--c.ap0.content.force.com/servlet/servlet.FileDownload?file='+id;
                }
            }
   
        
        // 20201225 liying end
       // 20201224 liying start 
        // 返回按钮根据传id返回上一级操作
        function test(){
        var queryVal=GetQueryValue('parentId');
         var url='https://ocsm--stagefull.my.salesforce.com/'+queryVal;
        // var url='https://ocsm.my.salesforce.com/'+queryVal;
         window.location.href=url;
    }
    // 20201224 liying end 
     //js取参
            //20201221 liying start
            function GetQueryValue(queryName) {
                  var query = decodeURI(window.location.search.substring(1));
                  var vars = query.split("&");
                 for (var i = 0; i < vars.length; i++) {
                     var pair = vars[i].split("=");
                     if (pair[0] == queryName) { return pair[1]; }
                 }
                 return null;
             }
             //20201221 liying end
    </script>
    <body>
        <div style="height: 40px;background-color:#0f218b;width: 100%; ">
            <h1 style="color: white;margin-left: 45%;font-size: 24px;">
               附件一览表
            </h1>
        </div>
        <table class="pure-table pure-table-horizontal" id="theTable_header" styleclass="list" style="width: 100%">
            <thead>
                <tr style="text-align: center;">
                    <th scope="col" style="width:60%; font-size: 13px;text-align: center;">
                        附件名称
                    </th>
                    <apex:variable rendered="{!IF(attachmentInfo.isShow,true,false)}" value="Society" var="Society">
                        <th scope="col" style="width: 40%;font-size: 13px;text-align: center;">
                            附件类型
                        </th>
                    </apex:variable>
                    <!--  <td scope="col" style="width: 40%;height: 30px;">
                        附件类型
                    </td> -->
                </tr>
            </thead>
        </table>
        <div id="tablediv" style="overflow:auto; width: 100%; height:100%;">
            <apex:datatable border="0" id="theTable_content" style="width:100%;border-bottom-width: 0px;  font-size:11px; border-spacing:0;" styleclass="list" value="{!attachmentInfo.attachMentList}" var="attach">
                <apex:column style="width: 60%;   height: 25px;text-align: center;font-size: 13px;
      border-left: 1px solid #cbcbcb;">
                    <!--  //javascript:void(0) 为了实现a标签跳转 -->
                    <a href="javascript:void(0);" onclick="openUrl('{!attach.Id}','{!attach.Name}')">
                        <apex:outputfield id="attachMentName" value="{!attach.Name}">
                        </apex:outputfield>
                    </a>
                </apex:column>
                <apex:column style="width:40%;   height: 25px;text-align: center; font-size: 13px; border-right: 1px solid #cbcbcb;">
                    <apex:variable rendered="{!IF(attachmentInfo.isShow,true,false)}" value="Society1" var="Society1">
                        <apex:outputtext value="{!attach.ContentType}">
                        </apex:outputtext>
                    </apex:variable>
                </apex:column>
            </apex:datatable>
        </div>
        <input id="left" onclick="test()" style="margin-left: 80%; margin-top: 100px;border-radius: 3px; /* 边框半径 */width: 50px; height: 30px;background: #1E90FF; /* 背景颜色 */ cursor: pointer; /* 鼠标移入按钮范围时出现手势 */
        outline: none; /* 不显示轮廓线 */font-family: Microsoft YaHei; /* 设置字体 */color: white; /* 字体颜色 */font-size: 14px; /* 字体大小 */border: 1px solid #1E90FF " type="button" value="返回"/>
    </body>
</apex:page>