<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <%@ include file="../../common/head.jsp"%>
    <link rel="stylesheet" type="text/css" href="../res/js//plugins/webuploader/webuploader.css">
    <link rel="stylesheet" type="text/css" href="../res/css/demo/webuploader-demo.css">
    <script type="text/javascript" src="../res/js/plugins/webuploader/webuploader.js"></script>
    <script type="text/javascript" src="../res/js/plugins/webuploader/uploader.js"></script>
	<cs:initFile/>
</head>

<body>
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">
            	 <cs:form_validate formId="editUserForm"/>
                  <form class="form-horizontal" action="edit.cs" id="editUserForm" method="POST">
					
						<input type="hidden" value="${dcproject.id }" name="id">

                      
                     <div class="form-group">
                          <label class="col-sm-3 control-label">名称：</label>
                          <div class="col-sm-6">
                              <input id="name" name="name" class="form-control" validate="{required:true}" value="${dcproject.name }" validateMessage="{required:'请输入名称'}" >
                          </div>
                      </div>
                      <div class="form-group">
                          <label class="col-sm-3 control-label">省：</label>
                          <div class="col-sm-6">
		                      <select id="provinceCode" name="provinceCode" class="form-control">
		                          <option value="" >省</option>
		                      </select>
		                      <input type="hidden" id="province" value="${dcproject.province }" name="province"/>
	                      </div>
                      </div>
                      
                      <div class="form-group">
                          <label class="col-sm-3 control-label">市：</label>
                          <div class="col-sm-6">
		                      <select id="cityCode" name="cityCode" class="form-control">
		                          <option value="" >市</option>                                
		                      </select>
		                      <input type="hidden" id="city" name="city" value="${dcproject.city }" />
                          </div>
                      </div>
                      
                     <div class="form-group">
                          <label class="col-sm-3 control-label">描述：</label>
                          <div class="col-sm-6">
                              <textarea id="info" name="info" class="form-control" style="height: 310px;">${dcproject.info }</textarea>
                          </div>
                      </div>
                     
                      <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-3 pull-left">
                                    <button class="btn btn-default btn-dlg-close">取消</button>
                                    <button class="btn btn-primary" type="submit">提交</button>
                                </div>
                       </div>
                      
                  </form>
            </div>
        </div>

    </div>

<script type="text/javascript">

$(function(){	
	var provinceCode='${dcproject.provinceCode }';
	var cityCode='${dcproject.cityCode }';
	
	$.get('<%=basePath%>area/getProvice.cs',function(data){
		for(var i in data){
			var _option = '';
			if(provinceCode ==data[i].code ){
				 _option = '<option value="' + data[i].code + '" selected>' + data[i].name + '</option>';
			}else{
			 _option = '<option value="' + data[i].code + '" >' + data[i].name + '</option>';
			}
			$('#provinceCode').append(_option);
		}
	});  
	
	
	///省
	$("#provinceCode").change(function(){
		var self = $(this);
		
		$('#cityCode').empty();
   	    var _option = '<option>请选择</option>';
		$('#cityCode').append(_option);
		$('#city').val("");
		
		
		$.get('<%=basePath%>area/getByParentCode.cs',{'param': self.val()}, function(data){
			for(var i in data){
					var _option = '<option value="' + data[i].code + '" >' + data[i].name + '</option>';
					$('#cityCode').append(_option);
				}
		}); 
		$('#province').val(self.find("option:selected").text());
	});
	
	///城市
	$("#cityCode").change(function(){
		var self = $(this);
		
		$.get('<%=basePath%>area/getByParentCode.cs',{'param': self.val()}, function(data){
			for(var i in data){
					var _option = '<option value="' + data[i].code + '" >' + data[i].name + '</option>';
					$('#countyCode').append(_option);
				  
				}
		}); 
		
		$('#city').val(self.find("option:selected").text());
	});
	

	
	
	
	if(cityCode != ''){
		$.get('<%=basePath%>area/getByParentCode.cs',{'param': provinceCode}, function(data){
			for(var i in data){
			    var _option = '';
				if(cityCode == data[i].code ){
					
					 _option = '<option value="' + data[i].code + '" selected>' + data[i].name + '</option>';
				}else{
				    _option = '<option value="' + data[i].code + '" >' + data[i].name + '</option>';
				}
				$('#cityCode').append(_option);
			}
		}); 
	}
	
});

</script>

</body>

</html>

