<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
		 <%@include file="../../../frame/assets/header-all.jsp"%>
		 <style type="text/css">
body{   overflow:hidden;
   }
		 li{margin: 0 30px;font-size: 13px;}
		 table{border:1px solid #e6e6e6;width:100%;}
		 tr{height:30px;}
		 tr,td{border:1px solid #e6e6e6;text-align:center;}
		 tr td:nth-child(odd){background-color:#eeeeee;text-align:center;width:16%;color:black;}
		 tr td:nth-child(even){color:black;}
		 .textbox {margin:0 !important;}
		 span.textbox:hover, span.combo:hover{border:0 !important;text-align: center;}
		  span.textbox{border:0 !important;}
		  .textbox-text{text-align:center !important;}
		  *{box-shadow:0px 0px 0px rgba(0, 0, 0, 0.075) !important;}
		  
			
			#pic{
				width: auto;
			    height: auto;
			    position: absolute;
			    top: 10%;
			    left: 24%;
			    z-index: 1;
			}
		 </style>
		
	</head>
	<body>
	
	<div style="padding:0 15px;">
		<div style="line-height:36px;height:36px;border-bottom:1px solid  #e6e6e6;">
			<ul style="display:flex;justify-content:space-between;'">
				<li style="margin-left:0 !important;">工单编号：<span style="color:#008000;" id="jobnum"></span></li>
				<!-- <li>故障类型：<span style="color:#a0d6a1;" id="faulttype"></span></li> -->
				<li>告警等级：<span style="color:#008000;" id="faultgradeMc"></span></li>
				<li>处理状态：<span style="color:#008000;" id="jobprocessstateMc">工单上报</span></li>
			</ul>
		</div>
		
		<div id="pic" style="display:none;">
			<img alt="" src="" style="width: 60%">
		</div>
		
		<div style="padding-top:0px;">
		   <form id="order" method="post">
		    	<table cellpadding="0"  cellspacing="0">
		    		<tr>
		    			<td colspan="6" style="background-color:#dcdcdc;">故障信息描述</td>
		    		</tr>
		    		
		    		<tr>
		    			<td>故障设备类型</td>
		    			<td><span id="faultdevicetypeMc"></span></td>
		    			<td>故障设备名称</td>
		    			<td><span id="faultdevicename"></span></td>
		    			<td>故障设备编号</td>
		    			<td><span id="faultdeviceid"></span></td>
		    		</tr>
		    		<tr>
		    			<td>故障发生时间</td>
		    			<td><span id="faultoccurtime"></span></td>
		    			<td>故障类型</td>
		    			<td>
		    				<span id="faulttypeMc"></span>
		    			</td>
		    			<td>工单上报单位</td>
		    			<td>
		    				<span id="jobreportcompanyMc"></span>
		    				<input id="jobreportcompany" type="text" style="display:none" />
		    			</td>
		    		</tr>
		    		<tr>
		    			<td>工单上报人</td>
		    			<td><span id="jobreportpeople"></span></td>
		    			<td>上报人电话</td>
		    			<td><span id="jobreportphone"></span></td>
		    			<td>上报时间</td>
		    			<td><span id="jobreporttime"></span></td>
		    		</tr>
		    		<tr>
		    			<td >故障描述</td>
		    			<td colspan="5">
		    				<input id="faultdescription" style="width:100%; font-size:12px;border: 0;text-align:center;">
						</td>		    		
		    		</tr>
		    		<tr>
		    			<td >故障图片</td>
		    			<td colspan="5"><a><span id="faultpictureurl"></span></a></td>
		    		</tr>
		    		<tr>
		    			<td colspan="6"  style="background-color:#dcdcdc;">工单进度信息</td>
		    		</tr>
		    		<tr>
		    			<td>处理阶段:</td>
		    			<td colspan="5">
		    			<ul style="display:flex;'" id="chuliState">
			               <li style="position:relative;padding-left:22px;"><span style="background-color:green;height:14px;width:14px;border-radius:14px;display:block;position:absolute;top:0;left:0;line-height:14px;text-align:center;color:white;'">1</span><span style="color:green;">工单上报</span><span  class="qiantou"  style="height: 26px;width: 39px;border-radius: 12px; display: block;position: absolute;top: -6px;right: -53px; line-height: 12px;text-align: center;color: green;font-weight: bolder;font-size: 16px;background: url(../../common/images/jt-gray.png) no-repeat;"></span></li>
		    				<li style="position:relative;padding-left:22px;"><span style="background-color:gray;height:14px;width:14px;border-radius:14px;display:block;position:absolute;top:0;left:0;line-height:14px;text-align:center;color:white;'">2</span><span style="color:gray;">工单受理</span><span  class="qiantou"  style="height: 26px;width: 39px;border-radius: 12px; display: block;position: absolute;top: -6px;right: -53px; line-height: 12px;text-align: center;color: green;font-weight: bolder;font-size: 16px;background: url(../../common/images/jt-gray.png) no-repeat;"></span></li>
		    				<li style="position:relative;padding-left:22px;"><span style="background-color:gray;height:14px;width:14px;border-radius:14px;display:block;position:absolute;top:0;left:0;line-height:14px;text-align:center;color:white;'">3</span><span style="color:gray;">工单反馈</span><span  class="qiantou"  style="height: 26px;width: 39px;border-radius: 12px; display: block;position: absolute;top: -6px;right: -53px; line-height: 12px;text-align: center;color: green;font-weight: bolder;font-size: 16px;background: url(../../common/images/jt-gray.png) no-repeat;"></span></li>
		    				<li style="position:relative;padding-left:22px;"><span style="background-color:gray;height:14px;width:14px;border-radius:14px;display:block;position:absolute;top:0;left:0;line-height:14px;text-align:center;color:white;'">4</span><span style="color:gray;">工单维保确认</span></li>	<span  class="qiantou"  style="height: 26px;width: 39px;border-radius: 12px; display: block;position: absolute;top: -5px;right: -53px; line-height: 12px;text-align: center;color: green;font-weight: bolder;font-size: 16px;background: url(../../common/images/jt-gray.png) no-repeat;"></span>
							<li style="position:relative;padding-left:22px;"><span style="background-color:gray;height:14px;width:14px;border-radius:14px;display:block;position:absolute;top:0;left:0;line-height:15px;text-align:center;color:white;">5</span><span style="color:gray;">工单验收</span></li>
							</ul>
		    			</td>
		    		</tr>
		    		<tr>
		    			<td>接收人单位</td>
		    			<td>
							<select  class="easyui-combobox" id="jobacceptcompany" name="jobacceptcompany" style="width:130px;margin:0;">
							</select>
						</td>		    			
		    			<td>工单接收人</td>
		    			<td>
			    			<select  class="easyui-combobox" id="jobacceptpeople" name="jobacceptpeople" style="width:130px;margin:0;">
							  
							</select>
		    			</td>
		    			<td>接收人联系方式</td>
		    			<td><span id="jobacceptphone"></span></td>
		    		</tr>
		    		
		    		
		    	</table>
		    </form>
		</div>
	</div>
	</body>
</html>	
 <script type="text/javascript">
 
 	var winId	= $.getUrlParam("winId");
	var event = top.$("#"+winId).panel("options").data;
//	console.log("===告警事件：",event);
	
 	$(function(){
 		$('#faultpictureurl').click(function(){
 			$('#pic').show();	
 		})
 		$('img').click(function(){
 			$('#pic').hide();
 		})
 		
 		
 		var alarmdeviceid = event.alarmdeviceid;		// 告警设备编号
		var alarmdevicetypename = event.alarmdevicetypename;	// 告警设备类型
		var alarmdevicename = event.alarmdevicename;	// 设备名称
		var alarmtime = event.alarmtime;				// 告警时间
		var falutdescription = event.falutdescription;  // 故障描述
		var faultgradeMc = event.alarmgradename;		// 告警等级
		var alarmtypename = event.alarmtypename;		// 告警大类
		var alarmsubtypename = event.alarmsubtypename;  // 告警类型  eg:视频遮挡异常,场景变更异常,颜色异常
		var faultpictureurl = event.pictureurl;
		
		if(faultpictureurl != null){
			var proName = window.location.pathname.split("/")[1];
			var sysUrl = "http://"+window.location.host+"/"+proName;
		 	var picProxyGetUrl = sysUrl+"/sourceProxy?fileType=picUrlProxy&picUrl="+faultpictureurl;
		 	$('#pic img').attr("src",picProxyGetUrl);
		}
		// 数据填充
		$('#jobnum').html(getNowTime());
		$('#faultgradeMc').html(faultgradeMc);
		// 故障信息描述
		$('#faultdevicetypeMc').html(alarmdevicetypename);
		$('#faultdevicename').html(alarmdevicename);
		$('#faultdeviceid').html(alarmdeviceid);
		
		$('#faultoccurtime').html(alarmtime);
		$('#faulttypeMc').html(alarmtypename);
		$('#jobreporttime').html(getNowTime('-'));
		
		$('#faultdescription').val(alarmsubtypename);
		$('#faultpictureurl').html(faultpictureurl);
		
		// 上报人相关信息
		$.ajax({
			 type : 'post',
			 dataType : 'json',
			 url : 'ywrepairjobinfoAction!getUserInfo.do',
			 success:function(res){
//				 console.log("user：",res)
				 if(res){					
					 $('#jobreportcompany').val(res.bmbh);
					 $('#jobreportcompanyMc').html(res.bmmc);
					 $('#jobreportpeople').html(res.yhzh);
					 $('#jobreportphone').html(res.sjhm);
				 }
			 }	 	
		}) 
	
		// 工单接收人相关信息
		$('#jobacceptcompany').combobox({				// 选取部门
			 url:'ywrepairjobinfoAction!getReportBm.do',    // 查询有审批工单权限的部门
//			 url:'ptyhbmAction!query_Ptyhbm.do',			// 查询所有部门
			 textField:"bmmc",  
			 valueField:"bmbh",
			 panelWidth:148,
			 value:"" 
		});
		$("#jobacceptcompany").combobox({			
			onChange: function (n,o) {
//				console.log(n,o);				
				$('#jobacceptpeople').combobox({				// 选取接收人
					 url:'ywrepairjobinfoAction!getReportUser.do?bmbh='+n,    // 查询部门下有审批工单权限的人
//					 url:'ptyhAction!query_Ptyh.do?bmbh='+n,			  // 查询部门下所有人
					 textField:"yhmc",  
					 valueField:"yhzh",
					 value:"" 
				});
			}
		})
		$("#jobacceptpeople").combobox({			
			onChange: function (n,o) {
//				console.log(n,o);				
				$.ajax({
					type : 'post',
					dataType : 'json',
					url : 'ywrepairjobinfoAction!getReportUser.do',
					data : {'yhzh': n},
					success : function(res){
//						console.log("电话：",res);
						if(res && res.length > 0){
							$('#jobacceptphone').html(res[0].sjhm)
						}else{
							$('#jobacceptphone').html("");
						}
					}
				})
			}
		})
 	});
 	
 	function getNowTime(flag){
		var date = new Date();
	    var year = date.getFullYear();
	    var month = date.getMonth() + 1;
	    var day = date.getDate();
	    var hour = date.getHours();
		var minute = date.getMinutes();
		var second = date.getSeconds();
		var minsec = date.getMilliseconds(); //获取当前毫秒数(0-999)
	    month = month < 10 ? '0' + month : month;
	    day = day < 10 ? '0' + day : day;
	    hour = hour < 10 ? '0' + hour : hour;
	    second = second < 10 ? '0' + second : second;
	    if(flag == "-"){
	    	return year +"-"+ month +"-"+ day +" "+ hour +":"+ minute +":"+ second;
	    }else{
	    	return "" + year + month + day + hour + minute + second + minsec;
	    }
	    
	}
</script>