Commit 827df551 by 宋祥

1.调整文件下载,改为直接通过链接下载

parent b3650156
...@@ -96,10 +96,13 @@ public class ServiceHGWD001C extends ServiceBase { ...@@ -96,10 +96,13 @@ public class ServiceHGWD001C extends ServiceBase {
*/ */
public EiInfo add(EiInfo inInfo) { public EiInfo add(EiInfo inInfo) {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo, EiConstant.resultBlock); HGWD001C fWd001C = MapUtils.toDaoEPBase(inInfo, EiConstant.resultBlock, HGWD001C.class);
String fileId = MapUtils.getString(queryMap, HGWD001.FIELD_FILE_ID);
// 写入下载记录 // 写入下载记录
this.saveData(inInfo, fileId); this.saveData(inInfo, fWd001C.getFileId());
// 构建文件HTTP地址
String url = Iplat4jUtils.buildDocUrl(fWd001C.getDocId());
AssertUtils.isEmpty(url, "文件地址异常,请联系管理人员!");
inInfo.set("url", url);
inInfo.setMsg("操作成功"); inInfo.setMsg("操作成功");
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败"); LogUtils.setDetailMsg(inInfo, e, "操作失败");
...@@ -120,7 +123,7 @@ public class ServiceHGWD001C extends ServiceBase { ...@@ -120,7 +123,7 @@ public class ServiceHGWD001C extends ServiceBase {
String fileName = MapUtils.getString(queryMap, HGWD001.FIELD_FILE_NAME); String fileName = MapUtils.getString(queryMap, HGWD001.FIELD_FILE_NAME);
String zipName = fileName + "_" + DateUtils.shortDateTime(); String zipName = fileName + "_" + DateUtils.shortDateTime();
List<String> docIds = ObjectUtils.listKey(inInfo, HGWD099.FIELD_DOC_ID); List<String> docIds = ObjectUtils.listKey(inInfo, HGWD099.FIELD_DOC_ID);
inInfo.set("downloadUrl", Iplat4jUtils.compressFile(docIds, zipName)); inInfo.set("url", Iplat4jUtils.compressFile(docIds, zipName));
// 写入下载记录 // 写入下载记录
this.saveData(inInfo, fileId); this.saveData(inInfo, fileId);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -481,14 +481,12 @@ $(function () { ...@@ -481,14 +481,12 @@ $(function () {
e.preventDefault(); e.preventDefault();
deleteFunc(); deleteFunc();
}, },
columns: [ columns: [{
{
field: "operator", field: "operator",
title: "操作", title: "操作",
readonly: true, readonly: true,
template: function (item) { template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' let template = "";
+ 'href="' + downloadHref(item.docId) + '">下载</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="changeFile(\'' + item.docId + '\',\''+item.bizId+'\')" target="_blank">变更</a>'; + 'onclick="changeFile(\'' + item.docId + '\',\''+item.bizId+'\')" target="_blank">变更</a>';
return template; return template;
...@@ -554,7 +552,7 @@ $(function () { ...@@ -554,7 +552,7 @@ $(function () {
//确认发布 //确认发布
$("#confirmRelease").on("click", updateRelease); $("#confirmRelease").on("click", updateRelease);
// 批量下载 // 批量下载
$("#BATCH_DOWNLOAD").on("click", batchDownload); $("#BATCH_DOWNLOAD").on("click", download);
}); });
let query = function () { let query = function () {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<c:set var="ctx" value="${pageContext.request.contextPath}"/> <c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=userId%>" /> <c:set var="loginName" value="<%=userId%>" />
<script type="text/javascript" src="${ctx}/common/js/dayjs.min.js"></script> <script type="text/javascript" src="${ctx}/common/js/dayjs.min.js"></script>
<script src="${ctx}/HG/WD/HGWD001C1.js"></script>
<EF:EFPage title="文档库"> <EF:EFPage title="文档库">
......
...@@ -26,7 +26,7 @@ let singleDownload = function (row) { ...@@ -26,7 +26,7 @@ let singleDownload = function (row) {
EiCommunicator.send("HGWD001C", "add", inInfo, { EiCommunicator.send("HGWD001C", "add", inInfo, {
onSuccess(res) { onSuccess(res) {
if (res.status > -1) { if (res.status > -1) {
window.open(CommonUtils.downloadFile(row['docId'], false), '_blank'); window.open(res.extAttr.url, '_blank');
} else { } else {
message(res.msg); message(res.msg);
} }
...@@ -44,7 +44,7 @@ let batchDownload = function () { ...@@ -44,7 +44,7 @@ let batchDownload = function () {
JSUtils.submitGridsData("result", "HGWD001C", "batchDownload", false, JSUtils.submitGridsData("result", "HGWD001C", "batchDownload", false,
function (res) { function (res) {
if (res.status > -1) { if (res.status > -1) {
window.open(res.extAttr.downloadUrl, '_blank'); window.open(res.extAttr.url, '_blank');
} }
} }
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment