Files

304 lines
11 KiB
Plaintext
Raw Permalink Normal View History

2026-01-16 14:13:44 +08:00
<%@page import="com.sipai.entity.document.Data"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page import="com.sipai.entity.base.ServerObject"%>
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
<%request.setAttribute("Science_File", Data.Science_File); %>
<!DOCTYPE html>
<!-- <html lang="zh-CN"> -->
<!-- BEGIN HEAD -->
<head>
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
<!-- 引用页头及CSS页-->
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<!-- 文件上传-->
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/css/fileinput.min.css" />
<script type="text/javascript"
src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js" charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js"
charset="utf-8"></script>
<style>
.main-header {
display: none;
}
.content-header {
display: none;
}
.main-footer {
display: none;
}
</style>
<script type="text/javascript">
//新增节点
var addFun = function () {
deleteBoxStyleFun();
var node = $('#tree').treeview('getSelected');
var pid = "-1";
if (node != null && node.length > 0) {
if (node[0].id != "tree") {
pid = node[0].id;
}
}else{
var id = '${param.id}';
if (id != null && id.length > 0) {
pid = id;
}
}
$.post(ext.contextPath + '/document/doaddData.do', { pid: pid, doctype: '${Science_File}', companyId: companyId }, function (data) {
$("#faultBox").html(data);
});
};
//删除节点
function deleteFun() {
var node = $('#tree').treeview('getSelected');
var data = "";
if (node != null && node.length > 0) {
data = node[0].id;
if(data!='${param.id}'){
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
}).then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/document/dodel.do', { id: data }, function (data) {
if (data.res > 0) {
initFun();
} else {
showAlert('d', '删除失败');
}
}, 'json');
}
});
}else{
showAlert('d', '根节点无法删除', 'mainAlertdiv');
}
} else {
showAlert('d', '请先选择记录', 'mainAlertdiv');
}
}
//编辑节点基本信息
var editFun = function () {
var node = $('#tree').treeview('getSelected');
var data = "";
if (node != null && node.length > 0) {
data = node[0].id;
$.post(ext.contextPath + '/document/doeditData.do', { id: data, doctype: '${Science_File}', companyId: companyId,rootID : '${param.id}' }, function (data) {
$("#faultBox").html(data);
});
} else {
showAlert('d', '请先选择编辑的节点', 'mainAlertdiv');
}
};
//全局搜索资料
var searchFileFun = function () {
$.post(ext.contextPath + '/document/showSearchFile.do', { companyId: companyId, doctype: '${Science_File}', }, function (data) {
$("#fileList").html(data);
});
};
//编辑文件,点击节点后进入文件上传下载界面
var editFileFun = function (id, text) {
$.post(ext.contextPath + '/document/editDataFile.do', { id: id, text: text, doctype: '${Science_File}', companyId: companyId }, function (data) {
$("#faultBox").html(data);
});
};
var addStyleFun = function () {
$('#tree').css("text-align", "center");
$('#tree').css("line-height", "550px");
$('#tree').css("color", "#9FB6CD");
$('#tree').html('请您先新增节点!');
$('#faultBox').css("background-color", "#FFFFFF");
$('#faultBox').css("text-align", "center");
$('#faultBox').html("暂无资料!");
}
var deleteBoxStyleFun = function () {
$('#faultBox').html("");
$('#faultBox').css("background-color", "");
$('#faultBox').css("text-align", "");
}
var deleteTreeStyleFun = function () {
$('#tree').html('');
$('#tree').css("text-align", "");
$('#tree').css("line-height", "");
$('#tree').css("color", "");
}
var initFun = function () {
$.post(ext.contextPath + '/document/getDataJson.do', { doctype: '${Science_File}', docname: $("#search_name").val(), companyId: companyId ,id:'${param.id}'}, function (data) {
if (data.length == 0) {
$('#tree').treeview({ data: data });
addStyleFun();
} else {
deleteTreeStyleFun();
deleteBoxStyleFun();
$('#tree').treeview({ data: data });
editFileFun(data[0].id, data[0].text);
}
console.info(data.length)
$('#tree').on('nodeSelected', function (event, data) {
editFileFun(data.id, data.text);
});
}, 'json');
};
var conpanyId = "${param.unitId}";
$(function () {
var flag = IsApp();
if (flag == true) {
} else {
$(".main-header").show();
$(".content-header").show();
$(".main-footer").show();
}
if(unitId==null || unitId==undefined || unitId==''){
unitId = conpanyId;
}
//简易公司combotree
$.post(ext.contextPath + "/user/showCompanySelectTree.do", {}, function (data) {
$('#companySelectTree').html(data);
});
//initFun();
//jquery html()方法加载导致box无法执行boxwidget(),手动初始化
$('#searchBox').boxWidget();
$('#switchBtn').bootstrapSwitch({
onText: '是',
offText: '否',
size: "small",
onSwitchChange: function (event, state) {
if (state) {
$("#files").show();
searchFileFun();
$("#nodes").hide();
} else {
$("#nodes").show();
$("#files").hide();
}
}
})
$("#file_search").hide();
$("#files").hide();
});
var dosearch = function () {
$("#faultBox").html("");
initFun();
searchFileFun();
};
</script>
</head>
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
<div class="wrapper">
<!-- 引用top -->
<%-- <jsp:include page="/jsp/top.jsp"></jsp:include> --%>
<!-- 菜单栏 -->
<%-- <jsp:include page="/jsp/left.jsp"></jsp:include> --%>
<div class="content-wrapper">
<!-- Main content -->
<section class="content container-fluid">
<div id="mainAlertdiv"></div>
<div id="subDiv"></div>
<div id="doc4SelectDiv"></div>
<div id="fileInputDiv"></div>
<div id="equ4SelectDiv"></div>
<div id="equ4SelectDiv2"></div>
<div class="row form-inline">
<div class="col-md-3" id="companySelectTree"></div>
<div class="col-md-3 pull-right">
<div class="switch" data-on="primary" data-off="info" text-align="right" align="right">
<label class="control-label">全局检索</label>
<input id="switchBtn" type="checkbox" />
</div>
</div>
<!-- <div id="file_search" class="col-md-6 input-group input-group-sm pull-right" style="width:300px;">
<input type="text" id="search_name" name="search_name" autocomplete="off" style="height:35px" class="form-control pull-right" placeholder="资料名称...">
<div class="input-group-btn">
<button class="btn btn-default" style="height:35px" onclick="dosearch();">资料检索<i class="fa fa-search"></i></button>
</div>
</div> -->
</div>
<div class="row" id="nodes">
<div class="col-md-2">
<div>
<security:authorize buttonUrl="document/add.do">
<button type="button" class="btn btn-default btn-sm" data-toggle="tooltip" onclick="addFun();"><i
class="fa fa-plus"></i>新增节点</button>
</security:authorize>
<security:authorize buttonUrl="document/delete.do">
<button type="button" class="btn btn-default btn-sm" data-toggle="tooltip" onclick="deleteFun();"><i
class="fa fa-trash-o"></i> 删除节点</button>
</security:authorize>
<security:authorize buttonUrl="document/edit.do">
<button type="button" class="btn btn-default btn-sm" data-toggle="tooltip" onclick="editFun();"><i
class="fa fa-edit"></i> 编辑节点</button>
</security:authorize>
</div>
<div class="input-group input-group-sm" style="padding-top:5px;padding-bottom:3px">
<input type="text" id="search_name" name="search_name" autocomplete="off" style="height:35px"
class="form-control pull-right" placeholder="节点名称...">
<div class="input-group-btn">
<button class="btn btn-default" style="height:35px" onclick="dosearch();"><i
class="fa fa-search"></i></button>
</div>
</div>
<div class="box box-solid">
<!-- <div class="box-header with-border" style="height:100px;">
<h3 class="box-title"></h3>
<div class="box-tools">
</div>
</div> -->
<div class="box-body no-padding">
<div id="tree" style="height:550px;overflow:auto;"></div>
</div>
<!-- /.box-body -->
</div>
</div>
<div class="col-md-10" id="faultBox">
</div>
</div>
<!-- 全局搜索资料显示 -->
<div class="row" id="files">
<div class="col-md-12" id="fileList">
</div>
</div>
</section>
<!-- /.content -->
</div>
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include> --%>
<%-- <jsp:include page="/jsp/side.jsp"></jsp:include> --%>
</div>
</body>
<!-- bootstrap switch -->
<link rel="stylesheet"
href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css" />
<script type="text/javascript"
src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js"
charset="utf-8"></script>
</html>