Commit 171fa8d1 by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-ly

parents 7361fe07 e8ed80a2
...@@ -179,24 +179,23 @@ public class DaoUtils { ...@@ -179,24 +179,23 @@ public class DaoUtils {
log.warn("写入创建人姓名失败", e); log.warn("写入创建人姓名失败", e);
} }
// 创建人企业编码 // 创建人企业编码
try { String accountCode = UserSessionUtils.getAccountCode();
String accountCode = BeanUtils.getProperty(bean, "accountCode"); if (!"admin".equals(userId)) {
if (StringUtils.isBlank(accountCode)) {
accountCode = UserSessionUtils.getAccountCode();
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!"); AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
} }
try {
BeanUtils.setProperty(bean, "accountCode", accountCode); BeanUtils.setProperty(bean, "accountCode", accountCode);
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人企业编码失败", e); log.warn("写入创建人企业编码失败", e);
} }
// 创建人组织机构 // 创建人组织机构
try {
String depCode = BeanUtils.getProperty(bean, "depCode");
if (StringUtils.isBlank(depCode) && !"admin".equals(userId)) {
List<String> orgIds = UserSessionUtils.getOrgId(); List<String> orgIds = UserSessionUtils.getOrgId();
if (!"admin".equals(userId)) {
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!"); AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
depCode = orgIds.get(0);
} }
try {
// 此处应该不支持自定义部门,否则写入的部门信息不准确
String depCode = CollectionUtils.isEmpty(orgIds) ? "" : orgIds.get(0);
BeanUtils.setProperty(bean, "depCode", depCode); BeanUtils.setProperty(bean, "depCode", depCode);
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人部门编码失败", e); log.warn("写入创建人部门编码失败", e);
...@@ -247,24 +246,22 @@ public class DaoUtils { ...@@ -247,24 +246,22 @@ public class DaoUtils {
map.put("createdName", userName); map.put("createdName", userName);
map.put("updatedName", ""); map.put("updatedName", "");
// 创建人企业编码 // 创建人企业编码
try { String accountCode = UserSessionUtils.getAccountCode();
String accountCode = MapUtils.getString(map, "accountCode"); if (!"admin".equals(userId)) {
if (ObjectUtils.isNullBlank(accountCode)) {
accountCode = UserSessionUtils.getAccountCode();
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!"); AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
} }
try {
map.put("accountCode", accountCode); map.put("accountCode", accountCode);
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人企业编码失败", e); log.warn("写入创建人企业编码失败", e);
} }
// 创建人部门编码 // 创建人部门编码
try {
String depCode = MapUtils.getString(map, "depCode");
if (ObjectUtils.isNullBlank(depCode) && !"admin".equals(userId)) {
List<String> orgIds = UserSessionUtils.getOrgId(); List<String> orgIds = UserSessionUtils.getOrgId();
if (!"admin".equals(userId)) {
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!"); AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
depCode = orgIds.get(0);
} }
try {
String depCode = CollectionUtils.isEmpty(orgIds) ? "" : orgIds.get(0);
map.put("depCode", depCode); map.put("depCode", depCode);
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人企业编码失败", e); log.warn("写入创建人企业编码失败", e);
......
package com.baosight.hggp.hg.sc.service; package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi; import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi;
import com.baosight.hggp.core.extapp.decheng.model.DcContract; import com.baosight.hggp.core.extapp.decheng.model.DcContract;
...@@ -207,7 +208,11 @@ public class ServiceHGSC101 extends ServiceEPBase { ...@@ -207,7 +208,11 @@ public class ServiceHGSC101 extends ServiceEPBase {
// 设计来源 // 设计来源
dbSc001.setProjectSource(getProjectSource(dcContract.getDesignSource())); dbSc001.setProjectSource(getProjectSource(dcContract.getDesignSource()));
dbSc001.setContractNo(dcContract.getHtid()); dbSc001.setContractNo(dcContract.getHtid());
DaoUtils.insert(HGSC001.INSERT, dbSc001); dbSc001.setRecCreator("System");
dbSc001.setRecCreateTime(DateUtils.shortDateTime());
dbSc001.setRecRevisor("System");
dbSc001.setRecReviseTime(DateUtils.shortDateTime());
DaoBase.getInstance().insert(HGSC001.INSERT, dbSc001);
} }
/** /**
......
...@@ -5,6 +5,7 @@ import com.baosight.hggp.common.ChangeTypeEnum; ...@@ -5,6 +5,7 @@ import com.baosight.hggp.common.ChangeTypeEnum;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.enums.OrgTypeEnum; import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.core.tools.FileTools; import com.baosight.hggp.core.tools.FileTools;
...@@ -16,6 +17,7 @@ import com.baosight.hggp.hg.wd.constant.HgWdConstant; ...@@ -16,6 +17,7 @@ import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant; import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001; import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001A; import com.baosight.hggp.hg.wd.domain.HGWD001A;
import com.baosight.hggp.hg.wd.domain.HGWD001C;
import com.baosight.hggp.hg.wd.domain.HGWD003; import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.domain.HGWD099; import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.hg.wd.tools.HGWDTools; import com.baosight.hggp.hg.wd.tools.HGWDTools;
...@@ -586,38 +588,4 @@ public class ServiceHGWD001 extends ServiceEPBase { ...@@ -586,38 +588,4 @@ public class ServiceHGWD001 extends ServiceEPBase {
return inInfo; return inInfo;
} }
/**
* 批量下载
*
* @param inInfo
* @return
*/
public EiInfo batchDownload(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String fileName = MapUtils.getString(queryMap, HGWD001.FIELD_FILE_NAME);
String zipName = fileName + "_" + DateUtils.shortDateTime();
List<String> docIds = ObjectUtils.listKey(inInfo, HGWD099.FIELD_DOC_ID);
inInfo.set("downloadUrl", Iplat4jUtils.compressFile(docIds, zipName));
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "批量下载失败");
}
return inInfo;
}
/**
* 清理下载的文件
*
* @param inInfo
* @return
*/
public EiInfo clearDownload(EiInfo inInfo) {
try {
FileTools.clearZip();
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "清理下载的文件失败");
}
return inInfo;
}
} }
...@@ -3,14 +3,20 @@ package com.baosight.hggp.hg.wd.service; ...@@ -3,14 +3,20 @@ package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum; import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.tools.FileTools;
import com.baosight.hggp.core.utils.Iplat4jUtils;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001C; import com.baosight.hggp.hg.wd.domain.HGWD001C;
import com.baosight.hggp.hg.wd.domain.HGWD002; import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.hg.wd.tools.HGWDTools; import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils; import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils; import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -91,6 +97,42 @@ public class ServiceHGWD001C extends ServiceBase { ...@@ -91,6 +97,42 @@ public class ServiceHGWD001C extends ServiceBase {
*/ */
public EiInfo add(EiInfo inInfo) { public EiInfo add(EiInfo inInfo) {
try { try {
// 写入下载记录
this.saveData(inInfo);
inInfo.setMsg("操作成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
/**
* 批量下载
*
* @param inInfo
* @return
*/
public EiInfo batchDownload(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String fileName = MapUtils.getString(queryMap, HGWD001.FIELD_FILE_NAME);
String zipName = fileName + "_" + DateUtils.shortDateTime();
List<String> docIds = ObjectUtils.listKey(inInfo, HGWD099.FIELD_DOC_ID);
inInfo.set("downloadUrl", Iplat4jUtils.compressFile(docIds, zipName));
// 写入下载记录
this.saveData(inInfo);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "批量下载失败");
}
return inInfo;
}
/**
* 保存数据
*
* @param inInfo
*/
private void saveData(EiInfo inInfo) {
List<HGWD001C> fWd001cs = MapUtils.toDaoEPBases(inInfo, HGWD001C.class); List<HGWD001C> fWd001cs = MapUtils.toDaoEPBases(inInfo, HGWD001C.class);
for (HGWD001C fWd001c : fWd001cs) { for (HGWD001C fWd001c : fWd001cs) {
AssertUtils.isEmpty(fWd001c.getFileId(), "文件ID不能为空"); AssertUtils.isEmpty(fWd001c.getFileId(), "文件ID不能为空");
...@@ -100,10 +142,19 @@ public class ServiceHGWD001C extends ServiceBase { ...@@ -100,10 +142,19 @@ public class ServiceHGWD001C extends ServiceBase {
fWd001c.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); fWd001c.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGWD001C.INSERT, fWd001c); DaoUtils.insert(HGWD001C.INSERT, fWd001c);
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); }
inInfo.setMsg("操作成功");
/**
* 清理下载的文件
*
* @param inInfo
* @return
*/
public EiInfo clearDownload(EiInfo inInfo) {
try {
FileTools.clearZip();
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败"); LogUtils.setMsg(inInfo, e, "清理下载的文件失败");
} }
return inInfo; return inInfo;
} }
......
package com.baosight.hggp.hg.wd.service; package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum; import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi; import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi;
...@@ -16,6 +17,7 @@ import com.baosight.hggp.hg.sc.tools.HGSCTools; ...@@ -16,6 +17,7 @@ import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.wd.domain.HGWD005; import com.baosight.hggp.hg.wd.domain.HGWD005;
import com.baosight.hggp.hg.wd.tools.HGWDTools; import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils; import com.baosight.hggp.util.MapUtils;
...@@ -143,7 +145,11 @@ public class ServiceHGWD005 extends ServiceEPBase { ...@@ -143,7 +145,11 @@ public class ServiceHGWD005 extends ServiceEPBase {
dbWd005.setUnit(dcProductList.getUnit()); dbWd005.setUnit(dcProductList.getUnit());
dbWd005.setClassify(dcProductList.getFenlei()); dbWd005.setClassify(dcProductList.getFenlei());
dbWd005.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); dbWd005.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGWD005.INSERT, dbWd005); dbWd005.setRecCreator("System");
dbWd005.setRecCreateTime(DateUtils.shortDateTime());
dbWd005.setRecRevisor("System");
dbWd005.setRecReviseTime(DateUtils.shortDateTime());
DaoBase.getInstance().insert(HGWD005.INSERT, dbWd005);
} else { } else {
Map updateMap = new HashMap(); Map updateMap = new HashMap();
updateMap.put(HGWD005.FIELD_ID, dbWd005.getId()); updateMap.put(HGWD005.FIELD_ID, dbWd005.getId());
......
...@@ -6,21 +6,23 @@ $(function () { ...@@ -6,21 +6,23 @@ $(function () {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
}); });
IPLATUI.EFGrid.result = { IPLATUI.EFGrid.result = {
pageable: { pageable: {
pageSize: 20, pageSize: 20,
pageSizes: [10, 20, 50, 70, 100], pageSizes: [10, 20, 50, 70, 100],
}, },
columns: [ columns: [{
{
field: "operator", field: "operator",
template: function (item) { template: function (item) {
let params = "'" + item.companyCode + "', '" + item.companyName + "', '"
+ item.id + "', '" + item.contractCode + "'";
let template = ''; let template = '';
if (item.companyCode) { if (item.companyCode) {
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="showFunc(\'' + item.companyCode + '\',\'' + item.companyName + '\',\'' + item.id + '\',\'' + item.contractCode + '\')" >详情</a>'; + 'onclick="showFunc(' + params + ')" >详情</a>';
} }
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDoc(' + params + ')" >附件</a>';
return template; return template;
} }
}, { }, {
...@@ -31,8 +33,7 @@ $(function () { ...@@ -31,8 +33,7 @@ $(function () {
defaultValue: function () { defaultValue: function () {
return currShortDate(); return currShortDate();
} }
}, }],
],
beforeEdit: function (e) { beforeEdit: function (e) {
let item = e.model; let item = e.model;
if(item.subStatus == '1'){ if(item.subStatus == '1'){
...@@ -177,4 +178,27 @@ function updateStatus() { ...@@ -177,4 +178,27 @@ function updateStatus() {
} }
} }
/**
* 展示附件
*
* @param contractCode
* @param companyName
* @param parentId
* @param contractCode
*/
let showDoc = function (companyCode, companyName, parentId, contractCode){
let params = {
"inqu_status-0-companyCode": companyCode,
"inqu_status-0-companyName": companyName,
"inqu_status-0-parentId": parentId,
"inqu_status-0-contractCode": contractCode
}
JSColorbox.open({
href: "HGWD002",
title: "<div style='text-align: center;'>文档管理</div>",
width: "100%",
height: "100%",
params: params
});
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/29
Time: 15:49
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html> <!DOCTYPE html>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %> <%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
......
...@@ -1066,7 +1066,7 @@ let batchDownload = function () { ...@@ -1066,7 +1066,7 @@ let batchDownload = function () {
message("请先勾选要下载的数据!"); message("请先勾选要下载的数据!");
return; return;
} }
JSUtils.submitGridsData("result", "HGWD001", "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.downloadUrl, '_blank');
......
...@@ -31,7 +31,7 @@ $(function () { ...@@ -31,7 +31,7 @@ $(function () {
if (document.getElementById("splitter").getElementsByClassName("k-splitbar").length !== 1) { if (document.getElementById("splitter").getElementsByClassName("k-splitbar").length !== 1) {
$("#splitter").kendoSplitter({ $("#splitter").kendoSplitter({
panes: [ panes: [
{size: "30%", min: "25%", max: "75%", collapsible: true}, {size: "25%", min: "20%", max: "80%", collapsible: true},
{}, {},
{collapsible: true} {collapsible: true}
] ]
...@@ -251,40 +251,6 @@ let showDownloadRecord = function (fileId, docId) { ...@@ -251,40 +251,6 @@ let showDownloadRecord = function (fileId, docId) {
} }
/** /**
* 预览
*/
let preview = function () {
let url = "HGWD002A?inqu_status-0-fileId=" + $("#inqu_status-0-fileId").val();
window.open(url, '_blank');
}
/**
* 下载
*/
let download = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"下载\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGWD001C", "add", false,
function (res) {
if (res.status > -1) {
for (let i = 0; i < rows.length; i++) {
window.open(downloadHref(rows[i]['docId']), '_blank');
}
} else {
message(res.msg);
}
}
);
}
});
}
/**
* 设置树节点的值 * 设置树节点的值
* *
* @param nodeData * @param nodeData
...@@ -307,15 +273,23 @@ let showAuthButton = function () { ...@@ -307,15 +273,23 @@ let showAuthButton = function () {
// C:目录 // C:目录
if (leafType && leafType > 0) { if (leafType && leafType > 0) {
$("#PREVIEW").attr("disabled", false); $("#PREVIEW").attr("disabled", false);
// $("#DOWNLOAD").attr("disabled", false); $("#DOWNLOAD").attr("disabled", false);
} else { } else {
$("#PREVIEW").attr("disabled", true); $("#PREVIEW").attr("disabled", true);
// $("#DOWNLOAD").attr("disabled", true); $("#DOWNLOAD").attr("disabled", true);
} }
} }
/** /**
* 预览 * 预览
*/
let preview = function () {
let url = "HGWD002A?inqu_status-0-fileId=" + $("#inqu_status-0-fileId").val();
window.open(url, '_blank');
}
/**
* 预览
* *
* @param fileId * @param fileId
* @param docId * @param docId
...@@ -323,11 +297,57 @@ let showAuthButton = function () { ...@@ -323,11 +297,57 @@ let showAuthButton = function () {
* @param docName * @param docName
*/ */
let showPreview = function (fileId, docId, docType, docName) { let showPreview = function (fileId, docId, docType, docName) {
if (isBlank(docId)) { addRecordWindow(fileId, docId, docType, docName);
message("附件类型或ID不能为空"); }
/**
* 下载
*/
let download = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选要下载的数据!");
return; return;
} }
$("#previewFile").data("kendoWindow").center(); if (rows.length == 1) {
$("#previewFile").data("kendoWindow").open(); singleDownload(rows[0]);
addRecord(fileId, docId, docType, docName); } else {
batchDownload();
}
}
/**
* 单个下载
*
* @param row
*/
let singleDownload = function (row) {
let inInfo = new EiInfo();
inInfo.set("result-0-fileId", row['fileId']);
inInfo.set("result-0-docId", row['docId']);
EiCommunicator.send("HGWD001C", "add", inInfo, {
onSuccess(res) {
if (res.status > -1) {
window.open(CommonUtils.downloadFile(row['docId'], false), '_blank');
} else {
message(res.msg);
}
}
}, {async: false})
}
/**
* 批量下载
*
* @param fileId
* @param docId
*/
let batchDownload = function () {
JSUtils.submitGridsData("result", "HGWD001C", "batchDownload", false,
function (res) {
if (res.status > -1) {
window.open(res.extAttr.downloadUrl, '_blank');
}
}
);
} }
\ No newline at end of file
...@@ -5,12 +5,6 @@ ...@@ -5,12 +5,6 @@
<c:set var="ctx" value="${pageContext.request.contextPath}"/> <c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script src="${ctx}/common/docxjs/jszip.min.js"></script>
<script src="${ctx}/common/docxjs/docx-preview.js"></script>
<script src="${ctx}/common/js/xlsx.full.min.js"></script>
<script src="${ctx}/HG/WD/HGWD002A1.js"></script>
<link rel="stylesheet" href="${ctx}/HG/WD/HGWD002A.css">
<EF:EFPage title="文档浏览"> <EF:EFPage title="文档浏览">
<div id="splitter" class="i-fit-height"> <div id="splitter" class="i-fit-height">
<div id="left-pane" class="i-fit-height"> <div id="left-pane" class="i-fit-height">
...@@ -72,25 +66,4 @@ ...@@ -72,25 +66,4 @@
</EF:EFPage> </EF:EFPage>
<%-- 预览文件 --%> <jsp:include page="HGWD002A1.jsp" />
<EF:EFWindow id="previewFile" title="附件预览" height="100%" width="100%">
<div id="descDiv" class="center-flex">
<span id="descSpan" style="font-weight: bold;font-size: 18px">附件预览区域...</span>
</div>
<%-- 文本预览 --%>
<div id="textContainer" class="left-flex" style="display: none;">
<pre id="textSpan" class="textSpan"></pre>
</div>
<%-- docx文件预览--%>
<div id="docxContainer" style="display: none;"></div>
<%-- IMAGE文件预览--%>
<div id="imageContainer" class="left-flex" style="display: none;">
<img id="image" src="" style="border: 1px solid gray;width: 100%;height: 100%;"/>
</div>
<%-- other --%>
<iframe id="previewFrame" src="" style="display: none;"></iframe>
</EF:EFWindow>
<%-- 图片放大区域 --%>
<div id="imageOuterDiv" class="imageOuterDiv">
<img id="bigImage" src=""/>
</div>
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
<script src="${ctx}/common/docxjs/docx-preview.js"></script> <script src="${ctx}/common/docxjs/docx-preview.js"></script>
<script src="${ctx}/common/js/xlsx.full.min.js"></script> <script src="${ctx}/common/js/xlsx.full.min.js"></script>
<script src="${ctx}/HG/WD/HGWD002A1.js"></script> <script src="${ctx}/HG/WD/HGWD002A1.js"></script>
<link rel="stylesheet" href="${ctx}/HG/WD/HGWD002A.css"> <link rel="stylesheet" href="${ctx}/HG/WD/HGWD002A1.css">
<EF:EFPage title="附件预览"> <EF:EFPage title="文档预览">
<div class="row" style="margin: 0 -10px;"> <div class="row" style="margin: 0 -10px;">
<div class="col-md-3"> <div class="col-md-3">
<EF:EFRegion title="文目录树" id="tree" fitHeight="true"> <EF:EFRegion title="文目录树" id="tree" fitHeight="true">
<EF:EFInput ename="fileId" cname="文件ID" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput ename="fileId" cname="目录ID" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput ename="source" cname="来源" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput ename="source" cname="来源" blockId="inqu_status" row="0" type="hidden"/>
<div id="menu" style="margin-top: 12px; margin-bottom: 8px"> <div id="menu" style="margin-top: 12px; margin-bottom: 8px">
<EF:EFTree bindId="docTree" ename="node" textField="text" valueField="label" hasChildren="leaf" <EF:EFTree bindId="docTree" ename="node" textField="text" valueField="label" hasChildren="leaf"
......
/** /**
* 弹窗预览
*
* @param fileId
* @param docId
* @param docType
* @param docName
*/
function addRecordWindow(fileId, docId, docType, docName) {
$("#previewFile").data("kendoWindow").center();
$("#previewFile").data("kendoWindow").open();
addRecord(fileId, docId, docType, docName);
}
/**
* 新增预览记录 * 新增预览记录
* *
* @param fileId * @param fileId
* @param docId * @param docId
* @param docType * @param docType
*/ */
function addRecord(fileId, docId, docType, docName){ function addRecord(fileId, docId, docType, docName) {
if (isBlank(docId)) {
message("附件类型或ID不能为空");
return;
}
// 隐藏预览区域 // 隐藏预览区域
hideHtml(); hideHtml();
IPLAT.progress($("body"), true); IPLAT.progress($("body"), true);
...@@ -43,12 +61,12 @@ function previewFile(docId, docType, docName) { ...@@ -43,12 +61,12 @@ function previewFile(docId, docType, docName) {
$("#descDiv").css('display', 'none'); $("#descDiv").css('display', 'none');
if (isXml(docType)) { if (isXml(docType)) {
previewXml(docId); previewXml(docId);
} else if (isExcel(docType)) {
previewExcel(docId);
} else if (true) { } else if (true) {
previewOnline(docId, docName); previewOnline(docId, docName);
} else if (isText(docType)) { } else if (isText(docType)) {
previewText(docId); previewText(docId);
} else if (isExcel(docType)) {
previewExcel(docId);
} else if (isWord(docType)) { } else if (isWord(docType)) {
previewDocx(docId); previewDocx(docId);
} else if (isImage(docType)) { } else if (isImage(docType)) {
...@@ -149,7 +167,7 @@ function isExcel(docType) { ...@@ -149,7 +167,7 @@ function isExcel(docType) {
if (isBlank(docType)) { if (isBlank(docType)) {
return false; return false;
} }
const extensions = ['xls', 'xlsx']; const extensions = ['xls'];
return extensions.includes(docType.toLowerCase()); return extensions.includes(docType.toLowerCase());
} }
......
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<script src="${ctx}/common/docxjs/jszip.min.js"></script>
<script src="${ctx}/common/docxjs/docx-preview.js"></script>
<script src="${ctx}/common/js/xlsx.full.min.js"></script>
<script src="${ctx}/HG/WD/HGWD002A1.js"></script>
<link rel="stylesheet" href="${ctx}/HG/WD/HGWD002A1.css">
<%-- 预览文件 --%>
<EF:EFWindow id="previewFile" title="附件预览" height="100%" width="100%">
<div id="descDiv" class="center-flex">
<span id="descSpan" style="font-weight: bold;font-size: 18px">附件预览区域...</span>
</div>
<%-- 文本预览 --%>
<div id="textContainer" class="left-flex" style="display: none;">
<pre id="textSpan" class="textSpan"></pre>
</div>
<%-- docx文件预览--%>
<div id="docxContainer" style="display: none;"></div>
<%-- IMAGE文件预览--%>
<div id="imageContainer" class="left-flex" style="display: none;">
<img id="image" src="" style="border: 1px solid gray;width: 100%;height: 100%;"/>
</div>
<%-- other --%>
<iframe id="previewFrame" src="" style="display: none;"></iframe>
</EF:EFWindow>
<%-- 图片放大区域 --%>
<div id="imageOuterDiv" class="imageOuterDiv">
<img id="bigImage" src=""/>
</div>
\ No newline at end of file
...@@ -628,7 +628,7 @@ function loadChange(grid,e,field) { ...@@ -628,7 +628,7 @@ function loadChange(grid,e,field) {
* *
* @param bizType * @param bizType
* @param bizId * @param bizId
* @param * @param callback
*/ */
let uploadFile = function (bizType, bizId, callback) { let uploadFile = function (bizType, bizId, callback) {
let params = { let params = {
...@@ -650,14 +650,30 @@ function loadChange(grid,e,field) { ...@@ -650,14 +650,30 @@ function loadChange(grid,e,field) {
} }
/** /**
* 文件下载路径
*
* @param docId
* @param isPreview 是否预览,true:预览
* @returns {string}
*/
let downloadFile = function (docId, isPreview) {
if (isPreview) {
return IPLATUI.CONTEXT_PATH + '/file/download/preview/' + docId;
} else {
// S3地址必须支持公网
return IPLATUI.CONTEXT_PATH + '/file/download/' + docId;
}
}
/**
* 预览 * 预览
* *
* @param docId 文件ID * @param docId 文件ID
* @param docName 文件名称必须带后缀 * @param docName 文件名称必须带后缀
*/ */
function previewFile(docId, docName) { let previewFile = function (docId, docName) {
let hostname = window.location.hostname; let hostname = window.location.hostname;
let domain = hostname === "localhost" ? "http://129.211.46.84:8085": window.location.origin; let domain = hostname === "localhost" ? "http://129.211.46.84:8085" : window.location.origin;
let url = domain + IPLATUI.CONTEXT_PATH + '/file/download/preview/' + docId let url = domain + IPLATUI.CONTEXT_PATH + '/file/download/preview/' + docId
+ "?fullfilename="; + "?fullfilename=";
// Base64转码 // Base64转码
...@@ -683,6 +699,7 @@ function loadChange(grid,e,field) { ...@@ -683,6 +699,7 @@ function loadChange(grid,e,field) {
$.extend(window, { $.extend(window, {
CommonUtils: { CommonUtils: {
uploadFile: uploadFile, uploadFile: uploadFile,
downloadFile: downloadFile,
previewFile: previewFile, previewFile: previewFile,
} }
}); });
......
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