<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@ include file="/include/header2.jsp"%>
<%@ include file="/include/taglib.jsp" %>
<link rel="stylesheet" type="text/css" href="${ctx}/css/newCss/dialog.css">
<title>疑案管理</title>
<style>
	.risk_content ul em {
   		color: #adbfd8;
	}
	.modal-body {
	    padding: 0px;
	}
	/*body.bg1 {
	    background-image: url(../images/newImg/bg.png);
	}*/
	.modal-header {
	    padding: 5px 10px;
	}
	.input_txt{
		width: 200px
	}
	.risk_content .p {
	    float: left;
	    width: 6em;
	    font-weight: bold;
	}
	.risk_content .p_con{
		margin-left: 6em;
	}
	.risk_content li {
	    overflow: hidden;
	    padding: 10px 0px;
	}
	.risk_content li span {
	    width: 30%;
    	display: inline-block;
	}
	.myPageUl{
		text-align: center;
	}
</style>
</head>
<body class="bg1">
	<input id="userCode" type="hidden" value="${userCode}"/>
	<input id="userName" type="hidden" value="${userName}"/>
	<input id="userInfo" type="hidden" value='${userInfo}'/>
	<!--头部-->
	<div class="headCon">
		<jsp:include page="/WEB-INF/jsp/top2.jsp">
			<jsp:param name="index" value="疑案管理" />
		</jsp:include>
	</div>
	<div class="clear"></div>
	<div class="container_fluid">
		<!--左侧菜单-->
		<div class="searchCon left_menu managerLeft">
			<jsp:include page="/include/personalLeft.jsp">
				<jsp:param name="index" value="风险数据查询" />
			</jsp:include>
		</div>
		<!--主要内容-->
		<div class="resultCon" style="margin-left: 255px;position:relative;">
			<!--输入框查询的内容-->	
			<div class="reSearch">
				<div class="p_bar" style="border-bottom: 1px dashed #afb4bb;">您当前的位置：风险数据查询</div>
				<div class="row">
					<div class="col-md-12">
						<div class="search-group">
						    <input type="text" class="input_txt" id="SearchInput" name="name" placeholder="请输查询内容..." style="width: 430px ;margin-top:2px;float: left;" />
						    <span style="float: left;margin-left:10px;margin-bottom: 10px;">
							    <button class="btn btn-primary" id="searchBtn"><span class="glyphicon glyphicon-search" aria-hidden="ture"></span>查询</button>
							</span>
						</div>
						<div><a herf="#"></a></div>
					</div>
				</div>
					<hna:permission privilege="sysRisk.template">
				<div style="overflow:hidden;">
					<div class="search-group" style="float: right;margin-right:20px;margin-bottom: 10px;">
					<!-- 暂时隐去导出按钮
						<span>
							<button class="btn btn-primary" id="exportBtn"><span class="glyphicon glyphicon-export" aria-hidden="ture"></span>导出</button>
						</span>
					 -->
						<span>
							<button class="btn btn-primary" id="importModelBtn"><span class="glyphicon glyphicon-import" aria-hidden="ture"></span>导入模板下载</button>
						</span>
						<span>
							<button class="btn btn-primary" id="importBtn"><span class="glyphicon glyphicon-file" aria-hidden="ture"></span><span class="importBtnText">风险信息导入</span></button>
							<input type="file" id="importBtnCon" name="markFile" style="display:none;"/>
						</span>
					</div>
				</div>
					</hna:permission>
			</div>	
			<!--风险查询的内容-->	
			<div class="clear"></div><!-- 清除浮动 -->
			<div class="resultTable" style="width: 99%; padding: 10px;border-radius: 5px;position:relative;"><!-- background-color: #f2f6ff; -->
				<div id="branchMoney" class="riskChart" style="width: 49%; height: 500px; display:none;"></div><!-- float: left; -->
				<div id="repairMoney" class="riskChart" style="width: 50%; height: 500px;margin-left:20%;"></div><!-- float: right; -->
	        	<div class="riskSearchResult" id="search_content" style="display: none;">
	        		<ul class="search_result" style="min-height:400px;">
	        			<li>
			        		<p style="margin: 10px 0 2px 0;">
			        			<u><a id="ResultTitle" href="#" style="color: white; font-size:18px;">标注金额XXXX</a></u>
			        		</p>
			        		<p style="margin: 0;">报案号：123456789；<em style="color:red;">标注金额:XXXX</em>；姓名：小明</p>	
		        		</li>	
		        	</ul>		
	        		<ul class="pagination" style="margin: 20px 0 0 0;">
						<li><a href="#">&laquo;</a></li>
						<li class="active"><a href="#">1</a></li>
						<li><a href="#">2</a></li>
						<li><a href="#">3</a></li>
						<li><a href="#">4</a></li>
						<li><a href="#">5</a></li>
						<li><a href="#">&raquo;</a></li>
					</ul>
				</div>
				<div class="riskDitail" style="display: none;">
					<div style="overflow: hidden;">
						<p style="float: left; font-size: 16px;">案件详情</p>
						<span style="float: right;">
							<button class="btn btn-primary" id="Back">返回</button>
							<button class="btn btn-primary" id="AtlasShow" data-toggle="modal" data-target="#myModal">风险图谱</button>
						</span>
					</div>
					<div class="risk_content">
						<ul>
							<li>
								<div class="p">案件信息</div>
								<div class="p_con"><span>案件号：C440300VEH16072661</span></div>
							</li>
							<li>
								<div class="p">人员信息</div>
								<div class="p_con"><span>姓名：李四</span><span>证件号：231004197302260723</span><span>姓名：李四</span><span>证件号：231004197302260723</span><span>姓名：李四</span><span>证件号：231004197302260723</span><span>姓名：李四</span><span>证件号：231004197302260723</span><span>姓名：李四</span><span>证件号：231004197302260723</span><span>姓名：李四</span><span>证件号：231004197302260723</span></div>
							</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--图谱显示-->	
	<!-- <div class="modal" id="graphShow" hidden>
		<iframe src="${ctx}/sysRisk/riskGraph.do" width="100%" height="500px"></iframe>
	</div> -->
	<!-- 模态框（Modal）,正在导入 -->
	<div id="importModal" style="width: 100%;position: absolute;top: 0;bottom: 0;z-index: 999999999;background-color: rgba(0,0,0,0.7);color:#eee;font-size: 32px;display: none;align-items: center;justify-content: center;">正在导入...</div>

	<!-- 模态框（Modal） -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog" role="document" style="width:90%;">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
					&times;
					</button>
					<h4 class="modal-title" id="myModalLabel">
					风险图谱
					</h4>
				</div>
				<div class="modal-body">
					<!-- <iframe src="${ctx}/sysRisk/riskGraph.do" width="100%" height="700px"></iframe> -->
				</div>
				
			</div><!-- /.modal-content -->
		</div><!-- /.modal -->
	</div>

	<script src="${ctx}/js/lib/jquery-1.11.1.min.js"></script>
	<script src="${ctx}/js/lib/echarts.min.js"></script>
	<script src="${ctx}/js/lib/core.js"></script>
	<script src="${ctx}/component/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
	<script src="${ctx}/js/lib/perfect-scrollbar.jquery.js"></script>
	<script src="${ctx}/js/lib/jquery.ajaxfileupload.js"></script>
	<script>
		var sysRoleDialog;
		var markMess='',checked_arr=[];
		$(function() {
			
			/*查询按钮*/
			var currentPage;
			var pageCount;
			$("#searchBtn").click(function(){
				$("#search_content").html('');
				$(".riskChart").hide();
				$(".riskDitail").hide();
				$("#graphShow").hide();
				$(".riskSearchResult").show(500);
				var condition=$("#SearchInput").val();
				$.ajax({
					type:"POST",
					url:"${ctx}/sysRisk/ajaxPage.do",
					data:{condition:condition},
					success:function(result){
						if(result.status=="error"){
							alert(result.mess);
							return false;
						}else{
							console.log(result);
							currentPage=result.currentPage;
							pageCount=result.pageCount;
							var str=getSearchRe(result);
							$("#search_content").html(str);
							$(".resultTable").perfectScrollbar("update");
							$(".resultTable").scrollTop(0);
						}
					},
					error:function(){
						alert("失败");
					}
				});
			});
			/*翻页*/
			$("#search_content").delegate(".pagination li a","click",function(){
				var myCurrentPage=Number($(".myPageUl li.active a").text());
				var page = $(this).text();
				if(page=="上一页"){
					if(myCurrentPage<=1){
						return false;
					}else{
						page=currentPage-1;
					}
				}
				if(page=="下一页"){
					if(myCurrentPage>=pageCount){
						return false;
					}else{
						page=currentPage+1;
					}
				}
				if(page=="首页"){
					if(myCurrentPage==1){
						return false;
					}else{
						page=1;
					}
				}
				if(page=="尾页"){
					if(myCurrentPage==pageCount){
						return false;
					}else{
						page=pageCount;
					}
				}
				/*if(myCurrentPage<=1){
					if(page=="上一页"){
						return false;
					}
				}else if(myCurrentPage>=pageCount){
					if(page=="下一页"){
						return false;
					}
				}
				if(page=="上一页"){
					page=currentPage-1;
				}else if(page=="下一页"){
					page=currentPage+1;
				}*/

				$("#search_content").html('');
				var condition=$("#SearchInput").val();
				$.ajax({
					type:"POST",
					url:"${ctx}/sysRisk/ajaxPage.do",
					data:{condition:condition,page:page},
					success:function(result){
						console.log(result);
						var str=getSearchRe(result);
						currentPage=result.currentPage;
						$("#search_content").html(str);
						$(".resultTable").perfectScrollbar("update");
						$(".resultTable").scrollTop(0);
					},
					error:function(){
						alert("失败");
					}
				});
			})
			
			$("#search_content").delegate(".go","click",function(){
				var myCurrentPage=Number($(".myPageUl li.active a").text());
				var page = $(this).parent().parent().find(".input_txt").val();
				if(isNaN(page)){
					return false;
				}
				if(page==myCurrentPage||page>pageCount||page<=0){
					return false;
				}
				$("#search_content").html('');
					var condition=$("#SearchInput").val();
					$.ajax({
						type:"POST",
						url:"${ctx}/sysRisk/ajaxPage.do",
						data:{condition:condition,page:page},
						success:function(result){
							console.log(result);
							var str=getSearchRe(result);
							currentPage=result.currentPage;
							$("#search_content").html(str);
							$(".resultTable").perfectScrollbar("update");
							$(".resultTable").scrollTop(0);
						},
						error:function(){
							alert("失败");
						}
					});
				})
			

			//点击列表到详情
			$("#search_content").delegate(".ResultTitle","click",function(){
				$(".riskChart").hide();
				$(".riskSearchResult").hide();
				$(".riskDitail").fadeIn(500);
				$("#graphShow").hide();
				$(".risk_content").html('');
				var caseName=$(this).text();
				$.ajax({
					type:"POST",
					url:"${ctx}/sysRisk/view.do",
					data:{notificationNo:caseName},
					success:function(result){
						if(typeof(result)=='string'){
							result=JSON.parse(result);
						}
						if(result.status=="err"){
							alert(result.mess);
							return false;
						}
						console.log(result);
						var str=getDetialRe(result);
						$(".risk_content").html(str);
					},
					error:function(){
						alert("请求失败！");
					}
				});				
			})

			//点击返回
			$("#Back").click(function(){
				$(".riskChart").hide();
				$(".riskDitail").hide();
				$(".riskSearchResult").fadeIn(500);
				$("#graphShow").hide();
				
			})
			//图谱显示
			$("#AtlasShow").click(function(){
				//获取页面的高
				var alertHeight=$("body").height()*0.9;
				var _nodeId=$("#caseName").data("id");
				var _caseName=$("#caseName").text().trim();
				var ht='<iframe src="${ctx}/sysRisk/riskGraph.do" width="100%" height="'+alertHeight+'px"></iframe>'
				$(".modal-body").html(ht);
			})

			/*拼显示内容的字符串*/
			function getSearchRe(data){
				var str='<ul class="search_result" style="min-height:400px;">';
					if(data.dataList.length>0){
						for(var i=0;i<data.dataList.length;i++){
						var item=data.dataList[i];
						var flagName="";
						if(item.flag=="0"){
							flagName="系列案名称："+item.flagValue+"；";
						}else if(item.flag=="1"){
							flagName="人员名称："+item.flagValue+"；";
						}else{
							flagName="";
						}
						str+='<li>'
				        		+'<p style="margin: 10px 0 2px 0;">'
				        			+'<u><a class="ResultTitle" href="#" style="color: white; font-size:18px;">'+item.notificationNo+'</a></u>&nbsp;&nbsp;&nbsp;匹配度'+item.score
				        		+'</p>'
				        		+'<p style="margin: 0;">报案号：'+item.notificationNo+'；案件金额:'+item.claimAmount+'；检出金额:'+item.involvedAmount+'；'
				        		+'整案减损金额：'+item.caseInvolvedAmount+'；姓名：'+item.name+'；联系方式：'+item.phoneNumber+'；证件号：'+item.certificateNo+'；机构名称：'+item.underWritingBranchName+'；'
				        		+'机构号码：'+item.underWritingBranchCode+'；车牌号码：'+item.targetCarPlateNo+'；车架号码：'+item.targetCarVIN+'；'
				        		+'案件定性：'+item.caseNature+'；修理厂名称：'+item.garage+'；车商名称：'+item.supplierName+'；调查报告：'+item.investigationReport+'；'
				        		+flagName+'备注：'+item.remark+'；</p>'	
			        		+'</li>';
					}
				}else{
					str+='<p style="margin: 0;">暂无数据</p>';
				}
				
				str+='</ul><div class="myPageUl"><ul class="pagination" style="margin: 20px 0 0 0;"><li><a href="#">首页</a></li><li><a href="#">上一页</a></li>';
				var myPageCount=[];
				if(data.currentPage<3){
					myPageCount=[1,2,3,4,5];
				}else{
					var p=data.currentPage;
					if(data.currentPage>data.pageCount-3){
						myPageCount=[data.pageCount-4,data.pageCount-3,data.pageCount-2,data.pageCount-1,data.pageCount];
					}else{
						myPageCount=[p-2,p-1,p,p+1,p+2];
					}
				}
				for(var k=0;k<myPageCount.length&&k<data.pageCount;k++){
					if(myPageCount[k]==data.currentPage){
						str+='<li class="active"><a href="#">'+myPageCount[k]+'</a></li>';
					}else{
						str+='<li><a href="#">'+myPageCount[k]+'</a></li>';
					}
					
				}
				str+='<li><a href="#">下一页</a></li><li><a href="#">尾页</a></li></ul></div>';
				str+='<div class="pageGo">共<span>'+data.rowCount+'</span>条 跳转到 <input  type="number" value="1" data-target="input" class="input_txt" style="width:80px;"/><a style="margin-left:10px;" href="#" data-role="go" class="go">GO</a></div>'
				return str;
			}
			/*拼详情是字符串*/
			function getDetialRe(data){
				var str='<ul>';
				for(var i=0;i<data.length;i++){
					if(data[i].caseInfoCn=="案件信息"){
						var flagName="";
						if(data[i].flag=="0"){
							flagName='<span>系列案名称：<em>'+data[i].flagValue+'</em></span>';
						}else if(data[i].flag=="1"){
							flagName='<span>人员名称：<em>'+data[i].flagValue+'</em></span>';
						}else{
							flagName="";
						}
						str+='<li>'
								+'<div class="p">'+data[i].caseInfoCn+'</div>'
								+'<div class="p_con"><span id="caseName" data-id="'+data[i].nodeId+'">案件号：<em><b>'+data[i].notificationNo+'</b></em></span><span>报案时间：<em>'+data[i].notificationDate+'</em></span><span>标注日期：<em>'+data[i].markTime+'</em></span><span>案件金额：<em>'+data[i].claimAmount+'</em></span><span>检出金额：<em>'+data[i].involvedAmount+'</em></span><span>整案减损金额：<em>'+data[i].caseInvolvedAmount+'</em></span><span>入库时间：<em>'+data[i].inRiskTime+'</em></span><span>机构名称：<em>'+data[i].underWritingBranchName+'</em></span><span>机构号码：<em>'+data[i].underWritingBranchCode+'</em></span><span>修理厂名称：<em>'+data[i].garage+'</em></span><span>车商名称：<em>'+data[i].supplierName+'</em></span><span>调查报告：<em>'+data[i].investigationReport+'</em></span>'
								+'<span>出险分公司代码：<em>'+data[i].accidentBranchCode+'</em></span><span>出险分公司：<em>'+data[i].accidentBranchName+'</em></span><span>出险原因：<em>'+data[i].accidentCause+'</em></span><span>出险时间：<em>'+data[i].accidentDate+'</em></span><span>标的车驾驶员姓名：<em>'+data[i].accidentDriverName+'</em></span><span>事故信息中录入的标的车驾驶员电话：<em>'+data[i].accidentDriverTel+'</em></span><span>报案信息中95500记录的标的车驾驶员联系电话：<em>'+data[i].accidentDriverTel2+'</em></span><span>出险地址：<em>'+data[i].accidentLocation+'</em></span><span>出险情况：<em>'+data[i].accidentStatement+'</em></span><span>估损分公司：<em>'+data[i].assessmentBranchName+'</em></span><span>估损员：<em>'+data[i].assessmentStaffName+'</em></span><span>分公司：<em>'+data[i].branchCode+'</em></span><span>案件唯一标识：<em>'+data[i].casefolderId+'</em></span><span>被保险人姓名：<em>'+data[i].insurantName+'</em></span><span>是否有人伤：<em>'+data[i].isInjuryinvolved+'</em></span><span>报案人姓名：<em>'+data[i].notificationName+'</em></span><span>报案电话：<em>'+data[i].notificationTel+'</em></span><span>查勘分公司：<em>'+data[i].surveyorBranchName+'</em></span><span>查勘员名字：<em>'+data[i].surveyorName+'</em></span><span>车牌号码：<em>'+data[i].targetCarPlateNo+'</em></span><span>车架号码：<em>'+data[i].targetCarVIN+'</em></span><span>伤者姓名：<em>'+data[i].theinjuredName+'</em></span><span>伤者电话：<em>'+data[i].theinjuredTel+'</em></span><span>三者车驾驶员姓名：<em>'+data[i].thirdPartyAccidentDriverName+'</em></span><span>三者车驾驶员电话：<em>'+data[i].thirdPartyAccidentDriverTel+'</em></span><span>行驶证车主姓名：<em>'+data[i].venicleownerName+'</em></span>'+flagName+'</div>'
							+'</li>';
					}else if(data[i].personInfoCn=="人员信息"){
						str+='<li style="">'
								+'<div class="p">'+data[i].personInfoCn+'</div>'
								+'<div class="p_con"><span>姓名：<em>'+data[i].personName+'</em></span><span>联系地址：<em>'+data[i].personAddress+'</em></span><span>身份证号码：<em>'+data[i].personCertificateNo+'</em></span><span>电子邮件：<em>'+data[i].personEmail+'</em></span><span>联系方式：<em>'+data[i].personTel+'</em></span></div>'
							_+'</li>';
					}else if(data[i].carInfoCn=="车辆信息"){
						str+='<li>'
								+'<div class="p">'+data[i].carInfoCn+'</div>'
								+'<div class="p_con"><span>事故车目前位置：<em>'+data[i].accidentVehicleAccidentVehicleLocation+'</em></span><span>品牌名称：<em>'+data[i].accidentVehicleBrandName+'</em></span><span>发动机号：<em>'+data[i].accidentVehicleEngineNo+'</em></span><span>车型名称：<em>'+data[i].accidentVehicleMoldName+'</em></span><span>车牌号码：<em>'+data[i].accidentVehiclePlateNo+'</em></span><span>历史车牌号码：<em>'+data[i].accidentVehiclePlateNoHistory+'</em></span><span>新车购置价：<em>'+data[i].accidentVehiclePurchasePirce+'</em></span><span>车架号：<em>'+data[i].accidentVehicleVIN+'</em></span><span>车组名称：<em>'+data[i].accidentVehicleVehicleGroupName+'</em></span><span>车辆登记日期：<em>'+data[i].accidentVehicleVehicleRegisterDate+'</em></span></div>'
							+'</li>';
					}else if(data[i].insuranceInfoCn=="保单信息"){
						str+='<li>'
								+'<div class="p">'+data[i].insuranceInfoCn+'</div>'
								+'<div class="p_con"><span>代理点代码：<em>'+data[i].insuranceProductAgentCode+'</em></span><span>代理点名字：<em>'+data[i].insuranceProductAgentName+'</em></span><span>分公司：<em>'+data[i].insuranceProductBranchName+'</em></span><span>起保日期：<em>'+data[i].insuranceProductEffectiveDate+'</em></span><span>终保日期：<em>'+data[i].insuranceProductExpireDate+'</em></span><span>经办人名字：<em>'+data[i].insuranceProductOperatorName+'</em></span><span>保单号：<em>'+data[i].insuranceProductPolicyNo+'</em></span><span>保单类型：<em>'+data[i].insuranceProductPolicyType+'</em></span></div>'
							+'</li>';
					}else if(data[i].settlementAcountInfoCn=="账户信息"){
						str+='<li>'
								+'<div class="p">'+data[i].settlementAcountInfoCn+'</div>'
								+'<div class="p_con"><span>账号：<em>'+data[i].settlementAccountAccountNo+'</em></span><span>证件号码：<em>'+data[i].settlementAccountCertificateNo+'</em></span><span>证件类型：<em>'+data[i].settlementAccountCertificateType+'</em></span><span>收款账号城市：<em>'+data[i].settlementAccountCityOfPayeeAccount+'</em></span><span>商业险支付金额合计：<em>'+data[i].settlementAccountCommercialActualAmount+'</em></span><span>交强险支付金额合计：<em>'+data[i].settlementAccountCtpactualAmount+'</em></span><span>备注：<em>'+data[i].settlementAccountMemo+'</em></span><span>银行名称：<em>'+data[i].settlementAccountNameOfBank+'</em></span><span>收款人开户行：<em>'+data[i].settlementAccountNameOfHeadBank+'</em></span><span>收款人姓名：<em>'+data[i].settlementAccountPayeeAccountName+'</em></span><span>收款人类别：<em>'+data[i].settlementAccountPayeeType+'</em></span><span>收款账号省份：<em>'+data[i].settlementAccountProvinceOfPayeeAccount+'</em></span></div>'
							+'</li>';
					}else if(data[i].telephoneCn=="电话号码"){
						str+='<li style="">'
								+'<div class="p">'+data[i].telephoneCn+'</div>'
								+'<div class="p_con"><span>电话号码：<em>'+data[i].telephoneTel+'</em></span></div>'
							_+'</li>';
					}else if(data[i].caseNatureCn=="案件定性"){
						str+='<li>'
								+'<div class="p">'+data[i].caseNatureCn+'</div>'
								+'<div class="p_con"><span>案件定性：<em>'+data[i].caseNature+'</em></span></div>'
							+'</li>';
					}else if(data[i].remarkCn=="备注"){
						str+='<li>'
								+'<div class="p">'+data[i].remarkCn+'</div>'
								+'<div class="p_con"><span>备注内容：<em>'+data[i].remark+'</em></span></div>'
							+'</li>';
					}
				}
				str+='</ul>';
				return str;
			}

			/*
			*画曲线图，分公司与涉及金额
			*2018-02-06
			*/
			var branchMoneyChart = echarts.init(document.getElementById("branchMoney"));
			var repairMoneyChart = echarts.init(document.getElementById("repairMoney"));//画条形图，维修厂与涉及金额

			/*var result ={
				title:{text: '分公司与涉及金额'},
				legend:["涉及金额"],
				x:["集团","上海运营中心","营运中心华南分中心","营运中心上海分中心","华南运营中心","集团东北审计部","产险总公司","江西分公司","aaa","在线公司未知机构"],
				y:{
					"涉及金额":[1098,980,1308,450,234,880,1000,4324,54346,3542]
				},
				col:["#C23531"]
			};*/
			$.ajax({
				type:"POST",
				url:"${ctx}/sysRisk/statisticsData.do",
				success:function(result){
					
					if(typeof(result.branch)=="string"){
				 		result.branch=JSON.parse(result.branch);
				 	}
				 	if(typeof(result.grage)=="string"){
				 		result.grage=JSON.parse(result.grage);
				 	}
					setbranchMoney(result.branch);
					setrepairMoney(result.grage);
				},
				error:function(){
					alert("失败");
				}
			});
			
			function setbranchMoney(result){				
				branchMoneyChart.setOption(getLineOption(result));
				branchMoneyChart.hideLoading();
			}
			//画条形图，维修厂与涉及金额

			//var repairMoneyChart = echarts.init(document.getElementById("repairMoney"));
			/*var result ={
				title:{text: '维修厂与涉及金额'},
				legend:["涉及金额"],
				x:["维修厂","上海维修厂","华南分中心维修厂","营运中心上海分中心","华南运营中心","集团东北审计部","产险总公司","江西分公司","aaa","在线公司未知机构"],
				y:{
					"涉及金额":[1098,980,1308,450,234,880,1000,4324,5434,3542]
				},
				data:[1098,980,1308,450,234,880,1000,4324,5434,3542]
			};*/
			//setrepairMoney(repairPic);
			function setrepairMoney(result){				
				repairMoneyChart.setOption(getbarOption(result));
				repairMoneyChart.hideLoading();
			}
		})

		/*
		 *  曲线图
		 *  function 主要用在风险库页面
		 *  @param data 画图需要的数据
		 */
		 function getLineOption(data){
			var option = {
			    title :[{
			    	text:data.title.text,
			    	x:'left',
			    	textStyle:{
			        	color:"#fff"
			        }
			    }],
			    tooltip : {
			        trigger: 'axis'
			    },
			    grid:[{
			    	top:60,
			    	width:'85%',
			    	bottom:100,
			    	right:50,
			    	containLabel:true
			    }],
			    legend: {
			    	data:data.legend,
			    	textStyle:{
			    		color:'#fff'
			    	}
			    },
			    calculable : true,
			    xAxis : [
			        {
			            type: 'category',
			            data: data.x,
			            boundaryGap:false,
				        axisTick:{show:true,inside:true},
						splitLine:{show:false},
						axisLine:{
							lineStyle:{
								color:"#ddd"
							}
						},
						axisLabel:{
							interval:0,
							rotate:45,
							textStyle:{color:"#ffffff",fontSize:8}
						},
						axisPointer:{
							show:true
						}
			        }
			    ],
			    yAxis : [
			        {
			            type : 'value',
			            name: '元',
			            axisLabel : {
			                formatter: '{value} ',
			                textStyle:{color:"#ffffff",fontSize:8}
			            },
			            splitLine:{
			            	show:false
			            },
			            axisLine:{
							lineStyle:{
								color:"#ddd"
							}
						}
			        }
			    ],
			    series : []
			};
			for(var i=0;i<data.legend.length;i++){
				option.series.push({
		            name:data.legend[i],
		            type:'line',
		            data:data.y[data.legend[i]],
		            markPoint : {
		                data : [
		                    {type : 'max', name: '最大值'},
		                    {type : 'min', name: '最小值'}
		                ]
		            },
		            markLine : {
		                data : [
		                    {type : 'average', name: '平均值'}
		                ]
		            },
		            lineStyle:{
		            	normal:{
		            		color:likeColor(i)
		            	}
		            },
		            itemStyle:{
		            	normal:{
		            		color:likeColor(i)
		            	}
		            },
		            areaStyle:{}
		            /*smooth:true	*/
		        });
			}
			return option;
		}

		/*
		 *  条形图
		 *  function 主要用在风险库页面
		 *  @param data 画图需要的数据
		 */
		function getbarOption(data){
			var option = {
			    title : [{
			        text: data.title.text,
			        x:'left',
			        textStyle:{
			        	color:"#fff",
			        }
			    }],
			    legend: [{
			        orient: 'horizontal',
			        data: data.x,
			    	textStyle:{
			    		color:"#fff"
			    	}
			    }],
			    tooltip: {
			        trigger: 'axis',
			        axisPointer: {
			            type: 'cross',
			            crossStyle: {
			                color: '#fff'
			            }
			        }
			    },
			    grid:[{
			    	top:60,
			    	width:'85%',
			    	bottom:100,
			    	right:10,
			    	containLabel:true
			    }],
			    xAxis: [
				        {
				        	type: 'value',
				        	boundaryGap:[0,0.01],
				            name: '元',
				            axisTick:{show:true,inside:true},
							splitLine:{show:false},
							axisLine:{
								lineStyle:{
									color:"#ddd"
								}
							},
							axisLabel:{
								interval:0,
								rotate:45,
								textStyle:{color:"#ffffff",fontSize:8}
							},
							axisPointer:{
								show:true
							}
				           /* type: 'category',
				            data: data.x,
					        axisTick:{show:true,inside:true},
							splitLine:{show:false},
							axisLine:{
								lineStyle:{
									color:"#ddd"
								}
							},
							axisLabel:{
								interval:0,
								rotate:45,
								textStyle:{color:"#ffffff",fontSize:8}
							},
							axisPointer:{
								show:true
							}*/
				        }
				    ],
				    yAxis: [
				        {  type: 'category',
				            data: data.x,
				            nameTextStyle: {
				            	color:"#ffffff"
				            },
				            axisTick:{show:false},
							splitLine:{
								show:false,
							},
							axisLine:{
								lineStyle:{
									color:"#ddd"
								}
							},
							axisLabel:{
								textStyle:{
									color:"#ffffff",
									fontSize:12
								}
							}
				        }
				    ],
				series : [{
					type:"bar",
					name:data.legend,
					data:data.y[data.legend[0]],
					itemStyle:{
			        	normal:{
			        		color: function(params){
							var colorlist=['rgb(243, 88, 51)','rgb(193,35,43)','rgb(181,195,52)','rgb(252,206,16)','rgb(39,114,123)','rgb(155,202,99)','rgb(254,168,145)','rgb(243,164,59)','#5e7e54','#e44f2f'];
							return colorlist[params.dataIndex];
						},
			        		opacity:0.9
			        	}
			        }
				}]
			};
			/*for(var i=0;i<data.legend.length;i++){
				option.series.push({
					type:"bar",
					name:data.legend[i],
					data:data.y[data.legend[i]],
					itemStyle:{
			        	normal:{
			        		color: likeColor(i),
			        		opacity:0.9
			        	}
			        }
				})
			}*/
			return option;
		}

		/*
		 *  堆积柱状图
		 *  function 主要用在风险库页面
		 *  @param data 画图需要的数据
		 *  Cumuli 中文意思是堆积，积累
		 */
 		function getCumuliOption(data){
 			var option = {
			    angleAxis:{
			    	type:'category',
			    	data:['周一','周二'],
			    	z:10
			    },
			    radiusAxis:{
			    },
			    polar:{
			    },
			    series:[
			    	{
			    		type:"bar",
			    		data:[1,2],
			    		coordinateSystem: 'polar',
			    		name: data.legend[0]
			    	}
			    ],
			    legend: {
			    	show:true,
			    	data:data.legend,
			    	textStyle:{
			    		color:'#fff'
			    	}
			    }
			};			
			return option;
 		}

		//画图时用的颜色
		function likeColor(i){
			var colorlist=['rgb(243, 88, 51)','rgb(243,164,59)','rgb(193,35,43)','rgb(181,195,52)','rgb(252,206,16)','rgb(39,114,123)','rgb(155,202,99)','rgb(254,168,145)','#5e7e54','#e44f2f'];
			return colorlist[i];
		}

		//控制窗口大小
	    $(function () {
			$(".resultCon").perfectScrollbar();
			$(".resultTable").perfectScrollbar();
			resize();
            $(window).resize(function(){
				resize();
			});
			
	    });
	    function resize(){
			//获取窗口高度
			var windowheight=$(window).height();
			var leftList = windowheight-40;
			$(".searchCon").css({"height":leftList+"px"});
			$(".resultCon").css({"height":leftList-12+"px"});
			$(".resultTable").css({"height":leftList-12-160+"px"});
			$(".resultCon").perfectScrollbar("update");
			$(".resultTable").perfectScrollbar("update");
		}
	    
		//导出用户信息
		$("#exportBtn").click(function(){
			//var deleteVal=$("[name='deleteFlag']").find("option:selected").val();
			var condition=$("#SearchInput").val();
			window.location.href="${ctx}/sysRisk/exportRiskInfo.do?condition="+condition;
		});
		//导入用户模板下载
		$("#importModelBtn").click(function(){
			window.location.href="${ctx}/sysRisk/downloadForRisk.do";
		});
		//批量用户导入
		$("#importBtn").click(function(){
			$("#importBtnCon").click();
		})
		$("#importBtnCon").ajaxfileupload({
		    action: '${ctx}/sysRisk/saveSysRiskByMany.do',
		    valid_extensions : ['xls','xlsx'],
		    params: {
				extra: 'markFile'
		    },				
		    onComplete: function(data,a,b,c) {
				if(data.status=="err"){
					alert(data.mess);
					$("#importBtn .importBtnText").text("批量用户导入");
					$("#importModal").css("display","none");
					return;
				}else{
					alert(data.mess);
					$("#importBtn .importBtnText").text("批量用户导入");
					$("#importModal").css("display","none");
				}
				var result=data;

				console.log(data);
				//alert(JSON.stringify(data));
		    },
		    onStart: function() {
				$("#importBtn .importBtnText").text("正在上传...");
				$("#importModal").css("display","flex");
				//if(weWantedTo) return false; // cancels upload
		    },
		    onCancel: function() {
				console.log('no file selected');
		    },
			errow:function(data){
				alert("上传失败");
			}
		});

	</script>
</body>
</html>