liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<apex:page action="{!init}" id="Page"  controller="QLMAttachmentPreviewController" showheader="false" sidebar="false" lightningStylesheets="true">
 
    <!-- 文件列表 点击行项目 预览图片 非图片格式点击下载  -->
    <apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/>
    <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="{!URLFOR($Resource.connection20)}"/>
    <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
    <title>
        附件一览表
    </title>
    <!-- 表格整体样式 -->
    <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>
 
    <script language="javascript" type="text/javascript">
        //判断附件名称后缀名
        function openUrl(id,name,contentdocumentId){
            var htmlArr=['html'];
            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'];
            //定义后缀名 suffix
            var suffix=name.substring(name.lastIndexOf('.')+1);
            // alert(suffix);
            // alert(wordArr.indexOf(suffix)>-1);
            if(picArr.indexOf(suffix)>-1){
                if((!!window.ActiveXObject || "ActiveXObject" in window)&&(suffix=='bmp'||suffix=='BMP')) {
                    alert("IE浏览器不能打开后缀是bmp的文件,请使用其他浏览器!");
                }else{
                    // 20240221 ssm 阿里云落地,高超总需求,不在当前页面打开 start
                    // window.location.href=' {!baseUrl}' + '/TenderAttachment?id='+id;
                    window.open(' {!baseUrl}' + '/apex/TenderAttachment?id='+id, '_blank');
                    // window.location.href=' https://ocsm--c.ap0.visual.force.com/apex/TenderAttachment?id='+id;
                    // 20240221 ssm 阿里云落地,高超总需求,不在当前页面打开 end
                } 
            }else if(htmlArr.indexOf(suffix)>-1){
                // 20240221 ssm 阿里云落地,高超总需求,不在当前页面打开 start
                // window.location.href=' {!baseUrl}' + '/apex/QLMAttachmentPreview1?id='+id;
                window.open(' {!baseUrl}' + '/apex/QLMAttachmentPreview1?id='+id, '_blank');
                // window.location.href=' https://ocsm--c.ap0.visual.force.com/apex/QLMAttachmentPreview1?id='+id;
                // 20240221 ssm 阿里云落地,高超总需求,不在当前页面打开 end
            }else if(picArr.indexOf(suffix)<=-1){
                // window.location.href='https://ocsm--stagefull--c.documentforce.com/servlet/servlet.FileDownload?file='+id;
                // window.location.href=' {!baseUrl}' + '/servlet/servlet.FileDownload?file='+id;
                // window.open('{!baseUrl}' + '/sfc/servlet.shepherd/version/download/'+id, '_blank');
                // window.open('{!baseUrl}' + '/sfc/servlet.shepherd/version/renditionDownload?rendition=SVGZ&versionId='+id+'&operationContext=CHATTER', '_blank');
                window.open('{!baseUrl}' + '/lightning/r/ContentDocument\/'+contentdocumentId+'/view', '_blank');
            }
        }
        // function openUrl1(id){
        //     var htmlArr=['html'];
        //     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'];
        //     //定义后缀名 suffix
        //     var suffix=name.substring(name.lastIndexOf('.')+1);
        //     if(picArr.indexOf(suffix)<=-1){
        //         window.location.href=''+id;
        //         // window.location.href='https://ocsm--c.ap0.content.force.com/servlet/servlet.FileDownload?file='+id;
        //     }
        // }
        
    // 返回按钮根据传id返回上一级操作
        function test(){
        var queryVal=GetQueryValue('parentId');
        // var url='https://ocsm--partial--c.sandbox.vf.force.com/'+queryVal;
 
        // 阿里云迁移 by DTT-亚楠 20240107 start 
        // var url='https://ocsm.my.salesforce.com/'+queryVal;
        var url=' {!baseUrl}/' + queryVal; 
        // 阿里云迁移 by DTT-亚楠 20240107 end  
        window.location.href=url;
        }
 
        //js取参
        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;
        }
 
        function ClearJson(str) {
            if (str != null && str != "") {
                return str.replace(/(\t|\r|\n|\s|\b|\f|\"|\u)/ig, "").replace(/(\\)/ig, "");
            }
 
            return "";
        }
        // function stripscript(s){
        //     var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
        //     var rs = "";
        //     for (var i = 0; i < s.length; i++) {
        //     rs = rs+s.substr(i, 1).replace(pattern, '');
        //     }
        //     return rs;
        // }
    </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;"> -->
                    <!-- 阿里云迁移 by DTT-亚楠 20240107 60——>45 -->
                    <!-- <th scope="col" style="width:45%; font-size: 13px;text-align: center;">
                        附件名称
                    </th> -->
 
                    <!-- 阿里云迁移 by DTT-亚楠 20240107 start -->
                    <!-- <th scope="col" style="width:10%; font-size: 13px;text-align: center;">
                        信息ID
                    </th>
                    <th scope="col" style="width:10%; font-size: 13px;text-align: center;">
                        项目阶段
                    </th>
                    <th scope="col" style="width:20%; font-size: 13px;text-align: center;">
                        阶段补充说明
                    </th>
                    <th scope="col" style="width:10%; font-size: 13px;text-align: center;">
                        更新日期
                    </th>                     -->                    
                    <!-- 阿里云迁移 by DTT-亚楠 20240107 end -->
 
                    <!-- <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%;">
            <!-- 阿里云迁移 by DTT-亚楠 20240107 attachMentList ——> contentVerResList -->
            <apex:datatable border="0" id="theTable_content" style="width:100%;border-bottom-width: 0px;  font-size:11px; border-spacing:0;" styleclass="list" value="{!attachmentInfo.contentVerResList}" var="attach">  
                <!-- 阿里云迁移 by DTT-亚楠 20240107 60——>50 -->
                <apex:column style="width: 30%; word-wrap: break-word; max-width:40%; height: 25px;text-align: center;font-size: 13px;
      border-left: 1px solid #cbcbcb;">
                    <apex:facet name="header">
                        <div style="text-align: center;font-size: 13px;">附件名称</div>
                    </apex:facet>
                    <!--  //javascript:void(0) 为了实现a标签跳转 -->
                    <a href="javascript:void(0);" onclick="openUrl('{!attach.Id}','{!attach.Title}','{!attach.contDocumentId}')">
                        <!-- 阿里云迁移 by DTT-亚楠 20240107 outputField ——> outputText -->
                        <apex:outputText id="attachMentName" value="{!attach.Title}">
                        </apex:outputText>
                    </a>
                    <!-- onclick="ClearJson('{!attach.Name}')" -->
                </apex:column>
                
                <!-- 阿里云迁移 by DTT-亚楠 20240107 start -->
                <apex:column style="width: 10%; height: 25px;text-align: center;font-size: 13px; border-left: 1px solid #cbcbcb;">
                    <apex:facet name="header">
                        <div style="text-align: center;font-size: 13px;">信息ID</div>
                    </apex:facet>
                    <apex:outputText id="infoId" value="{!attach.infoId}">
                    </apex:outputText></apex:column>
                <apex:column style="width: 10%;   height: 25px;text-align: center;font-size: 13px; border-left: 1px solid #cbcbcb;">
                    <apex:facet name="header">
                        <div style="text-align: center;font-size: 13px;">项目阶段</div>
                    </apex:facet>
                    <apex:outputText id="infoType" value="{!attach.infoType}">
                    </apex:outputText></apex:column>
                <apex:column style="width: 20%;   height: 25px;text-align: center;font-size: 13px; border-left: 1px solid #cbcbcb;">
                    <apex:facet name="header">
                        <div style="text-align: center;font-size: 13px;">阶段补充说明</div>
                    </apex:facet>
                    <apex:outputText id="subInfoType" value="{!attach.subInfoType}">
                    </apex:outputText></apex:column>
                <apex:column style="width: 10%;   height: 25px;text-align: center;font-size: 13px; border-left: 1px solid #cbcbcb;">
                    <apex:facet name="header">
                        <div style="text-align: center;font-size: 13px;">更新时间</div>
                    </apex:facet>
                    <apex:outputText id="updateDate" value="{0,date,yyyy.MM.dd}">
                        <apex:param value="{!attach.updateDate}" />
                    </apex:outputText></apex:column>
                <!-- 阿里云迁移 by DTT-亚楠 20240107 end -->
                <!-- <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>
            <apex:outputPanel layout="none" rendered="{!(Over12MInfoList.size>0)}">
            <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;">  
                            超过12M附件名称
                        </th>
                    </tr>
                </thead>
            </table>
        </apex:outputPanel>
            <!-- alert("{!Over12MInfoList}"); -->
            <apex:datatable border="0" id="theTable_content1" style="width:100%;border-bottom-width: 0px;  font-size:11px; border-spacing:0;" styleclass="list" value="{!Over12MInfoList}" var="Over12Mattach">
            <!-- alert("{!Over12MInfoList}"); -->
                <apex:column style="width: 60%;   height: 25px;text-align: center;font-size: 13px;
      border-left: 1px solid #cbcbcb;">
                    <!--  //javascript:void(0) 为了实现a标签跳转 -->
                    <a href="{!Over12Mattach.url}" target="blank">
                        {!Over12Mattach.Name}
                    </a>
                </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>