KnowledgeShare.jsp 8.81 KB
Newer Older
afe's avatar
afe committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>知识共享</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">

  </head>
  
  
<body>
 
	<div>
		<div class="container">
			<ol class="breadcrumb">
				<li><a href="${ctx}/index">首页</a></li>
				<li>即席查询</li>
				<li class="active">知识共享</li>
			</ol>
		</div>
	</div>
 
 	<div id="main-container main-tab-container">
		<div id="content" class="container">
			<div class="tab-bar-bt">
				<ul class="nav nav-tabs">
					<li class="active"><a id="a_home" href="#home" data-toggle="tab">知识结果查询</a></li>
				</ul>
			</div>
			<div class="section">
				<div class="tab-content">

					<div class="tab-pane fade in active" id="home">
						<div class="row me-row">

							<div id="slidePushMenus2" class="cbp-spmenu-push">

								<div class="slideMenu" id="cbp-spmenu-s2" style="">
									<div class="form">
										<tags:ZSGX_KnowledgeSourceTag/>
										<tags:ZSGX_KnowledgeTypeTag/>
										<tags:ZSGX_ProvinceTag/>
										<tags:ZSGX_KeywordSearch/>
										<button id="submit" class="btn btn-primary" onclick="knowledgeSubmit()">提交</button>
										<button id="disable" class="btn btn-warning"	onclick="knowledgeReset()">重置</button>
									</div>
								</div>

								<div class="main col-xs-12">
									<div id="mainm2" class="mainm" ></div>

									<div class="content clearfix">
										<div class="block clearfix">
											<button id="showLeftPush2" class="menu-trigger btn btn-default" onclick="toggleMenu('slidePushMenus2')"> 
												<span class="glyphicon glyphicon-list"></span>
											</button>
											<div class="slide-menu-tags">
												<span id="ContentTag" class="label label-info" data-placement="bottom" ></span>
												<span id="KnowledgeSourceTag" class="label label-info" data-placement="bottom" ></span>
												<span id="KnowledgeTypeTag" class="label label-info" data-placement="bottom" ></span>
												<span id="ProvinceTag" class="label label-info" data-placement="bottom" >全国</span> 
											</div>
											<div class="bt-list-import">
												<a href="#" id="uploadExcel" class=""> <span
													class="glyphicon glyphicon-import"></span> <span
													class="glyphicon-class">导出Excel</span> </a>
											</div>
										</div>

										<div class="row">
											<div class="col-xs-12">
												<div class="table-header">
												知识查询结果
												<shiro:hasAnyRoles name="admin,dataAnalysis,businessAnalysis">
													<div id="time_div" style="top: -6px;float: right;height: 0px;position: relative;">
														<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" id="updateKnowledge" disabled>修改知识记录</button>
														<button class="btn-sm btn btn-warning btn-sm btn-group btn-group-cog" id="deleteKnowledge" disabled>删除知识记录</button> 
														<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" id="createKnowledge">新建知识记录</button>
													</div>
												 </shiro:hasAnyRoles>	
													
												</div>
	                                             <table id="knowledgeResultTable" class="table table-hover table-striped">
	                                             </table>
	                                      		<input type="hidden" id="knowledgeResult" name="knowledgeResult" value='${knowledgeList}' /> 
											
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<form action="#" method="get" id="listForm">
						
				</form>
				<form action="#" method="post" id="downFileForm"></form>
				</div>
			</div>
		</div>
	</div>
<script type="text/javascript" src="${ctx}/static/js/knowledgeTable.js"></script>

<script type="text/javascript">
	knowledgeTable();
	
	var receiveContent = "${indexContent}";
	var receiveKnowledgeSource = "${indexKnowledgeSource}";
	var receiveKnowledgeType = "${indexKnowledgeType}";
	var receiveProvince = "${indexProvince}";
	
	//下载文件
	function downFile(fileSite,createTime){
	    //alert(createTime);
	    var filepath=formatDate(createTime,"yyyyMMddHHssmm");
		var uploadFile = "${ctx}/DataManage/KnowledgeShare/downFile?fileSite="+encodeURI(encodeURI(fileSite))+"&createTime="+filepath;
		var downFileForm=$("#downFileForm");
		downFileForm.attr("action",uploadFile);
		downFileForm.submit();
		downFileForm.attr("action","#"); 
	}
	
	$("#createKnowledge").click(function(){
		$.dialog({
				title: "提醒",
				content:"确定新建知识记录?",
				ok: function(){location.href="${ctx}/DataManage/KnowledgeCreate";},
				okValue:"确定",
				cancel: function(){},
				cancelValue:"取消",
				lock:true
				});
	});
	
	
	//筛选项确定按钮
	function knowledgeSubmit(){
		var content = getContent();
		var knowledgeSource = getKnowledgeSourceValue();
		var knowledgeType = getKnowledgeTypeValue();
		var province = getProvinceValue();
		receiveContent = content;
		receiveKnowledgeSource = knowledgeSource;
		receiveKnowledgeType = knowledgeType;
		receiveProvince = province;
		$.ajax({
				    type : 'GET',
					contentType : 'application/json',
					url: "${ctx}/DataManage/KnowledgeShare/knowledgeTableChange?content="+encodeURI(encodeURI(content))+"&knowledgeSource="+knowledgeSource+"&knowledgeType="+knowledgeType+"&province="+province,
					dataType : 'text',
					async: false,
					beforeSend: function(data) {
					},
					success: function(data) {
	                   $("#knowledgeResult").val(data);
	                   knowledgeTable();
	                   knowledgeTableIds=[];
	                   $("#updateKnowledge").attr("disabled", true);
	                   $("#deleteKnowledge").attr("disabled", true);
					   toggleMenu('slidePushMenus2');//隐藏筛选项
				       updateTag(true);
					}
				});	
	};
	function updateTag(isLable){
		if(isLable){
			if(getContent()!=""){
				$("#ContentTag").text("知识内容").attr('data-original-title', getContent()).tooltip();
			}else{
				$("#ContentTag").empty();
			}
			if(getKnowledgeSourceValue()!=""){
				$("#KnowledgeSourceTag").text("知识来源").attr('data-original-title', getknowledgeSourceTitle()).tooltip();
			}else{
				$("#KnowledgeSourceTag").empty();
			}
			if(getKnowledgeTypeValue()!=""){
				$("#KnowledgeTypeTag").text("知识类型").attr('data-original-title', getKnowledgeTypeTitle()).tooltip();
			}else{
				$("#KnowledgeTypeTag").empty();
			}
				$("#ProvinceTag").text(getProvinceTitle());
			
		}
	}
	
	//筛选项重置按钮
	function knowledgeReset(){
		contentReset();
		knowledgeSourceReset();
		knowledgeTypeReset();
		provinceReset();
	};
	
	
	//更新知识记录按钮点击
	$("#updateKnowledge").click(function(){
		
		 $.dialog({
			title: "提醒",
			content:"确定更新知识记录?",
			ok: function(){window.location.href = "${ctx}/DataManage/KnowledgeUpdate?updateId="+knowledgeTableIds+"&content="+encodeURI(encodeURI(receiveContent))+"&knowledgeSource="+receiveKnowledgeSource+"&knowledgeType="+receiveKnowledgeType+"&province="+receiveProvince;},
			okValue:"确定",
			cancel: function(){},
			cancelValue:"取消",
			lock:true
			}); 
	});
	
	//删除知识库按钮点击
	$("#deleteKnowledge").click(function(){
		
		$.dialog({
			title: "提醒",
			content:"确定删除知识记录?",
			ok: function(){
				$.ajax({
				    type : 'GET',
					contentType : 'application/json',
					url: "${ctx}/DataManage/KnowledgeShare/deleteKnowledge?updateId="+knowledgeTableIds,
					dataType : 'text',
					async: false,
					beforeSend: function(data) { 
					},
					success: function(data) {
	                   $("#knowledgeResult").val(data);
	                   knowledgeTable();
	                   knowledgeTableIds=[];
	                   $("#updateKnowledge").attr("disabled", true);
	                   $("#deleteKnowledge").attr("disabled", true);
					}
				});	
			},
			okValue:"确定",
			cancel: function(){},
			cancelValue:"取消",
			lock:true
			}); 
	});
	
	//导出EXCEL
	$("#uploadExcel").click(function(){
		var listForm=$("#listForm");
           	listForm.attr("method","post");
		   	listForm.attr("action","${ctx}/DataManage/KnowledgeShare/uploadExcel");
		   	listForm.submit();
		   	listForm.attr("action","#");
	});
	
</script>

</body>
</html>