Commit afc54580 by liuyang

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

parents e9ade1a5 1a9a39a8
...@@ -147,6 +147,8 @@ public class ServiceHGWD003 extends ServiceEPBase { ...@@ -147,6 +147,8 @@ public class ServiceHGWD003 extends ServiceEPBase {
// 获取FILE_ID // 获取FILE_ID
String fileId = MapUtils.getString(queryMap, HGWD003.FIELD_FILE_ID); String fileId = MapUtils.getString(queryMap, HGWD003.FIELD_FILE_ID);
AssertUtils.isEmpty(fileId, "请选择目录"); AssertUtils.isEmpty(fileId, "请选择目录");
// 判断是否是管理员或项目经理
AssertUtils.isTrue(!HgWdUtils.HgWd003.isManager(fileId), "操作失败,非项目经理不能进行删除");
List<HGWD003> fWd003s = MapUtils.toDaoEPBases(inInfo, HGWD003.class); List<HGWD003> fWd003s = MapUtils.toDaoEPBases(inInfo, HGWD003.class);
for (HGWD003 fWd003 : fWd003s) { for (HGWD003 fWd003 : fWd003s) {
fWd003.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode()); fWd003.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
...@@ -174,6 +176,8 @@ public class ServiceHGWD003 extends ServiceEPBase { ...@@ -174,6 +176,8 @@ public class ServiceHGWD003 extends ServiceEPBase {
// 获取FILE_ID // 获取FILE_ID
String fileId = MapUtils.getString(queryMap, HGWD003.FIELD_FILE_ID); String fileId = MapUtils.getString(queryMap, HGWD003.FIELD_FILE_ID);
AssertUtils.isEmpty(fileId, "请选择目录"); AssertUtils.isEmpty(fileId, "请选择目录");
// 判断是否是管理员或项目经理
AssertUtils.isTrue(!HgWdUtils.HgWd009.isManager(), "操作失败,非管理员不能进行修改");
List<HGWD003> fWd003s = MapUtils.toDaoEPBases(inInfo, HGWD003.class); List<HGWD003> fWd003s = MapUtils.toDaoEPBases(inInfo, HGWD003.class);
for (HGWD003 fWd003 : fWd003s) { for (HGWD003 fWd003 : fWd003s) {
DaoUtils.update(HgWdSqlConstant.HgWd003.UPDATE_INFO, fWd003); DaoUtils.update(HgWdSqlConstant.HgWd003.UPDATE_INFO, fWd003);
...@@ -197,7 +201,7 @@ public class ServiceHGWD003 extends ServiceEPBase { ...@@ -197,7 +201,7 @@ public class ServiceHGWD003 extends ServiceEPBase {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 文档管理员不做校验 // 文档管理员不做校验
if (HgWdUtils.HgWd009.isManager(UserSessionUtils.getLoginName())) { if (HgWdUtils.HgWd009.isManager()) {
inInfo.set("isManager", CommonConstant.YesNo.YES_1); inInfo.set("isManager", CommonConstant.YesNo.YES_1);
return inInfo; return inInfo;
} else { } else {
......
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.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ016;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.wd.domain.HGWD003; import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.utils.HgWdUtils;
import com.baosight.hggp.hg.xs.domain.User; import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
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.StringUtil;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -77,6 +68,8 @@ public class ServiceHGWD003A extends ServiceEPBase { ...@@ -77,6 +68,8 @@ public class ServiceHGWD003A extends ServiceEPBase {
// 获取FILE_ID // 获取FILE_ID
String fileId = MapUtils.getString(queryMap, HGWD003.FIELD_FILE_ID); String fileId = MapUtils.getString(queryMap, HGWD003.FIELD_FILE_ID);
AssertUtils.isEmpty(fileId, "请选择目录"); AssertUtils.isEmpty(fileId, "请选择目录");
// 判断是否是管理员或项目经理
AssertUtils.isTrue(!HgWdUtils.HgWd003.isManager(fileId), "操作失败,非项目经理不能授权人员");
List<HGWD003> fWd003s = MapUtils.toDaoEPBases(inInfo, HGWD003.class); List<HGWD003> fWd003s = MapUtils.toDaoEPBases(inInfo, HGWD003.class);
for (HGWD003 fWd003 : fWd003s) { for (HGWD003 fWd003 : fWd003s) {
fWd003.setFileId(fileId); fWd003.setFileId(fileId);
......
...@@ -2,10 +2,12 @@ package com.baosight.hggp.hg.wd.service; ...@@ -2,10 +2,12 @@ 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.security.UserSessionUtils;
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.HGWD003; import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.tools.HGWDTools; import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.hg.wd.utils.HgWdUtils;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
...@@ -47,7 +49,7 @@ public class ServiceHGWD003B extends ServiceEPBase { ...@@ -47,7 +49,7 @@ public class ServiceHGWD003B extends ServiceEPBase {
} }
/** /**
* 树节点查询 * 查询
* *
* @param inInfo * @param inInfo
* @return * @return
...@@ -55,6 +57,11 @@ public class ServiceHGWD003B extends ServiceEPBase { ...@@ -55,6 +57,11 @@ public class ServiceHGWD003B extends ServiceEPBase {
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 仅查询自己是项目经理的目录
String userId = UserSessionUtils.getLoginName();
if (!HgWdUtils.HgWd009.isManager(userId)) {
queryMap.put("managerUserId", userId);
}
inInfo = super.query(inInfo, HGWD001.QUERY, new HGWD001()); inInfo = super.query(inInfo, HGWD001.QUERY, new HGWD001());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败"); LogUtils.setMsg(inInfo, e, "查询节点失败");
...@@ -74,6 +81,8 @@ public class ServiceHGWD003B extends ServiceEPBase { ...@@ -74,6 +81,8 @@ public class ServiceHGWD003B extends ServiceEPBase {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 获取FILE_ID信息 // 获取FILE_ID信息
String mainFileId = MapUtils.getString(queryMap, "mainFileId"); String mainFileId = MapUtils.getString(queryMap, "mainFileId");
// 判断是否是管理员或项目经理
AssertUtils.isTrue(!HgWdUtils.HgWd009.isManager(), "操作失败,非管理员不能进行复制");
HGWD001 dbWd001 = HGWDTools.HgWd001.get(mainFileId); HGWD001 dbWd001 = HGWDTools.HgWd001.get(mainFileId);
AssertUtils.isNull(dbWd001, String.format("【%s】文档目录不存在", mainFileId)); AssertUtils.isNull(dbWd001, String.format("【%s】文档目录不存在", mainFileId));
// 获取FILE_ID授权信息 // 获取FILE_ID授权信息
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<sql id="condition"> <sql id="condition">
AND DELETE_FLAG = 0 AND DELETE_FLAG = 0
<include refid="HGXSDataAuth.authCondition"/> <include refid="HGXSDataAuth.authCondition"/>
<include refid="customCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -106,6 +107,11 @@ ...@@ -106,6 +107,11 @@
<isNotEmpty prepend=" AND " property="parentIds"> <isNotEmpty prepend=" AND " property="parentIds">
PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate> PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="managerUserId">
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE T.FILE_ID = M.FILE_ID
AND M.USER_ID = #managerUserId#
AND M.IS_PROJECT_MANAGER = 1)
</isNotEmpty>
</sql> </sql>
<sql id="orderBy"> <sql id="orderBy">
...@@ -122,14 +128,14 @@ ...@@ -122,14 +128,14 @@
<select id="query" resultClass="com.baosight.hggp.hg.wd.domain.HGWD001"> <select id="query" resultClass="com.baosight.hggp.hg.wd.domain.HGWD001">
SELECT SELECT
<include refid="column"/> <include refid="column"/>
FROM ${hggpSchema}.HGWD001 FROM ${hggpSchema}.HGWD001 T
WHERE 1=1 WHERE 1=1
<include refid="condition"/> <include refid="condition"/>
<include refid="orderBy"/> <include refid="orderBy"/>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGWD001 SELECT COUNT(*) FROM ${hggpSchema}.HGWD001 T
WHERE 1=1 WHERE 1=1
<include refid="condition"/> <include refid="condition"/>
</select> </select>
......
...@@ -5,8 +5,6 @@ import com.baosight.hggp.core.dao.DaoUtils; ...@@ -5,8 +5,6 @@ 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.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cw.domain.HGCW999; import com.baosight.hggp.hg.cw.domain.HGCW999;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
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;
...@@ -23,7 +21,10 @@ import com.baosight.hggp.util.StringUtils; ...@@ -23,7 +21,10 @@ import com.baosight.hggp.util.StringUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -183,6 +184,20 @@ public class HGWDTools { ...@@ -183,6 +184,20 @@ public class HGWDTools {
public static class HgWd003 { public static class HgWd003 {
/** /**
* 查询
*
* @param fileId
*/
public static HGWD003 getByUser(String fileId) {
AssertUtils.isEmpty(fileId, "文件ID不能为空");
Map queryMap = new HashMap();
queryMap.put(HGWD003.FIELD_FILE_ID, fileId);
queryMap.put(HGWD003.FIELD_USER_ID, UserSessionUtils.getLoginName());
List<HGWD003> results = DaoBase.getInstance().query(HgWdSqlConstant.HgWd003.GET_BY_USER, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* @param fileId * @param fileId
* @return * @return
*/ */
...@@ -343,6 +358,14 @@ public class HGWDTools { ...@@ -343,6 +358,14 @@ public class HGWDTools {
/** /**
* 查询 * 查询
* *
*/
public static HGWD009 getByUser() {
return getByUser(UserSessionUtils.getLoginName());
}
/**
* 查询
*
* @param userId * @param userId
*/ */
public static HGWD009 getByUser(String userId) { public static HGWD009 getByUser(String userId) {
......
package com.baosight.hggp.hg.wd.utils; package com.baosight.hggp.hg.wd.utils;
import com.baosight.hggp.hg.wd.domain.HGWD009; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.tools.HGWDTools; import com.baosight.hggp.hg.wd.tools.HGWDTools;
/** /**
...@@ -13,19 +14,60 @@ public class HgWdUtils { ...@@ -13,19 +14,60 @@ public class HgWdUtils {
* @author:songx * @author:songx
* @date:2024/8/19,14:57 * @date:2024/8/19,14:57
*/ */
public static class HgWd003 {
/**
* 是否项目经理
*
* @param fileId
* @return
*/
public static boolean isProjectManager(String fileId) {
HGWD003 dbWd003 = HGWDTools.HgWd003.getByUser(fileId);
if (dbWd003 == null) {
return false;
}
return CommonConstant.YesNo.YES_1.equals(dbWd003.getIsProjectManager());
}
/**
* 是否项目经理或管理员
*
* @param fileId
* @return
*/
public static boolean isManager(String fileId) {
if (isProjectManager(fileId)) {
return true;
}
return HgWd009.isManager();
}
}
/**
* @author:songx
* @date:2024/8/19,14:57
*/
public static class HgWd009 { public static class HgWd009 {
/** /**
* 是否管理员 * 是否管理员
* *
* @param userId
* @return * @return
*/ */
public static boolean isManager(String userId) { public static boolean isManager() {
HGWD009 dbWd009 = HGWDTools.HgWd009.getByUser(userId); return HGWDTools.HgWd009.getByUser() != null;
return dbWd009 != null;
} }
/**
* 是否管理员
*
* @return
*/
public static boolean isManager(String userId) {
return HGWDTools.HgWd009.getByUser(userId) != null;
}
} }
} }
...@@ -561,6 +561,10 @@ public class FileUtils extends org.apache.commons.io.FileUtils { ...@@ -561,6 +561,10 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
response.setContentType("application/pdf"); response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "inline; filename=" response.setHeader("Content-Disposition", "inline; filename="
+ URLEncoder.encode(fileName, "UTF-8")); + URLEncoder.encode(fileName, "UTF-8"));
} else if ("txt".contains(fileType)) {
response.setContentType("text/plain; charset=UTF-8");
response.setHeader("Content-Disposition", "inline; filename="
+ URLEncoder.encode(fileName, "UTF-8"));
} else { } else {
response.setContentType("application/octet-stream;charset=UTF-8"); response.setContentType("application/octet-stream;charset=UTF-8");
response.setHeader("Content-Disposition", "attachment;filename=" response.setHeader("Content-Disposition", "attachment;filename="
......
...@@ -51,6 +51,7 @@ $(function () { ...@@ -51,6 +51,7 @@ $(function () {
* 页面加载完后执行 * 页面加载完后执行
*/ */
$(window).load(function () { $(window).load(function () {
// 鼠标滚动
imageMouseListener(); imageMouseListener();
}); });
...@@ -58,7 +59,7 @@ $(window).load(function () { ...@@ -58,7 +59,7 @@ $(window).load(function () {
* 图片鼠标事件监听 * 图片鼠标事件监听
*/ */
function imageMouseListener() { function imageMouseListener() {
document.getElementById('image').addEventListener('mousewheel', function (event) { document.getElementById('imageContainer').addEventListener('mousewheel', function (event) {
var scale = event.wheelDelta / 1000; var scale = event.wheelDelta / 1000;
var newScale = Math.max(Math.min(this.scale || 1, 3), 0.1); var newScale = Math.max(Math.min(this.scale || 1, 3), 0.1);
newScale += scale; newScale += scale;
...@@ -68,14 +69,6 @@ function imageMouseListener() { ...@@ -68,14 +69,6 @@ function imageMouseListener() {
}); });
} }
function zoomImage(scale) {
var img = document.getElementById('image');
var width = img.naturalWidth * (scale / 100);
var height = img.naturalHeight * (scale / 100);
img.style.width = width + 'px';
img.style.height = height + 'px';
}
/** /**
* 批量展开树节点 * 批量展开树节点
* *
...@@ -115,19 +108,25 @@ function add(docId, leafType, docType) { ...@@ -115,19 +108,25 @@ function add(docId, leafType, docType) {
otherDownload(true, null); otherDownload(true, null);
return; return;
} }
IPLAT.progress($("body"), true);
let inInfo = new EiInfo(); let inInfo = new EiInfo();
inInfo.set("result-0-fileId", $("#inqu_status-0-fileId").val()); inInfo.set("result-0-fileId", $("#inqu_status-0-fileId").val());
inInfo.set("result-0-docId", docId); inInfo.set("result-0-docId", docId);
EiCommunicator.send('HGWD001B', 'add', inInfo, { EiCommunicator.send('HGWD001B', 'add', inInfo, {
onSuccess: function (res) { onSuccess: function (res) {
if (res.getStatus() >= 0) { if (res.getStatus() >= 0) {
try {
preview(docId, docType); preview(docId, docType);
} catch (e) {
}
} else { } else {
message(res.getMsg()); message(res.getMsg());
} }
IPLAT.progress($("body"), false);
}, },
onFail: function (res) { onFail: function (res) {
NotificationUtil("操作失败,原因[" + res.getMsg() + "]", "error"); NotificationUtil("操作失败,原因[" + res.getMsg() + "]", "error");
IPLAT.progress($("body"), false);
} }
}); });
} }
...@@ -141,10 +140,16 @@ function add(docId, leafType, docType) { ...@@ -141,10 +140,16 @@ function add(docId, leafType, docType) {
function preview(docId, docType) { function preview(docId, docType) {
// 隐藏文本描述 // 隐藏文本描述
$("#descDiv").css('display', 'none'); $("#descDiv").css('display', 'none');
if ("docx" == docType) { if (isText(docType)) {
previewText(docId);
} else if (isXml(docType)) {
previewXml(docId);
} else if (isExcel(docType)) {
previewExcel(docId);
} else if (isWord(docType)) {
previewDocx(docId); previewDocx(docId);
} else if (isImage(docType)) { } else if (isImage(docType)) {
previewImage(docId); previewFrame(docId);
} else if (isFrame(docType)) { } else if (isFrame(docType)) {
previewFrame(docId); previewFrame(docId);
} else { } else {
...@@ -156,9 +161,137 @@ function preview(docId, docType) { ...@@ -156,9 +161,137 @@ function preview(docId, docType) {
* 隐藏显示区域 * 隐藏显示区域
*/ */
function hideHtml() { function hideHtml() {
$("#textContainer").css('display', 'none');
$("#textSpan").html("");
$("#docxContainer").css('display', 'none'); $("#docxContainer").css('display', 'none');
$("#imageContainer").css('display', 'none'); $("#imageContainer").css('display', 'none');
$("#image").attr('src', "");
$("#previewFrame").css('display', 'none'); $("#previewFrame").css('display', 'none');
$("#previewFrame").attr("src", "");
}
/**
* 是否文本
*
* @param fileName
* @returns {boolean}
*/
function isText(docType) {
if (isBlank(docType)) {
return false;
}
const extensions = ['txt'];
return extensions.includes(docType.toLowerCase());
}
/**
* 文件预览
*
* @param docId
*/
function previewText(docId) {
fetch(downloadHref(docId, true)).then(res => {
return res.text();
}).then(data => {
let container = document.getElementById("textContainer");
container.style.display = 'block';
// 使用new TextDecoder()指定编码
// const utf8Decoder = new TextDecoder('UTF-8', {ignoreBOM: true});
// const decodedText = utf8Decoder.decode(arrayBuffer);
$("#textSpan").text(data);
});
}
/**
* 是否文本
*
* @param fileName
* @returns {boolean}
*/
function isXml(docType) {
if (isBlank(docType)) {
return false;
}
const extensions = ['xml'];
return extensions.includes(docType.toLowerCase());
}
/**
* xml文件预览
*
* @param docId
*/
function previewXml(docId) {
fetch(downloadHref(docId, true)).then(res => {
return res.text();
}).then(data => {
let container = document.getElementById("textContainer");
container.style.display = 'block';
$("#textSpan").text(data);
});
}
/**
* 是否excel
*
* @param fileName
* @returns {boolean}
*/
function isExcel(docType) {
if (isBlank(docType)) {
return false;
}
const extensions = ['xls', 'xlsx'];
return extensions.includes(docType.toLowerCase());
}
/**
* 文件预览
*
* @param docId
*/
function previewExcel(docId) {
fetch(downloadHref(docId, true)).then(res => {
return res.blob();
}).then(blob => {
let container = document.getElementById("textContainer");
container.style.display = 'block';
// 使用new TextDecoder()指定编码
// const utf8Decoder = new TextDecoder('GBK', {ignoreBOM: true});
// const text = utf8Decoder.decode(arrayBuffer);
// $("#textSpan").html(text.replace(/\r\n?/g, '\n').replace(/\n/g, '<br/>'));
const reader = new FileReader();
reader.readAsArrayBuffer(blob);
reader.onload = function(e) {
let textSpan = document.getElementById('textSpan');
// 清空内容
textSpan.innerHTML = "";
let result = new Uint8Array(e.target.result);
let workbook = XLSX.read(result, {type: 'array'});
let sheetNames = workbook.SheetNames;
for (let i = 0; i < sheetNames.length; i++) {
// 假设我们只需要第一个工作表
var worksheet = workbook.Sheets[sheetNames[i]];
var data = XLSX.utils.sheet_to_html(worksheet);
// 在页面上显示JSON数据
textSpan.innerHTML += data + "<br/>";
}
};
});
}
/**
* 是否WORD
*
* @param fileName
* @returns {boolean}
*/
function isWord(docType) {
if (isBlank(docType)) {
return false;
}
const extensions = ['docx'];
return extensions.includes(docType.toLowerCase());
} }
/** /**
......
...@@ -7,10 +7,11 @@ ...@@ -7,10 +7,11 @@
<script src="${ctx}/common/docxjs/jszip.min.js"></script> <script src="${ctx}/common/docxjs/jszip.min.js"></script>
<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>
<style> <style>
.left-flex { .left-flex {
display: flex; /*display: flex;*/
align-items: center; /*align-items: flex-start;*/
height: 100%; height: 100%;
width: 100%; width: 100%;
overflow: scroll; overflow: scroll;
...@@ -31,22 +32,6 @@ ...@@ -31,22 +32,6 @@
border: 0px; border: 0px;
} }
.imageContainer {
display: flex;
flex-direction: column;
height: 100%;
}
.wide-div {
flex: 1;
flex-basis: 90%;
overflow: scroll;
}
.narrow-div {
flex: 0 0 10%;
}
img { img {
max-width: 100%; max-width: 100%;
max-height: 100%; max-height: 100%;
...@@ -58,10 +43,18 @@ ...@@ -58,10 +43,18 @@
cursor: zoom-out; cursor: zoom-out;
} }
.zoom-slider { .textSpan {
width: 100%; font-size: 16px;
margin-top: 10px; }
.textSpan table {
border: 1px solid black;
} }
.textSpan table td {
border: 1px solid black;
}
</style> </style>
<EF:EFPage title="文件预览"> <EF:EFPage title="文件预览">
<div class="row" style="margin: 0 -10px;"> <div class="row" style="margin: 0 -10px;">
...@@ -81,6 +74,10 @@ ...@@ -81,6 +74,10 @@
<div id="descDiv" class="center-flex"> <div id="descDiv" class="center-flex">
<span id="descSpan" style="font-weight: bold;font-size: 18px">文件预览区域...</span> <span id="descSpan" style="font-weight: bold;font-size: 18px">文件预览区域...</span>
</div> </div>
<%-- 文本预览 --%>
<div id="textContainer" class="center-flex">
<pre id="textSpan" class="textSpan"></pre>
</div>
<%-- docx文件预览--%> <%-- docx文件预览--%>
<div id="docxContainer" style="display: none;"></div> <div id="docxContainer" style="display: none;"></div>
<%-- IMAGE文件预览--%> <%-- IMAGE文件预览--%>
......
...@@ -264,7 +264,7 @@ let showAuthButton = function () { ...@@ -264,7 +264,7 @@ let showAuthButton = function () {
} else if (status >= 0 && res.extAttr.isProjectManager == 1) { } else if (status >= 0 && res.extAttr.isProjectManager == 1) {
$("#AUTH").show(); $("#AUTH").show();
$("#REMOVE_USER").show(); $("#REMOVE_USER").show();
$("#COPY_USER").hide(); $("#COPY_USER").show();
$("#SAVE").hide(); $("#SAVE").hide();
} else { } else {
$("#AUTH").hide(); $("#AUTH").hide();
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" height="69vh"> <EF:EFGrid blockId="result" autoDraw="override" checkMode="row" height="69vh">
<EF:EFColumn ename="fileId" cname="目录ID" hidden="true" primaryKey="true"/> <EF:EFColumn ename="fileId" cname="目录ID" hidden="true" primaryKey="true"/>
<EF:EFColumn ename="projCode" cname="项目编号" enable="false" width="120" align="center"/> <EF:EFColumn ename="projCode" cname="项目编号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="120" align="left"/> <EF:EFColumn ename="projName" cname="项目名称" enable="false" width="180" align="left"/>
<EF:EFColumn ename="fileName" cname="目录名称" enable="false" width="120" align="left"/> <EF:EFColumn ename="fileName" cname="目录名称" enable="false" width="180" align="left"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
</EF:EFPage> </EF:EFPage>
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