505 lines
18 KiB
HTML
505 lines
18 KiB
HTML
<%@ page language="java" import="java.util.*,com.g3.general.*" pageEncoding="utf-8" %>
|
|
<%@ include file="../ini.jsp" %>
|
|
<% if (orgid.equals("")) { return; } String id=request.getParameter("id"); String
|
|
mx_moduleid=request.getParameter("mx_moduleid"); String sh_state=request.getParameter("sh_state"); String
|
|
iread=request.getParameter("iread"); String tree_where=request.getParameter("tree_where"); String
|
|
mx_secondfather=request.getParameter("mx_secondfather"); if (mx_secondfather==null) { mx_secondfather="" ; }
|
|
String mx_secondfather_fz=request.getParameter("mx_secondfather_fz"); if (mx_secondfather_fz==null) {
|
|
mx_secondfather_fz="" ; } String default_click=request.getParameter("default_click"); if (default_click==null) {
|
|
default_click="" ; } %>
|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
|
|
<head>
|
|
<meta http-equiv="Cache-Control" content="no-cache" />
|
|
<base href="<%=basePath%>">
|
|
<title>采购下单浏览</title>
|
|
<jsp:include page="../inc.jsp"></jsp:include>
|
|
|
|
<script type="text/javascript" src="<%=basePath%>/js/jquery-easyui-1.4/jquery.min.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="<%=basePath%>/js/jquery-easyui-1.4/themes/default/easyui.css" />
|
|
<link rel="stylesheet" type="text/css" href="<%=basePath%>/js/jquery-easyui-1.4/themes/icon.css" />
|
|
<script type="text/javascript" src="<%=basePath%>/js/jquery-easyui-1.4/jquery.easyui.min.js"></script>
|
|
<script type="text/javascript" src="<%=basePath%>/js/jquery-easyui-1.4/locale/easyui-lang-zh_CN.js"></script>
|
|
|
|
<script type="text/javascript" src="<%=basePath%>/js/g3-file/libs/FileSaver.min.js"></script>
|
|
<script type="text/javascript" src="<%=basePath%>/js/g3-file/libs/jszip.min.js"></script>
|
|
<script type="text/javascript" src="<%=basePath%>/js/g3-file/index.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="<%=basePath%>/js/g3-file/index.css" />
|
|
|
|
<script type="text/javascript" src="g3Funlib.js?5"></script>
|
|
|
|
<script type="text/javascript" id="testScript" columns_viewgrid="v_xc_consite_wx"
|
|
changLang_table="v_xc_consite_wx" columns_editgrid="" src="language/language_new_yardyw.js"></script>
|
|
<script type="text/javascript" src="language/languagebtn.js"></script>
|
|
|
|
<style type="text/css">
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
html,
|
|
body {
|
|
height: 100%;
|
|
margin: 0;
|
|
}
|
|
|
|
.g3-layout {
|
|
height: 100%;
|
|
display: flex;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.g3-layout .pane {
|
|
height: 100%;
|
|
flex: 0 0 auto;
|
|
overflow: auto;
|
|
}
|
|
|
|
.g3-layout .split {
|
|
width: 1px;
|
|
position: relative;
|
|
background: #95b8e7;
|
|
}
|
|
|
|
.g3-layout .split::before {
|
|
content: "";
|
|
position: absolute;
|
|
left: -6px;
|
|
right: -6px;
|
|
top: 0;
|
|
bottom: 0;
|
|
cursor: ew-resize;
|
|
}
|
|
|
|
#fileContainer {
|
|
height: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
#previewContainer {
|
|
height: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="g3-layout" id="dropZone" style="position: relative;">
|
|
<div class="pane" data-pane="left" style="width: 10%;min-width: 150px;">
|
|
<ul id="otherbaseTree" class="easyui-tree"></ul>
|
|
</div>
|
|
|
|
<div class="split" id="split1"></div>
|
|
|
|
<div class="pane" data-pane="middle" style="width: 30%;min-width: 450px;">
|
|
<div id="fileContainer"></div>
|
|
</div>
|
|
|
|
<div class="split" id="split2"></div>
|
|
|
|
<div class="pane" data-pane="right" style="flex:1">
|
|
<div id="previewContainer">文件预览位置</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
/** 全局变量 */
|
|
var vid1 = "<%=id%>";
|
|
var mx_moduleid = "<%=mx_moduleid%>";
|
|
var sh_state = "<%=sh_state%>";
|
|
var iread = "<%=iread%>";
|
|
var orgid = "<%=orgid%>";
|
|
var tree_where = "<%=tree_where%>";
|
|
var mx_secondfather = "<%=mx_secondfather%>";
|
|
var mx_secondfather_fz = "<%=mx_secondfather_fz%>";
|
|
var default_click = "<%=default_click%>";
|
|
var Fmoduleid = "<%=mx_moduleid%>";
|
|
var modid = "g3hdzjsj";
|
|
var mx_orderid = '';
|
|
var jpowerqx = null;
|
|
var g3FileInstance = null;
|
|
var userid = "<%=userid%>";
|
|
var tablename = "bf_files";
|
|
|
|
/** 多语言文本 */
|
|
var tabtitle = '所有类别';
|
|
var xztitle = '下载';
|
|
var viewtitle = '查看';
|
|
var confirmOk = '是';
|
|
var confirmCancel = '否';
|
|
var alertCannotDelete = '已审核不能删除';
|
|
var alertSelectFile = '请选择要删除的图片';
|
|
var alertDeleteSuccess = '删除成功';
|
|
var alertDeleteFail = '删除失败';
|
|
var alertDeletePartial = '部分删除失败:成功 {0} 条,失败 {1} 条';
|
|
var confirmTitle = '操作提示';
|
|
var confirmMessage = '您确定删除选中的 {0} 条数据吗?';
|
|
|
|
/**
|
|
* 初始化多语言配置
|
|
*/
|
|
function initLanguage() {
|
|
var language = getCookie("languageCook");
|
|
if (language == 1) {
|
|
tabtitle = 'All Categories';
|
|
xztitle = 'Download';
|
|
viewtitle = 'View';
|
|
confirmOk = 'Yes';
|
|
confirmCancel = 'No';
|
|
alertCannotDelete = 'Cannot delete after review';
|
|
alertSelectFile = 'Please select files to delete';
|
|
alertDeleteSuccess = 'Delete success';
|
|
alertDeleteFail = 'Delete failed';
|
|
alertDeletePartial = 'Partial delete failed: {0} success, {1} failed';
|
|
confirmTitle = 'Confirmation';
|
|
confirmMessage = 'Are you sure to delete {0} selected items?';
|
|
} else if (language == 2) {
|
|
tabtitle = 'Все категории';
|
|
xztitle = 'Скачать';
|
|
viewtitle = 'Просмотр';
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 绑定分割条拖拽事件
|
|
* @param {string} splitId - 分割条元素ID
|
|
* @param {HTMLElement} leftEl - 左侧面板元素
|
|
*/
|
|
function bindSplit(splitId, leftEl) {
|
|
const split = document.getElementById(splitId);
|
|
let startX = 0, startWidth = 0, dragging = false;
|
|
|
|
split.addEventListener('mousedown', function (e) {
|
|
if (e.button !== 0) return;
|
|
dragging = true;
|
|
startX = e.clientX;
|
|
startWidth = leftEl.offsetWidth;
|
|
document.body.style.userSelect = 'none';
|
|
document.addEventListener('mousemove', onMouseMove);
|
|
document.addEventListener('mouseup', onMouseUp);
|
|
});
|
|
|
|
function onMouseMove(e) {
|
|
if (!dragging) return;
|
|
let newWidth = startWidth + (e.clientX - startX);
|
|
if (newWidth < 100) newWidth = 150;
|
|
leftEl.style.width = newWidth + 'px';
|
|
}
|
|
|
|
function onMouseUp() {
|
|
dragging = false;
|
|
document.body.style.userSelect = '';
|
|
document.removeEventListener('mousemove', onMouseMove);
|
|
document.removeEventListener('mouseup', onMouseUp);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 初始化文件管理组件
|
|
*/
|
|
function initG3File() {
|
|
if (g3FileInstance) return;
|
|
|
|
var langCode = getCookie("languageCook") == 1 ? "en-US" : "zh-CN";
|
|
|
|
g3FileInstance = $('#fileContainer').G3File({
|
|
language: langCode,
|
|
uploadConfig: {
|
|
aliyun: {
|
|
getAliyunKey: function () {
|
|
return new Promise(function (resolve, reject) {
|
|
$.ajax({
|
|
url: "jattachfiletype/getaliyunkey.jsp",
|
|
type: "GET",
|
|
data: {
|
|
orgid: orgid,
|
|
bucket: modid
|
|
},
|
|
success: function (res) {
|
|
try {
|
|
var json = typeof res === "string" ? JSON.parse(res) : res;
|
|
resolve({
|
|
accessid: json.accessid,
|
|
policy: json.policy,
|
|
signature: json.signature,
|
|
callback: json.callback,
|
|
host: json.host,
|
|
dir: json.dir,
|
|
expire: json.expire
|
|
});
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
},
|
|
error: function (err) {
|
|
reject(err);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
},
|
|
onDelete: handleDelete
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 处理文件删除操作,删除成功后刷新文件列表
|
|
* @param {Array} files - 待删除文件列表
|
|
* @param {Function} callback - 删除完成回调函数
|
|
*/
|
|
function handleDelete(files, callback) {
|
|
if (sh_state == 0) {
|
|
alert(alertCannotDelete);
|
|
callback(false);
|
|
return;
|
|
}
|
|
|
|
if (!files || files.length === 0) {
|
|
alert(alertSelectFile);
|
|
callback(false);
|
|
return;
|
|
}
|
|
|
|
$.messager.defaults = {
|
|
ok: confirmOk,
|
|
cancel: confirmCancel
|
|
};
|
|
|
|
$.messager.confirm(confirmTitle, confirmMessage.replace('{0}', files.length), function (ok) {
|
|
if (!ok) {
|
|
callback(false);
|
|
return;
|
|
}
|
|
|
|
var ids = files.map(item => item.subid);
|
|
|
|
if (ids.length === 0) {
|
|
alert(alertSelectFile);
|
|
callback(false);
|
|
return;
|
|
}
|
|
|
|
$.ajax({
|
|
type: 'post',
|
|
url: 'jattachfiletype/DelSubRecordBath.jsp',
|
|
data: {
|
|
module: tablename,
|
|
bucketName: modid,
|
|
ids: ids.join(",")
|
|
},
|
|
success: function (res) {
|
|
var last = res[res.length - 1];
|
|
if (last.result) {
|
|
alert(alertDeleteSuccess);
|
|
} else {
|
|
alert(alertDeletePartial.replace('{0}', last.success).replace('{1}', last.fail));
|
|
}
|
|
callback(true);
|
|
refreshFileList();
|
|
},
|
|
error: function () {
|
|
alert(alertDeleteFail);
|
|
callback(false);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 刷新文件列表(删除后重新请求数据)
|
|
*/
|
|
function refreshFileList() {
|
|
var queryWhere = buildQueryWhere(mx_orderid);
|
|
searchData(queryWhere);
|
|
}
|
|
|
|
/**
|
|
* 构建查询条件
|
|
* @param {string} orderId - 订单ID
|
|
* @returns {string} - 查询条件字符串
|
|
*/
|
|
function buildQueryWhere(orderId) {
|
|
var queryWhere = "mx_moduleid='" + Fmoduleid + "' and father='" + vid1 + "'";
|
|
|
|
if (tree_where && tree_where !== '' && tree_where != 'null') {
|
|
queryWhere += " and mx_orderid='" + tree_where + "'";
|
|
}
|
|
if (orderId && orderId !== '') {
|
|
queryWhere = "mx_moduleid='" + Fmoduleid + "' and father='" + vid1 + "' and mx_orderid='" + orderId + "'";
|
|
}
|
|
if (mx_secondfather && mx_secondfather !== '' && mx_secondfather != 'null') {
|
|
queryWhere += " and mx_secondfather='" + mx_secondfather + "'";
|
|
}
|
|
|
|
return queryWhere;
|
|
}
|
|
|
|
/**
|
|
* 搜索文件数据
|
|
* @param {string} condition - 查询条件
|
|
*/
|
|
function searchData(condition) {
|
|
if (!g3FileInstance) {
|
|
initG3File();
|
|
}
|
|
|
|
$.ajax({
|
|
url: "jattachfiletype/loaddata_attach.jsp",
|
|
type: "post",
|
|
async: true,
|
|
data: {
|
|
viewname: "bf_files",
|
|
searchcondition: condition,
|
|
orderfield: '',
|
|
soption: ''
|
|
},
|
|
success: function (res) {
|
|
var fileList = [];
|
|
for (var i = 0; i < res.length; i++) {
|
|
fileList.push({
|
|
name: res[i].mx_filename,
|
|
size: res[i].mx_filesize,
|
|
uploadDate: res[i].mx_addtime,
|
|
url: res[i].mx_mapfilename,
|
|
...res[i]
|
|
});
|
|
}
|
|
g3FileInstance.setFiles(fileList);
|
|
},
|
|
error: function () {
|
|
g3FileInstance.setFiles([]);
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 创建文件类型树
|
|
*/
|
|
function createTree() {
|
|
$('#otherbaseTree').tree('append', {
|
|
data: [{ id: '', text: tabtitle }]
|
|
});
|
|
var node = $('#otherbaseTree').tree('find', '');
|
|
|
|
var queryWhere = '';
|
|
if (tree_where !== '' && tree_where != 'null') {
|
|
queryWhere = "and b_id='" + tree_where + "'";
|
|
}
|
|
|
|
$.ajax({
|
|
type: 'post',
|
|
url: 'jsp/searchdata.jsp',
|
|
cache: false,
|
|
async: false,
|
|
data: {
|
|
soption: 'main',
|
|
searchcondition: "2>1 and b_module_id='" + Fmoduleid + "'" + queryWhere,
|
|
viewname: 'bf_files_type',
|
|
orderfield: 'b_xh'
|
|
},
|
|
dataType: 'json',
|
|
success: function (result) {
|
|
for (var i in result) {
|
|
$('#otherbaseTree').tree('append', {
|
|
parent: node.target,
|
|
data: [{ id: result[i].b_id, text: result[i].b_name }]
|
|
});
|
|
}
|
|
if (default_click && default_click != 'null') {
|
|
setTimeout(function () {
|
|
var node = $('#otherbaseTree').tree('find', default_click);
|
|
if (node) {
|
|
$('#otherbaseTree').tree('select', node.target);
|
|
onClickNode(node);
|
|
}
|
|
}, 200);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 加载子节点数据
|
|
* @param {Object} node - 树节点对象
|
|
*/
|
|
function loadChildNodes(node) {
|
|
$.ajax({
|
|
type: 'post',
|
|
url: 'jsp/searchdata.jsp',
|
|
cache: false,
|
|
async: false,
|
|
data: {
|
|
soption: 'main',
|
|
searchcondition: "b_module_id ='" + node.id + "'",
|
|
viewname: 'bf_files_type',
|
|
orderfield: 'b_xh'
|
|
},
|
|
dataType: 'json',
|
|
success: function (result) {
|
|
for (var i in result) {
|
|
$('#otherbaseTree').tree('append', {
|
|
parent: node.target,
|
|
data: [{ id: result[i].b_id, text: result[i].b_name }]
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 树节点点击事件处理
|
|
* @param {Object} node - 被点击的树节点
|
|
*/
|
|
function onClickNode(node) {
|
|
mx_orderid = node.id;
|
|
var queryWhere = buildQueryWhere(node.id);
|
|
|
|
if ($('#otherbaseTree').tree('getLevel', node.target) > 0 && $('#otherbaseTree').tree('isLeaf', node.target)) {
|
|
loadChildNodes(node);
|
|
}
|
|
|
|
searchData(queryWhere);
|
|
}
|
|
|
|
/**
|
|
* 初始化权限控制
|
|
*/
|
|
function initPowerControl() {
|
|
if (orgid != 'demo') {
|
|
jpowerqx = getUserPowerQX('bf_files', userid);
|
|
for (var key in jpowerqx) {
|
|
if (jpowerqx[key] != '1') {
|
|
$("a[tag='" + key + "']").linkbutton('disable');
|
|
$("button[tag='" + key + "']").attr('disabled', true);
|
|
$("input[tag='" + key + "']").attr('disabled', true);
|
|
}
|
|
}
|
|
}
|
|
if (getModulePowerByTag(Fmoduleid, userid, '4') != '1') {
|
|
sh_state = 0;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 页面初始化入口
|
|
*/
|
|
$(function () {
|
|
initLanguage();
|
|
bindSplit('split1', document.querySelector('[data-pane="left"]'));
|
|
bindSplit('split2', document.querySelector('[data-pane="middle"]'));
|
|
createTree();
|
|
|
|
$('#otherbaseTree').tree({
|
|
onClick: onClickNode
|
|
});
|
|
|
|
initPowerControl();
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |