Commit 2fcef0eb by liuyang

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

parents ee7ef098 a1e09350
......@@ -14,6 +14,7 @@ import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.eu.dm.util.PlatFileUploader;
import org.apache.commons.collections.CollectionUtils;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -133,7 +134,8 @@ public class Iplat4jUtils {
}
String chgName = dbDm02Map.get("chgName").toString();
String realPath = dbDm02Map.get("realPath").toString();
return S3Constant.RESOURCE + "/" + OSConstant.FILE_DOWNLOAD + "/" + realPath + chgName;
return S3Constant.RESOURCE + "/" + OSConstant.FILE_DOWNLOAD + "/" + realPath
+ URLEncoder.encode(chgName, "UTF-8");
}
}
......@@ -145,8 +147,8 @@ public class Iplat4jUtils {
* @return
*/
public static String compressFile(List<String> docIds, String zipName) throws Exception {
String zipFolderPath = OSConstant.ZIP_DIR + OSConstant.SEPARATOR + DateUtils.shortDate()
+ OSConstant.SEPARATOR + zipName;
String mainFolderPath = OSConstant.ZIP_DIR + OSConstant.SEPARATOR + DateUtils.shortDate();
String zipFolderPath = mainFolderPath + OSConstant.SEPARATOR + zipName;
FileUtils.createDirs(zipFolderPath);
String zipFilePath = zipFolderPath + ".zip";
if (CommonConstant.FileLocation.S3.equalsIgnoreCase(S3Constant.FILE_LOCATION)) {
......@@ -171,8 +173,10 @@ public class Iplat4jUtils {
// 压缩完删除本地文件
FileUtils.deleteFiles(zipFolderPath);
// 替换成HTTP地址
return S3Constant.RESOURCE + "/" + OSConstant.FILE_DOWNLOAD + zipFilePath.replace(OSConstant.DOC_ROOT_DIR, "")
.replace(OSConstant.SEPARATOR, "/");
return S3Constant.RESOURCE + "/" + OSConstant.FILE_DOWNLOAD
+ mainFolderPath.replace(OSConstant.DOC_ROOT_DIR, "")
.replace(OSConstant.SEPARATOR, "/") + "/"
+ URLEncoder.encode(zipName, "UTF-8") + ".zip";
}
}
......@@ -7,7 +7,7 @@ package com.baosight.hggp.hg.sc.enums;
public enum ProjectSourceEnum {
ENGINEERING("engineering", "工程设计图"),
FOREIGN("foreign", "外来涉密图"),
FOREIGN("foreign", "生产制造图"),
SPARE("spare", "备件制造图"),
OTHER("other", "其他"),
;
......
......@@ -320,8 +320,8 @@ $(function () {
if (e.button !== 2) {
return
}
if ("工程设计图" === e.target.textContent || "外来涉密图" === e.target.textContent
|| "备件制造图" === e.target.textContent || "其他" === e.target.textContent) {
if ("engineering" === e.target.title || "foreign" === e.target.title
|| "spare" === e.target.title || "other" === e.target.title) {
$("#isAdd").css('display', 'none');
$("#isDel").css('display', 'none');
$("#isEdit").css('display', 'none');
......
......@@ -66,17 +66,18 @@ function previewFile(url, docType) {
previewExcel(url);
} else if (isWord(docType)) {
previewDocx(url);
} else if (true) {
previewOnline(url);
} else if (isText(docType)) {
previewText(url);
} else if (isImage(docType)) {
previewImage(url);
} else if (isFrame(docType)) {
previewFrame(url);
} else {
otherDownload(false, docId);
previewOnline(url);
}
// else if (isText(docType)) {
// previewText(url);
// } else if (isImage(docType)) {
// previewImage(url);
// } else if (isFrame(docType)) {
// previewFrame(url);
// } else {
// otherDownload(false, docId);
// }
}
/**
......@@ -95,7 +96,7 @@ function hideHtml() {
/**
* 是否文本
*
* @param fileName
* @param docType
* @returns {boolean}
*/
function isText(docType) {
......@@ -132,7 +133,7 @@ function previewText(docId) {
/**
* 是否文本
*
* @param fileName
* @param docType
* @returns {boolean}
*/
function isXml(docType) {
......@@ -161,7 +162,7 @@ function previewXml(url) {
/**
* 是否excel
*
* @param fileName
* @param docType
* @returns {boolean}
*/
function isExcel(docType) {
......@@ -210,7 +211,7 @@ function previewExcel(url) {
/**
* 是否WORD
*
* @param fileName
* @param docType
* @returns {boolean}
*/
function isWord(docType) {
......@@ -241,7 +242,7 @@ function previewDocx(url) {
/**
* 判断是否是图片
*
* @param fileName
* @param docType
* @returns {boolean}
*/
function isImage(docType) {
......@@ -263,12 +264,12 @@ function previewImage(docId) {
}
/**
* 判断是否frame预览
* PDF预览
*
* @param fileName
* @param docType
* @returns {boolean}
*/
function isFrame(docType) {
function isPdf(docType) {
if (isBlank(docType)) {
return false;
}
......@@ -279,11 +280,13 @@ function isFrame(docType) {
/**
* frame预览
*
* @param docId
* @param url
*/
function previewFrame(docId) {
function previewFrame(url) {
// 替换地址中的file-download为file-preview
url = url.replace("file-download", "file-preview");
$("#previewFrame").css('display', '');
$("#previewFrame").attr("src", downloadHref(docId, true));
$("#previewFrame").attr("src", url);
}
/**
......@@ -363,6 +366,17 @@ let bigImage = null;
window.onload = function () {
// 监听iframe
// iframeLoad();
// 禁用鼠标右键
document.addEventListener('contextmenu', event => event.preventDefault());
document.addEventListener('copy', event => event.preventDefault());
// 图片预览初始化
// imageShowInit();
};
/**
* 图片预览初始化
*/
function imageShowInit(){
imageOuterDiv = document.querySelector("#imageOuterDiv");
realImage = document.querySelector("#image");
bigImage = document.querySelector("#bigImage");
......@@ -383,7 +397,7 @@ window.onload = function () {
// 拖转事件调用
imgDrag();
});
};
}
/**
* 点击图片放大
......
......@@ -671,10 +671,6 @@ function loadChange(grid,e,field) {
* @param url 文件URL
*/
let previewFile = function (url) {
// let hostname = window.location.hostname;
// let domain = hostname === "localhost" ? "http://129.211.46.84:8085" : window.location.origin;
// let url = domain + IPLATUI.CONTEXT_PATH + '/file/download/preview/' + docId
// + "?fullfilename=";
// Base64转码
let urlEncode;
try {
......
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