<%@ 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{    height: 526px  !important;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: 20%;
			    z-index: 1;
			}
		 </style>
	</head>
	<body>
	
	<div style="padding:2px 2px;    height: 100%;">
		<div style="line-height:30px;height:30px;border-bottom:1px solid  #e6e6e6;">
			<ul style="display:flex;justify-content:space-between;padding: 0 10px;">
				<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: 600px">
		</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">
		    				<span id="faultdescription"></span>
						</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: -8px;right: -53px; line-height: 12px;text-align: center;color: green;font-weight: bolder;font-size: 16px;background: url(../../common/images/jt-green.png) no-repeat;"></span></li>
		    				<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;'">2</span><span style="color:green;">工单受理</span><span  class="qiantou"  style="height: 26px;width: 39px;border-radius: 12px; display: block;position: absolute;top: -8px;right: -53px; line-height: 12px;text-align: center;color: green;font-weight: bolder;font-size: 16px;background: url(../../common/images/jt-green.png) no-repeat;"></span></li>
		    				<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;'">3</span><span style="color:green;">工单反馈</span><span  class="qiantou"  style="height: 26px;width: 39px;border-radius: 12px; display: block;position: absolute;top: -8px;right: -53px; line-height: 12px;text-align: center;color: green;font-weight: bolder;font-size: 16px;background: url(../../common/images/jt-green.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><span  class="qiantou"  style="height: 26px;width: 39px;border-radius: 12px; display: block;position: absolute;top: -8px;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;'">5</span><span style="color:gray;">工单验收</span></li>
						</ul>
		    			</td>
		    		</tr>
		    		<tr>
		    			<td>工单受理单位</td>
		    			<td><span id="jobacceptcompany"></span></td>		    			
		    			<td>工单受理人</td>
		    			<td><span id="jobacceptpeople"></span></td>
		    			<td>受理人电话</td>
		    			<td><span id="jobacceptphone"></span></td>
		    		</tr>
		    		<tr>
		    			<td>受理时间</td>
		    			<td><span id="jobaccepttime"></span></td>		    			
		    			<td>要求完成时间</td>
		    			<td><span id="requirefinishtime"></span></td>
		    			<td>工单受理信息</td>
		    			<td><span id="faultacceptinfo"></span></td>
		    		</tr>
		    		<tr>
		    			<td>是否申请延期</td>
		    			<td><span id="isdelay"></span></td>		    			
		    			<td>申请完成时间</td>
		    			<td><span id="delaytime"></span></td>
		    		</tr>
		    		<tr>
		    			<td>延期原因</td>
		    			<td colspan="5"><span id="delaycause"></span></td>
		    		</tr>
		    		<tr>
		    			<td colspan="6"  style="background-color:#dcdcdc;">延期审批</td>
		    		</tr>
		    		<tr>
		    			<td>延期审批意见</td>
		    			<td>
		    				<select  class="easyui-combobox" id='delayforstate' name="isdelay" style="width:130px;margin:0;">
							    <option value="910">不同意</option>
							    <option value="909">同意</option>							   
							</select>
						</td>		    			
		    			<td>延期审批时间</td>
		    			<td><span id="delayfortime"></span></td>		    			
		    		</tr>
		    		<tr>
		    			<td >延期审批描述</td>
		    			<td colspan="5">
		    				<input id="delayfordescription" style="width:100%; font-size:12px;border: 0;text-align:center;">
						</td>		    		
		    		</tr>
		    	</table>
		    </form>
		</div>
	</div>
	</body>
</html>	
 <script type="text/javascript">
    var sel = {};
 	var winId	= $.getUrlParam("winId");
	var jobid = $.getUrlParam("jobid");
 	$(function(){	
 		$('#faultpictureurl').click(function(){
 			$('#pic').show();	
 		})
 		$('img').click(function(){
 			$('#pic').hide();
 		})
 		// 根据工单 id 查询 工单详情     并填充数据
 		$.ajax({
 			type :  'post',
 			dataType : 'json',
 			url : 'ywrepairjobinfoAction!get_Ywrepairjobinfo.do',
 			data: {'jobid':jobid},
 			success : function(res){
 				console.log("返回的数据：",res);
 				if(res){
 					sel = res;						// 赋值
 					$('#jobnum').html(res.jobnum);
 					$('#faultgradeMc').html(res.faultgradename);
 					$('#faultdevicetypeMc').html(res.faultdevicetypename);
 					$('#faultdevicename').html(res.faultdevicename);
 					$('#faultdeviceid').html(res.faultdeviceid);
 					$('#faultoccurtime').html(res.faultoccurtime);
 					$('#faulttypeMc').html(res.faulttypename);
 					$('#faultdescription').html(res.faultdescription);
 					$('#faultpictureurl').html(res.faultpictureurl);
 					$('#jobreportcompany').html(res.jobreportcompany);
 					$('#jobreportpeople').html(res.jobreportpeople);
 					if (res.jobreportphone == null || res.jobreportphone == "null") {
 						$('#jobreportphone').html("-");
 					} else {
 						$('#jobreportphone').html(res.jobreportphone);
 					}
 					$('#jobreporttime').html(res.jobreporttime);
 					$('#jobacceptcompany').html(res.feedbackcompanyname);
 					$('#jobacceptpeople').html(res.feedbackpeople);
 					$('#jobacceptphone').html(res.feedbackphone);
 					$('#jobaccepttime').html(res.jobaccepttime);
 					$('#requirefinishtime').html(res.requirefinishtime);
 					$('#faultacceptinfo').html(res.faultacceptinfo);
 					var isdelay = res.isdelay;
 					if(isdelay == 1){
 						isdelay = '是';
 					}else{
 						isdelay = '否';
 					}
 					$('#isdelay').html(isdelay);
 					$('#delaytime').html(res.delaytime);
 					$('#delaycause').html(res.delaycause);
 					$('#delayfortime').html(getNowTime("-"));
 					var picUrl = res.faultpictureurl;
 					if(picUrl != null){
 						var proName = window.location.pathname.split("/")[1];
 						var sysUrl = "http://"+window.location.host+"/"+proName;
 					 	var picProxyGetUrl = sysUrl+"/sourceProxy?fileType=picUrlProxy&picUrl="+picUrl;
 					 	$('#pic img').attr("src",picProxyGetUrl);
 					}
 				}
 			}
 		})
 		
		// 点击确认提交数据
		parent.parent.$(".l-btn-text").on("click",function(){
			if($(this).text()=="确定"){
				saveInfo();
			}
		})
		});
 	
 	function saveInfo(){								// 数据入库
 		var params = {};
 		var jobid = sel.jobid; 		
 		var delayfortime = $('#delayfortime').html();
 		var delayforstate = $('#delayforstate').combobox("getValue");
 		var delayfordescription = $('#delayfordescription').val();
 		params.XGTJjobid = jobid;
 		params.alarmeventid =  sel.alarmeventid;
 		params.faultdeviceid = sel.faultdeviceid;
 		if (sel.channelnum != null) {
 			params.channelnum = sel.channelnum;
		}
 		params.delayfortime = delayfortime;
		params.jobprocessstate = "902";
		params.delayforstate = delayforstate;
		params.delayfordescription = delayfordescription;
		params.extend1 = sel.feedbackpeople;
		params.flag = "delay";
		$.ajax({
			url : "ywrepairjobinfoAction!edit_confirmOrder.do",
			type : "POST",
			dataType : "JSON",
			data : params,
			success : function(res){
				if(res == 'success'){
					$.showMsg("操作成功");
					top.$("#"+winId).dialog('close');
				}				
			}			
		})
 		
 	}
 	function isNull(str){
 		if(str==null || str=='' || str==" " || str=="null" || str == undefined){
 			return true;
 		}else{
 			return false;
 		}
 	}

 	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>