<script type="text/javascript">
    $(document).ready(function(){

        $('#lnglat').keydown(function (event) {
            if (event.keyCode==13){            
                var lnglat=$.trim($('#lnglat').val());    
                refresh(lnglat);
            };
        });       

        $('.btn-qry').click(function(){
            var lnglat=$.trim($('#lnglat').val());   
            refresh(lnglat);
        });

        function refresh(lnglat){
            if($.isEmpty(lnglat)){
                toastr.error(
                    '请先输入经纬度!', 
                    "操作错误：",
                    {timeOut: 800, positionClass: "toast-center-center"}
                );            
            }else{
                $('#adm1,#adm2,#adm3').val('');
                $.ajax({
                    type:'GET',                           
                    url:'/utils/adm/analyser/get/?lnglat='+lnglat,                
                    dataType:'json',
                    success: function(d) {
                        if(d.e==''){
                            $('#adm1').val(d['result']['adm1']);
                            $('#adm2').val(d['result']['adm2']);
                            $('#adm3').val(d['result']['adm3']);
                        }else{
                            toastr.error(
                                '未找到匹配的数据!', 
                                "提示：",
                                {timeOut: 800, positionClass: "toast-center-center"}
                            );                        
                        }
                    }                
                });
            }
        };
        
    });
</script>


<style>
  
   
</style>


<ol class="breadcrumb">
    <li>系统工具</li>
    <li>经纬度解析行政区划</li>    
</ol>


<div class="clearfix"></div>


<div class='x_panel' >

    <form role="form" class="form-horizontal">
        <div class="form-group ">            
            <div class='input-group'>
                <input id='lnglat' class='form-control' placeholder="请输入经纬度中间用逗号隔开，点击查询按钮或按回车键查询"/>
                <span class='input-group-btn'>
                    <a type="button" class='btn btn-primary btn-qry'>
                        <span class='glyphicon glyphicon-search' style='padding-right:5px;'></span>查询
                </a></span>
            </div>
        </div>

        <div class="form-group ">
            <label class="col-sm-1 control-label">一级行政区划</label>
            <div class="col-sm-3"><input class='form-control' id='adm1' disabled="true"/></div>
            <label class="col-sm-1 control-label">二级行政区划</label>
            <div class="col-sm-3"><input class='form-control' id='adm2' disabled="true"/></div>
            <label class="col-sm-1 control-label">三级行政区划</label>
            <div class="col-sm-3"><input class='form-control' id='adm3' disabled="true"/></div>           
        </div>
        <div style='margin-top:50px;'>
            <p>此页面仅用于验证云平台系统内行政区划划分及电子围栏数据的准确性</p>
            <p>经度在前纬度在后用逗号隔开,也可以使用
                <a href='https://api.map.baidu.com/lbsapi/getpoint/index.html'  style='cursor:pointer;color:green;' target='_blank'>
                百度地图坐标拾取器
                </a>获取后粘贴
                <!-- 2025-02-07-->
                <a href='https://map.baidu.com/' style='cursor:pointer;color:green;' target='_blank'>百度地图官网</a>
            </p>
        </div>
    </form>

</div>
