<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<!DOCTYPE html>
<html>
<head lang="en">
	<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
 	<%@include file="../../../frame/assets/header-all.jsp"%>
	<style>
	.form-line .text-content{
		width:120px;
	}
	</style>
</head>
<body class="easyui-layout">
<form id="childform" class="easyui-form" data-options="novalidate:true">
	<input id="softwareid" type="hidden" />
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>应用类型：</span> 
			<input id="softwaretype" class="easyui-combobox" data-options="required:false,validType:'length[0,40]'" missingMessage="应用类型必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must">*</em>应用名称：</span> 
			<input id="softwarename" readonly  unselectable="on"  class="easyui-textbox" data-options="required:true,validType:'length[0,40]'" missingMessage="应用名称必填项" > 
		</div> 	
	</div>
	
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must">*</em>服务名称：</span> 
			<input id="softwareservername" readonly  unselectable="on" class="easyui-textbox" data-options="required:true,validType:'length[0,19]'" missingMessage="服务名称" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must">*</em>所属分类：</span> 
			<input id="softwarecategory" class="easyui-combobox" data-options="required:true,validType:'length[0,10]'" missingMessage="所属分类" > 
		</div> 		
	</div>
	
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>上报间隔时间：</span> 
			<input id="softwareruninterval" class="easyui-textbox" data-options="prompt:'小时'" missingMessage="状态上报间隔时间必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>部署位置：</span> 
			<input id="softwareposition" class="easyui-textbox" data-options="required:false,validType:'length[0,128]'" missingMessage="位置描述必填项" > 
		</div> 	 
	</div>

	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must">*</em>是否启用：</span> 
			<input id="detectionswitch" class="easyui-combobox" data-options="required:true,validType:'length[0,10]'" missingMessage="检测开关必填项" > 
		</div>  
	</div>

	<div class="form-line clearfix">	
		<div class="fl">
			<span class="text-content"><em class="must"></em>应用描述：</span> 
			<textarea id="softwaredescribe"  style="width:441px; height:100px"></textarea>  			
		</div>			 
		
		
	</div>
	
	<!-- <div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must">*</em>应用ip：</span> 
			<input id="softwareip" class="easyui-textbox" data-options="required:true,validType:'length[0,19]'" missingMessage="服务ip必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must">*</em>网管端口：</span> 
			<input id="softwareport" class="easyui-textbox" data-options="required:true,validType:'length[0,10]'" missingMessage="网管端口必填项" > 
		</div> 		
	</div> -->
	

	<div class="form-line hidden">
		 
	</div>
</form>
</body>
</html>
<script type="text/javascript">
var winId	= $.getUrlParam("winId");
var records = top.$("#"+winId).panel("options").data;
$(function(){
	//加载下拉选项
	
	
	/* $.ajax({
		type:'post',
		dataType : 'json',
		url:'ywsoftwareinfoAction!get_Ywsiyou.do',
		data:{},
		success:function(flag){
			console.log("结果：",flag);
		}
	}); */
	
	$('#softwaretype').combobox({
		 url:'ywsoftwareinfoAction!get_Ywsiyou.do',
		 textField:"name",  
		 valueField:"name",
		 panelWidth:148,
		 value:"请选择" 
	})
	
	$('#softwarecategory').combobox({
		 url:'xtclAction!query_Xtcl.do?csdl=ywSoftWareType',
		 textField:"csmc",  
		 valueField:"csdm",
		 panelWidth:148,
		 value:'1' 
	});
	
	$("#softwaretype").combobox({		
		onChange: function (n,o) {	
			var category=null;
			if(n!='请选择'){
				$.ajax({
					type:'post',
					dataType : 'json',
					url:'ywsoftwareinfoAction!get_YwsiyouByName.do',
					data:{'nodeName':n},
					async:false,
					success:function(res){
//						console.log("结果",res);
						var nodeValue = res.nodeValue;
//						console.log("nodeValue: ",nodeValue);
						var softwareservername = nodeValue.servername;
						category = nodeValue.category;
						$("#softwareservername").textbox("setValue",softwareservername);
						$("#softwarename").textbox("setValue",res.comment);						
					}
				});
				
				if(category!=null){
					$('#softwarecategory').combobox({
						 url:'xtclAction!query_Xtcl.do?csdl=ywSoftWareType&csdm='+category+'',
						 textField:"csmc",  
						 valueField:"csdm",
						 panelWidth:148,
						 value:category 
					});
				}
			}
		}
	});
	
	
	$('#detectionswitch').combobox({
		 url:'xtclAction!query_Xtcl.do?csdl=ywTaskEnable',
		 textField:"csmc",  
		 valueField:"csdm",
		 panelWidth:148,
		 value:"1" 
	});
	
	setTimeout(loadValue,500);
});
function loadValue(){
	if(records){
		$("#softwareid").val(records.softwareid);
		$("#listid").textbox("setValue",records.listid);
		$("#machineid").combobox("setValue",records.machineid);
		$("#softwarenum").textbox("setValue",records.softwarenum);
		$("#softwaretype").textbox("setValue",records.softwaretype);
		$("#softwarename").textbox("setValue",records.softwarename);
		$("#softwareip").textbox("setValue",records.softwareip);
		$("#softwareport").textbox("setValue",records.softwareport);
		$("#softwareruninterval").textbox("setValue",records.softwareruninterval);
		$("#softwarestatus").numberbox("setValue",records.softwarestatus);
		$("#softwarestatusuptime").textbox("setValue",records.softwarestatusuptime);
		$("#softwarerestartstatus").numberbox("setValue",records.softwarerestartstatus);
		$("#softwarerestarttime").textbox("setValue",records.softwarerestarttime);
		$("#softwarerestartaccount").textbox("setValue",records.softwarerestartaccount);
//		$("#softwaredescribe").textbox("setValue",records.softwaredescribe);
		$("#softwaredescribe").val(records.softwaredescribe);
		$("#softwareposition").textbox("setValue",records.softwareposition);
		$("#softwareareanum").textbox("setValue",records.softwareareanum);
		$("#detectionswitch").combobox("setValue",records.detectionswitch);
		$("#detectionstarttime").textbox("setValue",records.detectionstarttime);
		$("#softwareservername").textbox("setValue",records.softwareservername);
		$("#softwarecategory").combobox("setValue",records.softwarecategory);
		$("#modifyaccount").textbox("setValue",records.modifyaccount);
		$("#modifytime").textbox("setValue",records.modifytime);
		$("#remarks").textbox("setValue",records.remarks);
		$("#extend1").textbox("setValue",records.extend1);
		$("#extend2").textbox("setValue",records.extend2);
		$("#extend3").textbox("setValue",records.extend3);
		$("#extend4").textbox("setValue",records.extend4);

	}else{
		
	}
}

</script>
