Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/document/manageDataTree.jsp
2026-01-16 14:13:44 +08:00

273 lines
11 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@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("Manage_File", Data.Manage_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";
console.info(node)
if(node!=null && node.length>0){
pid=node[0].id;
}
$.post(ext.contextPath + '/document/doaddData.do', {pid:pid,doctype:'${Manage_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;
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');
}
}
//编辑节点基本信息
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:'${Manage_File}',companyId:companyId} , function(data) {
$("#faultBox").html(data);
});
}else{
showAlert('d','请先选择编辑的节点','mainAlertdiv');
}
};
//全局搜索资料
var searchFileFun = function() {
$.post(ext.contextPath + '/document/showSearchFile.do', {companyId:companyId,doctype:'${Manage_File}',} , function(data) {
$("#fileList").html(data);
});
};
//编辑文件,点击节点后进入文件上传下载界面
var editFileFun = function(id,text) {
$.post(ext.contextPath + '/document/editDataFile.do', {id:id,text:text,doctype:'${Manage_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:'${Manage_File}',docname:$("#search_name").val(),companyId:companyId}, 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 = "";
$(function() {
var flag = IsApp();
if (flag==true){
}else{
$(".main-header").show();
$(".content-header").show();
$(".main-footer").show();
}
//简易公司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">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id ="head_title"></h1>
<ol class="breadcrumb">
<li><a id ='head_firstlevel' href="#"><i class="fa fa-dashboard"></i> </a></li>
<!-- <li class="active">Here</li> -->
</ol>
</section>
<!-- 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 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">
<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-3">
<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>
<button type="button" class="btn btn-default btn-sm" data-toggle="tooltip" onclick="deleteFun();"><i class="fa fa-trash-o"></i> 删除节点</button>
<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-9" 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>