cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
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
<#ftl >
    <#macro multipleUpload fileList=[]  urlName='url' fileName='file_name' inputFileName="infoFile" maxUploadCount="5">
        <#if fileList?size!=0>
            <#list fileList as file>
                <div style='cursor:pointer;'>
                    ${file[fileName]}  <a href="${base}/download.html?path=${file[urlName]}&fileName=${file[fileName]}">下载</a>
                </div>
            </#list>
        <#else>
            <div id="files">
                <input type="file" name="infoFile"/>
                <img title="添加" id="addfile" onclick="addAttchment()" src="${common_static}/static/images/jia1.png"
                     style="cursor: pointer; margin: 0px; padding: 0px;"/>
                &nbsp;<font color="red">文件大小限制在100M以内</font> <br/>
            </div>
        </#if>
        <script type="text/javascript">
            function addAttchment() {
                var files = $("#files");
                var context = "<div  style=\"cursor:pointer;\"><input  type=\"file\"  class='uploadFileLength' name=\"${inputFileName}\">&nbsp;<span name=\"deletefile\"><img title=\"删除\" src=\"${common_static}/static/images/jian1.png\" style=\" cursor:pointer ;margin: 0px;padding:0px;\"></span></div>";
                if ($("span[name='deletefile']").length === ${maxUploadCount}-1) {
                    alert('提示:附件最多能添加${maxUploadCount}个!');
                } else {
                    files.append(context);
                }
                $("span[name='deletefile']").live("click", function () {
                    $(this).parent("div").remove();
                });
            }
        </script>
    </#macro>