|
@@ -670,7 +670,7 @@
|
|
|
<th width="11%">注册日期</th>
|
|
|
<th width="11%"><span class="require-item">*</span>发证日期</th>
|
|
|
<th width="10%">发证机关</th>
|
|
|
- <th width="10%">文件<span style="color: #FF8C69; font-size: 10px; font-weight: normal; margin-left: 5px;">(图片)</span></th>
|
|
|
+ <th width="10%">文件</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody id="certificateList">
|
|
@@ -691,46 +691,68 @@
|
|
|
<td>
|
|
|
${certificate.issuingAuthority}
|
|
|
</td>
|
|
|
- <td >
|
|
|
+ <td class="text-left op-td">
|
|
|
<c:if test="${not empty certificate.filePathStr}">
|
|
|
- <%-- 安全处理URL中的 & --%>
|
|
|
+ <%-- 1. 安全处理URL中的 & --%>
|
|
|
<c:set var="safeFilePath" value="${fn:replace(certificate.filePathStr, '&', '&')}" />
|
|
|
|
|
|
- <%-- 先从 certificate.fileName 里提取扩展名 --%>
|
|
|
- <c:set var="fileNameArr" value="${fn:split(certificate.fileName, '.')}" />
|
|
|
- <c:set var="fileExt" value="${fn:toLowerCase(fileNameArr[fn:length(fileNameArr) - 1])}" />
|
|
|
-
|
|
|
- <%-- 如果没有后缀,尝试从 filePathStr 里提取 --%>
|
|
|
+ <%-- 2. 提取文件名 --%>
|
|
|
<c:choose>
|
|
|
- <c:when test="${fn:contains(certificate.fileName, '.')}">
|
|
|
- <%-- 已经有后缀 --%>
|
|
|
- <c:set var="downloadFileName" value="${certificate.fileName}" />
|
|
|
+ <c:when test="${not empty certificate.fileName}">
|
|
|
+ <c:set var="fileName" value="${certificate.fileName}" />
|
|
|
</c:when>
|
|
|
<c:otherwise>
|
|
|
- <%-- 从路径最后部分提取后缀 --%>
|
|
|
- <c:set var="pathParts" value="${fn:split(certificate.filePathStr, '/')}"/>
|
|
|
- <c:set var="lastPart" value="${pathParts[fn:length(pathParts) - 1]}" />
|
|
|
- <c:set var="lastPartArr" value="${fn:split(lastPart, '.')}" />
|
|
|
- <c:set var="pathExt" value="${fn:toLowerCase(lastPartArr[fn:length(lastPartArr) - 1])}" />
|
|
|
- <c:set var="downloadFileName" value="${certificate.fileName}.${pathExt}" />
|
|
|
+ <c:set var="fileNameArr" value="${fn:split(certificate.filePathStr, '/')}" />
|
|
|
+ <c:set var="fileName" value="${fileNameArr[fn:length(fileNameArr) - 1]}" />
|
|
|
</c:otherwise>
|
|
|
</c:choose>
|
|
|
|
|
|
- <%-- 显示图片缩略图 --%>
|
|
|
- <img src="${safeFilePath}" width="24" height="24"
|
|
|
- style="cursor:pointer; vertical-align:middle;"
|
|
|
- onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${safeFilePath}','90%','90%')"
|
|
|
- alt="文件预览" title="点击预览" />
|
|
|
+ <%-- 3. 提取文件扩展名(后缀)--%>
|
|
|
+ <c:set var="extArr" value="${fn:split(fileName, '.')}" />
|
|
|
+ <c:set var="ext" value="${fn:toLowerCase(extArr[fn:length(extArr) - 1])}" />
|
|
|
|
|
|
- <%-- 下载按钮 --%>
|
|
|
+ <%-- 4. 判断并显示文件内容(图片预览 / 链接预览) --%>
|
|
|
+ <c:choose>
|
|
|
+ <%-- ✅ 图片预览格式 --%>
|
|
|
+ <c:when test="${ext == 'jpg' || ext == 'jpeg' || ext == 'png' || ext == 'gif' || ext == 'bmp' || ext == 'webp'}">
|
|
|
+ <img src="${safeFilePath}" width="24" height="24"
|
|
|
+ style="cursor:pointer; vertical-align:middle;"
|
|
|
+ onclick="preview('预览','${safeFilePath}','90%','90%','1')"
|
|
|
+ alt="图片预览" title="点击预览图片" />
|
|
|
+ </c:when>
|
|
|
+
|
|
|
+ <%-- ✅ 非图片文件,按类型显示文件名并支持预览 --%>
|
|
|
+ <c:otherwise>
|
|
|
+ <c:choose>
|
|
|
+ <%-- PDF 特殊处理(可用 iframe 预览) --%>
|
|
|
+ <c:when test="${ext == 'pdf'}">
|
|
|
+ <a class="attention-info" href="javascript:void(0)"
|
|
|
+ style="color: #007bff;"
|
|
|
+ onclick="preview('预览','${safeFilePath}','90%','90%','1')">
|
|
|
+ ${fileName}
|
|
|
+ </a>
|
|
|
+ </c:when>
|
|
|
+
|
|
|
+ <%-- 其他文件格式 --%>
|
|
|
+ <c:otherwise>
|
|
|
+ <a class="attention-info" href="javascript:void(0)"
|
|
|
+ style="color: #007bff;"
|
|
|
+ onclick="preview('预览','${safeFilePath}','90%','90%')">
|
|
|
+ ${fileName}
|
|
|
+ </a>
|
|
|
+ </c:otherwise>
|
|
|
+ </c:choose>
|
|
|
+ </c:otherwise>
|
|
|
+ </c:choose>
|
|
|
+
|
|
|
+ <%-- 5. 下载按钮 --%>
|
|
|
<a href="javascript:void(0);"
|
|
|
- title="下载文件"
|
|
|
+ title="下载 ${fileName}"
|
|
|
style="color: #28a745; margin-left: 5px; text-decoration: none;"
|
|
|
- onclick="downloadFile('${ctx}', '${certificate.filePath}', '${downloadFileName}')">
|
|
|
+ onclick="downloadFile('${ctx}', '${certificate.filePath}', '${fileName}')">
|
|
|
<i class="fa fa-download"></i>
|
|
|
</a>
|
|
|
</c:if>
|
|
|
-
|
|
|
</td>
|
|
|
</tr>
|
|
|
</c:forEach>
|
|
@@ -749,7 +771,7 @@
|
|
|
<th width="15%"><span class="require-item">*</span>取得日期</th>
|
|
|
<th width="15%"><span class="require-item">*</span>取得途径</th>
|
|
|
<th width="20%"><span class="require-item">*</span>审批单位</th>
|
|
|
- <th width="15%">文件<span style="color: #FF8C69; font-size: 10px; font-weight: normal; margin-left: 5px;">(图片)</span></th>
|
|
|
+ <th width="15%">文件</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody id="titleList">
|
|
@@ -770,42 +792,65 @@
|
|
|
<td>
|
|
|
${title.approvalAuthority}
|
|
|
</td>
|
|
|
- <td>
|
|
|
+ <td class="text-left op-td">
|
|
|
<c:if test="${not empty title.filePathStr}">
|
|
|
- <%-- 安全处理URL中的 & --%>
|
|
|
+ <%-- 1. 安全处理URL中的 & --%>
|
|
|
<c:set var="safeFilePath" value="${fn:replace(title.filePathStr, '&', '&')}" />
|
|
|
|
|
|
- <%-- 先从 title.fileName 里提取扩展名 --%>
|
|
|
- <c:set var="fileNameArr" value="${fn:split(title.fileName, '.')}" />
|
|
|
- <c:set var="fileExt" value="${fn:toLowerCase(fileNameArr[fn:length(fileNameArr) - 1])}" />
|
|
|
-
|
|
|
- <%-- 如果没有后缀,尝试从 filePathStr 里提取 --%>
|
|
|
+ <%-- 2. 提取文件名 --%>
|
|
|
<c:choose>
|
|
|
- <c:when test="${fn:contains(title.fileName, '.')}">
|
|
|
- <%-- 已经有后缀 --%>
|
|
|
- <c:set var="downloadFileName" value="${title.fileName}" />
|
|
|
+ <c:when test="${not empty title.fileName}">
|
|
|
+ <c:set var="fileName" value="${title.fileName}" />
|
|
|
</c:when>
|
|
|
<c:otherwise>
|
|
|
- <%-- 从路径最后部分提取后缀 --%>
|
|
|
- <c:set var="pathParts" value="${fn:split(title.filePathStr, '/')}"/>
|
|
|
- <c:set var="lastPart" value="${pathParts[fn:length(pathParts) - 1]}" />
|
|
|
- <c:set var="lastPartArr" value="${fn:split(lastPart, '.')}" />
|
|
|
- <c:set var="pathExt" value="${fn:toLowerCase(lastPartArr[fn:length(lastPartArr) - 1])}" />
|
|
|
- <c:set var="downloadFileName" value="${title.fileName}.${pathExt}" />
|
|
|
+ <c:set var="fileNameArr" value="${fn:split(title.filePathStr, '/')}" />
|
|
|
+ <c:set var="fileName" value="${fileNameArr[fn:length(fileNameArr) - 1]}" />
|
|
|
</c:otherwise>
|
|
|
</c:choose>
|
|
|
|
|
|
- <%-- 显示图片缩略图 --%>
|
|
|
- <img src="${safeFilePath}" width="24" height="24"
|
|
|
- style="cursor:pointer; vertical-align:middle;"
|
|
|
- onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${safeFilePath}','90%','90%')"
|
|
|
- alt="文件预览" title="点击预览" />
|
|
|
+ <%-- 3. 提取文件扩展名(后缀)--%>
|
|
|
+ <c:set var="extArr" value="${fn:split(fileName, '.')}" />
|
|
|
+ <c:set var="ext" value="${fn:toLowerCase(extArr[fn:length(extArr) - 1])}" />
|
|
|
|
|
|
- <%-- 下载按钮 --%>
|
|
|
+ <%-- 4. 判断并显示文件内容(图片预览 / 链接预览) --%>
|
|
|
+ <c:choose>
|
|
|
+ <%-- ✅ 图片预览格式 --%>
|
|
|
+ <c:when test="${ext == 'jpg' || ext == 'jpeg' || ext == 'png' || ext == 'gif' || ext == 'bmp' || ext == 'webp'}">
|
|
|
+ <img src="${safeFilePath}" width="24" height="24"
|
|
|
+ style="cursor:pointer; vertical-align:middle;"
|
|
|
+ onclick="preview('预览','${safeFilePath}','90%','90%','1')"
|
|
|
+ alt="图片预览" title="点击预览图片" />
|
|
|
+ </c:when>
|
|
|
+
|
|
|
+ <%-- ✅ 非图片文件,按类型显示文件名并支持预览 --%>
|
|
|
+ <c:otherwise>
|
|
|
+ <c:choose>
|
|
|
+ <%-- PDF 特殊处理(可用 iframe 预览) --%>
|
|
|
+ <c:when test="${ext == 'pdf'}">
|
|
|
+ <a class="attention-info" href="javascript:void(0)"
|
|
|
+ style="color: #007bff;"
|
|
|
+ onclick="preview('预览','${safeFilePath}','90%','90%','1')">
|
|
|
+ ${fileName}
|
|
|
+ </a>
|
|
|
+ </c:when>
|
|
|
+
|
|
|
+ <%-- 其他文件格式 --%>
|
|
|
+ <c:otherwise>
|
|
|
+ <a class="attention-info" href="javascript:void(0)"
|
|
|
+ style="color: #007bff;"
|
|
|
+ onclick="preview('预览','${safeFilePath}','90%','90%')">
|
|
|
+ ${fileName}
|
|
|
+ </a>
|
|
|
+ </c:otherwise>
|
|
|
+ </c:choose>
|
|
|
+ </c:otherwise>
|
|
|
+ </c:choose>
|
|
|
+
|
|
|
+ <%-- 5. 下载按钮 --%>
|
|
|
<a href="javascript:void(0);"
|
|
|
- title="下载文件"
|
|
|
+ title="下载 ${fileName}"
|
|
|
style="color: #28a745; margin-left: 5px; text-decoration: none;"
|
|
|
- onclick="downloadFile('${ctx}', '${title.filePath}', '${downloadFileName}')">
|
|
|
+ onclick="downloadFile('${ctx}', '${title.filePath}', '${fileName}')">
|
|
|
<i class="fa fa-download"></i>
|
|
|
</a>
|
|
|
</c:if>
|